@bigcommerce/stencil-cli 8.10.3 → 8.10.4
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/lib/stencil-start.js
CHANGED
|
@@ -58,38 +58,35 @@ class StencilStart {
|
|
|
58
58
|
const initialStencilConfig = await this._stencilConfigManager.read();
|
|
59
59
|
// Use initial (before updates) port for BrowserSync
|
|
60
60
|
const browserSyncPort = cliOptions.port || initialStencilConfig.port;
|
|
61
|
-
const
|
|
61
|
+
const channelUrl = await this.getChannelUrl(initialStencilConfig, cliOptions);
|
|
62
62
|
const storeInfoFromAPI = await this._themeApiClient.checkCliVersion({
|
|
63
|
-
storeUrl:
|
|
63
|
+
storeUrl: channelUrl,
|
|
64
64
|
});
|
|
65
65
|
const updatedStencilConfig = this.updateStencilConfig(
|
|
66
66
|
initialStencilConfig,
|
|
67
67
|
storeInfoFromAPI,
|
|
68
68
|
browserSyncPort,
|
|
69
69
|
);
|
|
70
|
-
|
|
71
70
|
this._storeSettingsLocale = await this.getStoreSettingsLocale(
|
|
72
71
|
cliOptions,
|
|
73
72
|
updatedStencilConfig,
|
|
74
|
-
channelInfo.channel_id,
|
|
75
73
|
);
|
|
76
74
|
await this.startLocalServer(cliOptions, updatedStencilConfig);
|
|
77
75
|
this._logger.log(this.getStartUpInfo(updatedStencilConfig));
|
|
78
76
|
await this.startBrowserSync(cliOptions, browserSyncPort);
|
|
79
77
|
}
|
|
80
78
|
|
|
81
|
-
async getStoreSettingsLocale(cliOptions, stencilConfig
|
|
79
|
+
async getStoreSettingsLocale(cliOptions, stencilConfig) {
|
|
82
80
|
const { accessToken } = stencilConfig;
|
|
83
81
|
const apiHost = cliOptions.apiHost || stencilConfig.apiHost;
|
|
84
82
|
return this._storeSettingsApiClient.getStoreSettingsLocale({
|
|
85
83
|
storeHash: this.storeHash,
|
|
86
84
|
accessToken,
|
|
87
85
|
apiHost,
|
|
88
|
-
channelId,
|
|
89
86
|
});
|
|
90
87
|
}
|
|
91
88
|
|
|
92
|
-
async
|
|
89
|
+
async getChannelUrl(stencilConfig, cliOptions) {
|
|
93
90
|
const { accessToken } = stencilConfig;
|
|
94
91
|
const apiHost = cliOptions.apiHost || stencilConfig.apiHost;
|
|
95
92
|
this.storeHash = await this._themeApiClient.getStoreHash({
|
|
@@ -109,7 +106,7 @@ class StencilStart {
|
|
|
109
106
|
const foundChannel = channels.find(
|
|
110
107
|
(channel) => channel.channel_id === parseInt(channelId, 10),
|
|
111
108
|
);
|
|
112
|
-
return foundChannel
|
|
109
|
+
return foundChannel ? foundChannel.url : null;
|
|
113
110
|
}
|
|
114
111
|
|
|
115
112
|
/**
|
|
@@ -2,50 +2,29 @@ import 'colors';
|
|
|
2
2
|
import NetworkUtils from './utils/NetworkUtils.js';
|
|
3
3
|
|
|
4
4
|
const networkUtils = new NetworkUtils();
|
|
5
|
-
|
|
6
|
-
async function getStoreSettingsLocaleWithChannel({ apiHost, storeHash, accessToken, channelId }) {
|
|
7
|
-
let url = `${apiHost}/stores/${storeHash}/v3/settings/store/locale`;
|
|
8
|
-
if (channelId) {
|
|
9
|
-
url += `?channel_id=${channelId}`;
|
|
10
|
-
}
|
|
11
|
-
const response = await networkUtils.sendApiRequest({
|
|
12
|
-
url,
|
|
13
|
-
accessToken,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return response.data.data;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function getStoreSettingsLocale({ apiHost, storeHash, accessToken, channelId }) {
|
|
5
|
+
async function getStoreSettingsLocale({ apiHost, storeHash, accessToken }) {
|
|
20
6
|
try {
|
|
21
|
-
|
|
22
|
-
apiHost
|
|
23
|
-
storeHash,
|
|
7
|
+
const response = await networkUtils.sendApiRequest({
|
|
8
|
+
url: `${apiHost}/stores/${storeHash}/v3/settings/store/locale`,
|
|
24
9
|
accessToken,
|
|
25
|
-
channelId,
|
|
26
10
|
});
|
|
27
|
-
|
|
28
|
-
if (!data) {
|
|
29
|
-
data = await getStoreSettingsLocaleWithChannel({ apiHost, storeHash, accessToken });
|
|
30
|
-
}
|
|
31
|
-
if (!data) {
|
|
11
|
+
if (!response.data.data) {
|
|
32
12
|
throw new Error('Received empty store locale in the server response'.red);
|
|
33
|
-
} else if (!data.default_shopper_language) {
|
|
13
|
+
} else if (!response.data.data.default_shopper_language) {
|
|
34
14
|
throw new Error(
|
|
35
15
|
'Received empty default_shopper_language field in the server response'.red,
|
|
36
16
|
);
|
|
37
|
-
} else if (!data.shopper_language_selection_method) {
|
|
17
|
+
} else if (!response.data.data.shopper_language_selection_method) {
|
|
38
18
|
throw new Error(
|
|
39
19
|
'Received empty shopper_language_selection_method field in the server response'.red,
|
|
40
20
|
);
|
|
41
21
|
}
|
|
42
|
-
return data;
|
|
22
|
+
return response.data.data;
|
|
43
23
|
} catch (err) {
|
|
44
24
|
err.name = 'StoreSettingsLocaleError';
|
|
45
25
|
throw err;
|
|
46
26
|
}
|
|
47
27
|
}
|
|
48
|
-
|
|
49
28
|
export { getStoreSettingsLocale };
|
|
50
29
|
export default {
|
|
51
30
|
getStoreSettingsLocale,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigcommerce/stencil-cli",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tool to run BigCommerce Stores locally for theme development.",
|
|
6
6
|
"main": "index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
],
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@bigcommerce/stencil-paper": "5.3.0",
|
|
54
|
-
"@bigcommerce/stencil-styles": "
|
|
54
|
+
"@bigcommerce/stencil-styles": "6.1.1",
|
|
55
55
|
"@hapi/boom": "^10.0.1",
|
|
56
56
|
"@hapi/glue": "^9.0.1",
|
|
57
57
|
"@hapi/h2o2": "^10.0.4",
|