Skip to content

Commit 11d96b8

Browse files
committed
feat: support custom config file, resolves #68
1 parent a09d29d commit 11d96b8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/node-modules-inspector/src/node/cli.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const cli = cac('node-modules-inspector')
2020
cli
2121
.command('build', 'Build inspector with current config file for static hosting')
2222
.option('--root <root>', 'Root directory', { default: process.cwd() })
23+
.option('--config <config>', 'Config file')
2324
.option('--depth <depth>', 'Max depth to list dependencies', { default: 25 })
2425
// Build specific options
2526
.option('--base <baseURL>', 'Base URL for deployment', { default: '/' })
@@ -37,6 +38,7 @@ cli
3738
storageNpmMeta,
3839
storageNpmMetaLatest,
3940
storagePublint,
41+
configFile: options.config,
4042
mode: 'build',
4143
}))
4244
const rpcDump: ServerFunctionsDump = {
@@ -77,6 +79,7 @@ cli
7779
cli
7880
.command('', 'Start dev inspector')
7981
.option('--root <root>', 'Root directory', { default: process.cwd() })
82+
.option('--config <config>', 'Config file')
8083
.option('--depth <depth>', 'Max depth to list dependencies', { default: 25 })
8184
// Dev specific options
8285
.option('--host <host>', 'Host', { default: process.env.HOST || '127.0.0.1' })
@@ -95,6 +98,7 @@ cli
9598
storageNpmMeta,
9699
storageNpmMetaLatest,
97100
storagePublint,
101+
configFile: options.config,
98102
mode: 'dev',
99103
})
100104

packages/node-modules-inspector/src/node/rpc.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface CreateServerFunctionsOptions extends
2020
ListPackagesNpmMetaLatestOptions {
2121
mode: 'dev' | 'build'
2222
storagePublint?: Storage<PublintMessage[]>
23+
configFile?: string
2324
}
2425

2526
export function createServerFunctions(options: CreateServerFunctionsOptions): ServerFunctions {
@@ -39,7 +40,7 @@ export function createServerFunctions(options: CreateServerFunctionsOptions): Se
3940
cwd: options.cwd,
4041
sources: [
4142
{
42-
files: 'node-modules-inspector.config',
43+
files: options.configFile || 'node-modules-inspector.config',
4344
},
4445
],
4546
defaults: {

0 commit comments

Comments
 (0)