@commercetools-frontend/application-cli 2.1.1 → 2.2.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.
@@ -2,6 +2,7 @@
2
2
 
3
3
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
4
4
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
5
+ var cosmiconfig = require('cosmiconfig');
5
6
  var tsDeepmerge = require('ts-deepmerge');
6
7
 
7
8
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -43,6 +44,20 @@ const bucketRegions = {
43
44
  northAmerica: 'merchant-center-north-america',
44
45
  asia: 'merchant-center-asia'
45
46
  };
47
+ const storageProviders = {
48
+ gs: {
49
+ tag: 'gs',
50
+ urls: {
51
+ default: 'https://storage.googleapis.com'
52
+ }
53
+ },
54
+ s3: {
55
+ tag: 's3',
56
+ urls: {
57
+ default: 'https://s3.amazonaws.com'
58
+ }
59
+ }
60
+ };
46
61
 
47
62
  const defaultConfig = {
48
63
  [bucketRegions.previews]: [{
@@ -104,8 +119,26 @@ function defineStorageBucketsConfig() {
104
119
  });
105
120
  return actualConfig;
106
121
  }
122
+ async function loadStorageBucketsConfig() {
123
+ let explorerResult;
124
+ const storageBucketConfigExplorer = cosmiconfig.cosmiconfig('storage-buckets', {
125
+ searchStrategy: 'project'
126
+ });
127
+ try {
128
+ // This is the list of the supported cloud environments and their related bucket location.
129
+ explorerResult = await storageBucketConfigExplorer.search();
130
+ } catch (e) {
131
+ throw new Error('Failed to load a storage bucket configuration. Create a cosmiconfig for `storage-buckets` for example `storage-buckets.config.cjs`.');
132
+ }
133
+ if (!explorerResult) {
134
+ throw new Error('Failed loading a storage bucket configuration');
135
+ }
136
+ return explorerResult?.config;
137
+ }
107
138
 
108
139
  exports.bucketEnvironments = bucketEnvironments;
109
140
  exports.bucketRegions = bucketRegions;
110
141
  exports.clusterContexts = clusterContexts;
111
142
  exports.defineStorageBucketsConfig = defineStorageBucketsConfig;
143
+ exports.loadStorageBucketsConfig = loadStorageBucketsConfig;
144
+ exports.storageProviders = storageProviders;
@@ -2,6 +2,7 @@
2
2
 
3
3
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
4
4
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
5
+ var cosmiconfig = require('cosmiconfig');
5
6
  var tsDeepmerge = require('ts-deepmerge');
6
7
 
7
8
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -43,6 +44,20 @@ const bucketRegions = {
43
44
  northAmerica: 'merchant-center-north-america',
44
45
  asia: 'merchant-center-asia'
45
46
  };
47
+ const storageProviders = {
48
+ gs: {
49
+ tag: 'gs',
50
+ urls: {
51
+ default: 'https://storage.googleapis.com'
52
+ }
53
+ },
54
+ s3: {
55
+ tag: 's3',
56
+ urls: {
57
+ default: 'https://s3.amazonaws.com'
58
+ }
59
+ }
60
+ };
46
61
 
47
62
  const defaultConfig = {
48
63
  [bucketRegions.previews]: [{
@@ -104,8 +119,26 @@ function defineStorageBucketsConfig() {
104
119
  });
105
120
  return actualConfig;
106
121
  }
122
+ async function loadStorageBucketsConfig() {
123
+ let explorerResult;
124
+ const storageBucketConfigExplorer = cosmiconfig.cosmiconfig('storage-buckets', {
125
+ searchStrategy: 'project'
126
+ });
127
+ try {
128
+ // This is the list of the supported cloud environments and their related bucket location.
129
+ explorerResult = await storageBucketConfigExplorer.search();
130
+ } catch (e) {
131
+ throw new Error('Failed to load a storage bucket configuration. Create a cosmiconfig for `storage-buckets` for example `storage-buckets.config.cjs`.');
132
+ }
133
+ if (!explorerResult) {
134
+ throw new Error('Failed loading a storage bucket configuration');
135
+ }
136
+ return explorerResult?.config;
137
+ }
107
138
 
108
139
  exports.bucketEnvironments = bucketEnvironments;
109
140
  exports.bucketRegions = bucketRegions;
110
141
  exports.clusterContexts = clusterContexts;
111
142
  exports.defineStorageBucketsConfig = defineStorageBucketsConfig;
143
+ exports.loadStorageBucketsConfig = loadStorageBucketsConfig;
144
+ exports.storageProviders = storageProviders;
@@ -1,5 +1,6 @@
1
1
  import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
2
2
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
3
+ import { cosmiconfig } from 'cosmiconfig';
3
4
  import { merge } from 'ts-deepmerge';
4
5
 
5
6
  const clusterContexts = {
@@ -36,6 +37,20 @@ const bucketRegions = {
36
37
  northAmerica: 'merchant-center-north-america',
37
38
  asia: 'merchant-center-asia'
38
39
  };
40
+ const storageProviders = {
41
+ gs: {
42
+ tag: 'gs',
43
+ urls: {
44
+ default: 'https://storage.googleapis.com'
45
+ }
46
+ },
47
+ s3: {
48
+ tag: 's3',
49
+ urls: {
50
+ default: 'https://s3.amazonaws.com'
51
+ }
52
+ }
53
+ };
39
54
 
40
55
  const defaultConfig = {
41
56
  [bucketRegions.previews]: [{
@@ -97,5 +112,21 @@ function defineStorageBucketsConfig() {
97
112
  });
98
113
  return actualConfig;
99
114
  }
115
+ async function loadStorageBucketsConfig() {
116
+ let explorerResult;
117
+ const storageBucketConfigExplorer = cosmiconfig('storage-buckets', {
118
+ searchStrategy: 'project'
119
+ });
120
+ try {
121
+ // This is the list of the supported cloud environments and their related bucket location.
122
+ explorerResult = await storageBucketConfigExplorer.search();
123
+ } catch (e) {
124
+ throw new Error('Failed to load a storage bucket configuration. Create a cosmiconfig for `storage-buckets` for example `storage-buckets.config.cjs`.');
125
+ }
126
+ if (!explorerResult) {
127
+ throw new Error('Failed loading a storage bucket configuration');
128
+ }
129
+ return explorerResult?.config;
130
+ }
100
131
 
101
- export { bucketRegions as a, bucketEnvironments as b, clusterContexts as c, defineStorageBucketsConfig as d };
132
+ export { bucketRegions as a, bucketEnvironments as b, clusterContexts as c, defineStorageBucketsConfig as d, loadStorageBucketsConfig as l, storageProviders as s };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/application-cli",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
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.22.11",
23
23
  "@babel/runtime-corejs3": "^7.21.0",
24
24
  "@babel/runtime": "^7.21.0",
25
- "@commercetools-frontend/application-config": "22.17.0",
26
- "@commercetools-frontend/constants": "22.17.0",
27
- "@commercetools-frontend/l10n": "22.17.0",
25
+ "@commercetools-frontend/application-config": "22.19.0",
26
+ "@commercetools-frontend/constants": "22.19.0",
27
+ "@commercetools-frontend/l10n": "22.19.0",
28
28
  "@manypkg/find-root": "2.2.1",
29
29
  "cac": "^6.7.14",
30
30
  "cosmiconfig": "9.0.0",
31
- "dotenv": "16.3.2",
31
+ "dotenv": "16.4.2",
32
32
  "execa": "5.1.1",
33
33
  "jsonschema": "^1.4.1",
34
- "listr2": "8.0.1",
34
+ "listr2": "8.0.2",
35
35
  "node-fetch": "2.7.0",
36
36
  "ts-deepmerge": "7.0.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@tsconfig/node20": "20.1.2",
40
- "@types/node": "20.11.5",
40
+ "@types/node": "20.11.25",
41
41
  "typescript": "5.2.2"
42
42
  },
43
43
  "engines": {