Skip to content

Commit 737c740

Browse files
committed
feat: include most config files and maintain an exclude list
1 parent 383c6f2 commit 737c740

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

src/assembler_hooks/index_entities.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,18 @@ export function indexEntities(entities: IndexEntitiesConfig = {}) {
9191
enabled: entities.manifest?.enabled === false ? false : transformers.enabled,
9292
source: 'config',
9393
output: '.adonisjs/client/manifest.d.ts',
94-
include: entities.manifest?.include ?? ['auth.ts'],
94+
exclude: entities.manifest?.exclude ?? [
95+
'app.ts',
96+
'bodyparser.ts',
97+
'cors.ts',
98+
'database.ts',
99+
'encryption.ts',
100+
'inertia.ts',
101+
'session.ts',
102+
'shield.ts',
103+
'static.ts',
104+
'vite.ts',
105+
],
95106
}
96107

97108
return {
@@ -169,10 +180,10 @@ export function indexEntities(entities: IndexEntitiesConfig = {}) {
169180
if (isDirectory) {
170181
return true
171182
}
172-
if (!manifest.include?.length) {
183+
if (!manifest.exclude?.length) {
173184
return true
174185
}
175-
return !!manifest.include.find((include) => filePath.endsWith(include))
186+
return !manifest.exclude.find((include) => filePath.endsWith(include))
176187
},
177188
as(vfs, buffer, ___, helpers) {
178189
const configFilesList = vfs.asList()

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,6 @@ export type IndexEntitiesConfig = {
366366
manifest?: {
367367
/** Whether to enable manifest generation */
368368
enabled?: boolean
369-
include?: string[]
369+
exclude?: string[]
370370
}
371371
}

tests/index_generator.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ test.group('Index generator', () => {
407407

408408
await fs.create('config/app.ts', '') // ignored
409409
await fs.create('config/hash.ts', '')
410-
await fs.create('config/auth.ts', '') // ignored
410+
await fs.create('config/auth.ts', '')
411411

412412
const generator = new IndexGenerator(stringHelpers.toUnixSlash(fs.basePath), cliUi.logger)
413413
const indexer = indexEntities({
@@ -423,6 +423,7 @@ test.group('Index generator', () => {
423423
assert.snapshot(await fs.contents('.adonisjs/client/manifest.d.ts')).matchInline(`
424424
"/// <reference path=\\"../../adonisrc.ts\\" />
425425
/// <reference path=\\"../../config/auth.ts\\" />
426+
/// <reference path=\\"../../config/hash.ts\\" />
426427
"
427428
`)
428429
})
@@ -442,7 +443,7 @@ test.group('Index generator', () => {
442443
},
443444
manifest: {
444445
enabled: true,
445-
include: [],
446+
exclude: [],
446447
},
447448
})
448449

0 commit comments

Comments
 (0)