Skip to content

Commit ea372bf

Browse files
authored
Merge pull request #251 from dnum-mi/develop
Migration vers DSFR 1.3
2 parents 34d129b + e020116 commit ea372bf

File tree

175 files changed

+31640
-62424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+31640
-62424
lines changed

.docker/Dockerfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1-
FROM node:16.13.1-alpine3.14 as dev
1+
FROM nexus.forge-dc.cloudmi.minint.fr/node:16.13.1-alpine3.14 as dev
22

33
WORKDIR /app
44

55
CMD ["npm", "run", "dev"]
66

77
FROM dev as storybook-build
88

9+
ARG HTTP
10+
ENV HTTP=${HTTP}
11+
912
COPY ./package.json ./package-lock.json ./
13+
14+
RUN npm config set proxy $HTTP
15+
RUN npm config set https-proxy $HTTP
16+
RUN npm config set strict-ssl=false
17+
RUN npm config set registry=http://registry.npmjs.com
18+
19+
RUN npm ping --registry http://registry.npmjs.com
20+
RUN npm config get proxy
21+
1022
RUN npm i
1123

1224
COPY ./build-css.mjs ./index.html ./postcss.config.js ./rollup.config.js ./vite.config.js ./.browserslistrc ./
@@ -16,6 +28,8 @@ COPY ./.storybook ./.storybook
1628

1729
RUN npm run build-storybook
1830

19-
FROM nginx:1.21.4-alpine as storybook
31+
FROM nexus.forge-dc.cloudmi.minint.fr/nginx:1.21.4-alpine as storybook
2032

2133
COPY --from=storybook-build /app/storybook-static /usr/share/nginx/html
34+
35+

.docker/docker-compose.dev.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ version: '3'
22

33
services:
44
front:
5+
env_file:
6+
- ./.env
57
image: vue-dsfr
68
build:
79
context: ../
10+
args:
11+
- HTTP=${HTTP}
812
dockerfile: .docker/Dockerfile
913
volumes:
1014
- ../:/app # dossier_hote:dossier_conteneur

.github/workflows/run-tests.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Unit & Component Tests
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- ready_for_review
10+
11+
jobs:
12+
tests:
13+
name: Run unit tests and CT tests
14+
if: ${{ !github.event.pull_request.draft }}
15+
runs-on: ubuntu-latest
16+
17+
env:
18+
VITE_APP_GIT_TAG: ${{github.ref}}
19+
VITE_APP_GIT_SHA: ${{github.sha}}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Use Node.js 17.3.0
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: '17.3.0'
27+
- name: Install dependencies
28+
run: npm ci
29+
- name: Test all (client and server)
30+
run: npm test

.storybook/main.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ module.exports = {
1515
},
1616
],
1717
staticDirs: ['../public'],
18-
core: {
19-
builder: 'webpack5'
20-
}
21-
// "core": {
22-
// "builder": "storybook-builder-vite"
18+
// core: {
19+
// builder: 'webpack5'
2320
// }
21+
core: {
22+
builder: 'storybook-builder-vite',
23+
},
2424
}

.storybook/preview.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { defineComponent } from 'vue'
22
import { app } from '@storybook/vue3'
33
import { FocusTrap } from 'focus-trap-vue'
44

5+
import '@gouvfr/dsfr/dist/core/core.module.js'
6+
57
import '../src/main.css'
68

79
import './theme.css'

build-css.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,29 @@ const postcssPlugins = [
1919
stage: 1,
2020
features: {
2121
'custom-properties': false,
22+
'focus-visible-pseudo-class': false,
2223
},
2324
}),
2425
csso,
2526
]
2627

2728
mkdirp.sync('dist')
2829

