Skip to content

Commit abdf0e6

Browse files
committed
dev-bl/config-ip: Set port via nc.js
1 parent 1daab4e commit abdf0e6

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

build/brunch-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ module.exports = {
7676
It should return an object with a close() method (as ExpressJS app does)
7777
/*/ server: {
7878
// viewing url is http://localhost:3000
79-
port : 3000
79+
port : parseInt(NC_CONFIG.port)
8080
},
8181

8282
/// NPM INTEGRATION ///////////////////////////////////////////////////////////

build/nc.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const shell = require('shelljs');
44
let argv = require('minimist')(process.argv.slice(2));
55
let dataset = argv['dataset'];
66
let googlea = argv['googlea'];
7+
let port = argv['port'];
78

89
shell.echo(`
910
+------------------------+
@@ -55,19 +56,29 @@ if (googlea === undefined || googlea === '') {
5556
`);
5657
}
5758

59+
60+
// port
61+
if (port === undefined || port === '') {
62+
port = 3000;
5863
}
64+
shell.echo(`
65+
3. Setting port to ${port}
66+
Use './nc.js --port=xxxx' to define a diferent port.\n
67+
`);
68+
5969

6070
let script = `
6171
// this file generated by NC command
6272
const NC_CONFIG = {
6373
dataset: "${dataset}",
74+
port: "${port}",
6475
googlea: "${googlea}"
6576
};
6677
if (typeof process === "object") module.exports = NC_CONFIG;
6778
if (typeof window === "object") window.NC_CONFIG = NC_CONFIG;`
6879
let js = shell.ShellString(script).to('app/assets/netcreate-config.js');
6980

70-
shell.echo(` 3. Starting dev server...
81+
shell.echo(` 4. Starting dev server...
7182
\n
7283
\n`);
7384

0 commit comments

Comments
 (0)