@commercetools-frontend/application-cli 0.1.0 → 1.0.0

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/README.md CHANGED
@@ -59,7 +59,7 @@ Additionally, when specifying the `--dotenv-folder` option, you can specify a do
59
59
 
60
60
  ### Command: `compile-menu`
61
61
 
62
- This command compiles the menu configuration [defined in the application config](https://docs.commercetools.com/custom-applications/development/application-config#menulinks) into a `menu.json` file.
62
+ This command compiles the menu configuration [defined in the application config](https://docs.commercetools.com/custom-applications/api-reference/application-config#mainmenulink) into a `menu.json` file.
63
63
 
64
64
  > This is mostly useful for internal Merchant Center applications.
65
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/application-cli",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "Internal CLI to manage Merchant Center application deployments across various environments.",
5
5
  "keywords": [
6
6
  "commercetools",
@@ -12,9 +12,7 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "type": "module",
15
- "bin": {
16
- "application-cli": "./src/bin/cli.js"
17
- },
15
+ "bin": "./src/bin/cli.js",
18
16
  "files": [
19
17
  "src",
20
18
  "package.json",
@@ -22,19 +20,19 @@
22
20
  "README.md"
23
21
  ],
24
22
  "dependencies": {
25
- "@commercetools-frontend/application-config": "20.9.2",
23
+ "@commercetools-frontend/application-config": "21.0.0",
26
24
  "@manypkg/find-root": "1.1.0",
27
- "@manypkg/get-packages": "1.1.1",
28
- "cosmiconfig": "7.0.0",
25
+ "@manypkg/get-packages": "1.1.3",
26
+ "cosmiconfig": "7.0.1",
29
27
  "dotenv": "10.0.0",
30
28
  "execa": "5.1.1",
31
29
  "listr": "0.14.3",
32
30
  "listr-verbose-renderer": "0.6.0",
33
31
  "lodash.lowerfirst": "4.3.1",
34
- "mri": "1.1.6",
35
- "node-fetch": "2.6.1",
36
- "prettier": "2.3.2",
37
- "prompts": "2.4.1",
32
+ "mri": "1.2.0",
33
+ "node-fetch": "2.6.7",
34
+ "prettier": "2.5.1",
35
+ "prompts": "2.4.2",
38
36
  "rcfile": "1.0.3"
39
37
  },
40
38
  "engines": {
@@ -22,6 +22,12 @@ function writeUploadScriptFile({ fileName, fileContent, filePath }) {
22
22
  });
23
23
  }
24
24
 
25
+ function getBucketNamespace(prNumber) {
26
+ if (!prNumber) return;
27
+ if (prNumber === 'merchant-center-preview') return prNumber;
28
+ return `mc-${prNumber}`;
29
+ }
30
+
25
31
  /**
26
32
  * Construct the storage bucket URL for the specific application and cloud environment.
27
33
  *
@@ -38,7 +44,7 @@ function getApplicationAssetsBucketUrl({
38
44
  }) {
39
45
  const applicationAssetsBucketUrl = [
40
46
  `gs://${bucketRegion}`,
41
- prNumber && `mc-${prNumber}`,
47
+ getBucketNamespace(prNumber),
42
48
  applicationName,
43
49
  ].filter(Boolean);
44
50
 
@@ -62,7 +68,7 @@ function getApplicationIndexBucketUrl({
62
68
  function getCdnUrl({ bucketRegion, prNumber, applicationName }) {
63
69
  return [
64
70
  `https://storage.googleapis.com/${bucketRegion}`,
65
- prNumber && `mc-${prNumber}`,
71
+ getBucketNamespace(prNumber),
66
72
  applicationName,
67
73
  ]
68
74
  .filter(Boolean)
@@ -150,7 +156,6 @@ async function compileEnvironmentApplicationIndexes({
150
156
  throw new Error(compileResult.stderr);
151
157
  }
152
158
 
153
- const compiledHeadersJson = JSON.parse(compileResult.stdout);
154
159
  const applicationIndexUploadScriptContent =
155
160
  createApplicationIndexUploadScript({
156
161
  bucketUrl: getApplicationIndexBucketUrl({
@@ -159,7 +164,6 @@ async function compileEnvironmentApplicationIndexes({
159
164
  applicationName: cliFlags['application-name'],
160
165
  cloudEnvironment,
161
166
  }),
162
- compiledHeadersJson,
163
167
  cdnUrl,
164
168
  cloudEnvironment,
165
169
  buildRevision: cliFlags['build-revision'],
@@ -1,6 +1,5 @@
1
1
  function createApplicationIndexUploadScript({
2
2
  bucketUrl,
3
- compiledHeadersJson,
4
3
  cdnUrl,
5
4
  cloudEnvironment,
6
5
  buildRevision,
@@ -15,12 +14,6 @@ echo "Uploading compiled ${applicationIndexOutFile} to bucket ${bucketUrl}"
15
14
  gsutil \\
16
15
  -h "Content-Type: text/html" \\
17
16
  -h "Cache-Control: public, max-age=0, no-transform" \\
18
- ${Object.entries(compiledHeadersJson)
19
- .map(
20
- ([headerKey, headerValue]) =>
21
- ` -h "x-goog-meta-mc-${headerKey}: ${headerValue}" \\`
22
- )
23
- .join('\n')}
24
17
  cp -z html \\
25
18
  "$(dirname "$0")/${applicationIndexOutFile}" \\
26
19
  "${bucketUrl}/"