@commercetools-frontend/application-cli 2.2.0 → 2.3.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 +242 -28
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.prod.js +242 -28
- package/cli/dist/commercetools-frontend-application-cli-cli.esm.js +242 -28
- package/dist/commercetools-frontend-application-cli.cjs.dev.js +3 -1
- package/dist/commercetools-frontend-application-cli.cjs.prod.js +3 -1
- package/dist/commercetools-frontend-application-cli.esm.js +1 -1
- package/dist/declarations/src/constants.d.ts +11 -0
- package/dist/declarations/src/types.d.ts +6 -2
- package/dist/{storage-buckets-config-06a6b7d2.cjs.prod.js → storage-buckets-config-28a1d76e.cjs.dev.js} +38 -4
- package/dist/{storage-buckets-config-7277eecb.esm.js → storage-buckets-config-705b6341.esm.js} +37 -5
- package/dist/{storage-buckets-config-30d0f671.cjs.dev.js → storage-buckets-config-e3ea6d6f.cjs.prod.js} +38 -4
- package/package.json +6 -6
|
@@ -13,7 +13,7 @@ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance
|
|
|
13
13
|
import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
14
14
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
15
15
|
import _flatMapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/flat-map';
|
|
16
|
-
import { s as storageProviders, l as loadStorageBucketsConfig, c as clusterContexts } from '../../dist/storage-buckets-config-
|
|
16
|
+
import { s as storageProviders, l as loadStorageBucketsConfig, c as clusterContexts } from '../../dist/storage-buckets-config-705b6341.esm.js';
|
|
17
17
|
import fs from 'node:fs';
|
|
18
18
|
import path$1 from 'node:path';
|
|
19
19
|
import { Listr } from 'listr2';
|
|
@@ -70,12 +70,12 @@ function _callSuper(_this, derived, args) {
|
|
|
70
70
|
derived = _getPrototypeOf(derived);
|
|
71
71
|
return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? _Reflect$construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
|
|
72
72
|
}
|
|
73
|
-
var _bucketRegion = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
73
|
+
var _bucketRegion$1 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
74
74
|
var _bucketEnvironment$1 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
75
75
|
let StorageProvider = /*#__PURE__*/function () {
|
|
76
76
|
function StorageProvider(config) {
|
|
77
77
|
_classCallCheck(this, StorageProvider);
|
|
78
|
-
_Object$defineProperty(this, _bucketRegion, {
|
|
78
|
+
_Object$defineProperty(this, _bucketRegion$1, {
|
|
79
79
|
writable: true,
|
|
80
80
|
value: void 0
|
|
81
81
|
});
|
|
@@ -83,7 +83,7 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
83
83
|
writable: true,
|
|
84
84
|
value: void 0
|
|
85
85
|
});
|
|
86
|
-
_classPrivateFieldLooseBase(this, _bucketRegion)[_bucketRegion] = config.bucketRegion;
|
|
86
|
+
_classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1] = config.bucketRegion;
|
|
87
87
|
_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1] = config.bucketEnvironment;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
@@ -112,18 +112,26 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
112
112
|
var _context;
|
|
113
113
|
let applicationName = _ref.applicationName,
|
|
114
114
|
bucketProtocol = _ref.bucketProtocol,
|
|
115
|
-
bucketNamespace = _ref.bucketNamespace
|
|
116
|
-
|
|
115
|
+
bucketNamespace = _ref.bucketNamespace,
|
|
116
|
+
tag = _ref.tag;
|
|
117
|
+
if (!_classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1]) {
|
|
118
|
+
throw new Error("'bucketRegion' is not defined. Required to determine 'assetsBucketUrl'.");
|
|
119
|
+
}
|
|
120
|
+
const storageProvider = storageProviders[tag];
|
|
121
|
+
const assetBuketUrl = storageProvider.urls.bucket?.[_classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1]] ?? _classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1];
|
|
122
|
+
const assetsBucketUrl = _filterInstanceProperty(_context = [assetBuketUrl, bucketNamespace, applicationName]).call(_context, Boolean).join('/');
|
|
117
123
|
return `${bucketProtocol}${assetsBucketUrl}`;
|
|
118
124
|
}
|
|
119
125
|
}, {
|
|
120
126
|
key: "getApplicationIndexBucketUrl",
|
|
121
127
|
value: function getApplicationIndexBucketUrl(_ref2) {
|
|
122
|
-
let
|
|
128
|
+
let tag = _ref2.tag,
|
|
129
|
+
prNumber = _ref2.prNumber,
|
|
123
130
|
applicationName = _ref2.applicationName,
|
|
124
131
|
bucketProtocol = _ref2.bucketProtocol,
|
|
125
132
|
bucketNamespace = _ref2.bucketNamespace;
|
|
126
133
|
const applicationAssetsBucketUrl = this.getAssetsBucketUrl({
|
|
134
|
+
tag,
|
|
127
135
|
applicationName,
|
|
128
136
|
prNumber,
|
|
129
137
|
bucketProtocol,
|
|
@@ -138,40 +146,41 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
138
146
|
var _context2;
|
|
139
147
|
let applicationName = _ref3.applicationName,
|
|
140
148
|
prNumber = _ref3.prNumber,
|
|
141
|
-
publicBaseUrl = _ref3.publicBaseUrl
|
|
142
|
-
|
|
149
|
+
publicBaseUrl = _ref3.publicBaseUrl,
|
|
150
|
+
excludeBucketRegion = _ref3.excludeBucketRegion;
|
|
151
|
+
return _filterInstanceProperty(_context2 = [publicBaseUrl, excludeBucketRegion ? null : _classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1], this.getBucketNamespace(prNumber), applicationName]).call(_context2, Boolean).join('/');
|
|
143
152
|
}
|
|
144
153
|
}, {
|
|
145
154
|
key: "getPublicBaseUrl",
|
|
146
155
|
value: function getPublicBaseUrl(tag) {
|
|
147
156
|
if (!_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]) {
|
|
148
|
-
throw new Error("'bucketEnvironment is not defined. Required to determine 'publicBaseUrl'.");
|
|
157
|
+
throw new Error("'bucketEnvironment' is not defined. Required to determine 'publicBaseUrl'.");
|
|
149
158
|
}
|
|
150
159
|
const storageProvider = storageProviders[tag];
|
|
151
|
-
const publicBaseUrl = storageProvider.urls[_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]] ?? storageProvider.urls.default;
|
|
160
|
+
const publicBaseUrl = storageProvider.urls.public[_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]] ?? storageProvider.urls.public.default;
|
|
152
161
|
return publicBaseUrl;
|
|
153
162
|
}
|
|
154
163
|
}]);
|
|
155
164
|
return StorageProvider;
|
|
156
165
|
}();
|
|
157
|
-
var _bucketRegion2 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
158
|
-
var _bucketEnvironment2 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
166
|
+
var _bucketRegion2$1 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
167
|
+
var _bucketEnvironment2$1 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
159
168
|
let GoogleStorageProvider = /*#__PURE__*/function (_StorageProvider) {
|
|
160
169
|
_inherits(GoogleStorageProvider, _StorageProvider);
|
|
161
170
|
function GoogleStorageProvider(config) {
|
|
162
171
|
var _this;
|
|
163
172
|
_classCallCheck(this, GoogleStorageProvider);
|
|
164
173
|
_this = _callSuper(this, GoogleStorageProvider, [config]);
|
|
165
|
-
_Object$defineProperty(_assertThisInitialized(_this), _bucketRegion2, {
|
|
174
|
+
_Object$defineProperty(_assertThisInitialized(_this), _bucketRegion2$1, {
|
|
166
175
|
writable: true,
|
|
167
176
|
value: void 0
|
|
168
177
|
});
|
|
169
|
-
_Object$defineProperty(_assertThisInitialized(_this), _bucketEnvironment2, {
|
|
178
|
+
_Object$defineProperty(_assertThisInitialized(_this), _bucketEnvironment2$1, {
|
|
170
179
|
writable: true,
|
|
171
180
|
value: void 0
|
|
172
181
|
});
|
|
173
|
-
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _bucketRegion2)[_bucketRegion2] = config.bucketRegion;
|
|
174
|
-
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _bucketEnvironment2)[_bucketEnvironment2] = config.bucketEnvironment;
|
|
182
|
+
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _bucketRegion2$1)[_bucketRegion2$1] = config.bucketRegion;
|
|
183
|
+
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _bucketEnvironment2$1)[_bucketEnvironment2$1] = config.bucketEnvironment;
|
|
175
184
|
return _this;
|
|
176
185
|
}
|
|
177
186
|
_createClass(GoogleStorageProvider, [{
|
|
@@ -182,12 +191,12 @@ let GoogleStorageProvider = /*#__PURE__*/function (_StorageProvider) {
|
|
|
182
191
|
}, {
|
|
183
192
|
key: "getBucketRegion",
|
|
184
193
|
value: function getBucketRegion() {
|
|
185
|
-
return _classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2];
|
|
194
|
+
return _classPrivateFieldLooseBase(this, _bucketRegion2$1)[_bucketRegion2$1];
|
|
186
195
|
}
|
|
187
196
|
}, {
|
|
188
197
|
key: "getBucketEnvironment",
|
|
189
198
|
value: function getBucketEnvironment() {
|
|
190
|
-
return _classPrivateFieldLooseBase(this, _bucketEnvironment2)[_bucketEnvironment2];
|
|
199
|
+
return _classPrivateFieldLooseBase(this, _bucketEnvironment2$1)[_bucketEnvironment2$1];
|
|
191
200
|
}
|
|
192
201
|
}, {
|
|
193
202
|
key: "getProtocol",
|
|
@@ -210,6 +219,7 @@ let GoogleStorageProvider = /*#__PURE__*/function (_StorageProvider) {
|
|
|
210
219
|
key: "getAssetsBucketUrl",
|
|
211
220
|
value: function getAssetsBucketUrl(config) {
|
|
212
221
|
return _get(_getPrototypeOf(GoogleStorageProvider.prototype), "getAssetsBucketUrl", this).call(this, _objectSpread$4({
|
|
222
|
+
tag: this.getTag(),
|
|
213
223
|
bucketProtocol: this.getProtocol(),
|
|
214
224
|
bucketNamespace: _get(_getPrototypeOf(GoogleStorageProvider.prototype), "getBucketNamespace", this).call(this, config.prNumber)
|
|
215
225
|
}, config));
|
|
@@ -218,23 +228,101 @@ let GoogleStorageProvider = /*#__PURE__*/function (_StorageProvider) {
|
|
|
218
228
|
key: "getApplicationIndexBucketUrl",
|
|
219
229
|
value: function getApplicationIndexBucketUrl(config) {
|
|
220
230
|
return _get(_getPrototypeOf(GoogleStorageProvider.prototype), "getApplicationIndexBucketUrl", this).call(this, _objectSpread$4({
|
|
231
|
+
tag: this.getTag(),
|
|
221
232
|
bucketProtocol: this.getProtocol(),
|
|
222
233
|
bucketNamespace: _get(_getPrototypeOf(GoogleStorageProvider.prototype), "getBucketNamespace", this).call(this, config.prNumber)
|
|
223
234
|
}, config));
|
|
224
235
|
}
|
|
225
236
|
}]);
|
|
226
237
|
return GoogleStorageProvider;
|
|
227
|
-
}(StorageProvider);
|
|
238
|
+
}(StorageProvider);
|
|
239
|
+
var _bucketRegion3 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
240
|
+
var _bucketEnvironment3 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
241
|
+
let AwsStorageProvider = /*#__PURE__*/function (_StorageProvider2) {
|
|
242
|
+
_inherits(AwsStorageProvider, _StorageProvider2);
|
|
243
|
+
function AwsStorageProvider(config) {
|
|
244
|
+
var _this2;
|
|
245
|
+
_classCallCheck(this, AwsStorageProvider);
|
|
246
|
+
_this2 = _callSuper(this, AwsStorageProvider, [config]);
|
|
247
|
+
_Object$defineProperty(_assertThisInitialized(_this2), _bucketRegion3, {
|
|
248
|
+
writable: true,
|
|
249
|
+
value: void 0
|
|
250
|
+
});
|
|
251
|
+
_Object$defineProperty(_assertThisInitialized(_this2), _bucketEnvironment3, {
|
|
252
|
+
writable: true,
|
|
253
|
+
value: void 0
|
|
254
|
+
});
|
|
255
|
+
_classPrivateFieldLooseBase(_assertThisInitialized(_this2), _bucketRegion3)[_bucketRegion3] = config.bucketRegion;
|
|
256
|
+
_classPrivateFieldLooseBase(_assertThisInitialized(_this2), _bucketEnvironment3)[_bucketEnvironment3] = config.bucketEnvironment;
|
|
257
|
+
return _this2;
|
|
258
|
+
}
|
|
259
|
+
_createClass(AwsStorageProvider, [{
|
|
260
|
+
key: "getTag",
|
|
261
|
+
value: function getTag() {
|
|
262
|
+
return 's3';
|
|
263
|
+
}
|
|
264
|
+
}, {
|
|
265
|
+
key: "getBucketRegion",
|
|
266
|
+
value: function getBucketRegion() {
|
|
267
|
+
return _classPrivateFieldLooseBase(this, _bucketRegion3)[_bucketRegion3];
|
|
268
|
+
}
|
|
269
|
+
}, {
|
|
270
|
+
key: "getBucketEnvironment",
|
|
271
|
+
value: function getBucketEnvironment() {
|
|
272
|
+
return _classPrivateFieldLooseBase(this, _bucketEnvironment3)[_bucketEnvironment3];
|
|
273
|
+
}
|
|
274
|
+
}, {
|
|
275
|
+
key: "getProtocol",
|
|
276
|
+
value: function getProtocol() {
|
|
277
|
+
return 's3://';
|
|
278
|
+
}
|
|
279
|
+
}, {
|
|
280
|
+
key: "getPublicBaseUrl",
|
|
281
|
+
value: function getPublicBaseUrl() {
|
|
282
|
+
return _get(_getPrototypeOf(AwsStorageProvider.prototype), "getPublicBaseUrl", this).call(this, this.getTag());
|
|
283
|
+
}
|
|
284
|
+
}, {
|
|
285
|
+
key: "getCdnUrl",
|
|
286
|
+
value: function getCdnUrl(config) {
|
|
287
|
+
return _get(_getPrototypeOf(AwsStorageProvider.prototype), "getCdnUrl", this).call(this, _objectSpread$4({
|
|
288
|
+
publicBaseUrl: this.getPublicBaseUrl(),
|
|
289
|
+
excludeBucketRegion: true
|
|
290
|
+
}, config));
|
|
291
|
+
}
|
|
292
|
+
}, {
|
|
293
|
+
key: "getAssetsBucketUrl",
|
|
294
|
+
value: function getAssetsBucketUrl(config) {
|
|
295
|
+
return _get(_getPrototypeOf(AwsStorageProvider.prototype), "getAssetsBucketUrl", this).call(this, _objectSpread$4({
|
|
296
|
+
tag: this.getTag(),
|
|
297
|
+
bucketProtocol: this.getProtocol(),
|
|
298
|
+
bucketNamespace: _get(_getPrototypeOf(AwsStorageProvider.prototype), "getBucketNamespace", this).call(this, config.prNumber)
|
|
299
|
+
}, config));
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
key: "getApplicationIndexBucketUrl",
|
|
303
|
+
value: function getApplicationIndexBucketUrl(config) {
|
|
304
|
+
return _get(_getPrototypeOf(AwsStorageProvider.prototype), "getApplicationIndexBucketUrl", this).call(this, _objectSpread$4({
|
|
305
|
+
tag: this.getTag(),
|
|
306
|
+
bucketProtocol: this.getProtocol(),
|
|
307
|
+
bucketNamespace: _get(_getPrototypeOf(AwsStorageProvider.prototype), "getBucketNamespace", this).call(this, config.prNumber)
|
|
308
|
+
}, config));
|
|
309
|
+
}
|
|
310
|
+
}]);
|
|
311
|
+
return AwsStorageProvider;
|
|
312
|
+
}(StorageProvider);
|
|
228
313
|
function getStorageProvider(storageProvider, config) {
|
|
229
314
|
switch (storageProvider) {
|
|
230
315
|
case 'gs':
|
|
231
316
|
return new GoogleStorageProvider(config);
|
|
317
|
+
case 's3':
|
|
318
|
+
return new AwsStorageProvider(config);
|
|
232
319
|
default:
|
|
233
320
|
throw new Error(`Storage provider ${storageProvider} not supported`);
|
|
234
321
|
}
|
|
235
322
|
}
|
|
236
323
|
|
|
237
324
|
var _bucketEnvironment = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
325
|
+
var _bucketRegion = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
238
326
|
let GoogleStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
239
327
|
function GoogleStorageUploadScriptsGenerator(config) {
|
|
240
328
|
_classCallCheck(this, GoogleStorageUploadScriptsGenerator);
|
|
@@ -242,6 +330,11 @@ let GoogleStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
|
242
330
|
writable: true,
|
|
243
331
|
value: void 0
|
|
244
332
|
});
|
|
333
|
+
_Object$defineProperty(this, _bucketRegion, {
|
|
334
|
+
writable: true,
|
|
335
|
+
value: void 0
|
|
336
|
+
});
|
|
337
|
+
_classPrivateFieldLooseBase(this, _bucketRegion)[_bucketRegion] = config.bucketRegion;
|
|
245
338
|
_classPrivateFieldLooseBase(this, _bucketEnvironment)[_bucketEnvironment] = config.bucketEnvironment;
|
|
246
339
|
}
|
|
247
340
|
_createClass(GoogleStorageUploadScriptsGenerator, [{
|
|
@@ -359,11 +452,130 @@ fi
|
|
|
359
452
|
}
|
|
360
453
|
}]);
|
|
361
454
|
return GoogleStorageUploadScriptsGenerator;
|
|
362
|
-
}();
|
|
455
|
+
}();
|
|
456
|
+
var _bucketEnvironment2 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
457
|
+
var _bucketRegion2 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
458
|
+
let AwsStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
459
|
+
function AwsStorageUploadScriptsGenerator(config) {
|
|
460
|
+
_classCallCheck(this, AwsStorageUploadScriptsGenerator);
|
|
461
|
+
_Object$defineProperty(this, _bucketEnvironment2, {
|
|
462
|
+
writable: true,
|
|
463
|
+
value: void 0
|
|
464
|
+
});
|
|
465
|
+
_Object$defineProperty(this, _bucketRegion2, {
|
|
466
|
+
writable: true,
|
|
467
|
+
value: void 0
|
|
468
|
+
});
|
|
469
|
+
_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2] = config.bucketRegion;
|
|
470
|
+
_classPrivateFieldLooseBase(this, _bucketEnvironment2)[_bucketEnvironment2] = config.bucketEnvironment;
|
|
471
|
+
}
|
|
472
|
+
_createClass(AwsStorageUploadScriptsGenerator, [{
|
|
473
|
+
key: "getApplicationIndexUploadScript",
|
|
474
|
+
value: function getApplicationIndexUploadScript(_ref3) {
|
|
475
|
+
let packageManagerName = _ref3.packageManagerName,
|
|
476
|
+
bucketUrl = _ref3.bucketUrl,
|
|
477
|
+
cdnUrl = _ref3.cdnUrl,
|
|
478
|
+
buildRevision = _ref3.buildRevision,
|
|
479
|
+
buildNumber = _ref3.buildNumber,
|
|
480
|
+
applicationIndexOutFile = _ref3.applicationIndexOutFile;
|
|
481
|
+
return `
|
|
482
|
+
#!/usr/bin/env bash
|
|
483
|
+
|
|
484
|
+
echo "Uploading static assets to Amazon S3 bucket ${bucketUrl}"
|
|
485
|
+
|
|
486
|
+
set -e
|
|
487
|
+
|
|
488
|
+
aws s3 cp \\
|
|
489
|
+
"$(dirname "$0")/${applicationIndexOutFile}" \\
|
|
490
|
+
"${bucketUrl}/" \\
|
|
491
|
+
--content-type="text/html" \\
|
|
492
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
493
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
494
|
+
|
|
495
|
+
echo "Creating version.json and uploading it to bucket ${bucketUrl}"
|
|
496
|
+
|
|
497
|
+
NODE_ENV=production ${packageManagerName} application-cli create-version \\
|
|
498
|
+
--version-url=${cdnUrl}/${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}/version.json \\
|
|
499
|
+
--build-revision=${buildRevision} \\
|
|
500
|
+
--build-number=${buildNumber} \\
|
|
501
|
+
--out-file=$(dirname "$0")/version.json
|
|
502
|
+
|
|
503
|
+
aws s3 cp \\
|
|
504
|
+
"$(dirname "$0")/version.json" \\
|
|
505
|
+
"${bucketUrl}/" \\
|
|
506
|
+
--content-type="application/json" \\
|
|
507
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
508
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
509
|
+
`;
|
|
510
|
+
}
|
|
511
|
+
}, {
|
|
512
|
+
key: "getProductionBundlesUploadScript",
|
|
513
|
+
value: function getProductionBundlesUploadScript(_ref4) {
|
|
514
|
+
let bucketUrl = _ref4.bucketUrl,
|
|
515
|
+
assetsPath = _ref4.assetsPath,
|
|
516
|
+
skipMenu = _ref4.skipMenu;
|
|
517
|
+
return `
|
|
518
|
+
#!/usr/bin/env bash
|
|
519
|
+
|
|
520
|
+
echo "Uploading static assets to Amazon S3 bucket ${bucketUrl}"
|
|
521
|
+
|
|
522
|
+
set -e
|
|
523
|
+
|
|
524
|
+
# NOTE:
|
|
525
|
+
# The sync command on the AWS CLI is different to the -n option on the gcloud CLI.
|
|
526
|
+
# Sync will only upload files that are not already in the bucket, but it will skip existing ones
|
|
527
|
+
# that have been changed locally.
|
|
528
|
+
# The -n option on the gcloud CLI will skip uploading existing files and prevents them to be overwritten.
|
|
529
|
+
# https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html
|
|
530
|
+
# https://cloud.google.com/sdk/gcloud/reference/storage/cp
|
|
531
|
+
#
|
|
532
|
+
# Compression (gzip) is enabled on CloudFront by default. Hence compression does happing while uploading.
|
|
533
|
+
# https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-configuring
|
|
534
|
+
aws s3 sync ${assetsPath}/public \\
|
|
535
|
+
"${bucketUrl}" \\
|
|
536
|
+
--exclude "*" \\
|
|
537
|
+
--include "*.css" \\
|
|
538
|
+
--include "*.js" \\
|
|
539
|
+
--include "*.js.map" \\
|
|
540
|
+
--include "*.html" \\
|
|
541
|
+
--cache-control="public,max-age=31536000,no-transform" \\
|
|
542
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
543
|
+
|
|
544
|
+
# We need to upload the PNG and HTML files separately because we want them
|
|
545
|
+
# to be able to overwrite the existing files (if any). For instance, the
|
|
546
|
+
# file or the favicons.
|
|
547
|
+
aws s3 cp ${assetsPath}/public \\
|
|
548
|
+
"${bucketUrl}" \\
|
|
549
|
+
--recursive \\
|
|
550
|
+
--exclude "*" \\
|
|
551
|
+
--include "*.png" \\
|
|
552
|
+
--include "robots.txt" \\
|
|
553
|
+
--cache-control="public,max-age=31536000,no-transform" \\
|
|
554
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
555
|
+
|
|
556
|
+
if ${skipMenu}; then
|
|
557
|
+
echo "Skipping menu.json upload"
|
|
558
|
+
else
|
|
559
|
+
echo "Uploading menu.json to bucket ${bucketUrl}"
|
|
560
|
+
|
|
561
|
+
aws s3 cp \\
|
|
562
|
+
${assetsPath}/menu.json \\
|
|
563
|
+
${bucketUrl} \\
|
|
564
|
+
--content-type="application/json" \\
|
|
565
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
566
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
567
|
+
fi
|
|
568
|
+
`;
|
|
569
|
+
}
|
|
570
|
+
}]);
|
|
571
|
+
return AwsStorageUploadScriptsGenerator;
|
|
572
|
+
}();
|
|
363
573
|
function getUploadScriptsGenerator(storageProvider, config) {
|
|
364
574
|
switch (storageProvider) {
|
|
365
575
|
case 'gs':
|
|
366
576
|
return new GoogleStorageUploadScriptsGenerator(config);
|
|
577
|
+
case 's3':
|
|
578
|
+
return new AwsStorageUploadScriptsGenerator(config);
|
|
367
579
|
default:
|
|
368
580
|
throw new Error(`Storage provider ${storageProvider} not supported`);
|
|
369
581
|
}
|
|
@@ -551,7 +763,9 @@ async function command$3(cliFlags, cwd) {
|
|
|
551
763
|
// for all storage providers once per region.
|
|
552
764
|
const allStorageProvidersForBucketRegion = [...new _Set(_flatMapInstanceProperty(bucketEnvironmentConfigs).call(bucketEnvironmentConfigs, bucketEnvironmentConfig => bucketEnvironmentConfig.storageProviders || defaultStorageProviders))];
|
|
553
765
|
const allApplicationAssetTasks = _mapInstanceProperty(allStorageProvidersForBucketRegion).call(allStorageProvidersForBucketRegion, storageProviderTag => {
|
|
554
|
-
const uploadScriptsGeneratorConfig = {
|
|
766
|
+
const uploadScriptsGeneratorConfig = {
|
|
767
|
+
bucketRegion: bucketRegion
|
|
768
|
+
};
|
|
555
769
|
const storageProviderConfig = {
|
|
556
770
|
bucketRegion: bucketRegion
|
|
557
771
|
};
|
|
@@ -874,7 +1088,7 @@ async function command(cliFlags) {
|
|
|
874
1088
|
|
|
875
1089
|
var pkgJson = {
|
|
876
1090
|
name: "@commercetools-frontend/application-cli",
|
|
877
|
-
version: "2.
|
|
1091
|
+
version: "2.3.0",
|
|
878
1092
|
description: "Internal CLI to manage Merchant Center application deployments across various environments.",
|
|
879
1093
|
keywords: [
|
|
880
1094
|
"commercetools",
|
|
@@ -897,11 +1111,11 @@ var pkgJson = {
|
|
|
897
1111
|
},
|
|
898
1112
|
dependencies: {
|
|
899
1113
|
"@babel/core": "^7.22.11",
|
|
900
|
-
"@babel/runtime-corejs3": "^7.21.0",
|
|
901
1114
|
"@babel/runtime": "^7.21.0",
|
|
902
|
-
"@
|
|
903
|
-
"@commercetools-frontend/
|
|
904
|
-
"@commercetools-frontend/
|
|
1115
|
+
"@babel/runtime-corejs3": "^7.21.0",
|
|
1116
|
+
"@commercetools-frontend/application-config": "22.22.0",
|
|
1117
|
+
"@commercetools-frontend/constants": "22.22.0",
|
|
1118
|
+
"@commercetools-frontend/l10n": "22.22.0",
|
|
905
1119
|
"@manypkg/find-root": "2.2.1",
|
|
906
1120
|
cac: "^6.7.14",
|
|
907
1121
|
cosmiconfig: "9.0.0",
|
|
@@ -914,7 +1128,7 @@ var pkgJson = {
|
|
|
914
1128
|
},
|
|
915
1129
|
devDependencies: {
|
|
916
1130
|
"@tsconfig/node20": "20.1.2",
|
|
917
|
-
"@types/node": "20.11.
|
|
1131
|
+
"@types/node": "20.11.30",
|
|
918
1132
|
typescript: "5.2.2"
|
|
919
1133
|
},
|
|
920
1134
|
engines: {
|
|
@@ -2,7 +2,7 @@
|
|
|
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-28a1d76e.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('cosmiconfig');
|
|
@@ -12,6 +12,8 @@ require('ts-deepmerge');
|
|
|
12
12
|
|
|
13
13
|
exports.bucketEnvironments = storageBucketsConfig.bucketEnvironments;
|
|
14
14
|
exports.bucketRegions = storageBucketsConfig.bucketRegions;
|
|
15
|
+
exports.bucketUrls = storageBucketsConfig.bucketUrls;
|
|
15
16
|
exports.clusterContexts = storageBucketsConfig.clusterContexts;
|
|
16
17
|
exports.defineStorageBucketsConfig = storageBucketsConfig.defineStorageBucketsConfig;
|
|
18
|
+
exports.publicStorageUrls = storageBucketsConfig.publicStorageUrls;
|
|
17
19
|
exports.storageProviders = storageBucketsConfig.storageProviders;
|
|
@@ -2,7 +2,7 @@
|
|
|
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-e3ea6d6f.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('cosmiconfig');
|
|
@@ -12,6 +12,8 @@ require('ts-deepmerge');
|
|
|
12
12
|
|
|
13
13
|
exports.bucketEnvironments = storageBucketsConfig.bucketEnvironments;
|
|
14
14
|
exports.bucketRegions = storageBucketsConfig.bucketRegions;
|
|
15
|
+
exports.bucketUrls = storageBucketsConfig.bucketUrls;
|
|
15
16
|
exports.clusterContexts = storageBucketsConfig.clusterContexts;
|
|
16
17
|
exports.defineStorageBucketsConfig = storageBucketsConfig.defineStorageBucketsConfig;
|
|
18
|
+
exports.publicStorageUrls = storageBucketsConfig.publicStorageUrls;
|
|
17
19
|
exports.storageProviders = storageBucketsConfig.storageProviders;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { b as bucketEnvironments, a as bucketRegions, c as clusterContexts, d as defineStorageBucketsConfig, s as storageProviders } from './storage-buckets-config-
|
|
1
|
+
export { b as bucketEnvironments, a as bucketRegions, e as bucketUrls, c as clusterContexts, d as defineStorageBucketsConfig, p as publicStorageUrls, s as storageProviders } from './storage-buckets-config-705b6341.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 'cosmiconfig';
|
|
@@ -12,12 +12,14 @@ export declare const clusterContexts: {
|
|
|
12
12
|
readonly 'ctp_production_gcp_us-central1_v1': "ctp_production_gcp_us-central1_v1";
|
|
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
|
+
readonly ctp_staging_azure_northeurope_v1: "ctp_staging_azure_northeurope_v1";
|
|
15
16
|
};
|
|
16
17
|
export declare const bucketEnvironments: {
|
|
17
18
|
readonly 'ctp-gcp-staging': "ctp-gcp-staging";
|
|
18
19
|
readonly 'ctp-vw-staging-eu': "ctp-vw-staging-eu";
|
|
19
20
|
readonly 'ctp-aws-staging-cn': "ctp-aws-staging-cn";
|
|
20
21
|
readonly 'ctp-gcp-testing-performance-eu': "ctp-gcp-testing-performance-eu";
|
|
22
|
+
readonly 'ctp-azure-staging': "ctp-azure-staging";
|
|
21
23
|
readonly 'ctp-aws-production-fra': "ctp-aws-production-fra";
|
|
22
24
|
readonly 'ctp-gcp-production-eu': "ctp-gcp-production-eu";
|
|
23
25
|
readonly 'ctp-vw-production-eu': "ctp-vw-production-eu";
|
|
@@ -32,5 +34,14 @@ export declare const bucketRegions: {
|
|
|
32
34
|
readonly europe: "merchant-center-europe";
|
|
33
35
|
readonly northAmerica: "merchant-center-north-america";
|
|
34
36
|
readonly asia: "merchant-center-asia";
|
|
37
|
+
readonly china: "merchant-center-china";
|
|
38
|
+
};
|
|
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";
|
|
35
46
|
};
|
|
36
47
|
export declare const storageProviders: Record<TStorageProviderTag, TStorageProvider>;
|
|
@@ -22,8 +22,11 @@ export type TStorageProviderTag = 'gs' | 's3';
|
|
|
22
22
|
export type TStorageProvider = {
|
|
23
23
|
tag: TStorageProviderTag;
|
|
24
24
|
urls: {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
public: {
|
|
26
|
+
default: string;
|
|
27
|
+
} & Partial<Record<TBucketEnvironment, string>>;
|
|
28
|
+
bucket?: Partial<Record<TBucketRegion, string>>;
|
|
29
|
+
};
|
|
27
30
|
};
|
|
28
31
|
export type TStorageProviderConfig = {
|
|
29
32
|
bucketRegion?: TBucketRegion;
|
|
@@ -40,6 +43,7 @@ export interface IStorageProvider {
|
|
|
40
43
|
getApplicationIndexBucketUrl(config: TApplicationIndexBucketConfig): string;
|
|
41
44
|
}
|
|
42
45
|
export type TUploadScriptsGeneratorConfig = {
|
|
46
|
+
bucketRegion: TBucketRegion;
|
|
43
47
|
bucketEnvironment?: TBucketEnvironment;
|
|
44
48
|
};
|
|
45
49
|
export interface IUploadScriptsGenerator {
|
|
@@ -22,13 +22,15 @@ const clusterContexts = {
|
|
|
22
22
|
'ctp_production_aws_us-east-2_v1': 'ctp_production_aws_us-east-2_v1',
|
|
23
23
|
'ctp_production_gcp_us-central1_v1': 'ctp_production_gcp_us-central1_v1',
|
|
24
24
|
'ctp_production_gcp_australia-southeast1_v1': 'ctp_production_gcp_australia-southeast1_v1',
|
|
25
|
-
'ctp_production_aws_cn-northwest-1_v1': 'ctp_production_aws_cn-northwest-1_v1'
|
|
25
|
+
'ctp_production_aws_cn-northwest-1_v1': 'ctp_production_aws_cn-northwest-1_v1',
|
|
26
|
+
ctp_staging_azure_northeurope_v1: 'ctp_staging_azure_northeurope_v1'
|
|
26
27
|
};
|
|
27
28
|
const bucketEnvironments = {
|
|
28
29
|
'ctp-gcp-staging': 'ctp-gcp-staging',
|
|
29
30
|
'ctp-vw-staging-eu': 'ctp-vw-staging-eu',
|
|
30
31
|
'ctp-aws-staging-cn': 'ctp-aws-staging-cn',
|
|
31
32
|
'ctp-gcp-testing-performance-eu': 'ctp-gcp-testing-performance-eu',
|
|
33
|
+
'ctp-azure-staging': 'ctp-azure-staging',
|
|
32
34
|
'ctp-aws-production-fra': 'ctp-aws-production-fra',
|
|
33
35
|
'ctp-gcp-production-eu': 'ctp-gcp-production-eu',
|
|
34
36
|
'ctp-vw-production-eu': 'ctp-vw-production-eu',
|
|
@@ -42,19 +44,37 @@ const bucketRegions = {
|
|
|
42
44
|
previews: 'merchant-center-previews',
|
|
43
45
|
europe: 'merchant-center-europe',
|
|
44
46
|
northAmerica: 'merchant-center-north-america',
|
|
45
|
-
asia: 'merchant-center-asia'
|
|
47
|
+
asia: 'merchant-center-asia',
|
|
48
|
+
china: 'merchant-center-china'
|
|
49
|
+
};
|
|
50
|
+
const publicStorageUrls = {
|
|
51
|
+
google: 'https://storage.googleapis.com',
|
|
52
|
+
aws: 'https://s3.amazonaws.com',
|
|
53
|
+
china: 'https://mc-storage.cn-northwest-1.aws.commercetools.cn'
|
|
54
|
+
};
|
|
55
|
+
const bucketUrls = {
|
|
56
|
+
china: 'commercetools-mc-storage-aws-cn-prod-merchant-center'
|
|
46
57
|
};
|
|
47
58
|
const storageProviders = {
|
|
48
59
|
gs: {
|
|
49
60
|
tag: 'gs',
|
|
50
61
|
urls: {
|
|
51
|
-
|
|
62
|
+
public: {
|
|
63
|
+
default: publicStorageUrls.google
|
|
64
|
+
}
|
|
52
65
|
}
|
|
53
66
|
},
|
|
54
67
|
s3: {
|
|
55
68
|
tag: 's3',
|
|
56
69
|
urls: {
|
|
57
|
-
|
|
70
|
+
public: {
|
|
71
|
+
default: publicStorageUrls.aws,
|
|
72
|
+
'ctp-aws-staging-cn': publicStorageUrls.china,
|
|
73
|
+
'ctp-aws-production-cn': publicStorageUrls.china
|
|
74
|
+
},
|
|
75
|
+
bucket: {
|
|
76
|
+
'merchant-center-china': bucketUrls.china
|
|
77
|
+
}
|
|
58
78
|
}
|
|
59
79
|
}
|
|
60
80
|
};
|
|
@@ -72,6 +92,9 @@ const defaultConfig = {
|
|
|
72
92
|
}, {
|
|
73
93
|
cloudEnvironment: clusterContexts['ctp_testing_performance_gcp_europe-west1_v1'],
|
|
74
94
|
bucketEnvironment: bucketEnvironments['ctp-gcp-testing-performance-eu']
|
|
95
|
+
}, {
|
|
96
|
+
cloudEnvironment: clusterContexts['ctp_staging_azure_northeurope_v1'],
|
|
97
|
+
bucketEnvironment: bucketEnvironments['ctp-azure-staging']
|
|
75
98
|
}],
|
|
76
99
|
[bucketRegions.europe]: [{
|
|
77
100
|
cloudEnvironment: clusterContexts['ctp_production_aws_eu-central-1_v1'],
|
|
@@ -99,6 +122,15 @@ const defaultConfig = {
|
|
|
99
122
|
}, {
|
|
100
123
|
cloudEnvironment: clusterContexts['ctp_production_aws_cn-northwest-1_v1'],
|
|
101
124
|
bucketEnvironment: bucketEnvironments['ctp-aws-production-cn']
|
|
125
|
+
}],
|
|
126
|
+
[bucketRegions.china]: [{
|
|
127
|
+
cloudEnvironment: clusterContexts['ctp_staging_aws_cn-northwest-1_v1'],
|
|
128
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-staging-cn'],
|
|
129
|
+
storageProviders: ['s3']
|
|
130
|
+
}, {
|
|
131
|
+
cloudEnvironment: clusterContexts['ctp_production_aws_cn-northwest-1_v1'],
|
|
132
|
+
bucketEnvironment: bucketEnvironments['ctp-aws-production-cn'],
|
|
133
|
+
storageProviders: ['s3']
|
|
102
134
|
}]
|
|
103
135
|
};
|
|
104
136
|
function defineStorageBucketsConfig() {
|
|
@@ -138,7 +170,9 @@ async function loadStorageBucketsConfig() {
|
|
|
138
170
|
|
|
139
171
|
exports.bucketEnvironments = bucketEnvironments;
|
|
140
172
|
exports.bucketRegions = bucketRegions;
|
|
173
|
+
exports.bucketUrls = bucketUrls;
|
|
141
174
|
exports.clusterContexts = clusterContexts;
|
|
142
175
|
exports.defineStorageBucketsConfig = defineStorageBucketsConfig;
|
|
143
176
|
exports.loadStorageBucketsConfig = loadStorageBucketsConfig;
|
|
177
|
+
exports.publicStorageUrls = publicStorageUrls;
|
|
144
178
|
exports.storageProviders = storageProviders;
|