@commercetools-frontend/application-cli 1.5.0 → 1.6.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/README.md CHANGED
@@ -46,7 +46,7 @@ The above configuration would compile for two environments in `gcp-production-us
46
46
  - upload-assets-merchant-center-asia.sh
47
47
  ```
48
48
 
49
- 1. The `upload-index.sh` and `upload-assets-<bucket>.sh` scripts are generated pre-configured bash scripts for uploading the `application.html` and static assets to the respective storage bucket using `gsutil`.
49
+ 1. The `upload-index.sh` and `upload-assets-<bucket>.sh` scripts are generated pre-configured bash scripts for uploading the `application.html` and static assets to the respective storage bucket using `gcloud storage`.
50
50
  2. The `public` folder contains shared static assets for all environments.
51
51
  3. The `application.html` references the static assets from its respective environment's bucket
52
52
 
@@ -74,7 +74,7 @@ function createApplicationIndexUploadScript(_ref) {
74
74
  buildRevision = _ref.buildRevision,
75
75
  buildNumber = _ref.buildNumber,
76
76
  applicationIndexOutFile = _ref.applicationIndexOutFile;
77
- const uploadScriptContent = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = _concatInstanceProperty__default["default"](_context8 = _concatInstanceProperty__default["default"](_context9 = _concatInstanceProperty__default["default"](_context10 = "#!/usr/bin/env bash\n\nset -e\n\necho \"Uploading compiled ".concat(applicationIndexOutFile, " to bucket ")).call(_context10, bucketUrl, "\"\ngsutil \\\n-h \"Content-Type: text/html\" \\\n-h \"Cache-Control: public, max-age=0, no-transform\" \\\ncp -z html \\\n\"$(dirname \"$0\")/")).call(_context9, applicationIndexOutFile, "\" \\\n\"")).call(_context8, bucketUrl, "/\"\n\necho \"Creating version.json and uploading it to bucket ")).call(_context7, bucketUrl, "\"\n\nNODE_ENV=production ")).call(_context6, packageManagerName, " application-cli create-version \\\n --version-url=")).call(_context5, cdnUrl, "/")).call(_context4, cloudEnvironment, "/version.json \\\n --build-revision=")).call(_context3, buildRevision, " \\\n --build-number=")).call(_context2, buildNumber, " \\\n --out-file=$(dirname \"$0\")/version.json\n\ngsutil \\\n-h \"Content-Type: application/json\" \\\n-h \"Cache-Control: private, max-age=0, no-transform\" \\\ncp -z json \\\n\"$(dirname \"$0\")/version.json\" \\\n\"")).call(_context, bucketUrl, "/\"\n");
77
+ const uploadScriptContent = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = _concatInstanceProperty__default["default"](_context8 = _concatInstanceProperty__default["default"](_context9 = _concatInstanceProperty__default["default"](_context10 = "#!/usr/bin/env bash\n\nset -e\n\necho \"Uploading compiled ".concat(applicationIndexOutFile, " to bucket ")).call(_context10, bucketUrl, "\"\ngcloud storage cp \\\n \"$(dirname \"$0\")/")).call(_context9, applicationIndexOutFile, "\" \\\n \"")).call(_context8, bucketUrl, "/\" \\\n -z html \\\n --content-type=\"text/html\" \\\n --cache-control=\"public,max-age=0,no-transform\"\n\necho \"Creating version.json and uploading it to bucket ")).call(_context7, bucketUrl, "\"\n\nNODE_ENV=production ")).call(_context6, packageManagerName, " application-cli create-version \\\n --version-url=")).call(_context5, cdnUrl, "/")).call(_context4, cloudEnvironment, "/version.json \\\n --build-revision=")).call(_context3, buildRevision, " \\\n --build-number=")).call(_context2, buildNumber, " \\\n --out-file=$(dirname \"$0\")/version.json\n\ngcloud storage cp \\\n \"$(dirname \"$0\")/version.json\" \\\n \"")).call(_context, bucketUrl, "/\" \\\n -z json \\\n --content-type=\"application/json\" \\\n --cache-control=\"public,max-age=0,no-transform\"\n");
78
78
  return uploadScriptContent;
79
79
  }
80
80
 
