Skip to content

Commit

Permalink
feat: ✨ exporte les symboles pour les clés d’injection
Browse files Browse the repository at this point in the history
  • Loading branch information
laruiss committed Sep 12, 2024
1 parent bbc4458 commit 3f3a904
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ci/check-exports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const isCI = process.argv.includes('--ci')
const getNormalizedDir = (relativeDir) => fileURLToPath(new URL(relativeDir, import.meta.url))

// const sfcs = await globby(fileURLToPath(new URL('../src/components/**/*.vue', import.meta.url)))
const sfcs = (await globby('src/components/**/*.{vue,types.ts}'))
.filter(path => !/Demo|Example/.test(path))
const sfcs = (await globby('src/components/**/*.{vue,ts}'))
.filter(path => !/Demo|Example|stories|spec\.ts|index\.ts/.test(path))
.map(path => path.replace(/^(.*).types.ts$/, '$1.types'))

const projectFn = component => component.endsWith('types')
? `export * from '${component.replace('src/components', '.')}'`
const projectFn = component => (component.endsWith('types') || component.includes('injection-key.ts'))
? `export * from '${component.replace('src/components', '.').replace(/\.ts$/, '')}'`
: `export { default as ${path.basename(component, '.vue')} } from '${component.replace('src/components', '.')}'`

const correctComponentList = sfcs.map(projectFn).sort()
Expand Down
3 changes: 3 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './DsfrAccordion/DsfrAccordion.types'
export * from './DsfrAccordion/injection-key'
export * from './DsfrAlert/DsfrAlert.types'
export * from './DsfrBackToTop/DsfrBackToTop.types'
export * from './DsfrBadge/DsfrBadge.types'
Expand All @@ -17,6 +18,7 @@ export * from './DsfrFollow/DsfrFollow.types'
export * from './DsfrFooter/DsfrFooter.types'
export * from './DsfrFranceConnect/DsfrFranceConnect.types'
export * from './DsfrHeader/DsfrHeader.types'
export * from './DsfrHeader/injection-key'
export * from './DsfrHighlight/DsfrHighlight.types'
export * from './DsfrInput/DsfrInput.types'
export * from './DsfrLanguageSelector/DsfrLanguageSelector.types'
Expand All @@ -39,6 +41,7 @@ export * from './DsfrStepper/DsfrStepper.types'
export * from './DsfrSummary/DsfrSummary.types'
export * from './DsfrTable/DsfrTable.types'
export * from './DsfrTabs/DsfrTabs.types'
export * from './DsfrTabs/injection-key'
export * from './DsfrTag/DsfrTags.types'
export * from './DsfrTile/DsfrTiles.types'
export * from './DsfrToggleSwitch/DsfrToggleSwitch.types'
Expand Down

0 comments on commit 3f3a904

Please sign in to comment.