@commercetools-frontend/application-cli 1.3.0 → 1.5.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.
Files changed (35) hide show
  1. package/bin/cli.js +9 -0
  2. package/cli/dist/commercetools-frontend-application-cli-cli.cjs.d.ts +2 -0
  3. package/cli/dist/commercetools-frontend-application-cli-cli.cjs.d.ts.map +1 -0
  4. package/cli/dist/commercetools-frontend-application-cli-cli.cjs.dev.js +725 -0
  5. package/cli/dist/commercetools-frontend-application-cli-cli.cjs.js +7 -0
  6. package/cli/dist/commercetools-frontend-application-cli-cli.cjs.prod.js +725 -0
  7. package/cli/dist/commercetools-frontend-application-cli-cli.esm.js +699 -0
  8. package/cli/package.json +4 -0
  9. package/dist/declarations/src/cli.d.ts +2 -0
  10. package/dist/declarations/src/commands/compile-deployments.d.ts +3 -0
  11. package/dist/declarations/src/commands/compile-menu.d.ts +3 -0
  12. package/dist/declarations/src/commands/create-version.d.ts +3 -0
  13. package/dist/declarations/src/commands/validate-menu.d.ts +5 -0
  14. package/dist/declarations/src/schema.d.ts +228 -0
  15. package/dist/declarations/src/types.d.ts +92 -0
  16. package/dist/declarations/src/utils/create-application-assets-upload-script.d.ts +3 -0
  17. package/dist/declarations/src/utils/create-application-index-upload-script.d.ts +3 -0
  18. package/dist/declarations/src/utils/get-application-directory.d.ts +2 -0
  19. package/dist/declarations/src/utils/is-ci.d.ts +2 -0
  20. package/dist/declarations/src/utils/load-dotenv-files.d.ts +5 -0
  21. package/dist/declarations/src/utils/resolve-in-application.d.ts +2 -0
  22. package/package.json +27 -9
  23. package/src/bin/cli.js +0 -100
  24. package/src/commands/compile-deployments.js +0 -283
  25. package/src/commands/compile-menu.js +0 -126
  26. package/src/commands/create-version.js +0 -43
  27. package/src/commands/validate-menu.js +0 -33
  28. package/src/commands/validate-menu.spec.js +0 -43
  29. package/src/schema.js +0 -112
  30. package/src/utils/create-application-assets-upload-script.js +0 -62
  31. package/src/utils/create-application-index-upload-script.js +0 -41
  32. package/src/utils/get-application-directory.js +0 -7
  33. package/src/utils/is-ci.js +0 -5
  34. package/src/utils/load-dotenv-files.js +0 -48
  35. package/src/utils/resolve-in-application.js +0 -8
@@ -1,41 +0,0 @@
1
- function createApplicationIndexUploadScript({
2
- packageManagerName,
3
- bucketUrl,
4
- cdnUrl,
5
- cloudEnvironment,
6
- buildRevision,
7
- buildNumber,
8
- applicationIndexOutFile,
9
- }) {
10
- const uploadScriptContent = `#!/usr/bin/env bash
11
-
12
- set -e
13
-
14
- echo "Uploading compiled ${applicationIndexOutFile} to bucket ${bucketUrl}"
15
- gsutil \\
16
- -h "Content-Type: text/html" \\
17
- -h "Cache-Control: public, max-age=0, no-transform" \\
18
- cp -z html \\
19
- "$(dirname "$0")/${applicationIndexOutFile}" \\
20
- "${bucketUrl}/"
21
-
22
- echo "Creating version.json and uploading it to bucket ${bucketUrl}"
23
-
24
- ${packageManagerName} application-cli create-version \\
25
- --version-url=${cdnUrl}/${cloudEnvironment}/version.json \\
26
- --build-revision=${buildRevision} \\
27
- --build-number=${buildNumber} \\
28
- --out-file=$(dirname "$0")/version.json
29
-
30
- gsutil \\
31
- -h "Content-Type: application/json" \\
32
- -h "Cache-Control: private, max-age=0, no-transform" \\
33
- cp -z json \\
34
- "$(dirname "$0")/version.json" \\
35
- "${bucketUrl}/"
36
- `;
37
-
38
- return uploadScriptContent;
39
- }
40
-
41
- export default createApplicationIndexUploadScript;
@@ -1,7 +0,0 @@
1
- import fs from 'fs';
2
-
3
- function getApplicationDirectory(cwd) {
4
- return fs.realpathSync(cwd);
5
- }
6
-
7
- export default getApplicationDirectory;
@@ -1,5 +0,0 @@
1
- function isCI() {
2
- return process.env.CI === true || process.env.CI === 'true';
3
- }
4
-
5
- export default isCI;
@@ -1,48 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import dotenv from 'dotenv';
4
-
5
- function loadDotenvFiles({ dotenvPath, cloudEnvironment }) {
6
- // No path requested, skip.
7
- if (!dotenvPath) {
8
- return {};
9
- }
10
-
11
- // Check if the given path exists.
12
- if (!fs.existsSync(dotenvPath)) {
13
- throw new Error(`The dotenv folder path does not exist: "${dotenvPath}".`);
14
- }
15
-
16
- // Load the environment values
17
- const sharedDotenvFile = '.env.production';
18
- const cloudDotenvFile = `.env.${cloudEnvironment}`;
19
-
20
- // The shared dotenv file across environments is optional
21
- const sharedProductionEnvironment = dotenv.config({
22
- encoding: 'utf8',
23
- path: path.join(dotenvPath, sharedDotenvFile),
24
- });
25
-
26
- const cloudSpecificProductionEnvironment = dotenv.config({
27
- encoding: 'utf8',
28
- path: path.join(dotenvPath, cloudDotenvFile),
29
- });
30
-
31
- if (cloudSpecificProductionEnvironment.error) {
32
- throw new Error(
33
- `Failed loading '${cloudDotenvFile}' in '${dotenvPath}'. Make sure it exists.`
34
- );
35
- }
36
- if (sharedProductionEnvironment.error) {
37
- throw new Error(
38
- `Failed loading '${sharedDotenvFile}' in '${dotenvPath}'. Make sure it exists.`
39
- );
40
- }
41
-
42
- return {
43
- ...sharedProductionEnvironment.parsed,
44
- ...cloudSpecificProductionEnvironment.parsed,
45
- };
46
- }
47
-
48
- export default loadDotenvFiles;
@@ -1,8 +0,0 @@
1
- import path from 'path';
2
- import getApplicationDirectory from './get-application-directory.js';
3
-
4
- function resolveInApplication(relativePath, cwd) {
5
- return path.resolve(getApplicationDirectory(cwd), relativePath);
6
- }
7
-
8
- export default resolveInApplication;