Skip to content

Commit

Permalink
feat(fec): Allow passing a port option to dev script
Browse files Browse the repository at this point in the history
  • Loading branch information
bastilian committed May 14, 2024
1 parent 2182283 commit 2de3162
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions packages/config/src/bin/dev-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async function devScript(
webpackConfig?: string;
clouddotEnv?: string;
uiEnv?: string;
port?: string;
},
cwd: string
) {
Expand Down Expand Up @@ -69,6 +70,10 @@ async function devScript(
await setEnv(cwd);
}

if (argv.port) {
process.env.PORT = argv.port;
}

spawn(`npm exec -- webpack serve -c ${configPath}`, [], {
stdio: [process.stdout, process.stdout, process.stdout],
cwd,
Expand Down
17 changes: 12 additions & 5 deletions packages/config/src/bin/fec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const argv = yargs
alias: 'c',
describe: 'Path to webpack config',
})
.positional('port', {
.option('port', {
type: 'number',
alias: 'p',
describe: 'Asset server port',
Expand All @@ -97,10 +97,17 @@ const argv = yargs
})
.command('patch-etc-hosts', "You may have to run this as 'sudo'. Setup your etc/hosts allow development hosts in your browser")
.command('dev', 'Start development server', (yargs) => {
yargs.positional('webpack-config', {
type: 'string',
describe: 'Path to webpack config',
});
yargs
.positional('webpack-config', {
type: 'string',
describe: 'Path to webpack config',
})
.option('port', {
type: 'number',
alias: 'p',
describe: 'Asset server port',
default: 1337,
});
})
.command('build', 'Build production bundle', (yargs) => {
yargs.positional('webpack-config', {
Expand Down

0 comments on commit 2de3162

Please sign in to comment.