Skip to content

Commit c7834df

Browse files
authored
Merge pull request #254 from dnum-mi/tech/add-types
feat: 🏷️ Add type definitions
2 parents 3918bb3 + ce47efd commit c7834df

File tree

108 files changed

+8036
-377
lines changed

Some content is hidden

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

108 files changed

+8036
-377
lines changed

env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

package-lock.json

Lines changed: 2610 additions & 280 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"version": "1.0.0-beta.35",
44
"files": [
55
"dist",
6-
"types"
6+
"types",
7+
"LICENSE",
8+
"README.md"
79
],
810
"engines": {
911
"node": "17.x.x",
@@ -23,8 +25,10 @@
2325
"check-exports": "node ./ci/check-exports.mjs",
2426
"check-exports-ci": "node ./ci/check-exports.mjs --ci",
2527
"dev": "npm run storybook",
26-
"prebuild": "rimraf dist",
28+
"clean-dist": "rimraf dist",
29+
"prebuild": "run-s clean-dist gen-types",
2730
"build": "run-p build:css build:js",
31+
"postbuild": "copyfiles types/composable.d.ts dist/composable.d.ts",
2832
"build:css": "node build-css.mjs",
2933
"build:js": "cross-env NODE_ENV=production rollup --config rollup.config.js",
3034
"demo-app": "vite",
@@ -37,7 +41,11 @@
3741
"storybook": "cross-env NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006",
3842
"build-storybook": "build-storybook",
3943
"prepublishOnly": "npm run build",
40-
"semantic-release": "semantic-release"
44+
"semantic-release": "semantic-release",
45+
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
46+
"vite:build": "vite build && tsc -d --emitDeclarationOnly && vue-typegen gen -s src -o types",
47+
"typegen": "tsc -d --emitDeclarationOnly && vue-typegen gen -s src -o types",
48+
"vue-tsc": "vue-tsc --declaration --emitDeclarationOnly"
4149
},
4250
"dependencies": {
4351
"@gouvfr/dsfr": "^1.3.1",
@@ -53,6 +61,7 @@
5361
"@babel/preset-env": "^7.16.11",
5462
"@cypress/vite-dev-server": "^2.2.2",
5563
"@cypress/vue": "^3.1.1",
64+
"@rushstack/eslint-patch": "^1.1.0",
5665
"@rollup/plugin-alias": "^3.1.9",
5766
"@rollup/plugin-babel": "^5.3.1",
5867
"@rollup/plugin-commonjs": "^21.0.2",
@@ -72,20 +81,25 @@
7281
"@testing-library/jest-dom": "^5.16.2",
7382
"@testing-library/user-event": "^13.5.0",
7483
"@testing-library/vue": "^6.5.1",
84+
"@types/jsdom": "^16.2.14",
7585
"@types/jest": "^27.4.1",
86+
"@types/node": "^16.11.25",
7687
"@types/vue": "^2.0.0",
7788
"@typescript-eslint/eslint-plugin": "^5.13.0",
7889
"@typescript-eslint/parser": "^5.13.0",
7990
"@vitejs/plugin-vue": "^2.2.4",
8091
"@vitejs/plugin-vue-jsx": "^1.3.8",
8192
"@vue/compiler-sfc": "^3.2.31",
8293
"@vue/eslint-config-standard": "^6.1.0",
94+
"@vue/eslint-config-typescript": "^10.0.0",
8395
"@vue/test-utils": "^2.0.0-rc.18",
96+
"@vue/tsconfig": "^0.1.3",
8497
"@vue/vue3-jest": "^27.0.0-alpha.4",
8598
"autoprefixer": "^10.4.2",
8699
"babel-loader": "^8.2.3",
87100
"babel-plugin-transform-import-meta": "^2.1.1",
88101
"chalk": "^5.0.0",
102+
"copyfiles": "^2.4.1",
89103
"core-js": "^3.21.1",
90104
"cross-env": "^7.0.3",
91105
"cypress": "^9.5.1",
@@ -102,6 +116,7 @@
102116
"jest": "^27.5.1",
103117
"jest-svg-transformer": "^1.0.0",
104118
"jest-transform-stub": "^2.0.0",
119+
"jsdom": "^19.0.0",
105120
"lint-staged": "^12.3.4",
106121
"mkdirp": "^1.0.4",
107122
"npm-run-all": "^4.1.5",
@@ -120,14 +135,18 @@
120135
"rollup-plugin-visualizer": "^5.6.0",
121136
"rollup-plugin-vue": "^6.0.0",
122137
"semantic-release": "^19.0.2",
138+
"start-server-and-test": "^1.14.0",
123139
"storybook-builder-vite": "^0.1.17",
124140
"ts-jest": "^27.1.3",
125141
"tsd-jsdoc": "^2.5.0",
126142
"typescript": "^4.6.2",
127143
"vite": "^2.8.6",
144+
"vitest": "^0.5.0",
128145
"vue-loader": "^17.0.0",
129146
"vue-router": "^4.0.13",
130147
"vue-router-mock": "^0.1.7",
148+
"vue-tsc": "^0.32.1",
149+
"vue-typegen": "^0.2.0",
131150
"yorkie": "^2.0.0"
132151
},
133152
"peerDependencies": {

src/components/DsfrAccordion/DsfrAccordion.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<script>
22
// import '@gouvfr/dsfr/dist/component/accordion/accordion.module.js'
3+
import { defineComponent } from 'vue'
34
45
import { getRandomId } from '../../utils/random-utils.js'
56
6-
export default {
7+
export default defineComponent({
78
name: 'DsfrAccordion',
89
props: {
910
id: {
@@ -36,7 +37,7 @@ export default {
3637
},
3738
},
3839
39-
}
40+
})
4041
</script>
4142

4243
<template>

src/components/DsfrAlert/DsfrAlert.vue

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<script>
1+
<script lang="ts">
22
import { defineComponent } from 'vue'
33
44
import { getRandomId } from '../../utils/random-utils.js'
@@ -24,18 +24,9 @@ export default defineComponent({
2424
type: String,
2525
default: '',
2626
},
27-
small: {
28-
type: Boolean,
29-
default: false,
30-
},
31-
closed: {
32-
type: Boolean,
33-
default: false,
34-
},
35-
closeable: {
36-
type: Boolean,
37-
default: false,
38-
},
27+
small: Boolean,
28+
closed: Boolean,
29+
closeable: Boolean,
3930
},
4031
4132
emits: ['close'],

src/components/DsfrBreadcrumb/DsfrBreadcrumb.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<script>
2+
import { defineComponent } from 'vue'
3+
24
// TODO: Pourquoi pas d’animation ?
35
import '@gouvfr/dsfr/dist/component/breadcrumb/breadcrumb.module.js'
46
57
import { getRandomId } from '../../utils/random-utils.js'
68
7-
export default {
9+
export default defineComponent({
810
name: 'DsfrBreadcrumb',
911
1012
props: {
@@ -31,7 +33,7 @@ export default {
3133
return '$nuxt' in this ? 'nuxt-link' : 'router-link'
3234
},
3335
},
34-
}
36+
})
3537
</script>
3638

3739
<template>

src/components/DsfrButton/DsfrButton.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script>
2+
import { defineComponent } from 'vue'
3+
24
import '@gouvfr/dsfr/dist/component/button/button.module.js'
35
4-
export default {
6+
export default defineComponent({
57
name: 'DsfrButton',
68
props: {
79
disabled: Boolean,
@@ -23,7 +25,7 @@ export default {
2325
this.$refs.btn.focus()
2426
},
2527
},
26-
}
28+
})
2729
</script>
2830

2931
<template>

src/components/DsfrButton/DsfrButtonGroup.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
22
import { defineComponent } from 'vue'
3+
34
import DsfrButton from './DsfrButton.vue'
45
56
export default defineComponent({

src/components/DsfrCallout/DsfrCallout.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<script>
2+
import { defineComponent } from 'vue'
3+
24
import DsfrButton from '../DsfrButton/DsfrButton.vue'
35
4-
export default {
6+
export default defineComponent({
57
name: 'DsfrCallout',
68
79
components: {
@@ -27,7 +29,7 @@ export default {
2729
required: false,
2830
},
2931
},
30-
}
32+
})
3133
</script>
3234

3335
<template>

src/components/DsfrCard/DsfrCard.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<script>
2-
export default {
2+
import { defineComponent } from 'vue'
3+
4+
export default defineComponent({
35
name: 'DsfrCard',
46
57
props: {
@@ -42,7 +44,7 @@ export default {
4244
this.$refs.title.querySelector('.fr-card__link').click()
4345
},
4446
},
45-
}
47+
})
4648
</script>
4749

4850
<template>

0 commit comments

Comments
 (0)