Skip to content

Commit

Permalink
feat: remove numeric prefix from component names (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Aug 11, 2021
1 parent 2917fc3 commit a615dd1
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export async function scanComponents (dirs: ScanDir[], srcDir: string): Promise<
componentNameParts.push(prefixParts.shift()!)
}

const componentName = pascalCase(componentNameParts) + pascalCase(fileNameParts)
const componentName = pascalCase(componentNameParts).replace(/^\d+/, '') +
pascalCase(fileNameParts).replace(/^\d+/, '')

if (resolvedNames.has(componentName)) {
// eslint-disable-next-line no-console
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/unit/loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ beforeAll(async () => {
function expectToContainImports (content: string) {
const fixturePath = p => path.resolve('test/fixture', p).replace(/\\/g, '\\\\')
expect(content).toContain(`require('${fixturePath('components/Foo.vue')}')`)
expect(content).toContain(`require('${fixturePath('components/base/Button.vue')}')`)
expect(content).toContain(`require('${fixturePath('components/0-base/1.Button.vue')}')`)
expect(content).toContain(`require('${fixturePath('components/icons/Home.vue')}')`)
}

Expand Down

0 comments on commit a615dd1

Please sign in to comment.