@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
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./declarations/src/index";
|
|
2
|
-
//# sourceMappingURL=
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbWVyY2V0b29scy1mcm9udGVuZC1hcHBsaWNhdGlvbi1jbGkuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var storageBucketsConfig = require('./storage-buckets-config-478b8585.cjs.dev.js');
|
|
6
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
7
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
8
|
+
require('ts-deepmerge');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.bucketEnvironments = storageBucketsConfig.bucketEnvironments;
|
|
13
|
+
exports.bucketRegions = storageBucketsConfig.bucketRegions;
|
|
14
|
+
exports.clusterContexts = storageBucketsConfig.clusterContexts;
|
|
15
|
+
exports.defineStorageBucketsConfig = storageBucketsConfig.defineStorageBucketsConfig;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var storageBucketsConfig = require('./storage-buckets-config-0b3808a3.cjs.prod.js');
|
|
6
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
7
|
+
require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
8
|
+
require('ts-deepmerge');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.bucketEnvironments = storageBucketsConfig.bucketEnvironments;
|
|
13
|
+
exports.bucketRegions = storageBucketsConfig.bucketRegions;
|
|
14
|
+
exports.clusterContexts = storageBucketsConfig.clusterContexts;
|
|
15
|
+
exports.defineStorageBucketsConfig = storageBucketsConfig.defineStorageBucketsConfig;
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export { b as bucketEnvironments, a as bucketRegions, c as clusterContexts, d as defineStorageBucketsConfig } from './storage-buckets-config-7845a091.esm.js';
|
|
2
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
3
|
+
import '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
4
|
+
import 'ts-deepmerge';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const clusterContexts: {
|
|
2
|
+
readonly 'ctp_staging_gcp_europe-west1_v1': "ctp_staging_gcp_europe-west1_v1";
|
|
3
|
+
readonly 'vw_staging_aws_eu-central-1_v1': "vw_staging_aws_eu-central-1_v1";
|
|
4
|
+
readonly 'ctp_staging_aws_cn-northwest-1_v1': "ctp_staging_aws_cn-northwest-1_v1";
|
|
5
|
+
readonly 'ctp_testing_performance_gcp_europe-west1_v1': "ctp_testing_performance_gcp_europe-west1_v1";
|
|
6
|
+
readonly 'ctp_production_aws_eu-central-1_v1': "ctp_production_aws_eu-central-1_v1";
|
|
7
|
+
readonly 'ctp_production_gcp_europe-west1_v1': "ctp_production_gcp_europe-west1_v1";
|
|
8
|
+
readonly 'vw_production_aws_eu-central-1_v1': "vw_production_aws_eu-central-1_v1";
|
|
9
|
+
readonly 'att_production_aws_us-east-1_v1': "att_production_aws_us-east-1_v1";
|
|
10
|
+
readonly 'ctp_production_aws_us-east-2_v1': "ctp_production_aws_us-east-2_v1";
|
|
11
|
+
readonly 'ctp_production_gcp_us-central1_v1': "ctp_production_gcp_us-central1_v1";
|
|
12
|
+
readonly 'ctp_production_gcp_australia-southeast1_v1': "ctp_production_gcp_australia-southeast1_v1";
|
|
13
|
+
readonly 'ctp_production_aws_cn-northwest-1_v1': "ctp_production_aws_cn-northwest-1_v1";
|
|
14
|
+
};
|
|
15
|
+
export declare const bucketEnvironments: {
|
|
16
|
+
readonly 'ctp-gcp-staging': "ctp-gcp-staging";
|
|
17
|
+
readonly 'ctp-vw-staging-eu': "ctp-vw-staging-eu";
|
|
18
|
+
readonly 'ctp-aws-staging-cn': "ctp-aws-staging-cn";
|
|
19
|
+
readonly 'ctp-gcp-testing-performance-eu': "ctp-gcp-testing-performance-eu";
|
|
20
|
+
readonly 'ctp-aws-production-fra': "ctp-aws-production-fra";
|
|
21
|
+
readonly 'ctp-gcp-production-eu': "ctp-gcp-production-eu";
|
|
22
|
+
readonly 'ctp-vw-production-eu': "ctp-vw-production-eu";
|
|
23
|
+
readonly 'ctp-att-production-va': "ctp-att-production-va";
|
|
24
|
+
readonly 'ctp-aws-production-ohio': "ctp-aws-production-ohio";
|
|
25
|
+
readonly 'ctp-gcp-production-us': "ctp-gcp-production-us";
|
|
26
|
+
readonly 'ctp-gcp-production-au': "ctp-gcp-production-au";
|
|
27
|
+
readonly 'ctp-aws-production-cn': "ctp-aws-production-cn";
|
|
28
|
+
};
|
|
29
|
+
export declare const bucketRegions: {
|
|
30
|
+
readonly previews: "merchant-center-previews";
|
|
31
|
+
readonly europe: "merchant-center-europe";
|
|
32
|
+
readonly northAmerica: "merchant-center-north-america";
|
|
33
|
+
readonly asia: "merchant-center-asia";
|
|
34
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TBucketRegion, TCloudEnvironment, type TStorageBucketsConfig } from "./types.js";
|
|
2
|
+
type TConfigOptions = {
|
|
3
|
+
disabledBucketRegions?: TBucketRegion[];
|
|
4
|
+
disabledEnvironments?: TCloudEnvironment[];
|
|
5
|
+
};
|
|
6
|
+
type TDefineConfigArgs = {
|
|
7
|
+
regions?: TStorageBucketsConfig;
|
|
8
|
+
options?: TConfigOptions;
|
|
9
|
+
};
|
|
10
|
+
declare function defineStorageBucketsConfig({ regions, options, }?: TDefineConfigArgs): TStorageBucketsConfig;
|
|
11
|
+
export { defineStorageBucketsConfig };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { clusterContexts, bucketRegions, bucketEnvironments } from "./constants.js";
|
|
2
|
+
export type TCloudEnvironment = (typeof clusterContexts)[keyof typeof clusterContexts];
|
|
3
|
+
export type TBucketEnvironment = (typeof bucketEnvironments)[keyof typeof bucketEnvironments];
|
|
4
|
+
export type TBucketRegion = (typeof bucketRegions)[keyof typeof bucketRegions];
|
|
1
5
|
export type TApplicationAssetsBucketConfig = {
|
|
2
|
-
bucketRegion:
|
|
6
|
+
bucketRegion: TBucketRegion;
|
|
3
7
|
prNumber?: string;
|
|
4
8
|
applicationName: string;
|
|
5
9
|
};
|
|
6
10
|
export type TApplicationIndexBucketConfig = {
|
|
7
|
-
bucketRegion:
|
|
11
|
+
bucketRegion: TBucketRegion;
|
|
8
12
|
prNumber?: string;
|
|
9
13
|
applicationName: string;
|
|
10
|
-
bucketEnvironment:
|
|
14
|
+
bucketEnvironment: TBucketEnvironment;
|
|
11
15
|
};
|
|
12
16
|
export type TUploadScriptFile = {
|
|
13
17
|
fileName: string;
|
|
@@ -20,48 +24,63 @@ type TPaths = {
|
|
|
20
24
|
dotenvPath?: string;
|
|
21
25
|
assetsPath: string;
|
|
22
26
|
};
|
|
27
|
+
export type TStorageProviderTag = 'gs' | 's3';
|
|
28
|
+
export interface IStorageProvider {
|
|
29
|
+
getTag(): TStorageProviderTag;
|
|
30
|
+
getProtocol(): string;
|
|
31
|
+
getPublicBaseUrl(): string;
|
|
32
|
+
getCdnUrl(config: TApplicationAssetsBucketConfig): string;
|
|
33
|
+
getAssetsBucketUrl(config: TApplicationAssetsBucketConfig): string;
|
|
34
|
+
getApplicationIndexBucketUrl(config: TApplicationIndexBucketConfig): string;
|
|
35
|
+
}
|
|
36
|
+
export interface IUploadScriptsGenerator {
|
|
37
|
+
getProductionBundlesUploadScript(config: TCreateApplicationAssetsUploadScript): string;
|
|
38
|
+
getApplicationIndexUploadScript(config: TCreateApplicationIndexUploadScript): string;
|
|
39
|
+
}
|
|
23
40
|
export type TCompileEnvApplicationIndexes = {
|
|
24
41
|
cliFlags: TCompileDeploymentsFlags;
|
|
42
|
+
storageProvider: IStorageProvider;
|
|
43
|
+
uploadScriptsGenerator: IUploadScriptsGenerator;
|
|
25
44
|
paths: TPaths;
|
|
26
|
-
bucketRegion:
|
|
27
|
-
cloudEnvironment:
|
|
28
|
-
bucketEnvironment:
|
|
45
|
+
bucketRegion: TBucketRegion;
|
|
46
|
+
cloudEnvironment: TCloudEnvironment;
|
|
47
|
+
bucketEnvironment: TBucketEnvironment;
|
|
29
48
|
};
|
|
30
49
|
export type TCompileApplicationAssets = {
|
|
31
50
|
cliFlags: TCompileDeploymentsFlags;
|
|
51
|
+
storageProvider: IStorageProvider;
|
|
52
|
+
uploadScriptsGenerator: IUploadScriptsGenerator;
|
|
32
53
|
paths: TPaths;
|
|
33
|
-
bucketRegion:
|
|
54
|
+
bucketRegion: TBucketRegion;
|
|
34
55
|
};
|
|
35
|
-
type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
bucketEnvironment: string;
|
|
40
|
-
};
|
|
41
|
-
export type TBucketEnvironmentConfig = TCollapsedBucketEnvironmentConfig | TExpandedBucketEnvironmentConfig;
|
|
42
|
-
export type TGoogleStorageBucketsConfig = {
|
|
43
|
-
[key: TBucketRegion]: TBucketEnvironmentConfig[];
|
|
56
|
+
export type TBucketEnvironmentConfig = {
|
|
57
|
+
cloudEnvironment: TCloudEnvironment;
|
|
58
|
+
bucketEnvironment: TBucketEnvironment;
|
|
59
|
+
storageProviders?: TStorageProviderTag[];
|
|
44
60
|
};
|
|
61
|
+
export type TStorageBucketsConfig = Record<TBucketRegion, TBucketEnvironmentConfig[]>;
|
|
45
62
|
export type TCosmiconfigResult = {
|
|
46
|
-
config:
|
|
63
|
+
config: TStorageBucketsConfig;
|
|
47
64
|
};
|
|
48
65
|
export type TCreateApplicationIndexUploadScript = {
|
|
49
66
|
packageManagerName: string;
|
|
67
|
+
storageProvider: IStorageProvider;
|
|
50
68
|
bucketUrl: string;
|
|
51
69
|
cdnUrl: string;
|
|
52
|
-
bucketEnvironment:
|
|
70
|
+
bucketEnvironment: TBucketEnvironment;
|
|
53
71
|
buildRevision: string;
|
|
54
72
|
buildNumber: number;
|
|
55
73
|
applicationIndexOutFile: string;
|
|
56
74
|
};
|
|
57
75
|
export type TCreateApplicationAssetsUploadScript = {
|
|
76
|
+
storageProvider: IStorageProvider;
|
|
58
77
|
bucketUrl: string;
|
|
59
78
|
assetsPath: string;
|
|
60
79
|
skipMenu: boolean;
|
|
61
80
|
};
|
|
62
81
|
export type TLoadDotDev = {
|
|
63
82
|
dotenvPath?: string;
|
|
64
|
-
cloudEnvironment:
|
|
83
|
+
cloudEnvironment: TCloudEnvironment;
|
|
65
84
|
};
|
|
66
85
|
export type TLocalizedField = {
|
|
67
86
|
locale: string;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
4
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
5
|
+
var tsDeepmerge = require('ts-deepmerge');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
10
|
+
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
11
|
+
|
|
12
|
+
const clusterContexts = {
|
|
13
|
+
'ctp_staging_gcp_europe-west1_v1': 'ctp_staging_gcp_europe-west1_v1',
|
|
14
|
+
'vw_staging_aws_eu-central-1_v1': 'vw_staging_aws_eu-central-1_v1',
|
|
15
|
+
'ctp_staging_aws_cn-northwest-1_v1': 'ctp_staging_aws_cn-northwest-1_v1',
|
|
16
|
+
'ctp_testing_performance_gcp_europe-west1_v1': 'ctp_testing_performance_gcp_europe-west1_v1',
|
|
17
|
+
'ctp_production_aws_eu-central-1_v1': 'ctp_production_aws_eu-central-1_v1',
|
|
18
|
+
'ctp_production_gcp_europe-west1_v1': 'ctp_production_gcp_europe-west1_v1',
|
|
19
|
+
'vw_production_aws_eu-central-1_v1': 'vw_production_aws_eu-central-1_v1',
|
|
20
|
+
'att_production_aws_us-east-1_v1': 'att_production_aws_us-east-1_v1',
|
|
21
|
+
'ctp_production_aws_us-east-2_v1': 'ctp_production_aws_us-east-2_v1',
|
|
22
|
+
'ctp_production_gcp_us-central1_v1': 'ctp_production_gcp_us-central1_v1',
|
|
23
|
+
'ctp_production_gcp_australia-southeast1_v1': 'ctp_production_gcp_australia-southeast1_v1',
|
|
24
|
+
'ctp_production_aws_cn-northwest-1_v1': 'ctp_production_aws_cn-northwest-1_v1'
|
|
25
|
+
};
|
|
26
|
+
const bucketEnvironments = {
|
|
27
|
+
'ctp-gcp-staging': 'ctp-gcp-staging',
|
|
28
|
+
'ctp-vw-staging-eu': 'ctp-vw-staging-eu',
|
|
29
|
+
'ctp-aws-staging-cn': 'ctp-aws-staging-cn',
|
|
30
|
+
'ctp-gcp-testing-performance-eu': 'ctp-gcp-testing-performance-eu',
|
|
31
|
+
'ctp-aws-production-fra': 'ctp-aws-production-fra',
|
|
32
|
+
'ctp-gcp-production-eu': 'ctp-gcp-production-eu',
|
|
33
|
+
'ctp-vw-production-eu': 'ctp-vw-production-eu',
|
|
34
|
+
'ctp-att-production-va': 'ctp-att-production-va',
|
|
35
|
+
'ctp-aws-production-ohio': 'ctp-aws-production-ohio',
|
|
36
|
+
'ctp-gcp-production-us': 'ctp-gcp-production-us',
|
|
37
|
+
'ctp-gcp-production-au': 'ctp-gcp-production-au',
|
|
38
|
+
'ctp-aws-production-cn': 'ctp-aws-production-cn'
|
|
39
|
+
};
|
|
40
|
+
const bucketRegions = {
|
|
41
|
+
previews: 'merchant-center-previews',
|
|
42
|
+
europe: 'merchant-center-europe',
|
|
43
|
+
northAmerica: 'merchant-center-north-america',
|
|
44
|
+
asia: 'merchant-center-asia'
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const defaultConfig = {
|
|
48
|
+
[bucketRegions.previews]: [{
|
|
49
|
+
cloudEnvironment: clusterContexts['ctp_staging_gcp_europe-west1_v1'],
|
|
50
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-staging']
|
|
51
|
+
}, {
|
|
52
|
+
cloudEnvironment: clusterContexts['vw_staging_aws_eu-central-1_v1'],
|
|
53
|
+
bucketEnvironment: bucketEnvironments['ctp-vw-staging-eu']
|
|
54
|
+
}, {
|
|
55
|
+
cloudEnvironment: clusterContexts['ctp_staging_aws_cn-northwest-1_v1'],
|
|
56
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-staging-cn']
|
|
57
|
+
}, {
|
|
58
|
+
cloudEnvironment: clusterContexts['ctp_testing_performance_gcp_europe-west1_v1'],
|
|
59
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-testing-performance-eu']
|
|
60
|
+
}],
|
|
61
|
+
[bucketRegions.europe]: [{
|
|
62
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_eu-central-1_v1'],
|
|
63
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra']
|
|
64
|
+
}, {
|
|
65
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_europe-west1_v1'],
|
|
66
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-eu']
|
|
67
|
+
}, {
|
|
68
|
+
cloudEnvironment: clusterContexts['vw_production_aws_eu-central-1_v1'],
|
|
69
|
+
bucketEnvironment: bucketEnvironments['ctp-vw-production-eu']
|
|
70
|
+
}],
|
|
71
|
+
[bucketRegions.northAmerica]: [{
|
|
72
|
+
cloudEnvironment: clusterContexts['att_production_aws_us-east-1_v1'],
|
|
73
|
+
bucketEnvironment: bucketEnvironments['ctp-att-production-va']
|
|
74
|
+
}, {
|
|
75
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_us-east-2_v1'],
|
|
76
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio']
|
|
77
|
+
}, {
|
|
78
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_us-central1_v1'],
|
|
79
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-us']
|
|
80
|
+
}],
|
|
81
|
+
[bucketRegions.asia]: [{
|
|
82
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_australia-southeast1_v1'],
|
|
83
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-au']
|
|
84
|
+
}, {
|
|
85
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_cn-northwest-1_v1'],
|
|
86
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-cn']
|
|
87
|
+
}]
|
|
88
|
+
};
|
|
89
|
+
function defineStorageBucketsConfig() {
|
|
90
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
91
|
+
regions = _ref.regions,
|
|
92
|
+
options = _ref.options;
|
|
93
|
+
const actualConfig = regions ? tsDeepmerge.merge(defaultConfig, regions) : defaultConfig;
|
|
94
|
+
const disabledBucketRegions = options?.disabledBucketRegions ?? [];
|
|
95
|
+
const disabledEnvironments = options?.disabledEnvironments ?? [];
|
|
96
|
+
_forEachInstanceProperty__default["default"](disabledBucketRegions).call(disabledBucketRegions, disabledBucketRegion => {
|
|
97
|
+
delete actualConfig[disabledBucketRegion];
|
|
98
|
+
});
|
|
99
|
+
const allBucketRegions = _Object$keys__default["default"](actualConfig);
|
|
100
|
+
_forEachInstanceProperty__default["default"](disabledEnvironments).call(disabledEnvironments, disabledEnvrionment => {
|
|
101
|
+
_forEachInstanceProperty__default["default"](allBucketRegions).call(allBucketRegions, bucketRegionToBeRemoved => {
|
|
102
|
+
actualConfig[bucketRegionToBeRemoved] = actualConfig[bucketRegionToBeRemoved]?.filter(bucketEnvironmentConfig => bucketEnvironmentConfig.cloudEnvironment !== disabledEnvrionment);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
return actualConfig;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.bucketEnvironments = bucketEnvironments;
|
|
109
|
+
exports.bucketRegions = bucketRegions;
|
|
110
|
+
exports.clusterContexts = clusterContexts;
|
|
111
|
+
exports.defineStorageBucketsConfig = defineStorageBucketsConfig;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
4
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
5
|
+
var tsDeepmerge = require('ts-deepmerge');
|
|
6
|
+
|
|
7
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
10
|
+
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
11
|
+
|
|
12
|
+
const clusterContexts = {
|
|
13
|
+
'ctp_staging_gcp_europe-west1_v1': 'ctp_staging_gcp_europe-west1_v1',
|
|
14
|
+
'vw_staging_aws_eu-central-1_v1': 'vw_staging_aws_eu-central-1_v1',
|
|
15
|
+
'ctp_staging_aws_cn-northwest-1_v1': 'ctp_staging_aws_cn-northwest-1_v1',
|
|
16
|
+
'ctp_testing_performance_gcp_europe-west1_v1': 'ctp_testing_performance_gcp_europe-west1_v1',
|
|
17
|
+
'ctp_production_aws_eu-central-1_v1': 'ctp_production_aws_eu-central-1_v1',
|
|
18
|
+
'ctp_production_gcp_europe-west1_v1': 'ctp_production_gcp_europe-west1_v1',
|
|
19
|
+
'vw_production_aws_eu-central-1_v1': 'vw_production_aws_eu-central-1_v1',
|
|
20
|
+
'att_production_aws_us-east-1_v1': 'att_production_aws_us-east-1_v1',
|
|
21
|
+
'ctp_production_aws_us-east-2_v1': 'ctp_production_aws_us-east-2_v1',
|
|
22
|
+
'ctp_production_gcp_us-central1_v1': 'ctp_production_gcp_us-central1_v1',
|
|
23
|
+
'ctp_production_gcp_australia-southeast1_v1': 'ctp_production_gcp_australia-southeast1_v1',
|
|
24
|
+
'ctp_production_aws_cn-northwest-1_v1': 'ctp_production_aws_cn-northwest-1_v1'
|
|
25
|
+
};
|
|
26
|
+
const bucketEnvironments = {
|
|
27
|
+
'ctp-gcp-staging': 'ctp-gcp-staging',
|
|
28
|
+
'ctp-vw-staging-eu': 'ctp-vw-staging-eu',
|
|
29
|
+
'ctp-aws-staging-cn': 'ctp-aws-staging-cn',
|
|
30
|
+
'ctp-gcp-testing-performance-eu': 'ctp-gcp-testing-performance-eu',
|
|
31
|
+
'ctp-aws-production-fra': 'ctp-aws-production-fra',
|
|
32
|
+
'ctp-gcp-production-eu': 'ctp-gcp-production-eu',
|
|
33
|
+
'ctp-vw-production-eu': 'ctp-vw-production-eu',
|
|
34
|
+
'ctp-att-production-va': 'ctp-att-production-va',
|
|
35
|
+
'ctp-aws-production-ohio': 'ctp-aws-production-ohio',
|
|
36
|
+
'ctp-gcp-production-us': 'ctp-gcp-production-us',
|
|
37
|
+
'ctp-gcp-production-au': 'ctp-gcp-production-au',
|
|
38
|
+
'ctp-aws-production-cn': 'ctp-aws-production-cn'
|
|
39
|
+
};
|
|
40
|
+
const bucketRegions = {
|
|
41
|
+
previews: 'merchant-center-previews',
|
|
42
|
+
europe: 'merchant-center-europe',
|
|
43
|
+
northAmerica: 'merchant-center-north-america',
|
|
44
|
+
asia: 'merchant-center-asia'
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const defaultConfig = {
|
|
48
|
+
[bucketRegions.previews]: [{
|
|
49
|
+
cloudEnvironment: clusterContexts['ctp_staging_gcp_europe-west1_v1'],
|
|
50
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-staging']
|
|
51
|
+
}, {
|
|
52
|
+
cloudEnvironment: clusterContexts['vw_staging_aws_eu-central-1_v1'],
|
|
53
|
+
bucketEnvironment: bucketEnvironments['ctp-vw-staging-eu']
|
|
54
|
+
}, {
|
|
55
|
+
cloudEnvironment: clusterContexts['ctp_staging_aws_cn-northwest-1_v1'],
|
|
56
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-staging-cn']
|
|
57
|
+
}, {
|
|
58
|
+
cloudEnvironment: clusterContexts['ctp_testing_performance_gcp_europe-west1_v1'],
|
|
59
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-testing-performance-eu']
|
|
60
|
+
}],
|
|
61
|
+
[bucketRegions.europe]: [{
|
|
62
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_eu-central-1_v1'],
|
|
63
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra']
|
|
64
|
+
}, {
|
|
65
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_europe-west1_v1'],
|
|
66
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-eu']
|
|
67
|
+
}, {
|
|
68
|
+
cloudEnvironment: clusterContexts['vw_production_aws_eu-central-1_v1'],
|
|
69
|
+
bucketEnvironment: bucketEnvironments['ctp-vw-production-eu']
|
|
70
|
+
}],
|
|
71
|
+
[bucketRegions.northAmerica]: [{
|
|
72
|
+
cloudEnvironment: clusterContexts['att_production_aws_us-east-1_v1'],
|
|
73
|
+
bucketEnvironment: bucketEnvironments['ctp-att-production-va']
|
|
74
|
+
}, {
|
|
75
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_us-east-2_v1'],
|
|
76
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio']
|
|
77
|
+
}, {
|
|
78
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_us-central1_v1'],
|
|
79
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-us']
|
|
80
|
+
}],
|
|
81
|
+
[bucketRegions.asia]: [{
|
|
82
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_australia-southeast1_v1'],
|
|
83
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-au']
|
|
84
|
+
}, {
|
|
85
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_cn-northwest-1_v1'],
|
|
86
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-cn']
|
|
87
|
+
}]
|
|
88
|
+
};
|
|
89
|
+
function defineStorageBucketsConfig() {
|
|
90
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
91
|
+
regions = _ref.regions,
|
|
92
|
+
options = _ref.options;
|
|
93
|
+
const actualConfig = regions ? tsDeepmerge.merge(defaultConfig, regions) : defaultConfig;
|
|
94
|
+
const disabledBucketRegions = options?.disabledBucketRegions ?? [];
|
|
95
|
+
const disabledEnvironments = options?.disabledEnvironments ?? [];
|
|
96
|
+
_forEachInstanceProperty__default["default"](disabledBucketRegions).call(disabledBucketRegions, disabledBucketRegion => {
|
|
97
|
+
delete actualConfig[disabledBucketRegion];
|
|
98
|
+
});
|
|
99
|
+
const allBucketRegions = _Object$keys__default["default"](actualConfig);
|
|
100
|
+
_forEachInstanceProperty__default["default"](disabledEnvironments).call(disabledEnvironments, disabledEnvrionment => {
|
|
101
|
+
_forEachInstanceProperty__default["default"](allBucketRegions).call(allBucketRegions, bucketRegionToBeRemoved => {
|
|
102
|
+
actualConfig[bucketRegionToBeRemoved] = actualConfig[bucketRegionToBeRemoved]?.filter(bucketEnvironmentConfig => bucketEnvironmentConfig.cloudEnvironment !== disabledEnvrionment);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
return actualConfig;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
exports.bucketEnvironments = bucketEnvironments;
|
|
109
|
+
exports.bucketRegions = bucketRegions;
|
|
110
|
+
exports.clusterContexts = clusterContexts;
|
|
111
|
+
exports.defineStorageBucketsConfig = defineStorageBucketsConfig;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
|
|
2
|
+
import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
|
|
3
|
+
import { merge } from 'ts-deepmerge';
|
|
4
|
+
|
|
5
|
+
const clusterContexts = {
|
|
6
|
+
'ctp_staging_gcp_europe-west1_v1': 'ctp_staging_gcp_europe-west1_v1',
|
|
7
|
+
'vw_staging_aws_eu-central-1_v1': 'vw_staging_aws_eu-central-1_v1',
|
|
8
|
+
'ctp_staging_aws_cn-northwest-1_v1': 'ctp_staging_aws_cn-northwest-1_v1',
|
|
9
|
+
'ctp_testing_performance_gcp_europe-west1_v1': 'ctp_testing_performance_gcp_europe-west1_v1',
|
|
10
|
+
'ctp_production_aws_eu-central-1_v1': 'ctp_production_aws_eu-central-1_v1',
|
|
11
|
+
'ctp_production_gcp_europe-west1_v1': 'ctp_production_gcp_europe-west1_v1',
|
|
12
|
+
'vw_production_aws_eu-central-1_v1': 'vw_production_aws_eu-central-1_v1',
|
|
13
|
+
'att_production_aws_us-east-1_v1': 'att_production_aws_us-east-1_v1',
|
|
14
|
+
'ctp_production_aws_us-east-2_v1': 'ctp_production_aws_us-east-2_v1',
|
|
15
|
+
'ctp_production_gcp_us-central1_v1': 'ctp_production_gcp_us-central1_v1',
|
|
16
|
+
'ctp_production_gcp_australia-southeast1_v1': 'ctp_production_gcp_australia-southeast1_v1',
|
|
17
|
+
'ctp_production_aws_cn-northwest-1_v1': 'ctp_production_aws_cn-northwest-1_v1'
|
|
18
|
+
};
|
|
19
|
+
const bucketEnvironments = {
|
|
20
|
+
'ctp-gcp-staging': 'ctp-gcp-staging',
|
|
21
|
+
'ctp-vw-staging-eu': 'ctp-vw-staging-eu',
|
|
22
|
+
'ctp-aws-staging-cn': 'ctp-aws-staging-cn',
|
|
23
|
+
'ctp-gcp-testing-performance-eu': 'ctp-gcp-testing-performance-eu',
|
|
24
|
+
'ctp-aws-production-fra': 'ctp-aws-production-fra',
|
|
25
|
+
'ctp-gcp-production-eu': 'ctp-gcp-production-eu',
|
|
26
|
+
'ctp-vw-production-eu': 'ctp-vw-production-eu',
|
|
27
|
+
'ctp-att-production-va': 'ctp-att-production-va',
|
|
28
|
+
'ctp-aws-production-ohio': 'ctp-aws-production-ohio',
|
|
29
|
+
'ctp-gcp-production-us': 'ctp-gcp-production-us',
|
|
30
|
+
'ctp-gcp-production-au': 'ctp-gcp-production-au',
|
|
31
|
+
'ctp-aws-production-cn': 'ctp-aws-production-cn'
|
|
32
|
+
};
|
|
33
|
+
const bucketRegions = {
|
|
34
|
+
previews: 'merchant-center-previews',
|
|
35
|
+
europe: 'merchant-center-europe',
|
|
36
|
+
northAmerica: 'merchant-center-north-america',
|
|
37
|
+
asia: 'merchant-center-asia'
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const defaultConfig = {
|
|
41
|
+
[bucketRegions.previews]: [{
|
|
42
|
+
cloudEnvironment: clusterContexts['ctp_staging_gcp_europe-west1_v1'],
|
|
43
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-staging']
|
|
44
|
+
}, {
|
|
45
|
+
cloudEnvironment: clusterContexts['vw_staging_aws_eu-central-1_v1'],
|
|
46
|
+
bucketEnvironment: bucketEnvironments['ctp-vw-staging-eu']
|
|
47
|
+
}, {
|
|
48
|
+
cloudEnvironment: clusterContexts['ctp_staging_aws_cn-northwest-1_v1'],
|
|
49
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-staging-cn']
|
|
50
|
+
}, {
|
|
51
|
+
cloudEnvironment: clusterContexts['ctp_testing_performance_gcp_europe-west1_v1'],
|
|
52
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-testing-performance-eu']
|
|
53
|
+
}],
|
|
54
|
+
[bucketRegions.europe]: [{
|
|
55
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_eu-central-1_v1'],
|
|
56
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-fra']
|
|
57
|
+
}, {
|
|
58
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_europe-west1_v1'],
|
|
59
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-eu']
|
|
60
|
+
}, {
|
|
61
|
+
cloudEnvironment: clusterContexts['vw_production_aws_eu-central-1_v1'],
|
|
62
|
+
bucketEnvironment: bucketEnvironments['ctp-vw-production-eu']
|
|
63
|
+
}],
|
|
64
|
+
[bucketRegions.northAmerica]: [{
|
|
65
|
+
cloudEnvironment: clusterContexts['att_production_aws_us-east-1_v1'],
|
|
66
|
+
bucketEnvironment: bucketEnvironments['ctp-att-production-va']
|
|
67
|
+
}, {
|
|
68
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_us-east-2_v1'],
|
|
69
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-ohio']
|
|
70
|
+
}, {
|
|
71
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_us-central1_v1'],
|
|
72
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-us']
|
|
73
|
+
}],
|
|
74
|
+
[bucketRegions.asia]: [{
|
|
75
|
+
cloudEnvironment: clusterContexts['ctp_production_gcp_australia-southeast1_v1'],
|
|
76
|
+
bucketEnvironment: bucketEnvironments['ctp-gcp-production-au']
|
|
77
|
+
}, {
|
|
78
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_cn-northwest-1_v1'],
|
|
79
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-cn']
|
|
80
|
+
}]
|
|
81
|
+
};
|
|
82
|
+
function defineStorageBucketsConfig() {
|
|
83
|
+
let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
84
|
+
regions = _ref.regions,
|
|
85
|
+
options = _ref.options;
|
|
86
|
+
const actualConfig = regions ? merge(defaultConfig, regions) : defaultConfig;
|
|
87
|
+
const disabledBucketRegions = options?.disabledBucketRegions ?? [];
|
|
88
|
+
const disabledEnvironments = options?.disabledEnvironments ?? [];
|
|
89
|
+
_forEachInstanceProperty(disabledBucketRegions).call(disabledBucketRegions, disabledBucketRegion => {
|
|
90
|
+
delete actualConfig[disabledBucketRegion];
|
|
91
|
+
});
|
|
92
|
+
const allBucketRegions = _Object$keys(actualConfig);
|
|
93
|
+
_forEachInstanceProperty(disabledEnvironments).call(disabledEnvironments, disabledEnvrionment => {
|
|
94
|
+
_forEachInstanceProperty(allBucketRegions).call(allBucketRegions, bucketRegionToBeRemoved => {
|
|
95
|
+
actualConfig[bucketRegionToBeRemoved] = actualConfig[bucketRegionToBeRemoved]?.filter(bucketEnvironmentConfig => bucketEnvironmentConfig.cloudEnvironment !== disabledEnvrionment);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
return actualConfig;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { bucketRegions as a, bucketEnvironments as b, clusterContexts as c, defineStorageBucketsConfig as d };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/application-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Internal CLI to manage Merchant Center application deployments across various environments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"commercetools",
|
|
@@ -20,28 +20,28 @@
|
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/core": "^7.22.11",
|
|
23
|
-
"@babel/runtime": "^7.21.0",
|
|
24
23
|
"@babel/runtime-corejs3": "^7.21.0",
|
|
25
|
-
"@
|
|
26
|
-
"@commercetools-frontend/
|
|
27
|
-
"@commercetools-frontend/
|
|
24
|
+
"@babel/runtime": "^7.21.0",
|
|
25
|
+
"@commercetools-frontend/application-config": "22.16.0",
|
|
26
|
+
"@commercetools-frontend/constants": "22.16.0",
|
|
27
|
+
"@commercetools-frontend/l10n": "22.16.0",
|
|
28
28
|
"@manypkg/find-root": "2.2.1",
|
|
29
29
|
"cac": "^6.7.14",
|
|
30
|
-
"cosmiconfig": "
|
|
31
|
-
"dotenv": "16.3.
|
|
30
|
+
"cosmiconfig": "9.0.0",
|
|
31
|
+
"dotenv": "16.3.2",
|
|
32
32
|
"execa": "5.1.1",
|
|
33
33
|
"jsonschema": "^1.4.1",
|
|
34
|
-
"listr2": "
|
|
35
|
-
"node-fetch": "2.7.0"
|
|
34
|
+
"listr2": "8.0.1",
|
|
35
|
+
"node-fetch": "2.7.0",
|
|
36
|
+
"ts-deepmerge": "7.0.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@tsconfig/node20": "20.1.2",
|
|
39
|
-
"@types/node": "20.
|
|
40
|
-
"@types/node-fetch": "2.6.2",
|
|
40
|
+
"@types/node": "20.11.5",
|
|
41
41
|
"typescript": "5.2.2"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
44
|
+
"node": ">=18",
|
|
45
45
|
"npm": ">=6"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commercetools-frontend-application-cli-cli.cjs.d.ts","sourceRoot":"","sources":["../../dist/declarations/src/cli.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commercetools-frontend-application-cli.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|