@commercetools-frontend/application-cli 2.2.0 → 2.3.1
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 +241 -28
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.prod.js +241 -28
- package/cli/dist/commercetools-frontend-application-cli-cli.esm.js +241 -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
|
@@ -17,7 +17,7 @@ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instan
|
|
|
17
17
|
var _Object$entries = require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
18
18
|
var _Set = require('@babel/runtime-corejs3/core-js-stable/set');
|
|
19
19
|
var _flatMapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/flat-map');
|
|
20
|
-
var storageBucketsConfig = require('../../dist/storage-buckets-config-
|
|
20
|
+
var storageBucketsConfig = require('../../dist/storage-buckets-config-28a1d76e.cjs.dev.js');
|
|
21
21
|
var fs = require('node:fs');
|
|
22
22
|
var path$1 = require('node:path');
|
|
23
23
|
var listr2 = require('listr2');
|
|
@@ -99,12 +99,12 @@ function _callSuper(_this, derived, args) {
|
|
|
99
99
|
derived = _getPrototypeOf(derived);
|
|
100
100
|
return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? _Reflect$construct__default["default"](derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
|
|
101
101
|
}
|
|
102
|
-
var _bucketRegion = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
102
|
+
var _bucketRegion$1 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
103
103
|
var _bucketEnvironment$1 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
104
104
|
let StorageProvider = /*#__PURE__*/function () {
|
|
105
105
|
function StorageProvider(config) {
|
|
106
106
|
_classCallCheck(this, StorageProvider);
|
|
107
|
-
_Object$defineProperty__default["default"](this, _bucketRegion, {
|
|
107
|
+
_Object$defineProperty__default["default"](this, _bucketRegion$1, {
|
|
108
108
|
writable: true,
|
|
109
109
|
value: void 0
|
|
110
110
|
});
|
|
@@ -112,7 +112,7 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
112
112
|
writable: true,
|
|
113
113
|
value: void 0
|
|
114
114
|
});
|
|
115
|
-
_classPrivateFieldLooseBase(this, _bucketRegion)[_bucketRegion] = config.bucketRegion;
|
|
115
|
+
_classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1] = config.bucketRegion;
|
|
116
116
|
_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1] = config.bucketEnvironment;
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -141,18 +141,26 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
141
141
|
var _context;
|
|
142
142
|
let applicationName = _ref.applicationName,
|
|
143
143
|
bucketProtocol = _ref.bucketProtocol,
|
|
144
|
-
bucketNamespace = _ref.bucketNamespace
|
|
145
|
-
|
|
144
|
+
bucketNamespace = _ref.bucketNamespace,
|
|
145
|
+
tag = _ref.tag;
|
|
146
|
+
if (!_classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1]) {
|
|
147
|
+
throw new Error("'bucketRegion' is not defined. Required to determine 'assetsBucketUrl'.");
|
|
148
|
+
}
|
|
149
|
+
const storageProvider = storageBucketsConfig.storageProviders[tag];
|
|
150
|
+
const assetBuketUrl = storageProvider.urls.bucket?.[_classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1]] ?? _classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1];
|
|
151
|
+
const assetsBucketUrl = _filterInstanceProperty__default["default"](_context = [assetBuketUrl, bucketNamespace, applicationName]).call(_context, Boolean).join('/');
|
|
146
152
|
return `${bucketProtocol}${assetsBucketUrl}`;
|
|
147
153
|
}
|
|
148
154
|
}, {
|
|
149
155
|
key: "getApplicationIndexBucketUrl",
|
|
150
156
|
value: function getApplicationIndexBucketUrl(_ref2) {
|
|
151
|
-
let
|
|
157
|
+
let tag = _ref2.tag,
|
|
158
|
+
prNumber = _ref2.prNumber,
|
|
152
159
|
applicationName = _ref2.applicationName,
|
|
153
160
|
bucketProtocol = _ref2.bucketProtocol,
|
|
154
161
|
bucketNamespace = _ref2.bucketNamespace;
|
|
155
162
|
const applicationAssetsBucketUrl = this.getAssetsBucketUrl({
|
|
163
|
+
tag,
|
|
156
164
|
applicationName,
|
|
157
165
|
prNumber,
|
|
158
166
|
bucketProtocol,
|
|
@@ -167,40 +175,41 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
167
175
|
var _context2;
|
|
168
176
|
let applicationName = _ref3.applicationName,
|
|
169
177
|
prNumber = _ref3.prNumber,
|
|
170
|
-
publicBaseUrl = _ref3.publicBaseUrl
|
|
171
|
-
|
|
178
|
+
publicBaseUrl = _ref3.publicBaseUrl,
|
|
179
|
+
excludeBucketRegion = _ref3.excludeBucketRegion;
|
|
180
|
+
return _filterInstanceProperty__default["default"](_context2 = [publicBaseUrl, excludeBucketRegion ? null : _classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1], this.getBucketNamespace(prNumber), applicationName]).call(_context2, Boolean).join('/');
|
|
172
181
|
}
|
|
173
182
|
}, {
|
|
174
183
|
key: "getPublicBaseUrl",
|
|
175
184
|
value: function getPublicBaseUrl(tag) {
|
|
176
185
|
if (!_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]) {
|
|
177
|
-
throw new Error("'bucketEnvironment is not defined. Required to determine 'publicBaseUrl'.");
|
|
186
|
+
throw new Error("'bucketEnvironment' is not defined. Required to determine 'publicBaseUrl'.");
|
|
178
187
|
}
|
|
179
188
|
const storageProvider = storageBucketsConfig.storageProviders[tag];
|
|
180
|
-
const publicBaseUrl = storageProvider.urls[_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]] ?? storageProvider.urls.default;
|
|
189
|
+
const publicBaseUrl = storageProvider.urls.public[_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]] ?? storageProvider.urls.public.default;
|
|
181
190
|
return publicBaseUrl;
|
|
182
191
|
}
|
|
183
192
|
}]);
|
|
184
193
|
return StorageProvider;
|
|
185
194
|
}();
|
|
186
|
-
var _bucketRegion2 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
187
|
-
var _bucketEnvironment2 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
195
|
+
var _bucketRegion2$1 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
196
|
+
var _bucketEnvironment2$1 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
188
197
|
let GoogleStorageProvider = /*#__PURE__*/function (_StorageProvider) {
|
|
189
198
|
_inherits(GoogleStorageProvider, _StorageProvider);
|
|
190
199
|
function GoogleStorageProvider(config) {
|
|
191
200
|
var _this;
|
|
192
201
|
_classCallCheck(this, GoogleStorageProvider);
|
|
193
202
|
_this = _callSuper(this, GoogleStorageProvider, [config]);
|
|
194
|
-
_Object$defineProperty__default["default"](_assertThisInitialized(_this), _bucketRegion2, {
|
|
203
|
+
_Object$defineProperty__default["default"](_assertThisInitialized(_this), _bucketRegion2$1, {
|
|
195
204
|
writable: true,
|
|
196
205
|
value: void 0
|
|
197
206
|
});
|
|
198
|
-
_Object$defineProperty__default["default"](_assertThisInitialized(_this), _bucketEnvironment2, {
|
|
207
|
+
_Object$defineProperty__default["default"](_assertThisInitialized(_this), _bucketEnvironment2$1, {
|
|
199
208
|
writable: true,
|
|
200
209
|
value: void 0
|
|
201
210
|
});
|
|
202
|
-
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _bucketRegion2)[_bucketRegion2] = config.bucketRegion;
|
|
203
|
-
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _bucketEnvironment2)[_bucketEnvironment2] = config.bucketEnvironment;
|
|
211
|
+
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _bucketRegion2$1)[_bucketRegion2$1] = config.bucketRegion;
|
|
212
|
+
_classPrivateFieldLooseBase(_assertThisInitialized(_this), _bucketEnvironment2$1)[_bucketEnvironment2$1] = config.bucketEnvironment;
|
|
204
213
|
return _this;
|
|
205
214
|
}
|
|
206
215
|
_createClass(GoogleStorageProvider, [{
|
|
@@ -211,12 +220,12 @@ let GoogleStorageProvider = /*#__PURE__*/function (_StorageProvider) {
|
|
|
211
220
|
}, {
|
|
212
221
|
key: "getBucketRegion",
|
|
213
222
|
value: function getBucketRegion() {
|
|
214
|
-
return _classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2];
|
|
223
|
+
return _classPrivateFieldLooseBase(this, _bucketRegion2$1)[_bucketRegion2$1];
|
|
215
224
|
}
|
|
216
225
|
}, {
|
|
217
226
|
key: "getBucketEnvironment",
|
|
218
227
|
value: function getBucketEnvironment() {
|
|
219
|
-
return _classPrivateFieldLooseBase(this, _bucketEnvironment2)[_bucketEnvironment2];
|
|
228
|
+
return _classPrivateFieldLooseBase(this, _bucketEnvironment2$1)[_bucketEnvironment2$1];
|
|
220
229
|
}
|
|
221
230
|
}, {
|
|
222
231
|
key: "getProtocol",
|
|
@@ -239,6 +248,7 @@ let GoogleStorageProvider = /*#__PURE__*/function (_StorageProvider) {
|
|
|
239
248
|
key: "getAssetsBucketUrl",
|
|
240
249
|
value: function getAssetsBucketUrl(config) {
|
|
241
250
|
return _get(_getPrototypeOf(GoogleStorageProvider.prototype), "getAssetsBucketUrl", this).call(this, _objectSpread$4({
|
|
251
|
+
tag: this.getTag(),
|
|
242
252
|
bucketProtocol: this.getProtocol(),
|
|
243
253
|
bucketNamespace: _get(_getPrototypeOf(GoogleStorageProvider.prototype), "getBucketNamespace", this).call(this, config.prNumber)
|
|
244
254
|
}, config));
|
|
@@ -247,23 +257,101 @@ let GoogleStorageProvider = /*#__PURE__*/function (_StorageProvider) {
|
|
|
247
257
|
key: "getApplicationIndexBucketUrl",
|
|
248
258
|
value: function getApplicationIndexBucketUrl(config) {
|
|
249
259
|
return _get(_getPrototypeOf(GoogleStorageProvider.prototype), "getApplicationIndexBucketUrl", this).call(this, _objectSpread$4({
|
|
260
|
+
tag: this.getTag(),
|
|
250
261
|
bucketProtocol: this.getProtocol(),
|
|
251
262
|
bucketNamespace: _get(_getPrototypeOf(GoogleStorageProvider.prototype), "getBucketNamespace", this).call(this, config.prNumber)
|
|
252
263
|
}, config));
|
|
253
264
|
}
|
|
254
265
|
}]);
|
|
255
266
|
return GoogleStorageProvider;
|
|
256
|
-
}(StorageProvider);
|
|
267
|
+
}(StorageProvider);
|
|
268
|
+
var _bucketRegion3 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
269
|
+
var _bucketEnvironment3 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
270
|
+
let AwsStorageProvider = /*#__PURE__*/function (_StorageProvider2) {
|
|
271
|
+
_inherits(AwsStorageProvider, _StorageProvider2);
|
|
272
|
+
function AwsStorageProvider(config) {
|
|
273
|
+
var _this2;
|
|
274
|
+
_classCallCheck(this, AwsStorageProvider);
|
|
275
|
+
_this2 = _callSuper(this, AwsStorageProvider, [config]);
|
|
276
|
+
_Object$defineProperty__default["default"](_assertThisInitialized(_this2), _bucketRegion3, {
|
|
277
|
+
writable: true,
|
|
278
|
+
value: void 0
|
|
279
|
+
});
|
|
280
|
+
_Object$defineProperty__default["default"](_assertThisInitialized(_this2), _bucketEnvironment3, {
|
|
281
|
+
writable: true,
|
|
282
|
+
value: void 0
|
|
283
|
+
});
|
|
284
|
+
_classPrivateFieldLooseBase(_assertThisInitialized(_this2), _bucketRegion3)[_bucketRegion3] = config.bucketRegion;
|
|
285
|
+
_classPrivateFieldLooseBase(_assertThisInitialized(_this2), _bucketEnvironment3)[_bucketEnvironment3] = config.bucketEnvironment;
|
|
286
|
+
return _this2;
|
|
287
|
+
}
|
|
288
|
+
_createClass(AwsStorageProvider, [{
|
|
289
|
+
key: "getTag",
|
|
290
|
+
value: function getTag() {
|
|
291
|
+
return 's3';
|
|
292
|
+
}
|
|
293
|
+
}, {
|
|
294
|
+
key: "getBucketRegion",
|
|
295
|
+
value: function getBucketRegion() {
|
|
296
|
+
return _classPrivateFieldLooseBase(this, _bucketRegion3)[_bucketRegion3];
|
|
297
|
+
}
|
|
298
|
+
}, {
|
|
299
|
+
key: "getBucketEnvironment",
|
|
300
|
+
value: function getBucketEnvironment() {
|
|
301
|
+
return _classPrivateFieldLooseBase(this, _bucketEnvironment3)[_bucketEnvironment3];
|
|
302
|
+
}
|
|
303
|
+
}, {
|
|
304
|
+
key: "getProtocol",
|
|
305
|
+
value: function getProtocol() {
|
|
306
|
+
return 's3://';
|
|
307
|
+
}
|
|
308
|
+
}, {
|
|
309
|
+
key: "getPublicBaseUrl",
|
|
310
|
+
value: function getPublicBaseUrl() {
|
|
311
|
+
return _get(_getPrototypeOf(AwsStorageProvider.prototype), "getPublicBaseUrl", this).call(this, this.getTag());
|
|
312
|
+
}
|
|
313
|
+
}, {
|
|
314
|
+
key: "getCdnUrl",
|
|
315
|
+
value: function getCdnUrl(config) {
|
|
316
|
+
return _get(_getPrototypeOf(AwsStorageProvider.prototype), "getCdnUrl", this).call(this, _objectSpread$4({
|
|
317
|
+
publicBaseUrl: this.getPublicBaseUrl(),
|
|
318
|
+
excludeBucketRegion: true
|
|
319
|
+
}, config));
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
322
|
+
key: "getAssetsBucketUrl",
|
|
323
|
+
value: function getAssetsBucketUrl(config) {
|
|
324
|
+
return _get(_getPrototypeOf(AwsStorageProvider.prototype), "getAssetsBucketUrl", this).call(this, _objectSpread$4({
|
|
325
|
+
tag: this.getTag(),
|
|
326
|
+
bucketProtocol: this.getProtocol(),
|
|
327
|
+
bucketNamespace: _get(_getPrototypeOf(AwsStorageProvider.prototype), "getBucketNamespace", this).call(this, config.prNumber)
|
|
328
|
+
}, config));
|
|
329
|
+
}
|
|
330
|
+
}, {
|
|
331
|
+
key: "getApplicationIndexBucketUrl",
|
|
332
|
+
value: function getApplicationIndexBucketUrl(config) {
|
|
333
|
+
return _get(_getPrototypeOf(AwsStorageProvider.prototype), "getApplicationIndexBucketUrl", this).call(this, _objectSpread$4({
|
|
334
|
+
tag: this.getTag(),
|
|
335
|
+
bucketProtocol: this.getProtocol(),
|
|
336
|
+
bucketNamespace: _get(_getPrototypeOf(AwsStorageProvider.prototype), "getBucketNamespace", this).call(this, config.prNumber)
|
|
337
|
+
}, config));
|
|
338
|
+
}
|
|
339
|
+
}]);
|
|
340
|
+
return AwsStorageProvider;
|
|
341
|
+
}(StorageProvider);
|
|
257
342
|
function getStorageProvider(storageProvider, config) {
|
|
258
343
|
switch (storageProvider) {
|
|
259
344
|
case 'gs':
|
|
260
345
|
return new GoogleStorageProvider(config);
|
|
346
|
+
case 's3':
|
|
347
|
+
return new AwsStorageProvider(config);
|
|
261
348
|
default:
|
|
262
349
|
throw new Error(`Storage provider ${storageProvider} not supported`);
|
|
263
350
|
}
|
|
264
351
|
}
|
|
265
352
|
|
|
266
353
|
var _bucketEnvironment = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
354
|
+
var _bucketRegion = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
267
355
|
let GoogleStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
268
356
|
function GoogleStorageUploadScriptsGenerator(config) {
|
|
269
357
|
_classCallCheck(this, GoogleStorageUploadScriptsGenerator);
|
|
@@ -271,6 +359,11 @@ let GoogleStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
|
271
359
|
writable: true,
|
|
272
360
|
value: void 0
|
|
273
361
|
});
|
|
362
|
+
_Object$defineProperty__default["default"](this, _bucketRegion, {
|
|
363
|
+
writable: true,
|
|
364
|
+
value: void 0
|
|
365
|
+
});
|
|
366
|
+
_classPrivateFieldLooseBase(this, _bucketRegion)[_bucketRegion] = config.bucketRegion;
|
|
274
367
|
_classPrivateFieldLooseBase(this, _bucketEnvironment)[_bucketEnvironment] = config.bucketEnvironment;
|
|
275
368
|
}
|
|
276
369
|
_createClass(GoogleStorageUploadScriptsGenerator, [{
|
|
@@ -388,11 +481,129 @@ fi
|
|
|
388
481
|
}
|
|
389
482
|
}]);
|
|
390
483
|
return GoogleStorageUploadScriptsGenerator;
|
|
391
|
-
}();
|
|
484
|
+
}();
|
|
485
|
+
var _bucketEnvironment2 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketEnvironment");
|
|
486
|
+
var _bucketRegion2 = /*#__PURE__*/_classPrivateFieldLooseKey("bucketRegion");
|
|
487
|
+
let AwsStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
488
|
+
function AwsStorageUploadScriptsGenerator(config) {
|
|
489
|
+
_classCallCheck(this, AwsStorageUploadScriptsGenerator);
|
|
490
|
+
_Object$defineProperty__default["default"](this, _bucketEnvironment2, {
|
|
491
|
+
writable: true,
|
|
492
|
+
value: void 0
|
|
493
|
+
});
|
|
494
|
+
_Object$defineProperty__default["default"](this, _bucketRegion2, {
|
|
495
|
+
writable: true,
|
|
496
|
+
value: void 0
|
|
497
|
+
});
|
|
498
|
+
_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2] = config.bucketRegion;
|
|
499
|
+
_classPrivateFieldLooseBase(this, _bucketEnvironment2)[_bucketEnvironment2] = config.bucketEnvironment;
|
|
500
|
+
}
|
|
501
|
+
_createClass(AwsStorageUploadScriptsGenerator, [{
|
|
502
|
+
key: "getApplicationIndexUploadScript",
|
|
503
|
+
value: function getApplicationIndexUploadScript(_ref3) {
|
|
504
|
+
let packageManagerName = _ref3.packageManagerName,
|
|
505
|
+
bucketUrl = _ref3.bucketUrl,
|
|
506
|
+
cdnUrl = _ref3.cdnUrl,
|
|
507
|
+
buildRevision = _ref3.buildRevision,
|
|
508
|
+
buildNumber = _ref3.buildNumber,
|
|
509
|
+
applicationIndexOutFile = _ref3.applicationIndexOutFile;
|
|
510
|
+
return `
|
|
511
|
+
#!/usr/bin/env bash
|
|
512
|
+
|
|
513
|
+
echo "Uploading static assets to Amazon S3 bucket ${bucketUrl}"
|
|
514
|
+
|
|
515
|
+
set -e
|
|
516
|
+
|
|
517
|
+
aws s3 cp "$(dirname "$0")/${applicationIndexOutFile}" \\
|
|
518
|
+
"${bucketUrl}/" \\
|
|
519
|
+
--content-type="text/html" \\
|
|
520
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
521
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
522
|
+
|
|
523
|
+
echo "Creating version.json and uploading it to bucket ${bucketUrl}"
|
|
524
|
+
|
|
525
|
+
NODE_ENV=production ${packageManagerName} application-cli create-version \\
|
|
526
|
+
--version-url=${cdnUrl}/${_classPrivateFieldLooseBase(this, _bucketEnvironment2)[_bucketEnvironment2]}/version.json \\
|
|
527
|
+
--build-revision=${buildRevision} \\
|
|
528
|
+
--build-number=${buildNumber} \\
|
|
529
|
+
--out-file=$(dirname "$0")/version.json
|
|
530
|
+
|
|
531
|
+
aws s3 cp "$(dirname "$0")" \\
|
|
532
|
+
"${bucketUrl}/" \\
|
|
533
|
+
--exclude "*" \\
|
|
534
|
+
--include "version.json" \\
|
|
535
|
+
--content-type="application/json" \\
|
|
536
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
537
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
538
|
+
`;
|
|
539
|
+
}
|
|
540
|
+
}, {
|
|
541
|
+
key: "getProductionBundlesUploadScript",
|
|
542
|
+
value: function getProductionBundlesUploadScript(_ref4) {
|
|
543
|
+
let bucketUrl = _ref4.bucketUrl,
|
|
544
|
+
assetsPath = _ref4.assetsPath,
|
|
545
|
+
skipMenu = _ref4.skipMenu;
|
|
546
|
+
return `
|
|
547
|
+
#!/usr/bin/env bash
|
|
548
|
+
|
|
549
|
+
echo "Uploading static assets to Amazon S3 bucket ${bucketUrl}"
|
|
550
|
+
|
|
551
|
+
set -e
|
|
552
|
+
|
|
553
|
+
# NOTE:
|
|
554
|
+
# The sync command on the AWS CLI is different to the -n option on the gcloud CLI.
|
|
555
|
+
# Sync will only upload files that are not already in the bucket, but it will skip existing ones
|
|
556
|
+
# that have been changed locally.
|
|
557
|
+
# The -n option on the gcloud CLI will skip uploading existing files and prevents them to be overwritten.
|
|
558
|
+
# https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html
|
|
559
|
+
# https://cloud.google.com/sdk/gcloud/reference/storage/cp
|
|
560
|
+
#
|
|
561
|
+
# Compression (gzip) is enabled on CloudFront by default. Hence compression does happing while uploading.
|
|
562
|
+
# https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-configuring
|
|
563
|
+
aws s3 sync ${assetsPath}/public \\
|
|
564
|
+
"${bucketUrl}" \\
|
|
565
|
+
--exclude "*" \\
|
|
566
|
+
--include "*.css" \\
|
|
567
|
+
--include "*.js" \\
|
|
568
|
+
--include "*.js.map" \\
|
|
569
|
+
--include "*.html" \\
|
|
570
|
+
--cache-control="public,max-age=31536000,no-transform" \\
|
|
571
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
572
|
+
|
|
573
|
+
# We need to upload the PNG and HTML files separately because we want them
|
|
574
|
+
# to be able to overwrite the existing files (if any). For instance, the
|
|
575
|
+
# file or the favicons.
|
|
576
|
+
aws s3 cp ${assetsPath}/public \\
|
|
577
|
+
"${bucketUrl}" \\
|
|
578
|
+
--recursive \\
|
|
579
|
+
--exclude "*" \\
|
|
580
|
+
--include "*.png" \\
|
|
581
|
+
--include "robots.txt" \\
|
|
582
|
+
--cache-control="public,max-age=31536000,no-transform" \\
|
|
583
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
584
|
+
|
|
585
|
+
if ${skipMenu}; then
|
|
586
|
+
echo "Skipping menu.json upload"
|
|
587
|
+
else
|
|
588
|
+
echo "Uploading menu.json to bucket ${bucketUrl}"
|
|
589
|
+
|
|
590
|
+
aws s3 cp ${assetsPath}/menu.json \\
|
|
591
|
+
"${bucketUrl}/" \\
|
|
592
|
+
--content-type="application/json" \\
|
|
593
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
594
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
595
|
+
fi
|
|
596
|
+
`;
|
|
597
|
+
}
|
|
598
|
+
}]);
|
|
599
|
+
return AwsStorageUploadScriptsGenerator;
|
|
600
|
+
}();
|
|
392
601
|
function getUploadScriptsGenerator(storageProvider, config) {
|
|
393
602
|
switch (storageProvider) {
|
|
394
603
|
case 'gs':
|
|
395
604
|
return new GoogleStorageUploadScriptsGenerator(config);
|
|
605
|
+
case 's3':
|
|
606
|
+
return new AwsStorageUploadScriptsGenerator(config);
|
|
396
607
|
default:
|
|
397
608
|
throw new Error(`Storage provider ${storageProvider} not supported`);
|
|
398
609
|
}
|
|
@@ -580,7 +791,9 @@ async function command$3(cliFlags, cwd) {
|
|
|
580
791
|
// for all storage providers once per region.
|
|
581
792
|
const allStorageProvidersForBucketRegion = [...new _Set__default["default"](_flatMapInstanceProperty__default["default"](bucketEnvironmentConfigs).call(bucketEnvironmentConfigs, bucketEnvironmentConfig => bucketEnvironmentConfig.storageProviders || defaultStorageProviders))];
|
|
582
793
|
const allApplicationAssetTasks = _mapInstanceProperty__default["default"](allStorageProvidersForBucketRegion).call(allStorageProvidersForBucketRegion, storageProviderTag => {
|
|
583
|
-
const uploadScriptsGeneratorConfig = {
|
|
794
|
+
const uploadScriptsGeneratorConfig = {
|
|
795
|
+
bucketRegion: bucketRegion
|
|
796
|
+
};
|
|
584
797
|
const storageProviderConfig = {
|
|
585
798
|
bucketRegion: bucketRegion
|
|
586
799
|
};
|
|
@@ -903,7 +1116,7 @@ async function command(cliFlags) {
|
|
|
903
1116
|
|
|
904
1117
|
var pkgJson = {
|
|
905
1118
|
name: "@commercetools-frontend/application-cli",
|
|
906
|
-
version: "2.
|
|
1119
|
+
version: "2.3.1",
|
|
907
1120
|
description: "Internal CLI to manage Merchant Center application deployments across various environments.",
|
|
908
1121
|
keywords: [
|
|
909
1122
|
"commercetools",
|
|
@@ -926,11 +1139,11 @@ var pkgJson = {
|
|
|
926
1139
|
},
|
|
927
1140
|
dependencies: {
|
|
928
1141
|
"@babel/core": "^7.22.11",
|
|
929
|
-
"@babel/runtime-corejs3": "^7.21.0",
|
|
930
1142
|
"@babel/runtime": "^7.21.0",
|
|
931
|
-
"@
|
|
932
|
-
"@commercetools-frontend/
|
|
933
|
-
"@commercetools-frontend/
|
|
1143
|
+
"@babel/runtime-corejs3": "^7.21.0",
|
|
1144
|
+
"@commercetools-frontend/application-config": "22.22.0",
|
|
1145
|
+
"@commercetools-frontend/constants": "22.22.0",
|
|
1146
|
+
"@commercetools-frontend/l10n": "22.22.0",
|
|
934
1147
|
"@manypkg/find-root": "2.2.1",
|
|
935
1148
|
cac: "^6.7.14",
|
|
936
1149
|
cosmiconfig: "9.0.0",
|
|
@@ -943,7 +1156,7 @@ var pkgJson = {
|
|
|
943
1156
|
},
|
|
944
1157
|
devDependencies: {
|
|
945
1158
|
"@tsconfig/node20": "20.1.2",
|
|
946
|
-
"@types/node": "20.
|
|
1159
|
+
"@types/node": "20.12.2",
|
|
947
1160
|
typescript: "5.2.2"
|
|
948
1161
|
},
|
|
949
1162
|
engines: {
|