30+
fs.readFile('./src/assets/variables-fdr.css', 'utf8', (err, css) => {
31+
if (err) {
32+
console.error(err)
33+
throw err
34+
}
35+
postcss(postcssPlugins)
36+
.process(css, { from: 'src/assets/variables-fdr.css', to: 'dist/variables-fdr.css' })
37+
.then(result => {
38+
fs.writeFile('dist/variables-fdr.css', result.css, () => true)
39+
if (result.map) {
40+
fs.writeFile('dist/variables-fdr.css.map', result.map.toString(), () => true)
41+
}
42+
})
43+
})
44+
2945
fs.readFile('./src/main.css', 'utf8', (err, css) => {
3046
if (err) {
3147
console.error(err)

ci/check-exports.mjs

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,68 @@
11
#!/usr/bin/env node
22
import { readFile, writeFile } from 'fs/promises'
3+
import inquirer from 'inquirer'
4+
import chalk from 'chalk'
35
import { globby } from 'globby'
46
import path from 'path'
57

8+
const isCI = process.argv.includes('--ci')
9+
610
const __dirname = path.dirname(new URL(import.meta.url).pathname)
711

812
const sfcs = await globby([path.resolve(__dirname, '../src/components/**/*.vue')])
913
const componentsDir = path.resolve(__dirname, '../src/components')
1014

1115
const projectFn = component => 'export { default as ' + path.basename(component, '.vue') + ' } from \'' + component.replace(componentsDir, '.') + '\''
1216

13-
const finalString = sfcs.map(projectFn).sort().join('\n') + '\n'
17+
const correctComponentList = sfcs.map(projectFn).sort()
18+
const correctString = correctComponentList.join('\n') + '\n'
1419

1520
const index = await readFile(path.resolve(__dirname, '../src/components/index.js'))
21+
const currentFileContent = index.toString()
1622

17-
if (index.toString() != finalString) {
23+
if (currentFileContent !== correctString) {
1824
if (process.argv.includes('--fix')) {
19-
await writeFile(path.resolve(__dirname, '../src/components/index.js'), finalString)
25+
await writeFile(path.resolve(__dirname, '../src/components/index.js'), correctString)
2026
console.log('Fixed')
2127
process.exit(0)
2228
}
23-
console.error('Le fichier d’export des composants src/components/index.js n’est pas correct')
29+
30+
const questions = [
31+
{
32+
type: 'input',
33+
name: 'fix',
34+
message: 'Le fichier d’export des composants src/components/index.js n’est pas correct\n Est ce que vous voulez corriger (y/N) ?',
35+
},
36+
]
37+
38+
const missingComponent = ''
39+
const currentFileContentAsList = currentFileContent.split('\n').slice(0, -1).sort()
40+
const onlyInCorrectList = correctComponentList.filter(line => !currentFileContentAsList.includes(line))
41+
if (onlyInCorrectList.length) {
42+
console.log(chalk.yellow.bold('\nLes lignes suivantes sont manquantes :'))
43+
onlyInCorrectList.forEach(line => console.log(chalk.red.bold(line)))
44+
console.log('')
45+
}
46+
47+
const onlyInCurrentFileList = currentFileContentAsList.filter(line => !correctComponentList.includes(line))
48+
if (onlyInCurrentFileList.length) {
49+
console.log(chalk.yellow.bold('\nLes lignes suivantes sont en trop :'))
50+
onlyInCurrentFileList.forEach(line => console.log(chalk.red.bold(line)))
51+
console.log('')
52+
}
53+
54+
if (onlyInCorrectList.length || onlyInCurrentFileList.length) {
55+
console.log('dans ' + chalk.yellow.bold(path.resolve(__dirname, '../src/components/index.js')))
56+
}
57+
58+
if (!isCI) {
59+
await inquirer.prompt(questions).then(async answers => {
60+
if (answers.fix.toLocaleLowerCase() === 'y') {
61+
await writeFile(path.resolve(__dirname, '../src/components/index.js'), correctString)
62+
console.log(chalk.green.bold('Fichier corrigé !'))
63+
process.exit(0)
64+
}
65+
})
66+
}
2467
process.exit(1)
2568
}

cypress/support/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
// https://on.cypress.io/configuration
1414
// ***********************************************************
1515

16+
// Import dsfr js globally
17+
import '@gouvfr/dsfr/dist/core/core.module.js'
18+
1619
// Import commands.js using ES2015 syntax:
1720
import './commands.js'
1821

0 commit comments

Comments
 (0)