Skip to content

Commit

Permalink
Merge branch '3.0' into feat/articulation-poc
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentC35 authored Dec 20, 2024
2 parents 33e489b + 6a6f85f commit e2cc563
Show file tree
Hide file tree
Showing 137 changed files with 5,219 additions and 2,015 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ jobs:
publish_dir: ./storybook-static
destination_dir: ./storybook-${{ steps.branch-name.outputs.current_branch }}
- name: build docs website
working-directory: ./docs/
working-directory: ./website/
run: yarn install --frozen-lockfile && yarn build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build
publish_dir: ./website/build
destination_dir: ./docs

check_if_version_upgraded:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: bahmutov/npm-install@v1
- name: generate coverage
run: yarn test:coverage
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/node_modules/
/.eslintrc.js
/docs/
/website/
/lib/
/storybook-static/
/test-results/
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<img align="right" src="docs/img/lunatic-logo.png" alt="Lunatic logo"/>
<p align="center">
<img alt="Lunatic" src="public/images/lunatic-logo.png" style="max-width: 100%;">
</p>

# Lunatic
Lunatic is a front-end library in the form of a React hook and component libraries for generating a questionnaire from the [Lunatic-Model](https://github.com/InseeFr/Lunatic-Model) data format.

[![Lunatic CI](https://github.com/InseeFr/Lunatic/actions/workflows/ci-main.yaml/badge.svg)](https://github.com/InseeFr/Lunatic/actions/workflows/ci-main.yaml)
[![npm version](https://badge.fury.io/js/%40inseefr%2Flunatic.svg)](https://badge.fury.io/js/%40inseefr%2Flunatic)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=InseeFr_Lunatic&metric=coverage)](https://sonarcloud.io/dashboard?id=InseeFr_Lunatic)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=InseeFr_Lunatic&metric=alert_status)](https://sonarcloud.io/dashboard?id=InseeFr_Lunatic)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=InseeFr_Lunatic&metric=coverage)](https://sonarcloud.io/dashboard?id=InseeFr_Lunatic)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Lunatic is a front-end library in the form of a React hook and component libraries for generating a questionnaire from the [Lunatic-Model](https://github.com/InseeFr/Lunatic-Model) data format.
---

- [Storybook 3.0](https://inseefr.github.io/Lunatic/storybook-3.0), branch `3.0`
- [Storybook 2.7](https://inseefr.github.io/Lunatic/storybook-2.7), branch `2.7`
Expand Down Expand Up @@ -110,7 +112,7 @@ function App({ source, data }) {
}
```

All the components offered by Lunatic are available in the [src/components](https://github.com/InseeFr/Lunatic/tree/2.7/src/components) folder.
All the components offered by Lunatic are available in the [src/components](https://github.com/InseeFr/Lunatic/tree/3.0/src/components) folder.

To activate the **autofocus**, you need to pass a key in the `autoFocusKey` property of `LunaticComponents`. As soon as this value changes, the first field is focused (a good solution is to pass the `pageTag` provided by `useLunatic`).

Expand Down Expand Up @@ -242,3 +244,10 @@ For publishing a release candidate update your `package.json` with `1.3.4-rc.0`
It also work if you do it from a branch that have an open PR on main.

> Make sure your have defined the `NPM_TOKEN` repository secret or NPM publishing will fail.
## Build

We build this library in ESM and CJS. ESM is the standard when you develop a front-end app.
But if you need test which use `@inseefr/lunatic`, you need lunatic library as CJS lib (to allow to run in node environnement).
So we have two build: one for ESM and one for CJS.
You have nothing to change in your code base, it's simply working.
137 changes: 0 additions & 137 deletions docs/docusaurus.config.ts

This file was deleted.

106 changes: 0 additions & 106 deletions docs/sidebars.ts

This file was deleted.

9 changes: 0 additions & 9 deletions docs/src/css/custom.css

This file was deleted.

8 changes: 3 additions & 5 deletions e2e/checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test.describe('Checkboxes', () => {
});

test('Can select arbitrary value', async ({ page }) => {
await goToStory(page, 'components-checkboxgroup--arbitrary');
await goToStory(page, 'components-checkboxgroup--with-detail');
const selector = page.getByRole('checkbox', { name: 'Autre préciser' });
await expect(selector).toBeVisible();
await selector.click();
Expand Down Expand Up @@ -72,13 +72,11 @@ test.describe('Checkboxes', () => {
await expectCollectedData(page, 'Q2', '3');
await expectCollectedData(page, 'Q3', 'Bonjour');
});
test(`Clicking multiple time should not trigger onChange`, async ({
page,
}) => {
test(`Allow to uncheck modality`, async ({ page }) => {
await goToStory(page, 'components-checkboxone--default');
await expect(page.getByRole('radio', { name: 'oui' })).toBeVisible();
await page.getByRole('radio', { name: 'oui' }).click();
await expectChanges(page, 0, () => {
await expectChanges(page, 1, () => {
return page.getByRole('radio', { name: 'oui' }).click();
});
});
Expand Down
9 changes: 8 additions & 1 deletion lunatic-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://insee.fr/lunatic/survey.schema.json",
"title": "Lunatic Source",
"description": "A lunatic survey unit",
"description": "Representation of a Lunatic survey unit in the Lunatic Model.",
"type": "object",
"properties": {
"label": {
Expand Down Expand Up @@ -1458,6 +1458,13 @@
"additionalProperties": false
}
]
},
"stopWords": {
"description": "list of words to exclude from the searching",
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["name", "fields", "queryParser", "version"]
Expand Down
Loading

0 comments on commit e2cc563

Please sign in to comment.