@@ -83,7 +83,7 @@ function createApplicationAssetsUploadScript(_ref) {
83
83
  let bucketUrl = _ref.bucketUrl,
84
84
  assetsPath = _ref.assetsPath,
85
85
  skipMenu = _ref.skipMenu;
86
- const uploadScriptContent = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = "#!/usr/bin/env bash\n\nset -e\n\n# NOTES:\n# https://cloud.google.com/storage/docs/gsutil/commands/cp#options\n# 1. The '-z' option triggers compressing the assets before\n# uploading them and sets the 'Content-Encoding' to 'gzip'.\n# 2. The 'Accept-encoding: gzip' is set automatically by the 'gsutils'.\n# 3. The 'max-age' is set to 1 year which is considered the maximum\n# \"valid\" lifetime of an asset to be cached.\n# 5. The '-n' will skip uploading existing files and prevents them to\n# be overwritten\necho \"Uploading static assets to bucket ".concat(bucketUrl, "\"\n\ngsutil -m \\\n -h \"Cache-Control: public, max-age=31536000, no-transform\" \\\n cp -z js,css \\\n -n \\\n ")).call(_context6, assetsPath, "/public/{*.css,*.js,*.js.map,*.png,*.html,robots.txt} \\\n \"")).call(_context5, bucketUrl, "\"\n\nif ")).call(_context4, skipMenu, "; then\n echo \"Skipping menu.json upload\"\nelse\n echo \"Uploading menu.json to bucket ")).call(_context3, bucketUrl, "\"\n # NOTE: somehow the 'cache-control:private' doesn't work.\n # I mean, the file is uploaded with the correct metadata but when I fetch\n # the file the response contains the header\n # 'cache-control: public, max-age=31536000, no-transform', even though the\n # documentation clearly states that by marking the header as 'private' will\n # disable the cache (for publicly readable objects).\n # https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#cache-control\n # However, I found out that, by requesting the file with any RANDOM\n # query parameter, will instruct the storage to return a 'fresh' object\n # (without any cache control).\n # Unofficial source: https://stackoverflow.com/a/49052895\n # This seems to be the 'easiest' option to 'disable' the cache for public\n # objects. Other alternative approaces are:\n # * make the object private with some simple ACL (private objects are not cached)\n # * suffix the file name with e.g. the git SHA, so we have different files\n # for each upload ('index.html.template-${CIRCLE_SHA1}'). The server knows\n # the git SHA on runtime and can get the correct file when it starts.\n # * find out why the 'private' cache control does not work\n gsutil \\\n -h \"Content-Type: application/json\" \\\n -h \"Cache-Control: private, max-age=0, no-transform\" \\\n cp -z json \\\n ")).call(_context2, assetsPath, "/menu.json \\\n ")).call(_context, bucketUrl, "\nfi\n");
86
+ const uploadScriptContent = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = "#!/usr/bin/env bash\n\nset -e\n\n# NOTES:\n# https://cloud.google.com/sdk/gcloud/reference/storage/cp\n# 1. The '-z' option triggers compressing the assets before\n# uploading them and sets the 'Content-Encoding' to 'gzip'.\n# 2. The 'Accept-encoding: gzip' is set automatically by the 'gcloud storage'.\n# 3. The 'max-age' is set to 1 year which is considered the maximum\n# \"valid\" lifetime of an asset to be cached.\n# 4. The '-n' will skip uploading existing files and prevents them to\n# be overwritten\necho \"Uploading static assets to bucket ".concat(bucketUrl, "\"\n\ngcloud storage cp \\\n ")).call(_context6, assetsPath, "/public/{*.css,*.js,*.js.map,*.png,*.html,robots.txt} \\\n \"")).call(_context5, bucketUrl, "\" \\\n -n \\\n -z js,css \\\n --cache-control=\"public,max-age=31536000,no-transform\"\n\nif ")).call(_context4, skipMenu, "; then\n echo \"Skipping menu.json upload\"\nelse\n echo \"Uploading menu.json to bucket ")).call(_context3, bucketUrl, "\"\n # NOTE: somehow the 'cache-control:private' doesn't work.\n # I mean, the file is uploaded with the correct metadata but when I fetch\n # the file the response contains the header\n # 'cache-control: public,max-age=31536000,no-transform', even though the\n # documentation clearly states that by marking the header as 'private' will\n # disable the cache (for publicly readable objects).\n # https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#cache-control\n # However, I found out that, by requesting the file with any RANDOM\n # query parameter, will instruct the storage to return a 'fresh' object\n # (without any cache control).\n # Unofficial source: https://stackoverflow.com/a/49052895\n # This seems to be the 'easiest' option to 'disable' the cache for public\n # objects. Other alternative approaces are:\n # * make the object private with some simple ACL (private objects are not cached)\n # * suffix the file name with e.g. the git SHA, so we have different files\n # for each upload ('index.html.template-${CIRCLE_SHA1}'). The server knows\n # the git SHA on runtime and can get the correct file when it starts.\n # * find out why the 'private' cache control does not work\n gcloud storage cp \\\n ")).call(_context2, assetsPath, "/menu.json \\\n ")).call(_context, bucketUrl, " \\\n -z json \\\n --content-type=\"application/json\" \\\n --cache-control=\"public,max-age=0,no-transform\"\nfi\n");
87
87
  return uploadScriptContent;
88
88
  }
89
89
 
@@ -277,7 +277,7 @@ async function compileEnvironmentApplicationIndexes(_ref6) {
277
277
  buildNumber: cliFlags.buildNumber,
278
278
  applicationIndexOutFile: cliFlags.applicationIndexOutFile
279
279
  });
280
- // Generate bash scripts to run the `gsutil` upload command.
280
+ // Generate bash scripts to run the `gcloud storage` upload command.
281
281
 
