Skip to content

Commit 37793e0

Browse files
authored
Merge pull request #293 from dnum-mi/tech/improve-types
Tech/improve types
2 parents d29e11f + abd29b2 commit 37793e0

File tree

85 files changed

+269
-236
lines changed

Some content is hidden

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

85 files changed

+269
-236
lines changed

.storybook/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import '../src/main.css'
88

99
import './theme.css'
1010

11-
import VIcon from '../src/icons.js'
11+
import {OhVueIcon as VIcon} from 'oh-vue-icons'
1212

1313
export const parameters = {
1414
actions: { argTypesRegex: "^on[A-Z].*" },

cypress/plugins/index.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@
1212
// For component testing 1/2
1313
const { startDevServer } = require('@cypress/vite-dev-server')
1414

15-
module.exports = (on, config) => {
16-
on('dev-server:start', options =>
17-
startDevServer({
18-
options,
19-
}),
20-
)
21-
22-
return config
23-
}
2415
module.exports = (on, config) => {
2516
// on('file:preprocessor', webpack({
2617
// webpackOptions: require('@vue/cli-service/webpack.config'),

package.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,25 @@
1414
"types": "./types",
1515
"license": "MIT",
1616
"main": "./dist/vue-dsfr.umd.js",
17-
"module": "./dist/vue-dsfr.esm.js",
17+
"module": "./dist/vue-dsfr.mjs",
18+
"exports": {
19+
".": {
20+
"require": "./dist/vue-dsfr.umd.js",
21+
"import": "./dist/vue-dsfr.mjs"
22+
},
23+
"./dist/vue-dsfr.css": {
24+
"require": "./dist/vue-dsfr.css",
25+
"import": "./dist/vue-dsfr.css"
26+
},
27+
"./dist/vue-dsfr-fonts.css": {
28+
"require": "./dist/vue-dsfr-fonts.css",
29+
"import": "./dist/vue-dsfr-fonts.css"
30+
},
31+
"./dist/vue-dsfr-fonts-essentials.css": {
32+
"require": "./dist/vue-dsfr-fonts-essentials.css",
33+
"import": "./dist/vue-dsfr-fonts-essentials.css"
34+
}
35+
},
1836
"publishConfig": {
1937
"@laruiss:registry": "https://registry.npmjs.com",
2038
"access": "public"
@@ -30,7 +48,7 @@
3048
"build": "run-p build:css build:js",
3149
"postbuild": "copyfiles types/composable.d.ts dist/composable.d.ts",
3250
"build:css": "node build-css.mjs",
33-
"build:js": "cross-env NODE_ENV=production rollup --config rollup.config.js",
51+
"build:js": "cross-env NODE_ENV=production rollup -c",
3452
"demo-app": "vite",
3553
"vitest": "vitest",
3654
"coverage": "vitest run --coverage",

rollup.config.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { defineConfig } from 'rollup'
12
import vue from 'rollup-plugin-vue'
23

34
import { nodeResolve } from '@rollup/plugin-node-resolve'
@@ -23,15 +24,16 @@ const postcssPlugins = [
2324
'focus-visible-pseudo-class': false,
2425
},
2526
}),
26-
csso,
27+
csso(),
2728
]
2829

2930
const baseOutput = {
3031
globals: {
3132
vue: 'vue',
33+
'oh-vue-icons': 'OhVueIcon',
34+
'oh-vue-icons/icons': 'oh-vue-icons/icons',
35+
'oh-vue-icons/icons/ri/index.js': 'oh-vue-icons/icons/ri/index.js',
3236
'vue-router': 'vue-router',
33-
'oh-vue-icons/dist/v3/icon.es': 'VIcon',
34-
'oh-vue-icons/icons': 'icons',
3537
'focus-trap': 'focus-trap',
3638
'focus-trap-vue': 'focus-trap-vue',
3739
},
@@ -42,8 +44,9 @@ const baseConfig = {
4244
external: [
4345
'vue',
4446
'vue-router',
45-
'oh-vue-icons/dist/v3/icon.es',
47+
'oh-vue-icons',
4648
'oh-vue-icons/icons',
49+
'oh-vue-icons/icons/ri/index.js',
4750
'focus-trap',
4851
'focus-trap-vue',
4952
],
@@ -62,13 +65,13 @@ const baseConfig = {
6265
],
6366
}
6467

65-
export default [
68+
export default defineConfig([
6669
// ESM build to be used with webpack/rollup.
6770
{
6871
...baseConfig,
6972
output: {
7073
format: 'esm',
71-
file: 'dist/vue-dsfr.esm.js',
74+
file: 'dist/vue-dsfr.mjs',
7275
globals: baseOutput.globals,
7376
name: 'VueDsfr',
7477
},
@@ -113,4 +116,4 @@ export default [
113116
name: 'VueDsfr',
114117
},
115118
},
116-
]
119+
])

src/components/DsfrAccordion/DsfrAccordion.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mount } from '@cypress/vue'
22
import DsfrAccordion from './DsfrAccordion.vue'
33
import DsfrAccordionsGroup from './DsfrAccordionsGroup.vue'
4-
import VIcon from '../../icons.js'
4+
import { OhVueIcon as VIcon } from 'oh-vue-icons'
55

66
import '../../main.css'
77

src/components/DsfrAccordion/DsfrAccordion.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { fireEvent, render } from '@testing-library/vue'
2-
import VIcon from '../../icons.js'
2+
import { OhVueIcon as VIcon } from 'oh-vue-icons'
33
// import '@gouvfr/dsfr/dist/core/core.module.js'
44

55
import DsfrAccordion from './DsfrAccordion.vue'
66

7-
87
describe('DsfrAccordion', () => {
98
it('should render a simple accordion', async () => {
109
const title = 'Intitulé de l’accordéon'

src/components/DsfrAccordion/DsfrAccordion.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default defineComponent({
6464
</section>
6565
</template>
6666

67-
<style src="@gouvfr/dsfr/dist/component/accordion/accordion.main.css" />
67+
<style src="@gouvfr/dsfr/dist/component/accordion/accordion.main.min.css" />
6868

6969
<style scoped>
7070
.fr-collapse--expanded {

src/components/DsfrAlert/DsfrAlert.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { mount } from '@cypress/vue'
22
import DsfrAlert from './DsfrAlert.vue'
3-
import VIcon from '../../icons.js'
3+
import { OhVueIcon as VIcon } from 'oh-vue-icons'
44

55
import '../../main.css'
66

src/components/DsfrAlert/DsfrAlert.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default defineComponent({
9999
</transition>
100100
</template>
101101

102-
<style src="@gouvfr/dsfr/dist/component/alert/alert.main.css" />
102+
<style src="@gouvfr/dsfr/dist/component/alert/alert.main.min.css" />
103103

104104
<style scoped>
105105
.fr-alert,

src/components/DsfrBreadcrumb/DsfrBreadcrumb.e2e.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { mount } from '@cypress/vue'
22
import DsfrBreadcrumb from './DsfrBreadcrumb.vue'
3-
import VIcon from '../../icons.js'
3+
import { OhVueIcon as VIcon } from 'oh-vue-icons'
44

55
import '../../main.css'
66

0 commit comments

Comments
 (0)