Skip to content

Commit

Permalink
feat(fusuma): add option of port to the 'start-task'.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmellon authored and hiroppy committed Sep 4, 2019
1 parent 2074f7d commit 3899e49
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/cli/src/fusuma.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ async function cli() {

.command('start', 'Start with webpack-dev-server')
.option('-d <directory>', 'Directory to load')
.option('-p <port>', 'Dev server port')
.action((args, options, logger) => {
resolve({
type: 'start',
options: { dir: options.d }
options: { dir: options.d, port: options.p }
});
})

Expand Down
5 changes: 3 additions & 2 deletions packages/fusuma/src/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ async function initProcess({ schema }) {
await init(process.cwd(), schema);
}

async function startProcess(basePath) {
async function startProcess(basePath, { port }) {
const spinner = loader('Starting server...').start();
const config = fusuma.combine(await fusuma.read(basePath));
const remoteOrigin = await getRemoteOriginUrl();

await start({
...config,
port,
internal: {
basePath,
remoteOrigin
Expand Down Expand Up @@ -146,7 +147,7 @@ function tasks({ type, options }) {
case 'init':
return initProcess(options);
case 'start':
return startProcess(basePath);
return startProcess(basePath, options);
case 'build':
return buildProcess(basePath);
case 'deploy':
Expand Down
3 changes: 2 additions & 1 deletion packages/webpack/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ const combineConfig = require('./webpack.config');

async function start(config) {
const server = require('./server');
const port = config.port || 8080

return await server(combineConfig('development', config), { port: 8080 });
return await server(combineConfig('development', config), { port });
}

async function build(config, isConsoleOutput = true, cb) {
Expand Down

0 comments on commit 3899e49

Please sign in to comment.