282
282
  writeUploadScriptFile({
283
283
  fileName: cliFlags.applicationIndexUploadScriptOutFile,
@@ -619,7 +619,7 @@ async function command(cliFlags) {
619
619
 
620
620
  var pkgJson = {
621
621
  name: "@commercetools-frontend/application-cli",
622
- version: "1.5.0",
622
+ version: "1.6.1",
623
623
  description: "Internal CLI to manage Merchant Center application deployments across various environments.",
624
624
  keywords: [
625
625
  "commercetools",
@@ -644,22 +644,22 @@ var pkgJson = {
644
644
  "@babel/core": "^7.21.0",
645
645
  "@babel/runtime": "^7.21.0",
646
646
  "@babel/runtime-corejs3": "^7.21.0",
647
- "@commercetools-frontend/application-config": "22.2.1",
648
- "@commercetools-frontend/constants": "22.2.1",
649
- "@manypkg/find-root": "2.1.0",
647
+ "@commercetools-frontend/application-config": "22.4.0",
648
+ "@commercetools-frontend/constants": "22.4.0",
649
+ "@manypkg/find-root": "2.2.1",
650
650
  cac: "^6.7.14",
651
- cosmiconfig: "8.1.3",
652
- dotenv: "16.0.3",
651
+ cosmiconfig: "8.2.0",
652
+ dotenv: "16.3.1",
653
653
  execa: "5.1.1",
654
654
  jsonschema: "^1.4.1",
655
655
  listr2: "^6.4.2",
656
- "node-fetch": "2.6.9"
656
+ "node-fetch": "2.6.12"
657
657
  },
658
658
  devDependencies: {
659
659
  "@tsconfig/node18": "1.0.3",
660
- "@types/node": "18.15.12",
661
- "@types/node-fetch": "2.6.3",
662
- typescript: "^4.9.5"
660
+ "@types/node": "20.4.4",
661
+ "@types/node-fetch": "2.6.2",
662
+ typescript: "^5.1.3"
663
663
  },
664
664
  engines: {
665
665
  node: ">=14",
@@ -74,7 +74,7 @@ function createApplicationIndexUploadScript(_ref) {
74
74
  buildRevision = _ref.buildRevision,
75
75
  buildNumber = _ref.buildNumber,
76
76
  applicationIndexOutFile = _ref.applicationIndexOutFile;
77
- const uploadScriptContent = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = _concatInstanceProperty__default["default"](_context8 = _concatInstanceProperty__default["default"](_context9 = _concatInstanceProperty__default["default"](_context10 = "#!/usr/bin/env bash\n\nset -e\n\necho \"Uploading compiled ".concat(applicationIndexOutFile, " to bucket ")).call(_context10, bucketUrl, "\"\ngsutil \\\n-h \"Content-Type: text/html\" \\\n-h \"Cache-Control: public, max-age=0, no-transform\" \\\ncp -z html \\\n\"$(dirname \"$0\")/")).call(_context9, applicationIndexOutFile, "\" \\\n\"")).call(_context8, bucketUrl, "/\"\n\necho \"Creating version.json and uploading it to bucket ")).call(_context7, bucketUrl, "\"\n\nNODE_ENV=production ")).call(_context6, packageManagerName, " application-cli create-version \\\n --version-url=")).call(_context5, cdnUrl, "/")).call(_context4, cloudEnvironment, "/version.json \\\n --build-revision=")).call(_context3, buildRevision, " \\\n --build-number=")).call(_context2, buildNumber, " \\\n --out-file=$(dirname \"$0\")/version.json\n\ngsutil \\\n-h \"Content-Type: application/json\" \\\n-h \"Cache-Control: private, max-age=0, no-transform\" \\\ncp -z json \\\n\"$(dirname \"$0\")/version.json\" \\\n\"")).call(_context, bucketUrl, "/\"\n");
77
+ const uploadScriptContent = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = _concatInstanceProperty__default["default"](_context7 = _concatInstanceProperty__default["default"](_context8 = _concatInstanceProperty__default["default"](_context9 = _concatInstanceProperty__default["default"](_context10 = "#!/usr/bin/env bash\n\nset -e\n\necho \"Uploading compiled ".concat(applicationIndexOutFile, " to bucket ")).call(_context10, bucketUrl, "\"\ngcloud storage cp \\\n \"$(dirname \"$0\")/")).call(_context9, applicationIndexOutFile, "\" \\\n \"")).call(_context8, bucketUrl, "/\" \\\n -z html \\\n --content-type=\"text/html\" \\\n --cache-control=\"public,max-age=0,no-transform\"\n\necho \"Creating version.json and uploading it to bucket ")).call(_context7, bucketUrl, "\"\n\nNODE_ENV=production ")).call(_context6, packageManagerName, " application-cli create-version \\\n --version-url=")).call(_context5, cdnUrl, "/")).call(_context4, cloudEnvironment, "/version.json \\\n --build-revision=")).call(_context3, buildRevision, " \\\n --build-number=")).call(_context2, buildNumber, " \\\n --out-file=$(dirname \"$0\")/version.json\n\ngcloud storage cp \\\n \"$(dirname \"$0\")/version.json\" \\\n \"")).call(_context, bucketUrl, "/\" \\\n -z json \\\n --content-type=\"application/json\" \\\n --cache-control=\"public,max-age=0,no-transform\"\n");
78
78
  return uploadScriptContent;
79
79
  }
80
80
 
