@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 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 `google-storage-buckets` [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) file for example `google-storage-buckets.config.cjs` with the bucket region mapping to multiple environments. For example:
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').TGoogleStorageBucketsConfig}
30
+ * @type {import('@commercetools-frontend/application-cli').TStorageBucketsConfig}
31
31
  */
32
32
  module.exports = {
33
- 'merchant-center-north-america': ['gcp-production-us'],
34
- 'merchant-center-asia': ['gcp-production-au'],
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 two environments in `gcp-production-us` and `gcp-production-au` each for their respective region. Yielding a `/deployments` folder for the application with the following structure:
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
- - public
42
- - gcp-production-us
43
- - application.html
44
- - upload-index.sh
45
- - gcp-production-au
46
- - application.html
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 `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
- 2. The `public` folder contains shared static assets for all environments.
54
- 3. The `application.html` references the static assets from its respective environment's bucket
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 supports an expanded version in which each cloud environment can be linked to another bucket environment:
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
- * @type {import('@commercetools-frontend/application-cli').TGoogleStorageBucketsConfig}
68
- */
69
- module.exports = {
70
- 'merchant-center-europe': [
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 the cloud environment `ctp_production_aws_eu-central-1_v1` will be uploaded to the `merchant-center-europe` bucket region within the `ctp-aws-production-fra` folder as the bucket environment.
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
- This is useful as cloud and bucket environments do not fall in the same lifecycle. A Kubernetes cluster is versioned and may have to change (e.g. be updated) without that needing to be reflected in the respective bucket environment. Also two cloud environments (e.g. in different versions) can be served from one bucket environment if needed.
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=commercetools-frontend-application-cli-cli.cjs.d.ts.map
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1hcHBsaWNhdGlvbi1jbGktY2xpLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vZGlzdC9kZWNsYXJhdGlvbnMvc3JjL2NsaS5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=