@commercetools-frontend/application-cli 1.0.0 → 1.0.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/application-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Internal CLI to manage Merchant Center application deployments across various environments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commercetools",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@commercetools-frontend/application-config": "21.
|
|
23
|
+
"@commercetools-frontend/application-config": "21.20.4",
|
|
24
24
|
"@manypkg/find-root": "1.1.0",
|
|
25
25
|
"@manypkg/get-packages": "1.1.3",
|
|
26
|
-
"cosmiconfig": "
|
|
27
|
-
"dotenv": "
|
|
28
|
-
"execa": "
|
|
26
|
+
"cosmiconfig": "8.0.0",
|
|
27
|
+
"dotenv": "16.0.3",
|
|
28
|
+
"execa": "6.1.0",
|
|
29
29
|
"listr": "0.14.3",
|
|
30
30
|
"listr-verbose-renderer": "0.6.0",
|
|
31
31
|
"lodash.lowerfirst": "4.3.1",
|
|
32
32
|
"mri": "1.2.0",
|
|
33
33
|
"node-fetch": "2.6.7",
|
|
34
|
-
"prettier": "2.
|
|
34
|
+
"prettier": "2.8.0",
|
|
35
35
|
"prompts": "2.4.2",
|
|
36
36
|
"rcfile": "1.0.3"
|
|
37
37
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import Listr from 'listr';
|
|
4
|
-
import execa from 'execa';
|
|
4
|
+
import { execa } from 'execa';
|
|
5
5
|
import { cosmiconfig } from 'cosmiconfig';
|
|
6
6
|
import { findRootSync } from '@manypkg/find-root';
|
|
7
7
|
import ListrVerboseRenderer from 'listr-verbose-renderer';
|
|
@@ -124,32 +124,42 @@ async function compileEnvironmentApplicationIndexes({
|
|
|
124
124
|
applicationName: cliFlags['application-name'],
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
+
const environmentVariablesForCompilation = {
|
|
128
|
+
...loadDotenvFiles({
|
|
129
|
+
dotenvPath: paths.dotenvPath,
|
|
130
|
+
cloudEnvironment,
|
|
131
|
+
}),
|
|
132
|
+
// The trailing slash is important to indicate to the CSP directive that all the resources
|
|
133
|
+
// under that path should be allowed.
|
|
134
|
+
MC_CDN_URL: `${cdnUrl}/`,
|
|
135
|
+
...(cliFlags['mc-url']
|
|
136
|
+
? {
|
|
137
|
+
MC_URL: cliFlags['mc-url'],
|
|
138
|
+
}
|
|
139
|
+
: {}),
|
|
140
|
+
...(cliFlags['mc-api-url']
|
|
141
|
+
? {
|
|
142
|
+
MC_API_URL: cliFlags['mc-api-url'],
|
|
143
|
+
}
|
|
144
|
+
: {}),
|
|
145
|
+
// Will be used by the Application Kit for Sentry and exposed on `window.app.revision`.
|
|
146
|
+
REVISION: cliFlags['build-revision'],
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/// Sentry and GTM is disabled on branch deployments
|
|
150
|
+
if (cliFlags['pr-number']) {
|
|
151
|
+
process.env.TRACKING_SENTRY = null;
|
|
152
|
+
process.env.TRACKING_GTM = null;
|
|
153
|
+
environmentVariablesForCompilation.TRACKING_SENTRY = null;
|
|
154
|
+
environmentVariablesForCompilation.TRACKING_GTM = null;
|
|
155
|
+
}
|
|
156
|
+
|
|
127
157
|
// Compile the application using the loaded environment values
|
|
128
158
|
const compileResult = await execa('mc-scripts', ['compile-html'], {
|
|
129
159
|
encoding: 'utf8',
|
|
130
160
|
preferLocal: true,
|
|
131
161
|
extendEnv: true,
|
|
132
|
-
env:
|
|
133
|
-
...loadDotenvFiles({
|
|
134
|
-
dotenvPath: paths.dotenvPath,
|
|
135
|
-
cloudEnvironment,
|
|
136
|
-
}),
|
|
137
|
-
// The trailing slash is important to indicate to the CSP directive that all the resources
|
|
138
|
-
// under that path should be allowed.
|
|
139
|
-
MC_CDN_URL: `${cdnUrl}/`,
|
|
140
|
-
...(cliFlags['mc-url']
|
|
141
|
-
? {
|
|
142
|
-
MC_URL: cliFlags['mc-url'],
|
|
143
|
-
}
|
|
144
|
-
: {}),
|
|
145
|
-
...(cliFlags['mc-api-url']
|
|
146
|
-
? {
|
|
147
|
-
MC_API_URL: cliFlags['mc-api-url'],
|
|
148
|
-
}
|
|
149
|
-
: {}),
|
|
150
|
-
// Will be used by the Application Kit for Sentry and exposed on `window.app.revision`.
|
|
151
|
-
REVISION: cliFlags['build-revision'],
|
|
152
|
-
},
|
|
162
|
+
env: environmentVariablesForCompilation,
|
|
153
163
|
});
|
|
154
164
|
|
|
155
165
|
if (compileResult.failed) {
|
|
@@ -66,18 +66,8 @@ const mapApplicationMenuConfigToGraqhQLMenuJson = (config) => {
|
|
|
66
66
|
actionRights: menuLinks.actionRights ?? null,
|
|
67
67
|
dataFences: menuLinks.dataFences ?? null,
|
|
68
68
|
submenu: menuLinks.submenuLinks.map((submenuLink) => ({
|
|
69
|
-
key:
|
|
70
|
-
|
|
71
|
-
// to the entry point URI path.
|
|
72
|
-
// However, when rendering the link, we need to provide the full uri path.
|
|
73
|
-
// Special case when the value is `/`: it means that the link is supposed to be
|
|
74
|
-
// treated the same as the entry point uri path. In this case, the return value
|
|
75
|
-
// should not contain any unnecessary trailing slash and therefore we return the
|
|
76
|
-
// main value `entryPointUriPath`.
|
|
77
|
-
uriPath:
|
|
78
|
-
submenuLink.uriPath === '/'
|
|
79
|
-
? entryPointUriPath
|
|
80
|
-
: `${entryPointUriPath}/${submenuLink.uriPath}`,
|
|
69
|
+
key: submenuLink.uriPath.replace('/', '-'),
|
|
70
|
+
uriPath: submenuLink.uriPath,
|
|
81
71
|
labelAllLocales: mapLabelAllLocalesWithDefaults(
|
|
82
72
|
submenuLink.labelAllLocales,
|
|
83
73
|
submenuLink.defaultLabel
|
|
@@ -45,16 +45,6 @@ gsutil \\
|
|
|
45
45
|
cp -z json \\
|
|
46
46
|
${assetsPath}/menu.json \\
|
|
47
47
|
${bucketUrl}
|
|
48
|
-
|
|
49
|
-
if [[ -f "${assetsPath}/public/licenses.csv" ]]; then
|
|
50
|
-
echo "Uploading licenses.csv to bucket ${bucketUrl}"
|
|
51
|
-
gsutil \\
|
|
52
|
-
-h "Content-Type: text/csv" \\
|
|
53
|
-
-h "Cache-Control: private, max-age=0, no-transform" \\
|
|
54
|
-
cp -z csv \\
|
|
55
|
-
${assetsPath}/public/licenses.csv \\
|
|
56
|
-
${bucketUrl}
|
|
57
|
-
fi
|
|
58
48
|
`;
|
|
59
49
|
|
|
60
50
|
return uploadScriptContent;
|