@commercetools-frontend/application-cli 1.4.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.
- package/bin/cli.js +9 -0
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.d.ts +2 -0
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.d.ts.map +1 -0
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.dev.js +725 -0
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.js +7 -0
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.prod.js +725 -0
- package/cli/dist/commercetools-frontend-application-cli-cli.esm.js +699 -0
- package/cli/package.json +4 -0
- package/dist/declarations/src/cli.d.ts +2 -0
- package/dist/declarations/src/commands/compile-deployments.d.ts +3 -0
- package/dist/declarations/src/commands/compile-menu.d.ts +3 -0
- package/dist/declarations/src/commands/create-version.d.ts +3 -0
- package/dist/declarations/src/commands/validate-menu.d.ts +5 -0
- package/dist/declarations/src/schema.d.ts +228 -0
- package/dist/declarations/src/types.d.ts +92 -0
- package/dist/declarations/src/utils/create-application-assets-upload-script.d.ts +3 -0
- package/dist/declarations/src/utils/create-application-index-upload-script.d.ts +3 -0
- package/dist/declarations/src/utils/get-application-directory.d.ts +2 -0
- package/dist/declarations/src/utils/is-ci.d.ts +2 -0
- package/dist/declarations/src/utils/load-dotenv-files.d.ts +5 -0
- package/dist/declarations/src/utils/resolve-in-application.d.ts +2 -0
- package/package.json +27 -9
- package/src/bin/cli.js +0 -100
- package/src/commands/compile-deployments.js +0 -283
- package/src/commands/compile-menu.js +0 -126
- package/src/commands/create-version.js +0 -43
- package/src/commands/validate-menu.js +0 -33
- package/src/commands/validate-menu.spec.js +0 -43
- package/src/schema.js +0 -112
- package/src/utils/create-application-assets-upload-script.js +0 -62
- package/src/utils/create-application-index-upload-script.js +0 -41
- package/src/utils/get-application-directory.js +0 -7
- package/src/utils/is-ci.js +0 -5
- package/src/utils/load-dotenv-files.js +0 -48
- 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;
|
package/src/utils/is-ci.js
DELETED
|
@@ -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;
|