@@ -83,7 +83,7 @@ function createApplicationAssetsUploadScript(_ref) {
83
83
  let bucketUrl = _ref.bucketUrl,
84
84
  assetsPath = _ref.assetsPath,
85
85
  skipMenu = _ref.skipMenu;
86
- const uploadScriptContent = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = "#!/usr/bin/env bash\n\nset -e\n\n# NOTES:\n# https://cloud.google.com/storage/docs/gsutil/commands/cp#options\n# 1. The '-z' option triggers compressing the assets before\n# uploading them and sets the 'Content-Encoding' to 'gzip'.\n# 2. The 'Accept-encoding: gzip' is set automatically by the 'gsutils'.\n# 3. The 'max-age' is set to 1 year which is considered the maximum\n# \"valid\" lifetime of an asset to be cached.\n# 5. The '-n' will skip uploading existing files and prevents them to\n# be overwritten\necho \"Uploading static assets to bucket ".concat(bucketUrl, "\"\n\ngsutil -m \\\n -h \"Cache-Control: public, max-age=31536000, no-transform\" \\\n cp -z js,css \\\n -n \\\n ")).call(_context6, assetsPath, "/public/{*.css,*.js,*.js.map,*.png,*.html,robots.txt} \\\n \"")).call(_context5, bucketUrl, "\"\n\nif ")).call(_context4, skipMenu, "; then\n echo \"Skipping menu.json upload\"\nelse\n echo \"Uploading menu.json to bucket ")).call(_context3, bucketUrl, "\"\n # NOTE: somehow the 'cache-control:private' doesn't work.\n # I mean, the file is uploaded with the correct metadata but when I fetch\n # the file the response contains the header\n # 'cache-control: public, max-age=31536000, no-transform', even though the\n # documentation clearly states that by marking the header as 'private' will\n # disable the cache (for publicly readable objects).\n # https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#cache-control\n # However, I found out that, by requesting the file with any RANDOM\n # query parameter, will instruct the storage to return a 'fresh' object\n # (without any cache control).\n # Unofficial source: https://stackoverflow.com/a/49052895\n # This seems to be the 'easiest' option to 'disable' the cache for public\n # objects. Other alternative approaces are:\n # * make the object private with some simple ACL (private objects are not cached)\n # * suffix the file name with e.g. the git SHA, so we have different files\n # for each upload ('index.html.template-${CIRCLE_SHA1}'). The server knows\n # the git SHA on runtime and can get the correct file when it starts.\n # * find out why the 'private' cache control does not work\n gsutil \\\n -h \"Content-Type: application/json\" \\\n -h \"Cache-Control: private, max-age=0, no-transform\" \\\n cp -z json \\\n ")).call(_context2, assetsPath, "/menu.json \\\n ")).call(_context, bucketUrl, "\nfi\n");
86
+ const uploadScriptContent = _concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = _concatInstanceProperty__default["default"](_context3 = _concatInstanceProperty__default["default"](_context4 = _concatInstanceProperty__default["default"](_context5 = _concatInstanceProperty__default["default"](_context6 = "#!/usr/bin/env bash\n\nset -e\n\n# NOTES:\n# https://cloud.google.com/sdk/gcloud/reference/storage/cp\n# 1. The '-z' option triggers compressing the assets before\n# uploading them and sets the 'Content-Encoding' to 'gzip'.\n# 2. The 'Accept-encoding: gzip' is set automatically by the 'gcloud storage'.\n# 3. The 'max-age' is set to 1 year which is considered the maximum\n# \"valid\" lifetime of an asset to be cached.\n# 4. The '-n' will skip uploading existing files and prevents them to\n# be overwritten\necho \"Uploading static assets to bucket ".concat(bucketUrl, "\"\n\ngcloud storage cp \\\n ")).call(_context6, assetsPath, "/public/{*.css,*.js,*.js.map,*.png,*.html,robots.txt} \\\n \"")).call(_context5, bucketUrl, "\" \\\n -n \\\n -z js,css \\\n --cache-control=\"public,max-age=31536000,no-transform\"\n\nif ")).call(_context4, skipMenu, "; then\n echo \"Skipping menu.json upload\"\nelse\n echo \"Uploading menu.json to bucket ")).call(_context3, bucketUrl, "\"\n # NOTE: somehow the 'cache-control:private' doesn't work.\n # I mean, the file is uploaded with the correct metadata but when I fetch\n # the file the response contains the header\n # 'cache-control: public,max-age=31536000,no-transform', even though the\n # documentation clearly states that by marking the header as 'private' will\n # disable the cache (for publicly readable objects).\n # https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#cache-control\n # However, I found out that, by requesting the file with any RANDOM\n # query parameter, will instruct the storage to return a 'fresh' object\n # (without any cache control).\n # Unofficial source: https://stackoverflow.com/a/49052895\n # This seems to be the 'easiest' option to 'disable' the cache for public\n # objects. Other alternative approaces are:\n # * make the object private with some simple ACL (private objects are not cached)\n # * suffix the file name with e.g. the git SHA, so we have different files\n # for each upload ('index.html.template-${CIRCLE_SHA1}'). The server knows\n # the git SHA on runtime and can get the correct file when it starts.\n # * find out why the 'private' cache control does not work\n gcloud storage cp \\\n ")).call(_context2, assetsPath, "/menu.json \\\n ")).call(_context, bucketUrl, " \\\n -z json \\\n --content-type=\"application/json\" \\\n --cache-control=\"public,max-age=0,no-transform\"\nfi\n");
87
87
  return uploadScriptContent;
88
88
  }
89
89
 
@@ -277,7 +277,7 @@ async function compileEnvironmentApplicationIndexes(_ref6) {
277
277
  buildNumber: cliFlags.buildNumber,
278
278
  applicationIndexOutFile: cliFlags.applicationIndexOutFile
279
279
  });
280
- // Generate bash scripts to run the `gsutil` upload command.
280
+ // Generate bash scripts to run the `gcloud storage` upload command.
281
281
 
