@bigcommerce/stencil-cli 8.8.6 → 8.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/stencil-start.js +3 -1
- package/lib/stencil-start.js +7 -6
- package/package.json +1 -1
- package/server/index.js +1 -1
package/bin/stencil-start.js
CHANGED
|
@@ -23,7 +23,8 @@ program
|
|
|
23
23
|
.option(
|
|
24
24
|
'-cu, --channelUrl [channelUrl]',
|
|
25
25
|
'Set a custom domain url to bypass dns/proxy protection',
|
|
26
|
-
)
|
|
26
|
+
)
|
|
27
|
+
.option('-p --port [portnumber]', 'Set port number to listen dev server');
|
|
27
28
|
const cliOptions = prepareCommand(program);
|
|
28
29
|
const options = {
|
|
29
30
|
open: cliOptions.open,
|
|
@@ -33,6 +34,7 @@ const options = {
|
|
|
33
34
|
tunnel: cliOptions.tunnel,
|
|
34
35
|
cache: cliOptions.cache,
|
|
35
36
|
channelUrl: cliOptions.channelUrl,
|
|
37
|
+
port: cliOptions.port,
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
async function run() {
|
package/lib/stencil-start.js
CHANGED
|
@@ -57,7 +57,7 @@ class StencilStart {
|
|
|
57
57
|
}
|
|
58
58
|
const initialStencilConfig = await this._stencilConfigManager.read();
|
|
59
59
|
// Use initial (before updates) port for BrowserSync
|
|
60
|
-
const browserSyncPort = initialStencilConfig.port;
|
|
60
|
+
const browserSyncPort = cliOptions.port || initialStencilConfig.port;
|
|
61
61
|
const channelUrl = await this.getChannelUrl(initialStencilConfig, cliOptions);
|
|
62
62
|
const storeInfoFromAPI = await this._themeApiClient.checkCliVersion({
|
|
63
63
|
storeUrl: channelUrl,
|
|
@@ -65,6 +65,7 @@ class StencilStart {
|
|
|
65
65
|
const updatedStencilConfig = this.updateStencilConfig(
|
|
66
66
|
initialStencilConfig,
|
|
67
67
|
storeInfoFromAPI,
|
|
68
|
+
browserSyncPort,
|
|
68
69
|
);
|
|
69
70
|
this._storeSettingsLocale = await this.getStoreSettingsLocale(
|
|
70
71
|
cliOptions,
|
|
@@ -72,7 +73,7 @@ class StencilStart {
|
|
|
72
73
|
);
|
|
73
74
|
await this.startLocalServer(cliOptions, updatedStencilConfig);
|
|
74
75
|
this._logger.log(this.getStartUpInfo(updatedStencilConfig));
|
|
75
|
-
await this.startBrowserSync(cliOptions,
|
|
76
|
+
await this.startBrowserSync(cliOptions, browserSyncPort);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
async getStoreSettingsLocale(cliOptions, stencilConfig) {
|
|
@@ -126,12 +127,12 @@ class StencilStart {
|
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
updateStencilConfig(stencilConfig, storeInfoFromAPI) {
|
|
130
|
+
updateStencilConfig(stencilConfig, storeInfoFromAPI, browserSyncPort) {
|
|
130
131
|
return {
|
|
131
132
|
...stencilConfig,
|
|
132
133
|
storeUrl: storeInfoFromAPI.sslUrl,
|
|
133
134
|
normalStoreUrl: storeInfoFromAPI.baseUrl,
|
|
134
|
-
port:
|
|
135
|
+
port: browserSyncPort,
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
|
|
@@ -151,7 +152,7 @@ class StencilStart {
|
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
async startBrowserSync(cliOptions,
|
|
155
|
+
async startBrowserSync(cliOptions, browserSyncPort) {
|
|
155
156
|
const DEFAULT_WATCH_FILES = ['/assets', '/templates', '/lang', '/.config'];
|
|
156
157
|
const DEFAULT_WATCH_IGNORED = ['/assets/scss', '/assets/css'];
|
|
157
158
|
const { themePath, configPath } = this._themeConfigManager;
|
|
@@ -218,7 +219,7 @@ class StencilStart {
|
|
|
218
219
|
ignoreInitial: true,
|
|
219
220
|
ignored: watchIgnored.map((val) => path.join(themePath, val)),
|
|
220
221
|
},
|
|
221
|
-
proxy: `localhost:${
|
|
222
|
+
proxy: `localhost:${Number(browserSyncPort) + 1}`,
|
|
222
223
|
tunnel,
|
|
223
224
|
});
|
|
224
225
|
// Handle manual reloading of browsers by typing 'rs';
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -14,7 +14,7 @@ function buildManifest(srcManifest, options) {
|
|
|
14
14
|
const parsedSecureUrl = new URL(options.dotStencilFile.storeUrl); // The url to a secure page (prompted as login page)
|
|
15
15
|
const parsedNormalUrl = new URL(options.dotStencilFile.normalStoreUrl); // The host url of the homepage;
|
|
16
16
|
const storeUrl = parsedSecureUrl.protocol + '//' + parsedSecureUrl.host;
|
|
17
|
-
resManifest.server.port = options.dotStencilFile.port;
|
|
17
|
+
resManifest.server.port = parseInt(options.dotStencilFile.port, 10) + 1;
|
|
18
18
|
pluginsByName['./plugins/router/router.module.js'].storeUrl = storeUrl;
|
|
19
19
|
pluginsByName['./plugins/router/router.module.js'].normalStoreUrl =
|
|
20
20
|
parsedNormalUrl.protocol + '//' + parsedNormalUrl.host;
|