@commercetools-frontend/application-cli 1.8.1 → 2.1.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 +36 -31
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.d.ts +1 -1
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.dev.js +317 -165
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.prod.js +317 -165
- package/cli/dist/commercetools-frontend-application-cli-cli.esm.js +309 -160
- package/dist/commercetools-frontend-application-cli.cjs.d.ts +1 -1
- package/dist/commercetools-frontend-application-cli.cjs.dev.js +13 -0
- package/dist/commercetools-frontend-application-cli.cjs.prod.js +13 -0
- package/dist/commercetools-frontend-application-cli.esm.js +4 -1
- package/dist/declarations/src/constants.d.ts +34 -0
- package/dist/declarations/src/index.d.ts +3 -1
- package/dist/declarations/src/storage-buckets-config.d.ts +11 -0
- package/dist/declarations/src/types.d.ts +38 -19
- package/dist/storage-buckets-config-0b3808a3.cjs.prod.js +111 -0
- package/dist/storage-buckets-config-478b8585.cjs.dev.js +111 -0
- package/dist/storage-buckets-config-7845a091.esm.js +101 -0
- package/package.json +12 -12
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.d.ts.map +0 -1
- package/dist/commercetools-frontend-application-cli.cjs.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -23,35 +23,35 @@ pnpm application-cli compile-deployments \
|
|
|
23
23
|
--build-revision=<git_sha>
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
The environments to compile the deployments for must be specified in a `
|
|
26
|
+
The environments to compile the deployments for must be specified in a `storage-buckets` [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) file for example `storage-buckets.config.cjs` with the bucket region mapping to multiple environments. For example:
|
|
27
27
|
|
|
28
28
|
```js
|
|
29
29
|
/**
|
|
30
|
-
* @type {import('@commercetools-frontend/application-cli').
|
|
30
|
+
* @type {import('@commercetools-frontend/application-cli').TStorageBucketsConfig}
|
|
31
31
|
*/
|
|
32
32
|
module.exports = {
|
|
33
|
-
'merchant-center-north-america':
|
|
34
|
-
|
|
33
|
+
'merchant-center-north-america': {
|
|
34
|
+
cloudEnvironment: 'ctp_production_gcp_us-central1_v1',
|
|
35
|
+
bucketEnvironment: 'ctp-gcp-production-us',
|
|
36
|
+
},
|
|
35
37
|
};
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
The above configuration would compile for
|
|
40
|
+
The above configuration would compile for one environment in `gcp-production-us` with its respective region. Yielding a `/deployments` folder for the application with the following structure:
|
|
39
41
|
|
|
40
42
|
```txt
|
|
41
|
-
-
|
|
42
|
-
- gcp-production-us
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
- upload-index.sh
|
|
48
|
-
- upload-assets-merchant-center-north-america.sh
|
|
49
|
-
- upload-assets-merchant-center-asia.sh
|
|
43
|
+
- gs
|
|
44
|
+
- gcp-production-us
|
|
45
|
+
- application.html
|
|
46
|
+
- upload-index.sh
|
|
47
|
+
- upload-assets-merchant-center-north-america.sh
|
|
48
|
+
- upload-assets-merchant-center-asia.sh
|
|
50
49
|
```
|
|
51
50
|
|
|
52
|
-
1. The `
|
|
53
|
-
2. The `
|
|
54
|
-
3. The `
|
|
51
|
+
1. The `gs` folder signals that these files will be uploaded to Google Storage which is the default storage provider
|
|
52
|
+
2. 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`.
|
|
53
|
+
3. The `public` folder contains shared static assets for all environments.
|
|
54
|
+
4. The `application.html` references the static assets from its respective environment's bucket
|
|
55
55
|
|
|
56
56
|
Depending on the environment you are deploying to, you need to:
|
|
57
57
|
|
|
@@ -60,25 +60,30 @@ Depending on the environment you are deploying to, you need to:
|
|
|
60
60
|
|
|
61
61
|
Additionally, when specifying the `--dotenv-folder` option, you can specify a dotenv file for each environment (for example `.env.gcp-production-eu`) and a single `.env.production` dotenv file. These files are then loaded when compiling the application for the respective environment.
|
|
62
62
|
|
|
63
|
-
The configuration also
|
|
63
|
+
The configuration also using a `defineBucketConfig` helper function to opt into defaults for bucket region and their environments:
|
|
64
64
|
|
|
65
65
|
```js
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{
|
|
72
|
-
cloudEnvironment: 'ctp_production_aws_eu-central-1_v1',
|
|
73
|
-
bucketEnvironment: 'ctp-aws-production-fra',
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
};
|
|
66
|
+
const {
|
|
67
|
+
defineStorageBucketsConfig,
|
|
68
|
+
} = require('@commercetools-frontend/application-cli');
|
|
69
|
+
|
|
70
|
+
module.exports = defineStorageBucketsConfig();
|
|
77
71
|
```
|
|
78
72
|
|
|
79
|
-
Given the configuration above
|
|
73
|
+
Given the configuration above upload scripts and `application.html` files would be generated for all default bucket regions and cloud environments. These can then be picked up by the CircleCI Orb for upload.
|
|
80
74
|
|
|
81
|
-
|
|
75
|
+
If you need to disable certain bucket regions or cloud environments, you can use the `options` parameter of `defineBucketConfig`:
|
|
76
|
+
|
|
77
|
+
You can disable existing bucket regions or environments:
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
module.exports = defineStorageBucketsConfig({
|
|
81
|
+
options: {
|
|
82
|
+
disabledBucketRegions: ['merchant-center-north-america']
|
|
83
|
+
disabledEnvironments: ['vw_production_aws_eu-central-1_v1']
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
```
|
|
82
87
|
|
|
83
88
|
### Command: `compile-menu`
|
|
84
89
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "../../dist/declarations/src/cli";
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1hcHBsaWNhdGlvbi1jbGktY2xpLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vZGlzdC9kZWNsYXJhdGlvbnMvc3JjL2NsaS5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|