282
282
  writeUploadScriptFile({
283
283
  fileName: cliFlags.applicationIndexUploadScriptOutFile,
@@ -619,7 +619,7 @@ async function command(cliFlags) {
619
619
 
620
620
  var pkgJson = {
621
621
  name: "@commercetools-frontend/application-cli",
622
- version: "1.5.0",
622
+ version: "1.6.1",
623
623
  description: "Internal CLI to manage Merchant Center application deployments across various environments.",
624
624
  keywords: [
625
625
  "commercetools",
@@ -644,22 +644,22 @@ var pkgJson = {
644
644
  "@babel/core": "^7.21.0",
645
645
  "@babel/runtime": "^7.21.0",
646
646
  "@babel/runtime-corejs3": "^7.21.0",
647
- "@commercetools-frontend/application-config": "22.2.1",
648
- "@commercetools-frontend/constants": "22.2.1",
649
- "@manypkg/find-root": "2.1.0",
647
+ "@commercetools-frontend/application-config": "22.4.0",
648
+ "@commercetools-frontend/constants": "22.4.0",
649
+ "@manypkg/find-root": "2.2.1",
650
650
  cac: "^6.7.14",
651
- cosmiconfig: "8.1.3",
652
- dotenv: "16.0.3",
651
+ cosmiconfig: "8.2.0",
652
+ dotenv: "16.3.1",
653
653
  execa: "5.1.1",
654
654
  jsonschema: "^1.4.1",
655
655
  listr2: "^6.4.2",
656
- "node-fetch": "2.6.9"
656
+ "node-fetch": "2.6.12"
657
657
  },
658
658
  devDependencies: {
659
659
  "@tsconfig/node18": "1.0.3",
660
- "@types/node": "18.15.12",
661
- "@types/node-fetch": "2.6.3",
662
- typescript: "^4.9.5"
660
+ "@types/node": "20.4.4",
661
+ "@types/node-fetch": "2.6.2",
662
+ typescript: "^5.1.3"
663
663
  },
664
664
  engines: {
665
665
  node: ">=14",
@@ -48,7 +48,7 @@ function createApplicationIndexUploadScript(_ref) {
48
48
  buildRevision = _ref.buildRevision,
49
49
  buildNumber = _ref.buildNumber,
50
50
  applicationIndexOutFile = _ref.applicationIndexOutFile;
51
- const uploadScriptContent = _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = _concatInstanceProperty(_context8 = _concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "#!/usr/bin/env bash\n\nset -e\n\necho \"Uploading compiled ".concat(applicationIndexOutFile, " to bucket ")).call(_context10, bucketUrl, "\"\ngsutil \\\n-h \"Content-Type: text/html\" \\\n-h \"Cache-Control: public, max-age=0, no-transform\" \\\ncp -z html \\\n\"$(dirname \"$0\")/")).call(_context9, applicationIndexOutFile, "\" \\\n\"")).call(_context8, bucketUrl, "/\"\n\necho \"Creating version.json and uploading it to bucket ")).call(_context7, bucketUrl, "\"\n\nNODE_ENV=production ")).call(_context6, packageManagerName, " application-cli create-version \\\n --version-url=")).call(_context5, cdnUrl, "/")).call(_context4, cloudEnvironment, "/version.json \\\n --build-revision=")).call(_context3, buildRevision, " \\\n --build-number=")).call(_context2, buildNumber, " \\\n --out-file=$(dirname \"$0\")/version.json\n\ngsutil \\\n-h \"Content-Type: application/json\" \\\n-h \"Cache-Control: private, max-age=0, no-transform\" \\\ncp -z json \\\n\"$(dirname \"$0\")/version.json\" \\\n\"")).call(_context, bucketUrl, "/\"\n");
51
+ const uploadScriptContent = _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = _concatInstanceProperty(_context7 = _concatInstanceProperty(_context8 = _concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "#!/usr/bin/env bash\n\nset -e\n\necho \"Uploading compiled ".concat(applicationIndexOutFile, " to bucket ")).call(_context10, bucketUrl, "\"\ngcloud storage cp \\\n \"$(dirname \"$0\")/")).call(_context9, applicationIndexOutFile, "\" \\\n \"")).call(_context8, bucketUrl, "/\" \\\n -z html \\\n --content-type=\"text/html\" \\\n --cache-control=\"public,max-age=0,no-transform\"\n\necho \"Creating version.json and uploading it to bucket ")).call(_context7, bucketUrl, "\"\n\nNODE_ENV=production ")).call(_context6, packageManagerName, " application-cli create-version \\\n --version-url=")).call(_context5, cdnUrl, "/")).call(_context4, cloudEnvironment, "/version.json \\\n --build-revision=")).call(_context3, buildRevision, " \\\n --build-number=")).call(_context2, buildNumber, " \\\n --out-file=$(dirname \"$0\")/version.json\n\ngcloud storage cp \\\n \"$(dirname \"$0\")/version.json\" \\\n \"")).call(_context, bucketUrl, "/\" \\\n -z json \\\n --content-type=\"application/json\" \\\n --cache-control=\"public,max-age=0,no-transform\"\n");
52
52
  return uploadScriptContent;
53
53
  }
54
54
 
