@commercetools-frontend/application-cli 2.3.2 → 2.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/cli/dist/commercetools-frontend-application-cli-cli.cjs.dev.js +198 -10
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.prod.js +198 -10
- package/cli/dist/commercetools-frontend-application-cli-cli.esm.js +192 -11
- package/dist/commercetools-frontend-application-cli.cjs.dev.js +3 -3
- package/dist/commercetools-frontend-application-cli.cjs.prod.js +3 -3
- package/dist/commercetools-frontend-application-cli.esm.js +3 -1
- package/dist/declarations/src/constants.d.ts +2 -8
- package/dist/declarations/src/storage-buckets-config.d.ts +2 -1
- package/dist/declarations/src/types.d.ts +18 -1
- package/dist/{storage-buckets-config-8e7abeff.cjs.dev.js → storage-buckets-config-0a380c12.cjs.prod.js} +39 -18
- package/dist/{storage-buckets-config-f41d07bc.esm.js → storage-buckets-config-896b4064.esm.js} +37 -17
- package/dist/{storage-buckets-config-e092f613.cjs.prod.js → storage-buckets-config-cf50df38.cjs.dev.js} +39 -18
- package/package.json +5 -1
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var storageBucketsConfig = require('./storage-buckets-config-
|
|
5
|
+
var storageBucketsConfig = require('./storage-buckets-config-cf50df38.cjs.dev.js');
|
|
6
6
|
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
7
7
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
8
8
|
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
9
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
9
10
|
require('cosmiconfig');
|
|
10
11
|
require('ts-deepmerge');
|
|
12
|
+
require('lodash');
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
exports.bucketEnvironments = storageBucketsConfig.bucketEnvironments;
|
|
15
17
|
exports.bucketRegions = storageBucketsConfig.bucketRegions;
|
|
16
|
-
exports.bucketUrls = storageBucketsConfig.bucketUrls;
|
|
17
18
|
exports.clusterContexts = storageBucketsConfig.clusterContexts;
|
|
18
19
|
exports.defineStorageBucketsConfig = storageBucketsConfig.defineStorageBucketsConfig;
|
|
19
|
-
exports.publicStorageUrls = storageBucketsConfig.publicStorageUrls;
|
|
20
20
|
exports.storageProviders = storageBucketsConfig.storageProviders;
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var storageBucketsConfig = require('./storage-buckets-config-
|
|
5
|
+
var storageBucketsConfig = require('./storage-buckets-config-0a380c12.cjs.prod.js');
|
|
6
6
|
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
7
7
|
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
8
8
|
require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
9
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
9
10
|
require('cosmiconfig');
|
|
10
11
|
require('ts-deepmerge');
|
|
12
|
+
require('lodash');
|
|
11
13
|
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
exports.bucketEnvironments = storageBucketsConfig.bucketEnvironments;
|
|
15
17
|
exports.bucketRegions = storageBucketsConfig.bucketRegions;
|
|
16
|
-
exports.bucketUrls = storageBucketsConfig.bucketUrls;
|
|
17
18
|
exports.clusterContexts = storageBucketsConfig.clusterContexts;
|
|
18
19
|
exports.defineStorageBucketsConfig = storageBucketsConfig.defineStorageBucketsConfig;
|
|
19
|
-
exports.publicStorageUrls = storageBucketsConfig.publicStorageUrls;
|
|
20
20
|
exports.storageProviders = storageBucketsConfig.storageProviders;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export { b as bucketEnvironments,
|
|
1
|
+
export { b as bucketEnvironments, e as bucketRegions, c as clusterContexts, d as defineStorageBucketsConfig, s as storageProviders } from './storage-buckets-config-896b4064.esm.js';
|
|
2
2
|
import '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
3
3
|
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
4
4
|
import '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
5
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
5
6
|
import 'cosmiconfig';
|
|
6
7
|
import 'ts-deepmerge';
|
|
8
|
+
import 'lodash';
|
|
@@ -13,6 +13,7 @@ export declare const clusterContexts: {
|
|
|
13
13
|
readonly 'ctp_production_gcp_australia-southeast1_v1': "ctp_production_gcp_australia-southeast1_v1";
|
|
14
14
|
readonly 'ctp_production_aws_cn-northwest-1_v1': "ctp_production_aws_cn-northwest-1_v1";
|
|
15
15
|
readonly ctp_staging_azure_northeurope_v1: "ctp_staging_azure_northeurope_v1";
|
|
16
|
+
readonly ctp_production_azure_eastus_v1: "ctp_production_azure_eastus_v1";
|
|
16
17
|
};
|
|
17
18
|
export declare const bucketEnvironments: {
|
|
18
19
|
readonly 'ctp-gcp-staging': "ctp-gcp-staging";
|
|
@@ -20,6 +21,7 @@ export declare const bucketEnvironments: {
|
|
|
20
21
|
readonly 'ctp-aws-staging-cn': "ctp-aws-staging-cn";
|
|
21
22
|
readonly 'ctp-gcp-testing-performance-eu': "ctp-gcp-testing-performance-eu";
|
|
22
23
|
readonly 'ctp-azure-staging': "ctp-azure-staging";
|
|
24
|
+
readonly 'ctp-azure-production-eastus': "ctp-azure-production-eastus";
|
|
23
25
|
readonly 'ctp-aws-production-fra': "ctp-aws-production-fra";
|
|
24
26
|
readonly 'ctp-gcp-production-eu': "ctp-gcp-production-eu";
|
|
25
27
|
readonly 'ctp-vw-production-eu': "ctp-vw-production-eu";
|
|
@@ -36,12 +38,4 @@ export declare const bucketRegions: {
|
|
|
36
38
|
readonly asia: "merchant-center-asia";
|
|
37
39
|
readonly china: "merchant-center-china";
|
|
38
40
|
};
|
|
39
|
-
export declare const publicStorageUrls: {
|
|
40
|
-
readonly google: "https://storage.googleapis.com";
|
|
41
|
-
readonly aws: "https://s3.amazonaws.com";
|
|
42
|
-
readonly china: "https://mc-storage.cn-northwest-1.aws.commercetools.cn";
|
|
43
|
-
};
|
|
44
|
-
export declare const bucketUrls: {
|
|
45
|
-
readonly china: "commercetools-mc-storage-aws-cn-prod-merchant-center";
|
|
46
|
-
};
|
|
47
41
|
export declare const storageProviders: Record<TStorageProviderTag, TStorageProvider>;
|
|
@@ -9,4 +9,5 @@ type TDefineConfigArgs = {
|
|
|
9
9
|
};
|
|
10
10
|
declare function defineStorageBucketsConfig({ regions, options, }?: TDefineConfigArgs): TStorageBucketsConfig;
|
|
11
11
|
declare function loadStorageBucketsConfig(): Promise<TStorageBucketsConfig>;
|
|
12
|
-
|
|
12
|
+
declare function loadConfig<TConfig>(moduleName: string, defaultConfig?: unknown): Promise<TConfig>;
|
|
13
|
+
export { defineStorageBucketsConfig, loadStorageBucketsConfig, loadConfig };
|
|
@@ -23,7 +23,7 @@ export type TStorageProvider = {
|
|
|
23
23
|
tag: TStorageProviderTag;
|
|
24
24
|
urls: {
|
|
25
25
|
public: {
|
|
26
|
-
default: string;
|
|
26
|
+
default: string | null;
|
|
27
27
|
} & Partial<Record<TBucketEnvironment, string>>;
|
|
28
28
|
bucket?: Partial<Record<TBucketRegion, string>>;
|
|
29
29
|
};
|
|
@@ -125,4 +125,21 @@ export type TValidateMenuFlags = {
|
|
|
125
125
|
inputFile: string;
|
|
126
126
|
navigation?: string;
|
|
127
127
|
};
|
|
128
|
+
export type TEvaluateChangeTriggersCliFlags = {
|
|
129
|
+
branch: string;
|
|
130
|
+
baseBranch: string;
|
|
131
|
+
headRevision: string;
|
|
132
|
+
triggerName: string;
|
|
133
|
+
gitCommitMessage?: string;
|
|
134
|
+
outEnvFile?: string;
|
|
135
|
+
silent?: boolean;
|
|
136
|
+
};
|
|
137
|
+
type TChangeTrigger = {
|
|
138
|
+
name: string;
|
|
139
|
+
containsSharedFiles?: boolean;
|
|
140
|
+
include: string[];
|
|
141
|
+
exclude: string[];
|
|
142
|
+
ignore: string[];
|
|
143
|
+
};
|
|
144
|
+
export type TChangeTriggersConfig = TChangeTrigger[];
|
|
128
145
|
export {};
|
|
@@ -3,14 +3,18 @@
|
|
|
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
5
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
6
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
6
7
|
var cosmiconfig = require('cosmiconfig');
|
|
7
8
|
var tsDeepmerge = require('ts-deepmerge');
|
|
9
|
+
var lodash = require('lodash');
|
|
8
10
|
|
|
9
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
12
|
|
|
11
13
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
12
14
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
13
15
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
16
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
17
|
+
var lodash__default = /*#__PURE__*/_interopDefault(lodash);
|
|
14
18
|
|
|
15
19
|
const clusterContexts = {
|
|
16
20
|
'ctp_staging_gcp_europe-west1_v1': 'ctp_staging_gcp_europe-west1_v1',
|
|
@@ -25,7 +29,8 @@ const clusterContexts = {
|
|
|
25
29
|
'ctp_production_gcp_us-central1_v1': 'ctp_production_gcp_us-central1_v1',
|
|
26
30
|
'ctp_production_gcp_australia-southeast1_v1': 'ctp_production_gcp_australia-southeast1_v1',
|
|
27
31
|
'ctp_production_aws_cn-northwest-1_v1': 'ctp_production_aws_cn-northwest-1_v1',
|
|
28
|
-
ctp_staging_azure_northeurope_v1: 'ctp_staging_azure_northeurope_v1'
|
|
32
|
+
ctp_staging_azure_northeurope_v1: 'ctp_staging_azure_northeurope_v1',
|
|
33
|
+
ctp_production_azure_eastus_v1: 'ctp_production_azure_eastus_v1'
|
|
29
34
|
};
|
|
30
35
|
const bucketEnvironments = {
|
|
31
36
|
'ctp-gcp-staging': 'ctp-gcp-staging',
|
|
@@ -33,6 +38,7 @@ const bucketEnvironments = {
|
|
|
33
38
|
'ctp-aws-staging-cn': 'ctp-aws-staging-cn',
|
|
34
39
|
'ctp-gcp-testing-performance-eu': 'ctp-gcp-testing-performance-eu',
|
|
35
40
|
'ctp-azure-staging': 'ctp-azure-staging',
|
|
41
|
+
'ctp-azure-production-eastus': 'ctp-azure-production-eastus',
|
|
36
42
|
'ctp-aws-production-fra': 'ctp-aws-production-fra',
|
|
37
43
|
'ctp-gcp-production-eu': 'ctp-gcp-production-eu',
|
|
38
44
|
'ctp-vw-production-eu': 'ctp-vw-production-eu',
|
|
@@ -49,20 +55,12 @@ const bucketRegions = {
|
|
|
49
55
|
asia: 'merchant-center-asia',
|
|
50
56
|
china: 'merchant-center-china'
|
|
51
57
|
};
|
|
52
|
-
const publicStorageUrls = {
|
|
53
|
-
google: 'https://storage.googleapis.com',
|
|
54
|
-
aws: 'https://s3.amazonaws.com',
|
|
55
|
-
china: 'https://mc-storage.cn-northwest-1.aws.commercetools.cn'
|
|
56
|
-
};
|
|
57
|
-
const bucketUrls = {
|
|
58
|
-
china: 'commercetools-mc-storage-aws-cn-prod-merchant-center'
|
|
59
|
-
};
|
|
60
58
|
const storageProviders = {
|
|
61
59
|
gs: {
|
|
62
60
|
tag: 'gs',
|
|
63
61
|
urls: {
|
|
64
62
|
public: {
|
|
65
|
-
default:
|
|
63
|
+
default: 'https://storage.googleapis.com'
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
},
|
|
@@ -70,12 +68,16 @@ const storageProviders = {
|
|
|
70
68
|
tag: 's3',
|
|
71
69
|
urls: {
|
|
72
70
|
public: {
|
|
73
|
-
default:
|
|
74
|
-
'ctp-aws-staging-cn':
|
|
75
|
-
'ctp-aws-production-cn':
|
|
71
|
+
default: null,
|
|
72
|
+
'ctp-aws-staging-cn': 'https://mc-storage.cn-northwest-1.aws.commercetools.cn',
|
|
73
|
+
'ctp-aws-production-cn': 'https://mc-storage.cn-northwest-1.aws.commercetools.cn',
|
|
74
|
+
'ctp-aws-production-ohio': 'https://mc-storage.us-east-2.aws.commercetools.com',
|
|
75
|
+
'ctp-aws-production-fra': 'https://mc-storage.eu-central-1.aws.commercetools.com'
|
|
76
76
|
},
|
|
77
77
|
bucket: {
|
|
78
|
-
'merchant-center-china':
|
|
78
|
+
'merchant-center-china': 'commercetools-mc-storage-aws-cn-prod-merchant-center',
|
|
79
|
+
'merchant-center-europe': 'commercetools-mc-storage-aws-eu-prod-merchant-center',
|
|
80
|
+
'merchant-center-north-america': 'commercetools-mc-storage-aws-us-prod-merchant-center'
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -100,7 +102,8 @@ const defaultConfig = {
|
|
|
100
102
|
}],
|
|
101
103
|
[bucketRegions.europe]: [{
|
|
102
104
|
cloudEnvironment: clusterContexts['ctp_production_aws_eu-central-1_v1'],
|
|
103
|
-
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra']
|
|
105
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra'],
|
|
106
|
+
storageProviders: ['gs', 's3']
|
|
104
107
|
}, {
|
|
105
108
|
cloudEnvironment: clusterContexts['ctp_production_gcp_europe-west1_v1'],
|
|
106
109
|
bucketEnvironment: bucketEnvironments['ctp-gcp-production-eu']
|
|
@@ -113,10 +116,14 @@ const defaultConfig = {
|
|
|
113
116
|
bucketEnvironment: bucketEnvironments['ctp-att-production-va']
|
|
114
117
|
}, {
|
|
115
118
|
cloudEnvironment: clusterContexts['ctp_production_aws_us-east-2_v1'],
|
|
116
|
-
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio']
|
|
119
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio'],
|
|
120
|
+
storageProviders: ['gs', 's3']
|
|
117
121
|
}, {
|
|
118
122
|
cloudEnvironment: clusterContexts['ctp_production_gcp_us-central1_v1'],
|
|
119
123
|
bucketEnvironment: bucketEnvironments['ctp-gcp-production-us']
|
|
124
|
+
}, {
|
|
125
|
+
cloudEnvironment: clusterContexts['ctp_production_azure_eastus_v1'],
|
|
126
|
+
bucketEnvironment: bucketEnvironments['ctp-azure-production-eastus']
|
|
120
127
|
}],
|
|
121
128
|
[bucketRegions.asia]: [{
|
|
122
129
|
cloudEnvironment: clusterContexts['ctp_production_gcp_australia-southeast1_v1'],
|
|
@@ -172,12 +179,26 @@ async function loadStorageBucketsConfig() {
|
|
|
172
179
|
}
|
|
173
180
|
return (_explorerResult = explorerResult) === null || _explorerResult === void 0 ? void 0 : _explorerResult.config;
|
|
174
181
|
}
|
|
182
|
+
async function loadConfig(moduleName, defaultConfig) {
|
|
183
|
+
const configExplorer = cosmiconfig.cosmiconfig(moduleName, {
|
|
184
|
+
searchStrategy: 'project'
|
|
185
|
+
});
|
|
186
|
+
try {
|
|
187
|
+
const cosmiconfigResult = await configExplorer.search();
|
|
188
|
+
const mergedConfig = lodash__default["default"].merge(defaultConfig, cosmiconfigResult === null || cosmiconfigResult === void 0 ? void 0 : cosmiconfigResult.config);
|
|
189
|
+
console.log("\u2139\uFE0F Merged and loaded cosmiconfig file for '".concat(moduleName, "'."));
|
|
190
|
+
return mergedConfig;
|
|
191
|
+
} catch (e) {
|
|
192
|
+
var _context, _context2;
|
|
193
|
+
console.warn(e);
|
|
194
|
+
throw new Error(_concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "Failed loading a ".concat(moduleName, " configuration. Create a cosmiconfig for '")).call(_context2, moduleName, "' for example '")).call(_context, moduleName, ".config.cjs.'"));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
175
197
|
|
|
176
198
|
exports.bucketEnvironments = bucketEnvironments;
|
|
177
199
|
exports.bucketRegions = bucketRegions;
|
|
178
|
-
exports.bucketUrls = bucketUrls;
|
|
179
200
|
exports.clusterContexts = clusterContexts;
|
|
180
201
|
exports.defineStorageBucketsConfig = defineStorageBucketsConfig;
|
|
202
|
+
exports.loadConfig = loadConfig;
|
|
181
203
|
exports.loadStorageBucketsConfig = loadStorageBucketsConfig;
|
|
182
|
-
exports.publicStorageUrls = publicStorageUrls;
|
|
183
204
|
exports.storageProviders = storageProviders;
|
package/dist/{storage-buckets-config-f41d07bc.esm.js → storage-buckets-config-896b4064.esm.js}
RENAMED
|
@@ -1,8 +1,10 @@
|
|
|
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
3
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
|
4
|
+
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
4
5
|
import { cosmiconfig } from 'cosmiconfig';
|
|
5
6
|
import { merge } from 'ts-deepmerge';
|
|
7
|
+
import lodash from 'lodash';
|
|
6
8
|
|
|
7
9
|
const clusterContexts = {
|
|
8
10
|
'ctp_staging_gcp_europe-west1_v1': 'ctp_staging_gcp_europe-west1_v1',
|
|
@@ -17,7 +19,8 @@ const clusterContexts = {
|
|
|
17
19
|
'ctp_production_gcp_us-central1_v1': 'ctp_production_gcp_us-central1_v1',
|
|
18
20
|
'ctp_production_gcp_australia-southeast1_v1': 'ctp_production_gcp_australia-southeast1_v1',
|
|
19
21
|
'ctp_production_aws_cn-northwest-1_v1': 'ctp_production_aws_cn-northwest-1_v1',
|
|
20
|
-
ctp_staging_azure_northeurope_v1: 'ctp_staging_azure_northeurope_v1'
|
|
22
|
+
ctp_staging_azure_northeurope_v1: 'ctp_staging_azure_northeurope_v1',
|
|
23
|
+
ctp_production_azure_eastus_v1: 'ctp_production_azure_eastus_v1'
|
|
21
24
|
};
|
|
22
25
|
const bucketEnvironments = {
|
|
23
26
|
'ctp-gcp-staging': 'ctp-gcp-staging',
|
|
@@ -25,6 +28,7 @@ const bucketEnvironments = {
|
|
|
25
28
|
'ctp-aws-staging-cn': 'ctp-aws-staging-cn',
|
|
26
29
|
'ctp-gcp-testing-performance-eu': 'ctp-gcp-testing-performance-eu',
|
|
27
30
|
'ctp-azure-staging': 'ctp-azure-staging',
|
|
31
|
+
'ctp-azure-production-eastus': 'ctp-azure-production-eastus',
|
|
28
32
|
'ctp-aws-production-fra': 'ctp-aws-production-fra',
|
|
29
33
|
'ctp-gcp-production-eu': 'ctp-gcp-production-eu',
|
|
30
34
|
'ctp-vw-production-eu': 'ctp-vw-production-eu',
|
|
@@ -41,20 +45,12 @@ const bucketRegions = {
|
|
|
41
45
|
asia: 'merchant-center-asia',
|
|
42
46
|
china: 'merchant-center-china'
|
|
43
47
|
};
|
|
44
|
-
const publicStorageUrls = {
|
|
45
|
-
google: 'https://storage.googleapis.com',
|
|
46
|
-
aws: 'https://s3.amazonaws.com',
|
|
47
|
-
china: 'https://mc-storage.cn-northwest-1.aws.commercetools.cn'
|
|
48
|
-
};
|
|
49
|
-
const bucketUrls = {
|
|
50
|
-
china: 'commercetools-mc-storage-aws-cn-prod-merchant-center'
|
|
51
|
-
};
|
|
52
48
|
const storageProviders = {
|
|
53
49
|
gs: {
|
|
54
50
|
tag: 'gs',
|
|
55
51
|
urls: {
|
|
56
52
|
public: {
|
|
57
|
-
default:
|
|
53
|
+
default: 'https://storage.googleapis.com'
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
},
|
|
@@ -62,12 +58,16 @@ const storageProviders = {
|
|
|
62
58
|
tag: 's3',
|
|
63
59
|
urls: {
|
|
64
60
|
public: {
|
|
65
|
-
default:
|
|
66
|
-
'ctp-aws-staging-cn':
|
|
67
|
-
'ctp-aws-production-cn':
|
|
61
|
+
default: null,
|
|
62
|
+
'ctp-aws-staging-cn': 'https://mc-storage.cn-northwest-1.aws.commercetools.cn',
|
|
63
|
+
'ctp-aws-production-cn': 'https://mc-storage.cn-northwest-1.aws.commercetools.cn',
|
|
64
|
+
'ctp-aws-production-ohio': 'https://mc-storage.us-east-2.aws.commercetools.com',
|
|
65
|
+
'ctp-aws-production-fra': 'https://mc-storage.eu-central-1.aws.commercetools.com'
|
|
68
66
|
},
|
|
69
67
|
bucket: {
|
|
70
|
-
'merchant-center-china':
|
|
68
|
+
'merchant-center-china': 'commercetools-mc-storage-aws-cn-prod-merchant-center',
|
|
69
|
+
'merchant-center-europe': 'commercetools-mc-storage-aws-eu-prod-merchant-center',
|
|
70
|
+
'merchant-center-north-america': 'commercetools-mc-storage-aws-us-prod-merchant-center'
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -92,7 +92,8 @@ const defaultConfig = {
|
|
|
92
92
|
}],
|
|
93
93
|
[bucketRegions.europe]: [{
|
|
94
94
|
cloudEnvironment: clusterContexts['ctp_production_aws_eu-central-1_v1'],
|
|
95
|
-
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra']
|
|
95
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra'],
|
|
96
|
+
storageProviders: ['gs', 's3']
|
|
96
97
|
}, {
|
|
97
98
|
cloudEnvironment: clusterContexts['ctp_production_gcp_europe-west1_v1'],
|
|
98
99
|
bucketEnvironment: bucketEnvironments['ctp-gcp-production-eu']
|
|
@@ -105,10 +106,14 @@ const defaultConfig = {
|
|
|
105
106
|
bucketEnvironment: bucketEnvironments['ctp-att-production-va']
|
|
106
107
|
}, {
|
|
107
108
|
cloudEnvironment: clusterContexts['ctp_production_aws_us-east-2_v1'],
|
|
108
|
-
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio']
|
|
109
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio'],
|
|
110
|
+
storageProviders: ['gs', 's3']
|
|
109
111
|
}, {
|
|
110
112
|
cloudEnvironment: clusterContexts['ctp_production_gcp_us-central1_v1'],
|
|
111
113
|
bucketEnvironment: bucketEnvironments['ctp-gcp-production-us']
|
|
114
|
+
}, {
|
|
115
|
+
cloudEnvironment: clusterContexts['ctp_production_azure_eastus_v1'],
|
|
116
|
+
bucketEnvironment: bucketEnvironments['ctp-azure-production-eastus']
|
|
112
117
|
}],
|
|
113
118
|
[bucketRegions.asia]: [{
|
|
114
119
|
cloudEnvironment: clusterContexts['ctp_production_gcp_australia-southeast1_v1'],
|
|
@@ -164,5 +169,20 @@ async function loadStorageBucketsConfig() {
|
|
|
164
169
|
}
|
|
165
170
|
return (_explorerResult = explorerResult) === null || _explorerResult === void 0 ? void 0 : _explorerResult.config;
|
|
166
171
|
}
|
|
172
|
+
async function loadConfig(moduleName, defaultConfig) {
|
|
173
|
+
const configExplorer = cosmiconfig(moduleName, {
|
|
174
|
+
searchStrategy: 'project'
|
|
175
|
+
});
|
|
176
|
+
try {
|
|
177
|
+
const cosmiconfigResult = await configExplorer.search();
|
|
178
|
+
const mergedConfig = lodash.merge(defaultConfig, cosmiconfigResult === null || cosmiconfigResult === void 0 ? void 0 : cosmiconfigResult.config);
|
|
179
|
+
console.log("\u2139\uFE0F Merged and loaded cosmiconfig file for '".concat(moduleName, "'."));
|
|
180
|
+
return mergedConfig;
|
|
181
|
+
} catch (e) {
|
|
182
|
+
var _context, _context2;
|
|
183
|
+
console.warn(e);
|
|
184
|
+
throw new Error(_concatInstanceProperty(_context = _concatInstanceProperty(_context2 = "Failed loading a ".concat(moduleName, " configuration. Create a cosmiconfig for '")).call(_context2, moduleName, "' for example '")).call(_context, moduleName, ".config.cjs.'"));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
167
187
|
|
|
168
|
-
export {
|
|
188
|
+
export { loadConfig as a, bucketEnvironments as b, clusterContexts as c, defineStorageBucketsConfig as d, bucketRegions as e, loadStorageBucketsConfig as l, storageProviders as s };
|
|
@@ -3,14 +3,18 @@
|
|
|
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
5
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
6
|
+
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
6
7
|
var cosmiconfig = require('cosmiconfig');
|
|
7
8
|
var tsDeepmerge = require('ts-deepmerge');
|
|
9
|
+
var lodash = require('lodash');
|
|
8
10
|
|
|
9
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
10
12
|
|
|
11
13
|
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
12
14
|
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
13
15
|
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
16
|
+
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
17
|
+
var lodash__default = /*#__PURE__*/_interopDefault(lodash);
|
|
14
18
|
|
|
15
19
|
const clusterContexts = {
|
|
16
20
|
'ctp_staging_gcp_europe-west1_v1': 'ctp_staging_gcp_europe-west1_v1',
|
|
@@ -25,7 +29,8 @@ const clusterContexts = {
|
|
|
25
29
|
'ctp_production_gcp_us-central1_v1': 'ctp_production_gcp_us-central1_v1',
|
|
26
30
|
'ctp_production_gcp_australia-southeast1_v1': 'ctp_production_gcp_australia-southeast1_v1',
|
|
27
31
|
'ctp_production_aws_cn-northwest-1_v1': 'ctp_production_aws_cn-northwest-1_v1',
|
|
28
|
-
ctp_staging_azure_northeurope_v1: 'ctp_staging_azure_northeurope_v1'
|
|
32
|
+
ctp_staging_azure_northeurope_v1: 'ctp_staging_azure_northeurope_v1',
|
|
33
|
+
ctp_production_azure_eastus_v1: 'ctp_production_azure_eastus_v1'
|
|
29
34
|
};
|
|
30
35
|
const bucketEnvironments = {
|
|
31
36
|
'ctp-gcp-staging': 'ctp-gcp-staging',
|
|
@@ -33,6 +38,7 @@ const bucketEnvironments = {
|
|
|
33
38
|
'ctp-aws-staging-cn': 'ctp-aws-staging-cn',
|
|
34
39
|
'ctp-gcp-testing-performance-eu': 'ctp-gcp-testing-performance-eu',
|
|
35
40
|
'ctp-azure-staging': 'ctp-azure-staging',
|
|
41
|
+
'ctp-azure-production-eastus': 'ctp-azure-production-eastus',
|
|
36
42
|
'ctp-aws-production-fra': 'ctp-aws-production-fra',
|
|
37
43
|
'ctp-gcp-production-eu': 'ctp-gcp-production-eu',
|
|
38
44
|
'ctp-vw-production-eu': 'ctp-vw-production-eu',
|
|
@@ -49,20 +55,12 @@ const bucketRegions = {
|
|
|
49
55
|
asia: 'merchant-center-asia',
|
|
50
56
|
china: 'merchant-center-china'
|
|
51
57
|
};
|
|
52
|
-
const publicStorageUrls = {
|
|
53
|
-
google: 'https://storage.googleapis.com',
|
|
54
|
-
aws: 'https://s3.amazonaws.com',
|
|
55
|
-
china: 'https://mc-storage.cn-northwest-1.aws.commercetools.cn'
|
|
56
|
-
};
|
|
57
|
-
const bucketUrls = {
|
|
58
|
-
china: 'commercetools-mc-storage-aws-cn-prod-merchant-center'
|
|
59
|
-
};
|
|
60
58
|
const storageProviders = {
|
|
61
59
|
gs: {
|
|
62
60
|
tag: 'gs',
|
|
63
61
|
urls: {
|
|
64
62
|
public: {
|
|
65
|
-
default:
|
|
63
|
+
default: 'https://storage.googleapis.com'
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
},
|
|
@@ -70,12 +68,16 @@ const storageProviders = {
|
|
|
70
68
|
tag: 's3',
|
|
71
69
|
urls: {
|
|
72
70
|
public: {
|
|
73
|
-
default:
|
|
74
|
-
'ctp-aws-staging-cn':
|
|
75
|
-
'ctp-aws-production-cn':
|
|
71
|
+
default: null,
|
|
72
|
+
'ctp-aws-staging-cn': 'https://mc-storage.cn-northwest-1.aws.commercetools.cn',
|
|
73
|
+
'ctp-aws-production-cn': 'https://mc-storage.cn-northwest-1.aws.commercetools.cn',
|
|
74
|
+
'ctp-aws-production-ohio': 'https://mc-storage.us-east-2.aws.commercetools.com',
|
|
75
|
+
'ctp-aws-production-fra': 'https://mc-storage.eu-central-1.aws.commercetools.com'
|
|
76
76
|
},
|
|
77
77
|
bucket: {
|
|
78
|
-
'merchant-center-china':
|
|
78
|
+
'merchant-center-china': 'commercetools-mc-storage-aws-cn-prod-merchant-center',
|
|
79
|
+
'merchant-center-europe': 'commercetools-mc-storage-aws-eu-prod-merchant-center',
|
|
80
|
+
'merchant-center-north-america': 'commercetools-mc-storage-aws-us-prod-merchant-center'
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -100,7 +102,8 @@ const defaultConfig = {
|
|
|
100
102
|
}],
|
|
101
103
|
[bucketRegions.europe]: [{
|
|
102
104
|
cloudEnvironment: clusterContexts['ctp_production_aws_eu-central-1_v1'],
|
|
103
|
-
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra']
|
|
105
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra'],
|
|
106
|
+
storageProviders: ['gs', 's3']
|
|
104
107
|
}, {
|
|
105
108
|
cloudEnvironment: clusterContexts['ctp_production_gcp_europe-west1_v1'],
|
|
106
109
|
bucketEnvironment: bucketEnvironments['ctp-gcp-production-eu']
|
|
@@ -113,10 +116,14 @@ const defaultConfig = {
|
|
|
113
116
|
bucketEnvironment: bucketEnvironments['ctp-att-production-va']
|
|
114
117
|
}, {
|
|
115
118
|
cloudEnvironment: clusterContexts['ctp_production_aws_us-east-2_v1'],
|
|
116
|
-
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio']
|
|
119
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio'],
|
|
120
|
+
storageProviders: ['gs', 's3']
|
|
117
121
|
}, {
|
|
118
122
|
cloudEnvironment: clusterContexts['ctp_production_gcp_us-central1_v1'],
|
|
119
123
|
bucketEnvironment: bucketEnvironments['ctp-gcp-production-us']
|
|
124
|
+
}, {
|
|
125
|
+
cloudEnvironment: clusterContexts['ctp_production_azure_eastus_v1'],
|
|
126
|
+
bucketEnvironment: bucketEnvironments['ctp-azure-production-eastus']
|
|
120
127
|
}],
|
|
121
128
|
[bucketRegions.asia]: [{
|
|
122
129
|
cloudEnvironment: clusterContexts['ctp_production_gcp_australia-southeast1_v1'],
|
|
@@ -172,12 +179,26 @@ async function loadStorageBucketsConfig() {
|
|
|
172
179
|
}
|
|
173
180
|
return (_explorerResult = explorerResult) === null || _explorerResult === void 0 ? void 0 : _explorerResult.config;
|
|
174
181
|
}
|
|
182
|
+
async function loadConfig(moduleName, defaultConfig) {
|
|
183
|
+
const configExplorer = cosmiconfig.cosmiconfig(moduleName, {
|
|
184
|
+
searchStrategy: 'project'
|
|
185
|
+
});
|
|
186
|
+
try {
|
|
187
|
+
const cosmiconfigResult = await configExplorer.search();
|
|
188
|
+
const mergedConfig = lodash__default["default"].merge(defaultConfig, cosmiconfigResult === null || cosmiconfigResult === void 0 ? void 0 : cosmiconfigResult.config);
|
|
189
|
+
console.log("\u2139\uFE0F Merged and loaded cosmiconfig file for '".concat(moduleName, "'."));
|
|
190
|
+
return mergedConfig;
|
|
191
|
+
} catch (e) {
|
|
192
|
+
var _context, _context2;
|
|
193
|
+
console.warn(e);
|
|
194
|
+
throw new Error(_concatInstanceProperty__default["default"](_context = _concatInstanceProperty__default["default"](_context2 = "Failed loading a ".concat(moduleName, " configuration. Create a cosmiconfig for '")).call(_context2, moduleName, "' for example '")).call(_context, moduleName, ".config.cjs.'"));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
175
197
|
|
|
176
198
|
exports.bucketEnvironments = bucketEnvironments;
|
|
177
199
|
exports.bucketRegions = bucketRegions;
|
|
178
|
-
exports.bucketUrls = bucketUrls;
|
|
179
200
|
exports.clusterContexts = clusterContexts;
|
|
180
201
|
exports.defineStorageBucketsConfig = defineStorageBucketsConfig;
|
|
202
|
+
exports.loadConfig = loadConfig;
|
|
181
203
|
exports.loadStorageBucketsConfig = loadStorageBucketsConfig;
|
|
182
|
-
exports.publicStorageUrls = publicStorageUrls;
|
|
183
204
|
exports.storageProviders = storageProviders;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/application-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Internal CLI to manage Merchant Center application deployments across various environments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commercetools",
|
|
@@ -32,11 +32,15 @@
|
|
|
32
32
|
"execa": "5.1.1",
|
|
33
33
|
"jsonschema": "^1.4.1",
|
|
34
34
|
"listr2": "8.2.0",
|
|
35
|
+
"lodash": "4.17.21",
|
|
36
|
+
"micromatch": "4.0.5",
|
|
35
37
|
"node-fetch": "2.7.0",
|
|
36
38
|
"ts-deepmerge": "7.0.0"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@tsconfig/node20": "20.1.4",
|
|
42
|
+
"@types/lodash": "^4.14.198",
|
|
43
|
+
"@types/micromatch": "4.0.6",
|
|
40
44
|
"@types/node": "20.12.7",
|
|
41
45
|
"typescript": "5.2.2"
|
|
42
46
|
},
|