@commercetools-frontend/application-cli 7.0.0 → 7.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/cli/dist/commercetools-frontend-application-cli-cli.cjs.dev.js +298 -126
- package/cli/dist/commercetools-frontend-application-cli-cli.cjs.prod.js +298 -126
- package/cli/dist/commercetools-frontend-application-cli-cli.esm.js +298 -125
- package/dist/commercetools-frontend-application-cli.cjs.dev.js +2 -2
- package/dist/commercetools-frontend-application-cli.cjs.prod.js +2 -2
- package/dist/commercetools-frontend-application-cli.esm.js +2 -2
- package/dist/declarations/src/constants.d.ts +2 -0
- package/dist/{storage-buckets-config-c97b3f01.cjs.dev.js → storage-buckets-config-09739a58.cjs.prod.js} +16 -13
- package/dist/{storage-buckets-config-3894c4d6.esm.js → storage-buckets-config-89e84e61.esm.js} +15 -12
- package/dist/{storage-buckets-config-eb422a27.cjs.prod.js → storage-buckets-config-c9659859.cjs.dev.js} +16 -13
- package/package.json +6 -6
|
@@ -9,12 +9,11 @@ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/obje
|
|
|
9
9
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
10
10
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
11
11
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
12
|
-
import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
|
|
13
12
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
14
13
|
import _Object$entries from '@babel/runtime-corejs3/core-js-stable/object/entries';
|
|
15
14
|
import _Set from '@babel/runtime-corejs3/core-js-stable/set';
|
|
16
15
|
import _flatMapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/flat-map';
|
|
17
|
-
import { s as storageProviders, l as loadStorageBucketsConfig, c as clusterContexts, a as loadConfig } from '../../dist/storage-buckets-config-
|
|
16
|
+
import { s as storageProviders, l as loadStorageBucketsConfig, c as clusterContexts, a as loadConfig } from '../../dist/storage-buckets-config-89e84e61.esm.js';
|
|
18
17
|
import fs from 'node:fs';
|
|
19
18
|
import path$1 from 'node:path';
|
|
20
19
|
import { Listr } from 'listr2';
|
|
@@ -45,6 +44,7 @@ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/ins
|
|
|
45
44
|
import micromatch from 'micromatch';
|
|
46
45
|
import snakeCase from 'lodash/snakeCase';
|
|
47
46
|
import { Validator } from 'jsonschema';
|
|
47
|
+
import '@babel/runtime-corejs3/core-js-stable/instance/bind';
|
|
48
48
|
import 'cosmiconfig';
|
|
49
49
|
import 'ts-deepmerge';
|
|
50
50
|
import 'lodash';
|
|
@@ -63,7 +63,7 @@ function isCI() {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function ownKeys$4(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
66
|
-
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
66
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$4(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$4(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
67
67
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
68
68
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
69
69
|
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
@@ -97,7 +97,7 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
97
97
|
value: function getBucketNamespace(prNumber) {
|
|
98
98
|
if (!prNumber) return;
|
|
99
99
|
if (prNumber === 'merchant-center-preview') return prNumber;
|
|
100
|
-
return
|
|
100
|
+
return `mc-${prNumber}`;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
@@ -106,7 +106,7 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
106
106
|
}, {
|
|
107
107
|
key: "getAssetsBucketUrl",
|
|
108
108
|
value: function getAssetsBucketUrl(_ref) {
|
|
109
|
-
var
|
|
109
|
+
var _context;
|
|
110
110
|
let applicationName = _ref.applicationName,
|
|
111
111
|
bucketProtocol = _ref.bucketProtocol,
|
|
112
112
|
bucketNamespace = _ref.bucketNamespace,
|
|
@@ -115,14 +115,13 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
115
115
|
throw new Error("'bucketRegion' is not defined. Required to determine 'assetsBucketUrl'.");
|
|
116
116
|
}
|
|
117
117
|
const storageProvider = storageProviders[tag];
|
|
118
|
-
const assetBuketUrl =
|
|
118
|
+
const assetBuketUrl = storageProvider.urls.bucket?.[_classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1]] ?? _classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1];
|
|
119
119
|
const assetsBucketUrl = _filterInstanceProperty(_context = [assetBuketUrl, bucketNamespace, applicationName]).call(_context, Boolean).join('/');
|
|
120
|
-
return
|
|
120
|
+
return `${bucketProtocol}${assetsBucketUrl}`;
|
|
121
121
|
}
|
|
122
122
|
}, {
|
|
123
123
|
key: "getApplicationIndexBucketUrl",
|
|
124
124
|
value: function getApplicationIndexBucketUrl(_ref2) {
|
|
125
|
-
var _context3;
|
|
126
125
|
let tag = _ref2.tag,
|
|
127
126
|
prNumber = _ref2.prNumber,
|
|
128
127
|
applicationName = _ref2.applicationName,
|
|
@@ -135,31 +134,29 @@ let StorageProvider = /*#__PURE__*/function () {
|
|
|
135
134
|
bucketProtocol,
|
|
136
135
|
bucketNamespace
|
|
137
136
|
});
|
|
138
|
-
const applicationIndexBucketUrl =
|
|
137
|
+
const applicationIndexBucketUrl = `${applicationAssetsBucketUrl}/${_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]}`;
|
|
139
138
|
return applicationIndexBucketUrl;
|
|
140
139
|
}
|
|
141
140
|
}, {
|
|
142
141
|
key: "getCdnUrl",
|
|
143
142
|
value: function getCdnUrl(_ref3) {
|
|
144
|
-
var
|
|
143
|
+
var _context2;
|
|
145
144
|
let applicationName = _ref3.applicationName,
|
|
146
145
|
prNumber = _ref3.prNumber,
|
|
147
146
|
publicBaseUrl = _ref3.publicBaseUrl,
|
|
148
147
|
excludeBucketRegion = _ref3.excludeBucketRegion;
|
|
149
|
-
return _filterInstanceProperty(
|
|
148
|
+
return _filterInstanceProperty(_context2 = [publicBaseUrl, excludeBucketRegion ? null : _classPrivateFieldLooseBase(this, _bucketRegion$1)[_bucketRegion$1], this.getBucketNamespace(prNumber), applicationName]).call(_context2, Boolean).join('/');
|
|
150
149
|
}
|
|
151
150
|
}, {
|
|
152
151
|
key: "getPublicBaseUrl",
|
|
153
152
|
value: function getPublicBaseUrl(tag) {
|
|
154
|
-
var _storageProvider$urls3;
|
|
155
153
|
if (!_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]) {
|
|
156
154
|
throw new Error("'bucketEnvironment' is not defined. Required to determine 'publicBaseUrl'.");
|
|
157
155
|
}
|
|
158
156
|
const storageProvider = storageProviders[tag];
|
|
159
|
-
const publicBaseUrl =
|
|
157
|
+
const publicBaseUrl = storageProvider.urls.public[_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]] ?? storageProvider.urls.public.default;
|
|
160
158
|
if (!publicBaseUrl) {
|
|
161
|
-
|
|
162
|
-
throw new Error(_concatInstanceProperty(_context5 = "'publicBaseUrl' is not defined for '".concat(tag, "' storage provider for ")).call(_context5, _classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1], " or as default."));
|
|
159
|
+
throw new Error(`'publicBaseUrl' is not defined for '${tag}' storage provider for ${_classPrivateFieldLooseBase(this, _bucketEnvironment$1)[_bucketEnvironment$1]} or as default.`);
|
|
163
160
|
}
|
|
164
161
|
return publicBaseUrl;
|
|
165
162
|
}
|
|
@@ -317,7 +314,7 @@ function getStorageProvider(storageProvider, config) {
|
|
|
317
314
|
case 's3':
|
|
318
315
|
return new AwsStorageProvider(config);
|
|
319
316
|
default:
|
|
320
|
-
throw new Error(
|
|
317
|
+
throw new Error(`Storage provider ${storageProvider} not supported`);
|
|
321
318
|
}
|
|
322
319
|
}
|
|
323
320
|
|
|
@@ -340,7 +337,6 @@ let GoogleStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
|
340
337
|
return _createClass(GoogleStorageUploadScriptsGenerator, [{
|
|
341
338
|
key: "getApplicationIndexUploadScript",
|
|
342
339
|
value: function getApplicationIndexUploadScript(_ref) {
|
|
343
|
-
var _context, _context2, _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context0;
|
|
344
340
|
let packageManagerName = _ref.packageManagerName,
|
|
345
341
|
bucketUrl = _ref.bucketUrl,
|
|
346
342
|
cdnUrl = _ref.cdnUrl,
|
|
@@ -350,16 +346,138 @@ let GoogleStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
|
350
346
|
if (!_classPrivateFieldLooseBase(this, _bucketEnvironment)[_bucketEnvironment]) {
|
|
351
347
|
throw new Error("Missing 'bucketEnvironment' when generating application index.");
|
|
352
348
|
}
|
|
353
|
-
return
|
|
349
|
+
return `
|
|
350
|
+
#!/usr/bin/env bash
|
|
351
|
+
|
|
352
|
+
set -e
|
|
353
|
+
|
|
354
|
+
echo "Uploading compiled ${applicationIndexOutFile} to Google Storage bucket ${bucketUrl}"
|
|
355
|
+
|
|
356
|
+
gcloud storage cp \\
|
|
357
|
+
"$(dirname "$0")/${applicationIndexOutFile}" \\
|
|
358
|
+
"${bucketUrl}/" \\
|
|
359
|
+
-z html \\
|
|
360
|
+
--content-type="text/html" \\
|
|
361
|
+
--cache-control="public,max-age=0,no-transform"
|
|
362
|
+
|
|
363
|
+
echo "Creating version.json and uploading it to bucket ${bucketUrl}"
|
|
364
|
+
|
|
365
|
+
NODE_ENV=production ${packageManagerName} application-cli create-version \\
|
|
366
|
+
--version-url=${cdnUrl}/${_classPrivateFieldLooseBase(this, _bucketEnvironment)[_bucketEnvironment]}/version.json \\
|
|
367
|
+
--build-revision=${buildRevision} \\
|
|
368
|
+
--build-number=${buildNumber} \\
|
|
369
|
+
--out-file=$(dirname "$0")/version.json
|
|
370
|
+
|
|
371
|
+
gcloud storage cp \\
|
|
372
|
+
"$(dirname "$0")/version.json" \\
|
|
373
|
+
"${bucketUrl}/" \\
|
|
374
|
+
-z json \\
|
|
375
|
+
--content-type="application/json" \\
|
|
376
|
+
--cache-control="public,max-age=0,no-transform"
|
|
377
|
+
`;
|
|
354
378
|
}
|
|
355
379
|
}, {
|
|
356
380
|
key: "getProductionBundlesUploadScript",
|
|
357
381
|
value: function getProductionBundlesUploadScript(_ref2) {
|
|
358
|
-
var _context1, _context10, _context11, _context12, _context13, _context14, _context15, _context16, _context17, _context18, _context19;
|
|
359
382
|
let bucketUrl = _ref2.bucketUrl,
|
|
360
383
|
assetsPath = _ref2.assetsPath,
|
|
361
384
|
skipMenu = _ref2.skipMenu;
|
|
362
|
-
return
|
|
385
|
+
return `
|
|
386
|
+
#!/usr/bin/env bash
|
|
387
|
+
|
|
388
|
+
set -e
|
|
389
|
+
|
|
390
|
+
# NOTES:
|
|
391
|
+
# https://cloud.google.com/sdk/gcloud/reference/storage/cp
|
|
392
|
+
# 1. The '-z' option triggers compressing the assets before
|
|
393
|
+
# uploading them and sets the 'Content-Encoding' to 'gzip'.
|
|
394
|
+
# 2. The 'Accept-encoding: gzip' is set automatically by the 'gcloud storage'.
|
|
395
|
+
# 3. The 'max-age' is set to 1 year which is considered the maximum
|
|
396
|
+
# "valid" lifetime of an asset to be cached.
|
|
397
|
+
# 4. The '-n' will skip uploading existing files and prevents them to
|
|
398
|
+
# be overwritten
|
|
399
|
+
echo "Uploading static assets to Google Storage bucket ${bucketUrl}"
|
|
400
|
+
|
|
401
|
+
# List of required file types
|
|
402
|
+
required_files=("*.css" "*.js" "*.js.map" "*.html")
|
|
403
|
+
|
|
404
|
+
# List of optional file types
|
|
405
|
+
optional_files=("*.svg")
|
|
406
|
+
|
|
407
|
+
# Check for the existence of required files
|
|
408
|
+
for file_pattern in "\${required_files[@]}"; do
|
|
409
|
+
if ! find "${assetsPath}/public" -type f -name "$file_pattern" -print -quit | grep -q .; then
|
|
410
|
+
echo "Error: No required files matching $file_pattern found in ${assetsPath}/public."
|
|
411
|
+
exit 1
|
|
412
|
+
fi
|
|
413
|
+
done
|
|
414
|
+
|
|
415
|
+
# Initialize source_pattern with required files
|
|
416
|
+
source_pattern="${assetsPath}/public/{$(IFS=,; echo "\${required_files[*]}")"
|
|
417
|
+
|
|
418
|
+
# Check for optional files and add them to the source_pattern if they exist
|
|
419
|
+
for file_pattern in "\${optional_files[@]}"; do
|
|
420
|
+
if find "${assetsPath}/public" -type f -name "$file_pattern" -print -quit | grep -q .; then
|
|
421
|
+
source_pattern+=",\${file_pattern}"
|
|
422
|
+
fi
|
|
423
|
+
done
|
|
424
|
+
|
|
425
|
+
# Close the brace in source_pattern
|
|
426
|
+
source_pattern+="}"
|
|
427
|
+
|
|
428
|
+
echo "Uploading files using the following pattern: \${source_pattern}"
|
|
429
|
+
|
|
430
|
+
# Expand the source_pattern variable as the below command will not work if the variable is a string
|
|
431
|
+
expanded_source_pattern=$(eval echo $source_pattern)
|
|
432
|
+
|
|
433
|
+
gcloud storage cp \\
|
|
434
|
+
$expanded_source_pattern \\
|
|
435
|
+
"${bucketUrl}" \\
|
|
436
|
+
-n \\
|
|
437
|
+
-z js,css \\
|
|
438
|
+
--cache-control="public,max-age=31536000,no-transform"
|
|
439
|
+
|
|
440
|
+
# We need to upload the PNG and HTML files separately because we want them
|
|
441
|
+
# to be able to overwrite the existing files (if any). For instance, the
|
|
442
|
+
# file or the favicons.
|
|
443
|
+
# This is controlled with the '-n' option (which is used for the JS and CSS
|
|
444
|
+
# as we don't want to overwrite them)
|
|
445
|
+
gcloud storage cp \\
|
|
446
|
+
${assetsPath}/public/{*.png,robots.txt} \\
|
|
447
|
+
"${bucketUrl}" \\
|
|
448
|
+
-z txt \\
|
|
449
|
+
--cache-control="public,max-age=31536000,no-transform"
|
|
450
|
+
|
|
451
|
+
if ${skipMenu}; then
|
|
452
|
+
echo "Skipping menu.json upload"
|
|
453
|
+
else
|
|
454
|
+
echo "Uploading menu.json to bucket ${bucketUrl}"
|
|
455
|
+
# NOTE: somehow the 'cache-control:private' doesn't work.
|
|
456
|
+
# I mean, the file is uploaded with the correct metadata but when I fetch
|
|
457
|
+
# the file the response contains the header
|
|
458
|
+
# 'cache-control: public,max-age=31536000,no-transform', even though the
|
|
459
|
+
# documentation clearly states that by marking the header as 'private' will
|
|
460
|
+
# disable the cache (for publicly readable objects).
|
|
461
|
+
# https://cloud.google.com/storage/docs/gsutil/addlhelp/WorkingWithObjectMetadata#cache-control
|
|
462
|
+
# However, I found out that, by requesting the file with any RANDOM
|
|
463
|
+
# query parameter, will instruct the storage to return a 'fresh' object
|
|
464
|
+
# (without any cache control).
|
|
465
|
+
# Unofficial source: https://stackoverflow.com/a/49052895
|
|
466
|
+
# This seems to be the 'easiest' option to 'disable' the cache for public
|
|
467
|
+
# objects. Other alternative approaces are:
|
|
468
|
+
# * make the object private with some simple ACL (private objects are not cached)
|
|
469
|
+
# * suffix the file name with e.g. the git SHA, so we have different files
|
|
470
|
+
# for each upload ('index.html.template-\${CIRCLE_SHA1}'). The server knows
|
|
471
|
+
# the git SHA on runtime and can get the correct file when it starts.
|
|
472
|
+
# * find out why the 'private' cache control does not work
|
|
473
|
+
gcloud storage cp \\
|
|
474
|
+
${assetsPath}/menu.json \\
|
|
475
|
+
${bucketUrl} \\
|
|
476
|
+
-z json \\
|
|
477
|
+
--content-type="application/json" \\
|
|
478
|
+
--cache-control="public,max-age=0,no-transform"
|
|
479
|
+
fi
|
|
480
|
+
`;
|
|
363
481
|
}
|
|
364
482
|
}]);
|
|
365
483
|
}();
|
|
@@ -382,23 +500,104 @@ let AwsStorageUploadScriptsGenerator = /*#__PURE__*/function () {
|
|
|
382
500
|
return _createClass(AwsStorageUploadScriptsGenerator, [{
|
|
383
501
|
key: "getApplicationIndexUploadScript",
|
|
384
502
|
value: function getApplicationIndexUploadScript(_ref3) {
|
|
385
|
-
var _context20, _context21, _context22, _context23, _context24, _context25, _context26, _context27, _context28, _context29, _context30;
|
|
386
503
|
let packageManagerName = _ref3.packageManagerName,
|
|
387
504
|
bucketUrl = _ref3.bucketUrl,
|
|
388
505
|
cdnUrl = _ref3.cdnUrl,
|
|
389
506
|
buildRevision = _ref3.buildRevision,
|
|
390
507
|
buildNumber = _ref3.buildNumber,
|
|
391
508
|
applicationIndexOutFile = _ref3.applicationIndexOutFile;
|
|
392
|
-
return
|
|
509
|
+
return `
|
|
510
|
+
#!/usr/bin/env bash
|
|
511
|
+
|
|
512
|
+
echo "Uploading static assets to Amazon S3 bucket ${bucketUrl}"
|
|
513
|
+
|
|
514
|
+
set -e
|
|
515
|
+
|
|
516
|
+
aws s3 cp "$(dirname "$0")/${applicationIndexOutFile}" \\
|
|
517
|
+
"${bucketUrl}/" \\
|
|
518
|
+
--content-type="text/html" \\
|
|
519
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
520
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
521
|
+
|
|
522
|
+
echo "Creating version.json and uploading it to bucket ${bucketUrl}"
|
|
523
|
+
|
|
524
|
+
NODE_ENV=production ${packageManagerName} application-cli create-version \\
|
|
525
|
+
--version-url=${cdnUrl}/${_classPrivateFieldLooseBase(this, _bucketEnvironment2)[_bucketEnvironment2]}/version.json \\
|
|
526
|
+
--build-revision=${buildRevision} \\
|
|
527
|
+
--build-number=${buildNumber} \\
|
|
528
|
+
--out-file=$(dirname "$0")/version.json
|
|
529
|
+
|
|
530
|
+
aws s3 cp "$(dirname "$0")/version.json" \\
|
|
531
|
+
"${bucketUrl}/" \\
|
|
532
|
+
--content-type="application/json" \\
|
|
533
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
534
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
535
|
+
`;
|
|
393
536
|
}
|
|
394
537
|
}, {
|
|
395
538
|
key: "getProductionBundlesUploadScript",
|
|
396
539
|
value: function getProductionBundlesUploadScript(_ref4) {
|
|
397
|
-
var _context31, _context32, _context33, _context34, _context35, _context36, _context37, _context38, _context39, _context40, _context41, _context42, _context43;
|
|
398
540
|
let bucketUrl = _ref4.bucketUrl,
|
|
399
541
|
assetsPath = _ref4.assetsPath,
|
|
400
542
|
skipMenu = _ref4.skipMenu;
|
|
401
|
-
return
|
|
543
|
+
return `
|
|
544
|
+
#!/usr/bin/env bash
|
|
545
|
+
|
|
546
|
+
echo "Uploading static assets to Amazon S3 bucket ${bucketUrl}"
|
|
547
|
+
|
|
548
|
+
set -e
|
|
549
|
+
|
|
550
|
+
# Check for the existence of the application required files types
|
|
551
|
+
if ! find "${assetsPath}" -type f -regex ".*\\.\\(css\\|js\\|html\\)" | grep -q .; then
|
|
552
|
+
echo "Error: No CSS, JS, or HTML files found in ${assetsPath}."
|
|
553
|
+
exit 1
|
|
554
|
+
fi
|
|
555
|
+
|
|
556
|
+
# NOTE:
|
|
557
|
+
# The sync command on the AWS CLI is different to the -n option on the gcloud CLI.
|
|
558
|
+
# Sync will only upload files that are not already in the bucket, but it will skip existing ones
|
|
559
|
+
# that have been changed locally.
|
|
560
|
+
# The -n option on the gcloud CLI will skip uploading existing files and prevents them to be overwritten.
|
|
561
|
+
# https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html
|
|
562
|
+
# https://cloud.google.com/sdk/gcloud/reference/storage/cp
|
|
563
|
+
#
|
|
564
|
+
# Compression (gzip) is enabled on CloudFront by default. Hence compression does happing while uploading.
|
|
565
|
+
# https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-configuring
|
|
566
|
+
aws s3 sync ${assetsPath}/public \\
|
|
567
|
+
"${bucketUrl}" \\
|
|
568
|
+
--exclude "*" \\
|
|
569
|
+
--include "*.css" \\
|
|
570
|
+
--include "*.js" \\
|
|
571
|
+
--include "*.js.map" \\
|
|
572
|
+
--include "*.html" \\
|
|
573
|
+
--include "*.svg" \\
|
|
574
|
+
--cache-control="public,max-age=31536000,no-transform" \\
|
|
575
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
576
|
+
|
|
577
|
+
# We need to upload the PNG and HTML files separately because we want them
|
|
578
|
+
# to be able to overwrite the existing files (if any). For instance, the
|
|
579
|
+
# file or the favicons.
|
|
580
|
+
aws s3 cp ${assetsPath}/public \\
|
|
581
|
+
"${bucketUrl}" \\
|
|
582
|
+
--recursive \\
|
|
583
|
+
--exclude "*" \\
|
|
584
|
+
--include "*.png" \\
|
|
585
|
+
--include "robots.txt" \\
|
|
586
|
+
--cache-control="public,max-age=31536000,no-transform" \\
|
|
587
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
588
|
+
|
|
589
|
+
if ${skipMenu}; then
|
|
590
|
+
echo "Skipping menu.json upload"
|
|
591
|
+
else
|
|
592
|
+
echo "Uploading menu.json to bucket ${bucketUrl}"
|
|
593
|
+
|
|
594
|
+
aws s3 cp ${assetsPath}/menu.json \\
|
|
595
|
+
"${bucketUrl}/" \\
|
|
596
|
+
--content-type="application/json" \\
|
|
597
|
+
--cache-control="public,max-age=0,no-transform" \\
|
|
598
|
+
--profile ${_classPrivateFieldLooseBase(this, _bucketRegion2)[_bucketRegion2]}
|
|
599
|
+
fi
|
|
600
|
+
`;
|
|
402
601
|
}
|
|
403
602
|
}]);
|
|
404
603
|
}();
|
|
@@ -409,7 +608,7 @@ function getUploadScriptsGenerator(storageProvider, config) {
|
|
|
409
608
|
case 's3':
|
|
410
609
|
return new AwsStorageUploadScriptsGenerator(config);
|
|
411
610
|
default:
|
|
412
|
-
throw new Error(
|
|
611
|
+
throw new Error(`Storage provider ${storageProvider} not supported`);
|
|
413
612
|
}
|
|
414
613
|
}
|
|
415
614
|
|
|
@@ -423,7 +622,7 @@ function doesFileExist(filePath) {
|
|
|
423
622
|
}
|
|
424
623
|
|
|
425
624
|
function ownKeys$3(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
426
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
625
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys$3(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys$3(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
427
626
|
function loadDotenvFiles(_ref) {
|
|
428
627
|
let dotenvPath = _ref.dotenvPath,
|
|
429
628
|
cloudEnvironment = _ref.cloudEnvironment;
|
|
@@ -434,12 +633,12 @@ function loadDotenvFiles(_ref) {
|
|
|
434
633
|
|
|
435
634
|
// Check if the given path exists.
|
|
436
635
|
if (!doesFileExist(dotenvPath)) {
|
|
437
|
-
throw new Error(
|
|
636
|
+
throw new Error(`The dotenv folder path does not exist: "${dotenvPath}".`);
|
|
438
637
|
}
|
|
439
638
|
|
|
440
639
|
// Load the environment values
|
|
441
640
|
const sharedDotenvFile = '.env.production';
|
|
442
|
-
const cloudDotenvFile =
|
|
641
|
+
const cloudDotenvFile = `.env.${cloudEnvironment}`;
|
|
443
642
|
|
|
444
643
|
// The shared dotenv file across environments is optional
|
|
445
644
|
const sharedProductionEnvironment = dotenv.config({
|
|
@@ -451,18 +650,16 @@ function loadDotenvFiles(_ref) {
|
|
|
451
650
|
path: path.join(dotenvPath, cloudDotenvFile)
|
|
452
651
|
});
|
|
453
652
|
if (cloudSpecificProductionEnvironment.error) {
|
|
454
|
-
|
|
455
|
-
throw new Error(_concatInstanceProperty(_context = "Failed loading '".concat(cloudDotenvFile, "' in '")).call(_context, dotenvPath, "'. Make sure it exists."));
|
|
653
|
+
throw new Error(`Failed loading '${cloudDotenvFile}' in '${dotenvPath}'. Make sure it exists.`);
|
|
456
654
|
}
|
|
457
655
|
if (sharedProductionEnvironment.error) {
|
|
458
|
-
|
|
459
|
-
throw new Error(_concatInstanceProperty(_context2 = "Failed loading '".concat(sharedDotenvFile, "' in '")).call(_context2, dotenvPath, "'. Make sure it exists."));
|
|
656
|
+
throw new Error(`Failed loading '${sharedDotenvFile}' in '${dotenvPath}'. Make sure it exists.`);
|
|
460
657
|
}
|
|
461
658
|
return _objectSpread$3(_objectSpread$3({}, sharedProductionEnvironment.parsed), cloudSpecificProductionEnvironment.parsed);
|
|
462
659
|
}
|
|
463
660
|
|
|
464
661
|
function ownKeys$2(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
465
|
-
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
662
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var _context3, _context4; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context3 = ownKeys$2(Object(t), !0)).call(_context3, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context4 = ownKeys$2(Object(t))).call(_context4, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
466
663
|
function writeUploadScriptFile(_ref) {
|
|
467
664
|
let fileName = _ref.fileName,
|
|
468
665
|
fileContent = _ref.fileContent,
|
|
@@ -474,7 +671,6 @@ function writeUploadScriptFile(_ref) {
|
|
|
474
671
|
});
|
|
475
672
|
}
|
|
476
673
|
async function compileApplicationAssets(_ref2) {
|
|
477
|
-
var _context, _context2;
|
|
478
674
|
let cliFlags = _ref2.cliFlags,
|
|
479
675
|
storageProvider = _ref2.storageProvider,
|
|
480
676
|
uploadScriptsGenerator = _ref2.uploadScriptsGenerator,
|
|
@@ -489,7 +685,7 @@ async function compileApplicationAssets(_ref2) {
|
|
|
489
685
|
skipMenu: cliFlags.skipMenu
|
|
490
686
|
});
|
|
491
687
|
const parsedApplicationAssetsUploadScriptFile = path$1.parse(cliFlags.applicationAssetsUploadScriptOutFile);
|
|
492
|
-
const applicationAssetsUploadScriptFileName =
|
|
688
|
+
const applicationAssetsUploadScriptFileName = `${parsedApplicationAssetsUploadScriptFile.name}-${storageProvider.getBucketRegion()}${parsedApplicationAssetsUploadScriptFile.ext}`;
|
|
493
689
|
writeUploadScriptFile({
|
|
494
690
|
fileName: applicationAssetsUploadScriptFileName,
|
|
495
691
|
fileContent: applicationAssetsUploadScriptContent,
|
|
@@ -522,7 +718,7 @@ async function compileEnvironmentApplicationIndexes(_ref3) {
|
|
|
522
718
|
})), {}, {
|
|
523
719
|
// The trailing slash is important to indicate to the CSP directive that all the resources
|
|
524
720
|
// under that path should be allowed.
|
|
525
|
-
MC_CDN_URL:
|
|
721
|
+
MC_CDN_URL: `${cdnUrl}/`
|
|
526
722
|
}, cliFlags.mcUrl ? {
|
|
527
723
|
MC_URL: cliFlags.mcUrl
|
|
528
724
|
} : {}), cliFlags.mcApiUrl ? {
|
|
@@ -579,7 +775,7 @@ async function compileEnvironmentApplicationIndexes(_ref3) {
|
|
|
579
775
|
}
|
|
580
776
|
}
|
|
581
777
|
async function command$4(cliFlags, cwd) {
|
|
582
|
-
var
|
|
778
|
+
var _context;
|
|
583
779
|
const storageBucketConfig = await loadStorageBucketsConfig();
|
|
584
780
|
const applicationDirectory = getApplicationDirectory(cwd);
|
|
585
781
|
let assetsPath;
|
|
@@ -596,12 +792,12 @@ async function command$4(cliFlags, cwd) {
|
|
|
596
792
|
assetsPath
|
|
597
793
|
};
|
|
598
794
|
const defaultStorageProviders = [storageProviders.gs.tag];
|
|
599
|
-
const taskList = new Listr(_mapInstanceProperty(
|
|
795
|
+
const taskList = new Listr(_mapInstanceProperty(_context = _Object$entries(storageBucketConfig)).call(_context, _ref4 => {
|
|
600
796
|
let _ref5 = _slicedToArray(_ref4, 2),
|
|
601
797
|
bucketRegion = _ref5[0],
|
|
602
798
|
bucketEnvironmentConfigs = _ref5[1];
|
|
603
799
|
return {
|
|
604
|
-
title:
|
|
800
|
+
title: `Compiling for bucket region ${bucketRegion}`,
|
|
605
801
|
task: (_bucketRegionCtx, bucketRegionTask) => {
|
|
606
802
|
// NOTE: Application assets need to be compiled
|
|
607
803
|
// for all storage providers once per region.
|
|
@@ -616,7 +812,7 @@ async function command$4(cliFlags, cwd) {
|
|
|
616
812
|
const storageProvider = getStorageProvider(storageProviderTag, storageProviderConfig);
|
|
617
813
|
const uploadScriptsGenerator = getUploadScriptsGenerator(storageProviderTag, uploadScriptsGeneratorConfig);
|
|
618
814
|
return {
|
|
619
|
-
title:
|
|
815
|
+
title: `Compiling application assets for '${storageProviderTag}'`,
|
|
620
816
|
task: () => compileApplicationAssets({
|
|
621
817
|
cliFlags,
|
|
622
818
|
storageProvider,
|
|
@@ -634,14 +830,14 @@ async function command$4(cliFlags, cwd) {
|
|
|
634
830
|
bucketEnvironment
|
|
635
831
|
};
|
|
636
832
|
return {
|
|
637
|
-
title:
|
|
833
|
+
title: `Compiling for cloud environment '${cloudEnvironment}'`,
|
|
638
834
|
task: (_storageProviderCtx, storageProviderTask) => {
|
|
639
|
-
var
|
|
640
|
-
const applicationIndexTasksForStorageProviders = _mapInstanceProperty(
|
|
835
|
+
var _context2;
|
|
836
|
+
const applicationIndexTasksForStorageProviders = _mapInstanceProperty(_context2 = storageProviders || defaultStorageProviders).call(_context2, storageProviderTag => {
|
|
641
837
|
const storageProvider = getStorageProvider(storageProviderTag, storageProviderConfig);
|
|
642
838
|
const uploadScriptsGenerator = getUploadScriptsGenerator(storageProviderTag, storageProviderConfig);
|
|
643
839
|
return {
|
|
644
|
-
title:
|
|
840
|
+
title: `Compiling application index for storage provider '${storageProviderTag}'`,
|
|
645
841
|
task: () => {
|
|
646
842
|
return compileEnvironmentApplicationIndexes({
|
|
647
843
|
cliFlags,
|
|
@@ -697,58 +893,48 @@ const mapLabelAllLocalesWithDefaults = (labelAllLocales, defaultLabel) => {
|
|
|
697
893
|
*/
|
|
698
894
|
|
|
699
895
|
const mapApplicationMenuConfigToGraqhQLMenuJson = config => {
|
|
700
|
-
var
|
|
896
|
+
var _context2;
|
|
701
897
|
const entryPointUriPath = config.env.entryPointUriPath;
|
|
702
898
|
|
|
703
899
|
// @ts-expect-error: the `accountLinks` is not explicitly typed as it's only used by the account app.
|
|
704
|
-
const accountLinks =
|
|
900
|
+
const accountLinks = config.env.__DEVELOPMENT__?.accountLinks ?? [];
|
|
705
901
|
if (accountLinks.length > 0) {
|
|
706
|
-
return _mapInstanceProperty(accountLinks).call(accountLinks, menuLink => {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
featureToggle: (_menuLink$featureTogg = menuLink.featureToggle) !== null && _menuLink$featureTogg !== void 0 ? _menuLink$featureTogg : null
|
|
715
|
-
};
|
|
716
|
-
});
|
|
902
|
+
return _mapInstanceProperty(accountLinks).call(accountLinks, menuLink => ({
|
|
903
|
+
key: menuLink.uriPath,
|
|
904
|
+
uriPath: menuLink.uriPath,
|
|
905
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLink.labelAllLocales, menuLink.defaultLabel),
|
|
906
|
+
permissions: menuLink.permissions ?? [],
|
|
907
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
908
|
+
featureToggle: menuLink.featureToggle ?? null
|
|
909
|
+
}));
|
|
717
910
|
}
|
|
718
|
-
const menuLinks =
|
|
911
|
+
const menuLinks = config.env.__DEVELOPMENT__?.menuLinks;
|
|
719
912
|
return {
|
|
720
913
|
key: entryPointUriPath,
|
|
721
914
|
uriPath: entryPointUriPath,
|
|
722
915
|
icon: menuLinks.icon,
|
|
723
|
-
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLinks
|
|
916
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(menuLinks?.labelAllLocales, menuLinks?.defaultLabel),
|
|
724
917
|
permissions: menuLinks.permissions,
|
|
725
918
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
726
|
-
featureToggle:
|
|
727
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
728
|
-
menuVisibility: (_menuLinks$menuVisibi = menuLinks.menuVisibility) !== null && _menuLinks$menuVisibi !== void 0 ? _menuLinks$menuVisibi : null,
|
|
919
|
+
featureToggle: menuLinks.featureToggle ?? null,
|
|
729
920
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
730
|
-
actionRights:
|
|
921
|
+
actionRights: menuLinks.actionRights ?? null,
|
|
731
922
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
732
|
-
dataFences:
|
|
733
|
-
submenu: _mapInstanceProperty(_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
actionRights: (_submenuLink$actionRi = submenuLink.actionRights) !== null && _submenuLink$actionRi !== void 0 ? _submenuLink$actionRi : null,
|
|
746
|
-
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
747
|
-
dataFences: (_submenuLink$dataFenc = submenuLink.dataFences) !== null && _submenuLink$dataFenc !== void 0 ? _submenuLink$dataFenc : null
|
|
748
|
-
};
|
|
749
|
-
}),
|
|
923
|
+
dataFences: menuLinks.dataFences ?? null,
|
|
924
|
+
submenu: _mapInstanceProperty(_context2 = menuLinks.submenuLinks).call(_context2, submenuLink => ({
|
|
925
|
+
key: submenuLink.uriPath.replace('/', '-'),
|
|
926
|
+
uriPath: submenuLink.uriPath,
|
|
927
|
+
labelAllLocales: mapLabelAllLocalesWithDefaults(submenuLink.labelAllLocales, submenuLink.defaultLabel),
|
|
928
|
+
permissions: submenuLink.permissions,
|
|
929
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
930
|
+
featureToggle: submenuLink.featureToggle ?? null,
|
|
931
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
932
|
+
actionRights: submenuLink.actionRights ?? null,
|
|
933
|
+
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
934
|
+
dataFences: submenuLink.dataFences ?? null
|
|
935
|
+
})),
|
|
750
936
|
// @ts-ignore: not defined in schema, as it's only used internally.
|
|
751
|
-
shouldRenderDivider:
|
|
937
|
+
shouldRenderDivider: menuLinks.shouldRenderDivider ?? false
|
|
752
938
|
};
|
|
753
939
|
};
|
|
754
940
|
async function command$3(cliFlags, cwd) {
|
|
@@ -828,51 +1014,43 @@ async function command$2(cliFlags) {
|
|
|
828
1014
|
*/
|
|
829
1015
|
const git = {
|
|
830
1016
|
// https://git-scm.com/docs/git-merge-base
|
|
831
|
-
base: (baseBranch, headRevision) => {
|
|
832
|
-
var _context;
|
|
833
|
-
return _concatInstanceProperty(_context = "git merge-base ".concat(baseBranch, " ")).call(_context, headRevision);
|
|
834
|
-
},
|
|
1017
|
+
base: (baseBranch, headRevision) => `git merge-base ${baseBranch} ${headRevision}`,
|
|
835
1018
|
// https://git-scm.com/docs/git-diff
|
|
836
|
-
changedFiles: (mergeRevision, headRevision) => {
|
|
837
|
-
|
|
838
|
-
return _concatInstanceProperty(_context2 = "git diff --name-only ".concat(mergeRevision, " ")).call(_context2, headRevision);
|
|
839
|
-
},
|
|
840
|
-
commitMessage: headRevision => "git log --format=oneline -n 1 ".concat(headRevision)
|
|
1019
|
+
changedFiles: (mergeRevision, headRevision) => `git diff --name-only ${mergeRevision} ${headRevision}`,
|
|
1020
|
+
commitMessage: headRevision => `git log --format=oneline -n 1 ${headRevision}`
|
|
841
1021
|
};
|
|
842
1022
|
const helpers = {
|
|
843
1023
|
async writeOutDotEnvFile(cliFlags, cwd, matchingTriggers) {
|
|
844
|
-
var
|
|
1024
|
+
var _context;
|
|
845
1025
|
// If desired read the env file and write out the matching triggers.
|
|
846
1026
|
if (!cliFlags.outEnvFile) {
|
|
847
1027
|
return;
|
|
848
1028
|
}
|
|
849
1029
|
const filePath = path$1.join(fs.realpathSync(cwd), cliFlags.outEnvFile);
|
|
850
|
-
const fileContents = _mapInstanceProperty(
|
|
851
|
-
var _context5;
|
|
1030
|
+
const fileContents = _mapInstanceProperty(_context = _Object$entries(matchingTriggers)).call(_context, _ref => {
|
|
852
1031
|
let _ref2 = _slicedToArray(_ref, 2),
|
|
853
1032
|
triggerName = _ref2[0],
|
|
854
1033
|
triggerValue = _ref2[1];
|
|
855
|
-
const triggerNameForEnvFile =
|
|
1034
|
+
const triggerNameForEnvFile = `${snakeCase(triggerName).toUpperCase()}`;
|
|
856
1035
|
|
|
857
1036
|
// General pipeline optimization hints are not transformed
|
|
858
1037
|
if (_startsWithInstanceProperty(triggerName).call(triggerName, 'allowPipelineOptimizations')) {
|
|
859
|
-
|
|
860
|
-
return _concatInstanceProperty(_context4 = "".concat(triggerNameForEnvFile, "=")).call(_context4, triggerValue);
|
|
1038
|
+
return `${triggerNameForEnvFile}=${triggerValue}`;
|
|
861
1039
|
}
|
|
862
|
-
return
|
|
1040
|
+
return `DID_${triggerNameForEnvFile}_CHANGE=${triggerValue}`;
|
|
863
1041
|
}).join('\n');
|
|
864
1042
|
await fs.promises.writeFile(filePath, fileContents);
|
|
865
1043
|
if (!cliFlags.silent) {
|
|
866
|
-
console.log(
|
|
1044
|
+
console.log(`📝 Wrote out file to '${filePath}' with contents:`);
|
|
867
1045
|
console.log(fileContents);
|
|
868
1046
|
}
|
|
869
1047
|
},
|
|
870
1048
|
async getChangedFiles(cliFlags) {
|
|
871
|
-
var
|
|
1049
|
+
var _context2, _context3;
|
|
872
1050
|
const baseCmdResult = await command$5(git.base(cliFlags.baseBranch, cliFlags.headRevision));
|
|
873
1051
|
const mergeRevision = baseCmdResult.stdout;
|
|
874
1052
|
const changedFilesCmdResult = await command$5(git.changedFiles(mergeRevision, cliFlags.headRevision));
|
|
875
|
-
const changedFiles = _filterInstanceProperty(
|
|
1053
|
+
const changedFiles = _filterInstanceProperty(_context2 = _mapInstanceProperty(_context3 = changedFilesCmdResult.stdout.split('\n')).call(_context3, filePath => _trimInstanceProperty(filePath).call(filePath))).call(_context2, filePath => filePath.length > 0);
|
|
876
1054
|
return changedFiles;
|
|
877
1055
|
},
|
|
878
1056
|
async matchTriggersAgainstChangedFiles(cliFlags, config, changedFiles) {
|
|
@@ -880,7 +1058,6 @@ const helpers = {
|
|
|
880
1058
|
|
|
881
1059
|
// Evaluate each trigger against each file.
|
|
882
1060
|
_forEachInstanceProperty(config).call(config, async trigger => {
|
|
883
|
-
var _trigger$exclude;
|
|
884
1061
|
const hasTriggerBeenInitialized = typeof matchedTriggers[trigger.name] === 'number';
|
|
885
1062
|
|
|
886
1063
|
// Given the trigger with this name was never evaluated it has to be defaulted to 0.
|
|
@@ -898,10 +1075,10 @@ const helpers = {
|
|
|
898
1075
|
ignore: trigger.ignore
|
|
899
1076
|
});
|
|
900
1077
|
if (!cliFlags.silent && anyFileChangedForTrigger) {
|
|
901
|
-
console.log(
|
|
1078
|
+
console.log(`ℹ️ Files for trigger ${trigger.name} changed.`);
|
|
902
1079
|
}
|
|
903
1080
|
let onlyExcludedFilesChangedForTrigger = false;
|
|
904
|
-
if (
|
|
1081
|
+
if (trigger.exclude?.length > 0) {
|
|
905
1082
|
// NOTE: `micromatch.every` evaluates if every file matches
|
|
906
1083
|
// every pattern.
|
|
907
1084
|
// We need to evaluate if every file matches some pattern.
|
|
@@ -912,7 +1089,7 @@ const helpers = {
|
|
|
912
1089
|
});
|
|
913
1090
|
}
|
|
914
1091
|
if (!cliFlags.silent && onlyExcludedFilesChangedForTrigger) {
|
|
915
|
-
console.log(
|
|
1092
|
+
console.log(`ℹ️ Only excluded files for trigger ${trigger.name} changed.`);
|
|
916
1093
|
}
|
|
917
1094
|
if (onlyExcludedFilesChangedForTrigger) {
|
|
918
1095
|
matchedTriggers[trigger.name] = 0;
|
|
@@ -929,19 +1106,18 @@ async function command$1(cliFlags, config, cwd) {
|
|
|
929
1106
|
const isDevelopmentBranch = cliFlags.branch !== cliFlags.baseBranch;
|
|
930
1107
|
const triggersContainingSharedFiles = _filterInstanceProperty(config).call(config, trigger => trigger.containsSharedFiles);
|
|
931
1108
|
if (!cliFlags.silent) {
|
|
932
|
-
|
|
933
|
-
console.log(
|
|
934
|
-
console.log(
|
|
935
|
-
console.log(_concatInstanceProperty(_context8 = "\uD83D\uDEA7 Comparing '".concat(cliFlags.baseBranch, "' against '")).call(_context8, cliFlags.headRevision, "' to determine changed files."));
|
|
1109
|
+
console.log(`ℹ️ Pipeline optimizations are ${enablePipelineOptimizations ? 'enabled' : 'disabled'}.`);
|
|
1110
|
+
console.log(`ℹ️ Changes have been commited to the ${isDevelopmentBranch ? 'a development' : 'the main'} branch.`);
|
|
1111
|
+
console.log(`🚧 Comparing '${cliFlags.baseBranch}' against '${cliFlags.headRevision}' to determine changed files.`);
|
|
936
1112
|
}
|
|
937
1113
|
|
|
938
1114
|
// Collect and parse changed files from git comparing base and head revision.
|
|
939
1115
|
const changedFiles = await helpers.getChangedFiles(cliFlags);
|
|
940
1116
|
if (!cliFlags.silent) {
|
|
941
1117
|
if (changedFiles.length === 0) {
|
|
942
|
-
console.log(
|
|
1118
|
+
console.log(`ℹ️ No changes found.`);
|
|
943
1119
|
} else {
|
|
944
|
-
console.log(
|
|
1120
|
+
console.log(`ℹ️ ${changedFiles.length} changes found.`);
|
|
945
1121
|
}
|
|
946
1122
|
}
|
|
947
1123
|
|
|
@@ -952,17 +1128,17 @@ async function command$1(cliFlags, config, cwd) {
|
|
|
952
1128
|
const hasCommitMessageTrigger = commitMessage && _includesInstanceProperty(commitMessage).call(commitMessage, '[ci all]');
|
|
953
1129
|
const doesSharedTriggerMatch = _someInstanceProperty(triggersContainingSharedFiles).call(triggersContainingSharedFiles, triggerContainingSharedFiles => matchedTriggers[triggerContainingSharedFiles.name] === 1);
|
|
954
1130
|
if (!cliFlags.silent) {
|
|
955
|
-
console.log(
|
|
1131
|
+
console.log(`ℹ️ The git commit message ${hasCommitMessageTrigger ? 'does' : 'does not'} contain a [ci all] trigger.`);
|
|
956
1132
|
}
|
|
957
1133
|
const doesPackageFolderTriggerMatch = matchedTriggers[cliFlags.triggerName] === 1;
|
|
958
1134
|
if (enablePipelineOptimizations && isDevelopmentBranch && !hasCommitMessageTrigger && !doesSharedTriggerMatch && !doesPackageFolderTriggerMatch) {
|
|
959
1135
|
if (!cliFlags.silent) {
|
|
960
|
-
console.log(
|
|
1136
|
+
console.log(`ℹ️ No relevant changes found for ${cliFlags.triggerName}.`);
|
|
961
1137
|
}
|
|
962
1138
|
matchedTriggers['allowPipelineOptimizationsForTrigger'] = 1;
|
|
963
1139
|
} else {
|
|
964
1140
|
if (!cliFlags.silent) {
|
|
965
|
-
console.log(
|
|
1141
|
+
console.log(`ℹ️ Relevant changes found for ${cliFlags.triggerName}.`);
|
|
966
1142
|
}
|
|
967
1143
|
matchedTriggers['allowPipelineOptimizationsForTrigger'] = 0;
|
|
968
1144
|
}
|
|
@@ -1000,9 +1176,6 @@ const baseMenuProperties = {
|
|
|
1000
1176
|
required: ['locale', 'value']
|
|
1001
1177
|
}]
|
|
1002
1178
|
},
|
|
1003
|
-
menuVisibility: {
|
|
1004
|
-
type: ['string', 'null']
|
|
1005
|
-
},
|
|
1006
1179
|
permissions: {
|
|
1007
1180
|
type: 'array',
|
|
1008
1181
|
items: {
|
|
@@ -1082,15 +1255,15 @@ function validateMenu(menuJson) {
|
|
|
1082
1255
|
async function command(cliFlags) {
|
|
1083
1256
|
const menuJsonPath = cliFlags.inputFile;
|
|
1084
1257
|
const isAppbarMenu = cliFlags.navigation === 'top';
|
|
1085
|
-
if (!menuJsonPath) throw new Error(
|
|
1086
|
-
if (!doesFileExist(menuJsonPath)) throw new Error(
|
|
1258
|
+
if (!menuJsonPath) throw new Error(`--input-file cannot be empty. please provide the path of compiled menu.json`);
|
|
1259
|
+
if (!doesFileExist(menuJsonPath)) throw new Error(`The menu.json file doesn't exist: ${menuJsonPath}`);
|
|
1087
1260
|
const menuJson = fs$1.readFileSync(menuJsonPath, 'utf-8');
|
|
1088
1261
|
return validateMenu(JSON.parse(menuJson), isAppbarMenu ? appbarMenuSchema : navbarMenuSchema);
|
|
1089
1262
|
}
|
|
1090
1263
|
|
|
1091
1264
|
var pkgJson = {
|
|
1092
1265
|
name: "@commercetools-frontend/application-cli",
|
|
1093
|
-
version: "7.
|
|
1266
|
+
version: "7.1.0",
|
|
1094
1267
|
description: "Internal CLI to manage Merchant Center application deployments across various environments.",
|
|
1095
1268
|
keywords: [
|
|
1096
1269
|
"commercetools",
|
|
@@ -1115,13 +1288,13 @@ var pkgJson = {
|
|
|
1115
1288
|
dependencies: {
|
|
1116
1289
|
"@babel/core": "^7.22.11",
|
|
1117
1290
|
"@babel/runtime-corejs3": "^7.21.0",
|
|
1118
|
-
"@commercetools-frontend/application-config": "24.
|
|
1119
|
-
"@commercetools-frontend/constants": "24.
|
|
1120
|
-
"@commercetools-frontend/l10n": "24.
|
|
1291
|
+
"@commercetools-frontend/application-config": "24.13.0",
|
|
1292
|
+
"@commercetools-frontend/constants": "24.13.0",
|
|
1293
|
+
"@commercetools-frontend/l10n": "24.13.0",
|
|
1121
1294
|
"@manypkg/find-root": "2.2.3",
|
|
1122
1295
|
commander: "^13.1.0",
|
|
1123
1296
|
cosmiconfig: "9.0.0",
|
|
1124
|
-
dotenv: "
|
|
1297
|
+
dotenv: "17.2.3",
|
|
1125
1298
|
execa: "5.1.1",
|
|
1126
1299
|
jsonschema: "^1.4.1",
|
|
1127
1300
|
listr2: "8.3.3",
|
|
@@ -1134,7 +1307,7 @@ var pkgJson = {
|
|
|
1134
1307
|
"@tsconfig/node20": "20.1.6",
|
|
1135
1308
|
"@types/lodash": "^4.14.198",
|
|
1136
1309
|
"@types/micromatch": "4.0.9",
|
|
1137
|
-
"@types/node": "
|
|
1310
|
+
"@types/node": "24.1.0",
|
|
1138
1311
|
typescript: "5.2.2"
|
|
1139
1312
|
},
|
|
1140
1313
|
engines: {
|