@@ -57,7 +57,7 @@ function createApplicationAssetsUploadScript(_ref) {
57
57
  let bucketUrl = _ref.bucketUrl,
58
58
  assetsPath = _ref.assetsPath,
59
59
  skipMenu = _ref.skipMenu;
60
- const uploadScriptContent = _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = "#!/usr/bin/env bash\n\nset -e\n\n# NOTES:\n# https://cloud.google.com/storage/docs/gsutil/commands/cp#options\n# 1. The '-z' option triggers compressing the assets before\n# uploading them and sets the 'Content-Encoding' to 'gzip'.\n# 2. The 'Accept-encoding: gzip' is set automatically by the 'gsutils'.\n# 3. The 'max-age' is set to 1 year which is considered the maximum\n# \"valid\" lifetime of an asset to be cached.\n# 5. The '-n' will skip uploading existing files and prevents them to\n# be overwritten\necho \"Uploading static assets to bucket ".concat(bucketUrl, "\"\n\ngsutil -m \\\n -h \"Cache-Control: public, max-age=31536000, no-transform\" \\\n cp -z js,css \\\n -n \\\n ")).call(_context6, assetsPath, "/public/{*.css,*.js,*.js.map,*.png,*.html,robots.txt} \\\n \"")).call(_context5, bucketUrl, "\"\n\nif ")).call(_context4, skipMenu, "; then\n echo \"Skipping menu.json upload\"\nelse\n echo \"Uploading menu.json to bucket ")).call(_context3, bucketUrl, "\"\n # NOTE: somehow the 'cache-control:private' doesn't work.\n # I mean, the file is uploaded with the correct metadata but when I fetch\n # the file the response contains the header\n # 'cache-control: public, max-age=31536000, no-transform', even though the\n # documentation clearly states that by marking the header as 'private' will\n # disable the cache (for publicly readable objects).\n # https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#cache-control\n # However, I found out that, by requesting the file with any RANDOM\n # query parameter, will instruct the storage to return a 'fresh' object\n # (without any cache control).\n # Unofficial source: https://stackoverflow.com/a/49052895\n # This seems to be the 'easiest' option to 'disable' the cache for public\n # objects. Other alternative approaces are:\n # * make the object private with some simple ACL (private objects are not cached)\n # * suffix the file name with e.g. the git SHA, so we have different files\n # for each upload ('index.html.template-${CIRCLE_SHA1}'). The server knows\n # the git SHA on runtime and can get the correct file when it starts.\n # * find out why the 'private' cache control does not work\n gsutil \\\n -h \"Content-Type: application/json\" \\\n -h \"Cache-Control: private, max-age=0, no-transform\" \\\n cp -z json \\\n ")).call(_context2, assetsPath, "/menu.json \\\n ")).call(_context, bucketUrl, "\nfi\n");
60
+ const uploadScriptContent = _concatInstanceProperty(_context = _concatInstanceProperty(_context2 = _concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = "#!/usr/bin/env bash\n\nset -e\n\n# NOTES:\n# https://cloud.google.com/sdk/gcloud/reference/storage/cp\n# 1. The '-z' option triggers compressing the assets before\n# uploading them and sets the 'Content-Encoding' to 'gzip'.\n# 2. The 'Accept-encoding: gzip' is set automatically by the 'gcloud storage'.\n# 3. The 'max-age' is set to 1 year which is considered the maximum\n# \"valid\" lifetime of an asset to be cached.\n# 4. The '-n' will skip uploading existing files and prevents them to\n# be overwritten\necho \"Uploading static assets to bucket ".concat(bucketUrl, "\"\n\ngcloud storage cp \\\n ")).call(_context6, assetsPath, "/public/{*.css,*.js,*.js.map,*.png,*.html,robots.txt} \\\n \"")).call(_context5, bucketUrl, "\" \\\n -n \\\n -z js,css \\\n --cache-control=\"public,max-age=31536000,no-transform\"\n\nif ")).call(_context4, skipMenu, "; then\n echo \"Skipping menu.json upload\"\nelse\n echo \"Uploading menu.json to bucket ")).call(_context3, bucketUrl, "\"\n # NOTE: somehow the 'cache-control:private' doesn't work.\n # I mean, the file is uploaded with the correct metadata but when I fetch\n # the file the response contains the header\n # 'cache-control: public,max-age=31536000,no-transform', even though the\n # documentation clearly states that by marking the header as 'private' will\n # disable the cache (for publicly readable objects).\n # https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#cache-control\n # However, I found out that, by requesting the file with any RANDOM\n # query parameter, will instruct the storage to return a 'fresh' object\n # (without any cache control).\n # Unofficial source: https://stackoverflow.com/a/49052895\n # This seems to be the 'easiest' option to 'disable' the cache for public\n # objects. Other alternative approaces are:\n # * make the object private with some simple ACL (private objects are not cached)\n # * suffix the file name with e.g. the git SHA, so we have different files\n # for each upload ('index.html.template-${CIRCLE_SHA1}'). The server knows\n # the git SHA on runtime and can get the correct file when it starts.\n # * find out why the 'private' cache control does not work\n gcloud storage cp \\\n ")).call(_context2, assetsPath, "/menu.json \\\n ")).call(_context, bucketUrl, " \\\n -z json \\\n --content-type=\"application/json\" \\\n --cache-control=\"public,max-age=0,no-transform\"\nfi\n");
61
61
  return uploadScriptContent;
62
62
  }
63
63
 
@@ -251,7 +251,7 @@ async function compileEnvironmentApplicationIndexes(_ref6) {
251
251
  buildNumber: cliFlags.buildNumber,
252
252
  applicationIndexOutFile: cliFlags.applicationIndexOutFile
253
253
  });
254
- // Generate bash scripts to run the `gsutil` upload command.
254
+ // Generate bash scripts to run the `gcloud storage` upload command.
255
255
 
256
256
  writeUploadScriptFile({
257
257
  fileName: cliFlags.applicationIndexUploadScriptOutFile,
@@ -593,7 +593,7 @@ async function command(cliFlags) {
593
593
 
594
594
  var pkgJson = {
595
595
  name: "@commercetools-frontend/application-cli",
596
- version: "1.5.0",
596
+ version: "1.6.1",
597
597
  description: "Internal CLI to manage Merchant Center application deployments across various environments.",
598
598
  keywords: [
599
599
  "commercetools",
@@ -618,22 +618,22 @@ var pkgJson = {
618
618
  "@babel/core": "^7.21.0",
619
619
  "@babel/runtime": "^7.21.0",
620
620
  "@babel/runtime-corejs3": "^7.21.0",
621
- "@commercetools-frontend/application-config": "22.2.1",
622
- "@commercetools-frontend/constants": "22.2.1",
623
- "@manypkg/find-root": "2.1.0",
621
+ "@commercetools-frontend/application-config": "22.4.0",
622
+ "@commercetools-frontend/constants": "22.4.0",
623
+ "@manypkg/find-root": "2.2.1",
624
624
  cac: "^6.7.14",
625
- cosmiconfig: "8.1.3",
626
- dotenv: "16.0.3",
625
+ cosmiconfig: "8.2.0",
626
+ dotenv: "16.3.1",
627
627
  execa: "5.1.1",
628
628
  jsonschema: "^1.4.1",
629
629
  listr2: "^6.4.2",
630
- "node-fetch": "2.6.9"
630
+ "node-fetch": "2.6.12"
631
631
  },
632
632
  devDependencies: {
633
633
  "@tsconfig/node18": "1.0.3",
634
- "@types/node": "18.15.12",
635
- "@types/node-fetch": "2.6.3",
636
- typescript: "^4.9.5"
634
+ "@types/node": "20.4.4",
635
+ "@types/node-fetch": "2.6.2",
636
+ typescript: "^5.1.3"
637
637
  },
638
638
  engines: {
639
639
  node: ">=14",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/application-cli",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "Internal CLI to manage Merchant Center application deployments across various environments.",
5
5
  "keywords": [
6
6
  "commercetools",
@@ -22,22 +22,22 @@
22
22
  "@babel/core": "^7.21.0",
23
23
  "@babel/runtime": "^7.21.0",
24
24
  "@babel/runtime-corejs3": "^7.21.0",
25
- "@commercetools-frontend/application-config": "22.2.1",
26
- "@commercetools-frontend/constants": "22.2.1",
27
- "@manypkg/find-root": "2.1.0",
25
+ "@commercetools-frontend/application-config": "22.4.0",
26
+ "@commercetools-frontend/constants": "22.4.0",
27
+ "@manypkg/find-root": "2.2.1",
28
28
  "cac": "^6.7.14",
29
- "cosmiconfig": "8.1.3",
30
- "dotenv": "16.0.3",
29
+ "cosmiconfig": "8.2.0",
30
+ "dotenv": "16.3.1",
31
31
  "execa": "5.1.1",
32
32
  "jsonschema": "^1.4.1",
33
33
  "listr2": "^6.4.2",
34
- "node-fetch": "2.6.9"
34
+ "node-fetch": "2.6.12"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@tsconfig/node18": "1.0.3",
38
- "@types/node": "18.15.12",
39
- "@types/node-fetch": "2.6.3",
40
- "typescript": "^4.9.5"
38
+ "@types/node": "20.4.4",
39
+ "@types/node-fetch": "2.6.2",
40
+ "typescript": "^5.1.3"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=14",
@@ -1,3 +0,0 @@
1
- import type { TAllCliFlags } from '../types';
2
- declare function command(cliFlags: TAllCliFlags, cwd: string): Promise<void>;
3
- export default command;
@@ -1,3 +0,0 @@
1
- import type { TCompileMenuFlags } from '../types';
2
- declare function command(cliFlags: TCompileMenuFlags, cwd: string): Promise<void>;
3
- export default command;
@@ -1,3 +0,0 @@
1
- import type { TCreateVersionFlags } from '../types';
2
- declare function command(cliFlags: TCreateVersionFlags): Promise<void>;
3
- export default command;
@@ -1,5 +0,0 @@
1
- import type { Schema } from 'jsonschema';
2
- import type { TValidateMenuFlags } from '../types';
3
- export declare function validateMenu(menuJson: string, schema?: Schema): string;
4
- declare function command(cliFlags: TValidateMenuFlags): Promise<string>;
5
- export default command;
@@ -1,228 +0,0 @@
1
- export declare const navbarMenuSchema: {
2
- $schema: string;
3
- title: string;
4
- type: string;
5
- properties: {
6
- submenu: {
7
- type: string;
8
- items: {
9
- type: string;
10
- properties: {
11
- key: {
12
- type: string;
13
- };
14
- uriPath: {
15
- type: string;
16
- };
17
- icon: {
18
- type: string;
19
- };
20
- featureToggle: {
21
- type: string[];
22
- };
23
- labelAllLocales: {
24
- type: string;
25
- items: {
26
- type: string;
27
- properties: {
28
- locale: {
29
- type: string;
30
- };
31
- value: {
32
- type: string;
33
- };
34
- };
35
- required: string[];
36
- }[];
37
- };
38
- menuVisibility: {
39
- type: string[];
40
- };
41
- permissions: {
42
- type: string;
43
- items: {
44
- type: string;
45
- };
46
- };
47
- dataFences: {
48
- type: string[];
49
- items: {
50
- type: string[];
51
- properties: {
52
- group: {
53
- type: string;
54
- };
55
- name: {
56
- type: string;
57
- };
58
- type: {
59
- type: string;
60
- };
61
- };
62
- }[];
63
- };
64
- actionRights: {
65
- type: string[];
66
- items: {
67
- type: string[];
68
- properties: {
69
- group: {
70
- type: string;
71
- };
72
- name: {
73
- type: string;
74
- };
75
- };
76
- }[];
77
- };
78
- };
79
- }[];
80
- };
81
- key: {
82
- type: string;
83
- };
84
- uriPath: {
85
- type: string;
86
- };
87
- icon: {
88
- type: string;
89
- };
90
- featureToggle: {
91
- type: string[];
92
- };
93
- labelAllLocales: {
94
- type: string;
95
- items: {
96
- type: string;
97
- properties: {
98
- locale: {
99
- type: string;
100
- };
101
- value: {
102
- type: string;
103
- };
104
- };
105
- required: string[];
106
- }[];
107
- };
108
- menuVisibility: {
109
- type: string[];
110
- };
111
- permissions: {
112
- type: string;
113
- items: {
114
- type: string;
115
- };
116
- };
117
- dataFences: {
118
- type: string[];
119
- items: {
120
- type: string[];
121
- properties: {
122
- group: {
123
- type: string;
124
- };
125
- name: {
126
- type: string;
127
- };
128
- type: {
129
- type: string;
130
- };
131
- };
132
- }[];
133
- };
134
- actionRights: {
135
- type: string[];
136
- items: {
137
- type: string[];
138
- properties: {
139
- group: {
140
- type: string;
141
- };
142
- name: {
143
- type: string;
144
- };
145
- };
146
- }[];
147
- };
148
- };
149
- required: string[];
150
- };
151
- export declare const appbarMenuSchema: {
152
- $schema: string;
153
- title: string;
154
- type: string;
155
- items: {
156
- type: string;
157
- properties: {
158
- key: {
159
- type: string;
160
- };
161
- uriPath: {
162
- type: string;
163
- };
164
- icon: {
165
- type: string;
166
- };
167
- featureToggle: {
168
- type: string[];
169
- };
170
- labelAllLocales: {
171
- type: string;
172
- items: {
173
- type: string;
174
- properties: {
175
- locale: {
176
- type: string;
177
- };
178
- value: {
179
- type: string;
180
- };
181
- };
182
- required: string[];
183
- }[];
184
- };
185
- menuVisibility: {
186
- type: string[];
187
- };
188
- permissions: {
189
- type: string;
190
- items: {
191
- type: string;
192
- };
193
- };
194
- dataFences: {
195
- type: string[];
196
- items: {
197
- type: string[];
198
- properties: {
199
- group: {
200
- type: string;
201
- };
202
- name: {
203
- type: string;
204
- };
205
- type: {
206
- type: string;
207
- };
208
- };
209
- }[];
210
- };
211
- actionRights: {
212
- type: string[];
213
- items: {
214
- type: string[];
215
- properties: {
216
- group: {
217
- type: string;
218
- };
219
- name: {
220
- type: string;
221
- };
222
- };
223
- }[];
224
- };
225
- };
226
- required: string[];
227
- }[];
228
- };
@@ -1,92 +0,0 @@
1
- export type TApplicationAssetsBucketConfig = {
2
- bucketRegion: string;
3
- prNumber?: string;
4
- applicationName: string;
5
- };
6
- export type TApplicationIndexBucketConfig = {
7
- bucketRegion: string;
8
- prNumber?: string;
9
- applicationName: string;
10
- cloudEnvironment: string;
11
- };
12
- export type TUploadScriptFile = {
13
- fileName: string;
14
- fileContent: string;
15
- filePath: string;
16
- };
17
- type TPaths = {
18
- publicAssetsPath: string;
19
- deploymentsPath: string;
20
- dotenvPath?: string;
21
- assetsPath: string;
22
- };
23
- export type TCompileEnvApplicationIndexes = {
24
- cliFlags: TCompileDeploymentsFlags;
25
- paths: TPaths;
26
- bucketRegion: string;
27
- cloudEnvironment: string;
28
- };
29
- export type TCompileApplicationAssets = {
30
- cliFlags: TCompileDeploymentsFlags;
31
- paths: TPaths;
32
- bucketRegion: string;
33
- };
34
- export type TCosmiconfigResult = {
35
- config: {
36
- [key: string]: string[];
37
- };
38
- };
39
- export type TCreateApplicationIndexUploadScript = {
40
- packageManagerName: string;
41
- bucketUrl: string;
42
- cdnUrl: string;
43
- cloudEnvironment: string;
44
- buildRevision: string;
45
- buildNumber: number;
46
- applicationIndexOutFile: string;
47
- };
48
- export type TCreateApplicationAssetsUploadScript = {
49
- bucketUrl: string;
50
- assetsPath: string;
51
- skipMenu: boolean;
52
- };
53
- export type TLoadDotDev = {
54
- dotenvPath?: string;
55
- cloudEnvironment: string;
56
- };
57
- export type TLocalizedField = {
58
- locale: string;
59
- value: string;
60
- };
61
- export type TCompileDeploymentsFlags = {
62
- applicationName: string;
63
- buildRevision: string;
64
- buildNumber: number;
65
- dotenvFolder?: string;
66
- prNumber?: string;
67
- mcUrl?: string;
68
- mcApiUrl?: string;
69
- applicationIndexOutFile: string;
70
- applicationIndexUploadScriptOutFile: string;
71
- applicationAssetsUploadScriptOutFile: string;
72
- ciAssetsRootPath?: string;
73
- packageManagerName: string;
74
- skipMenu: boolean;
75
- };
76
- export type TCompileMenuFlags = {
77
- dotenvFolder?: string;
78
- };
79
- export type TCreateVersionFlags = {
80
- versionUrl: string;
81
- buildRevision: string;
82
- buildNumber: number;
83
- rollbacks: number;
84
- outFile?: string;
85
- packageManagerName: string;
86
- };
87
- export type TValidateMenuFlags = {
88
- inputFile: string;
89
- navigation?: string;
90
- };
91
- export type TAllCliFlags = TCompileDeploymentsFlags & TCompileMenuFlags & TCreateVersionFlags & TValidateMenuFlags;
92
- export {};
@@ -1,3 +0,0 @@
1
- import type { TCreateApplicationAssetsUploadScript } from '../types';
2
- declare function createApplicationAssetsUploadScript({ bucketUrl, assetsPath, skipMenu, }: TCreateApplicationAssetsUploadScript): string;
3
- export default createApplicationAssetsUploadScript;
@@ -1,3 +0,0 @@
1
- import type { TCreateApplicationIndexUploadScript } from '../types';
2
- declare function createApplicationIndexUploadScript({ packageManagerName, bucketUrl, cdnUrl, cloudEnvironment, buildRevision, buildNumber, applicationIndexOutFile, }: TCreateApplicationIndexUploadScript): string;
3
- export default createApplicationIndexUploadScript;
@@ -1,2 +0,0 @@
1
- declare function getApplicationDirectory(cwd: string): string;
2
- export default getApplicationDirectory;
@@ -1,2 +0,0 @@
1
- declare function isCI(): boolean;
2
- export default isCI;
@@ -1,5 +0,0 @@
1
- import type { TLoadDotDev } from '../types';
2
- declare function loadDotenvFiles({ dotenvPath, cloudEnvironment }: TLoadDotDev): {
3
- [x: string]: string;
4
- };
5
- export default loadDotenvFiles;
@@ -1,2 +0,0 @@
1
- declare function resolveInApplication(relativePath: string, cwd: string): string;
2
- export default resolveInApplication;