@commercetools-frontend/mc-scripts 21.8.0 → 21.8.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.
Files changed (46) hide show
  1. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.dev.js +20 -12
  2. package/cli/dist/commercetools-frontend-mc-scripts-cli.cjs.prod.js +20 -12
  3. package/cli/dist/commercetools-frontend-mc-scripts-cli.esm.js +20 -12
  4. package/dist/{build-97278377.cjs.dev.js → build-3521a4f3.cjs.dev.js} +3 -3
  5. package/dist/{build-9395925a.cjs.prod.js → build-acb29f36.cjs.prod.js} +3 -3
  6. package/dist/{build-8582b673.esm.js → build-cac1a859.esm.js} +3 -3
  7. package/dist/commercetools-frontend-mc-scripts.cjs.dev.js +1 -1
  8. package/dist/commercetools-frontend-mc-scripts.cjs.prod.js +1 -1
  9. package/dist/commercetools-frontend-mc-scripts.esm.js +1 -1
  10. package/dist/{compile-html-4832f8c5.esm.js → compile-html-4361a0b3.esm.js} +18 -24
  11. package/dist/{compile-html-7654b5e6.cjs.prod.js → compile-html-d6331c35.cjs.prod.js} +18 -24
  12. package/dist/{compile-html-0c588a89.cjs.dev.js → compile-html-d9e731aa.cjs.dev.js} +18 -24
  13. package/dist/{config-sync-62824317.cjs.prod.js → config-sync-7bd51e9b.cjs.prod.js} +46 -74
  14. package/dist/{config-sync-d52e73f6.cjs.dev.js → config-sync-9540c47f.cjs.dev.js} +46 -74
  15. package/dist/{config-sync-20bc05e8.esm.js → config-sync-a6565737.esm.js} +46 -74
  16. package/dist/{create-postcss-config-4cbe10ab.cjs.dev.js → create-postcss-config-07259760.cjs.dev.js} +1 -1
  17. package/dist/{create-postcss-config-c1aa3525.esm.js → create-postcss-config-9e14f015.esm.js} +1 -1
  18. package/dist/{create-postcss-config-8ea16440.cjs.prod.js → create-postcss-config-c1122bfa.cjs.prod.js} +1 -1
  19. package/dist/{create-webpack-config-for-development-e2735e02.cjs.dev.js → create-webpack-config-for-development-20fbe5a5.cjs.dev.js} +1 -1
  20. package/dist/{create-webpack-config-for-development-a5e73092.cjs.prod.js → create-webpack-config-for-development-b70e9af1.cjs.prod.js} +1 -1
  21. package/dist/{create-webpack-config-for-development-8a8b84d6.esm.js → create-webpack-config-for-development-eb1432fe.esm.js} +1 -1
  22. package/dist/{create-webpack-config-for-production-7dc669e5.esm.js → create-webpack-config-for-production-331c8877.esm.js} +1 -1
  23. package/dist/{create-webpack-config-for-production-d9bf281c.cjs.dev.js → create-webpack-config-for-production-4e58ee43.cjs.dev.js} +1 -1
  24. package/dist/{create-webpack-config-for-production-4e7b56c0.cjs.prod.js → create-webpack-config-for-production-e894ffc1.cjs.prod.js} +1 -1
  25. package/dist/declarations/src/commands/compile-html.d.ts +1 -1
  26. package/dist/declarations/src/commands/config-sync.d.ts +1 -1
  27. package/dist/declarations/src/types.d.ts +3 -3
  28. package/dist/{login-7d94659e.esm.js → login-435f4c2b.esm.js} +2 -2
  29. package/dist/{login-779552b7.cjs.dev.js → login-d1cbdeca.cjs.dev.js} +2 -2
  30. package/dist/{login-706ccc9a.cjs.prod.js → login-e943a53a.cjs.prod.js} +2 -2
  31. package/dist/{package-b5c040f3.cjs.prod.js → package-8a5733b4.cjs.dev.js} +7 -7
  32. package/dist/{package-a98de907.esm.js → package-8b6676c0.esm.js} +7 -7
  33. package/dist/{package-aaf61bf0.cjs.dev.js → package-fab41a01.cjs.prod.js} +7 -7
  34. package/dist/{start-e3ccd672.cjs.prod.js → start-086879f3.cjs.prod.js} +3 -3
  35. package/dist/{start-e924bd5d.esm.js → start-52af291f.esm.js} +3 -3
  36. package/dist/{start-2b953ab0.cjs.dev.js → start-dfef24e1.cjs.dev.js} +3 -3
  37. package/dist/{user-agent-8044acd6.esm.js → user-agent-7d6d1d4a.esm.js} +1 -1
  38. package/dist/{user-agent-5da1830b.cjs.dev.js → user-agent-866e4833.cjs.dev.js} +1 -1
  39. package/dist/{user-agent-d18809af.cjs.prod.js → user-agent-94518666.cjs.prod.js} +1 -1
  40. package/package.json +7 -7
  41. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.dev.js +2 -2
  42. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.cjs.prod.js +2 -2
  43. package/postcss/dist/commercetools-frontend-mc-scripts-postcss.esm.js +2 -2
  44. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.dev.js +4 -4
  45. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.cjs.prod.js +4 -4
  46. package/webpack/dist/commercetools-frontend-mc-scripts-webpack.esm.js +4 -4
@@ -21,71 +21,65 @@ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
21
21
 
22
22
  var appDirectory = fs__default["default"].realpathSync(process.cwd());
23
23
 
24
- function run() {
24
+ function run(_x) {
25
25
  return _run.apply(this, arguments);
26
26
  }
27
27
 
28
28
  function _run() {
29
- _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
30
- var options,
31
- compiled,
32
- transformerPath,
33
- transformerFn,
34
- _context,
35
- _args = arguments;
29
+ _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(options) {
30
+ var compiled, transformerPath, transformerFn, _context;
36
31
 
37
32
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context2) {
38
33
  while (1) {
39
34
  switch (_context2.prev = _context2.next) {
40
35
  case 0:
41
- options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
42
36
  console.log('Compiling index.html...');
43
- _context2.next = 4;
37
+ _context2.next = 3;
44
38
  return mcHtmlTemplate.compileHtml(paths.paths.appIndexHtmlTemplate);
45
39
 
46
- case 4:
40
+ case 3:
47
41
  compiled = _context2.sent;
48
42
  fs__default["default"].writeFileSync(paths.paths.appIndexHtml, compiled.indexHtmlContent, {
49
43
  encoding: 'utf8'
50
44
  });
51
45
 
52
46
  if (!options.transformer) {
53
- _context2.next = 18;
47
+ _context2.next = 17;
54
48
  break;
55
49
  }
56
50
 
57
- _context2.prev = 7;
51
+ _context2.prev = 6;
58
52
  transformerPath = require.resolve(options.transformer, {
59
53
  paths: [appDirectory]
60
54
  });
61
55
  transformerFn = require(transformerPath);
62
56
  transformerFn(compiled);
63
- _context2.next = 16;
57
+ _context2.next = 15;
64
58
  break;
65
59
 
66
- case 13:
67
- _context2.prev = 13;
68
- _context2.t0 = _context2["catch"](7);
60
+ case 12:
61
+ _context2.prev = 12;
62
+ _context2.t0 = _context2["catch"](6);
69
63
  throw new Error(_concatInstanceProperty__default["default"](_context = "Could not load transformer module \"".concat(options.transformer, "\"\n")).call(_context, _context2.t0 instanceof Error ? _context2.t0.stack : ''));
70
64
 
71
- case 16:
72
- _context2.next = 19;
65
+ case 15:
66
+ _context2.next = 18;
73
67
  break;
74
68
 
75
- case 18:
76
- if (options['print-security-headers']) {
69
+ case 17:
70
+ if (options.printSecurityHeaders) {
77
71
  console.log(_JSON$stringify__default["default"](compiled.headers));
78
72
  }
79
73
 
80
- case 19:
74
+ case 18:
81
75
  console.log(chalk__default["default"].green('Compiled successfully.\n'));
82
76
 
83
- case 20:
77
+ case 19:
84
78
  case "end":
85
79
  return _context2.stop();
86
80
  }
87
81
  }
88
- }, _callee, null, [[7, 13]]);
82
+ }, _callee, null, [[6, 12]]);
89
83
  }));
90
84
  return _run.apply(this, arguments);
91
85
  }
@@ -11,7 +11,7 @@ var omit = require('lodash/omit');
11
11
  var prompts = require('prompts');
12
12
  var chalk = require('chalk');
13
13
  var applicationConfig = require('@commercetools-frontend/application-config');
14
- var userAgent = require('./user-agent-d18809af.cjs.prod.js');
14
+ var userAgent = require('./user-agent-94518666.cjs.prod.js');
15
15
  var graphqlRequest = require('graphql-request');
16
16
  var constants = require('@commercetools-frontend/constants');
17
17
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
@@ -33,7 +33,7 @@ require('fs');
33
33
  require('path');
34
34
  require('os');
35
35
  require('@commercetools/http-user-agent');
36
- require('./package-b5c040f3.cjs.prod.js');
36
+ require('./package-fab41a01.cjs.prod.js');
37
37
 
38
38
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
39
39
 
@@ -624,112 +624,84 @@ var getMcUrlLink = function getMcUrlLink(mcApiUrl, organizationId, applicationId
624
624
  return customAppLink;
625
625
  };
626
626
 
627
- function run() {
627
+ function run(_x) {
628
628
  return _run.apply(this, arguments);
629
629
  }
630
630
 
631
631
  function _run() {
632
- _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
632
+ _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(options) {
633
633
  var _context6;
634
634
 
635
- var options,
636
- applicationConfig$1,
637
- localCustomAppData,
638
- mcApiUrl,
639
- token,
640
- fetchedCustomApplication,
641
- _context4,
642
- _context5,
643
- userOrganizations,
644
- organizationId,
645
- organizationName,
646
- _userOrganizations$re,
647
- organization,
648
- _context3,
649
- organizationChoices,
650
- _yield$prompts,
651
- selectedOrganizationId,
652
- _yield$prompts2,
653
- _confirmation,
654
- _data,
655
- createdCustomApplication,
656
- _customAppLink,
657
- customAppLink,
658
- configDiff,
659
- _yield$prompts3,
660
- confirmation,
661
- data,
662
- _args = arguments;
635
+ var applicationConfig$1, localCustomAppData, mcApiUrl, token, fetchedCustomApplication, _context4, _context5, userOrganizations, organizationId, organizationName, _userOrganizations$re, organization, _context3, organizationChoices, _yield$prompts, selectedOrganizationId, _yield$prompts2, _confirmation, _data, createdCustomApplication, _customAppLink, customAppLink, configDiff, _yield$prompts3, confirmation, data;
663
636
 
664
637
  return _regeneratorRuntime__default["default"].wrap(function _callee$(_context7) {
665
638
  while (1) {
666
639
  switch (_context7.prev = _context7.next) {
667
640
  case 0:
668
- options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
669
641
  applicationConfig$1 = applicationConfig.processConfig();
670
642
  localCustomAppData = applicationConfig$1.data;
671
643
  mcApiUrl = applicationConfig$1.env.mcApiUrl;
672
644
  token = credentialsStorage.getToken(mcApiUrl);
673
645
 
674
646
  if (token) {
675
- _context7.next = 7;
647
+ _context7.next = 6;
676
648
  break;
677
649
  }
678
650
 
679
651
  throw new Error("You don't have a valid session for the ".concat(mcApiUrl, " environment. Please, run the \"mc-scripts login\" command to authenticate yourself."));
680
652
 
681
- case 7:
682
- _context7.next = 9;
653
+ case 6:
654
+ _context7.next = 8;
683
655
  return fetchCustomApplication({
684
656
  mcApiUrl: mcApiUrl,
685
657
  token: token,
686
658
  entryPointUriPath: localCustomAppData.entryPointUriPath
687
659
  });
688
660
 
689
- case 9:
661
+ case 8:
690
662
  fetchedCustomApplication = _context7.sent;
691
663
 
692
664
  if (fetchedCustomApplication) {
693
- _context7.next = 52;
665
+ _context7.next = 51;
694
666
  break;
695
667
  }
696
668
 
697
- _context7.next = 13;
669
+ _context7.next = 12;
698
670
  return fetchUserOrganizations({
699
671
  mcApiUrl: mcApiUrl,
700
672
  token: token
701
673
  });
702
674
 
703
- case 13:
675
+ case 12:
704
676
  userOrganizations = _context7.sent;
705
677
 
706
678
  if (!(userOrganizations.total === 0)) {
707
- _context7.next = 16;
679
+ _context7.next = 15;
708
680
  break;
709
681
  }
710
682
 
711
683
  throw new Error("It seems you are not an admin of any Organization. Please make sure to be part of the Administrators team of the Organization you want the Custom Application to be configured to.");
712
684
 
713
- case 16:
685
+ case 15:
714
686
  if (!(userOrganizations.total === 1)) {
715
- _context7.next = 22;
687
+ _context7.next = 21;
716
688
  break;
717
689
  }
718
690
 
719
691
  _userOrganizations$re = _slicedToArray(userOrganizations.results, 1), organization = _userOrganizations$re[0];
720
692
  organizationId = organization.id;
721
693
  organizationName = organization.name;
722
- _context7.next = 31;
694
+ _context7.next = 30;
723
695
  break;
724
696
 
725
- case 22:
697
+ case 21:
726
698
  organizationChoices = _mapInstanceProperty__default["default"](_context3 = userOrganizations.results).call(_context3, function (organization) {
727
699
  return {
728
700
  title: organization.name,
729
701
  value: organization.id
730
702
  };
731
703
  });
732
- _context7.next = 25;
704
+ _context7.next = 24;
733
705
  return prompts__default["default"]({
734
706
  type: 'select',
735
707
  name: 'organizationId',
@@ -738,26 +710,26 @@ function _run() {
738
710
  initial: 0
739
711
  });
740
712
 
741
- case 25:
713
+ case 24:
742
714
  _yield$prompts = _context7.sent;
743
715
  selectedOrganizationId = _yield$prompts.organizationId;
744
716
 
745
717
  if (selectedOrganizationId) {
746
- _context7.next = 29;
718
+ _context7.next = 28;
747
719
  break;
748
720
  }
749
721
 
750
722
  throw new Error("No Organization selected, aborting.");
751
723
 
752
- case 29:
724
+ case 28:
753
725
  organizationId = selectedOrganizationId;
754
726
  organizationName = _findInstanceProperty__default["default"](organizationChoices).call(organizationChoices, function (_ref) {
755
727
  var value = _ref.value;
756
728
  return value === organizationId;
757
729
  }).title;
758
730
 
759
- case 31:
760
- _context7.next = 33;
731
+ case 30:
732
+ _context7.next = 32;
761
733
  return prompts__default["default"]({
762
734
  type: 'text',
763
735
  name: 'confirmation',
@@ -765,23 +737,23 @@ function _run() {
765
737
  initial: 'yes'
766
738
  });
767
739
 
768
- case 33:
740
+ case 32:
769
741
  _yield$prompts2 = _context7.sent;
770
742
  _confirmation = _yield$prompts2.confirmation;
771
743
 
772
744
  if (!(!_confirmation || _confirmation.toLowerCase().charAt(0) !== 'y')) {
773
- _context7.next = 38;
745
+ _context7.next = 37;
774
746
  break;
775
747
  }
776
748
 
777
749
  console.log(chalk__default["default"].red('Aborted.'));
778
750
  return _context7.abrupt("return");
779
751
 
780
- case 38:
752
+ case 37:
781
753
  _data = omit__default["default"](localCustomAppData, ['id']);
782
754
 
783
- if (!options['dry-run']) {
784
- _context7.next = 44;
755
+ if (!options.dryRun) {
756
+ _context7.next = 43;
785
757
  break;
786
758
  }
787
759
 
@@ -790,8 +762,8 @@ function _run() {
790
762
  console.log(_JSON$stringify__default["default"](_data));
791
763
  return _context7.abrupt("return");
792
764
 
793
- case 44:
794
- _context7.next = 46;
765
+ case 43:
766
+ _context7.next = 45;
795
767
  return createCustomApplication({
796
768
  mcApiUrl: mcApiUrl,
797
769
  token: token,
@@ -799,36 +771,36 @@ function _run() {
799
771
  data: _data
800
772
  });
801
773
 
802
- case 46:
774
+ case 45:
803
775
  createdCustomApplication = _context7.sent;
804
776
 
805
777
  if (createdCustomApplication) {
806
- _context7.next = 49;
778
+ _context7.next = 48;
807
779
  break;
808
780
  }
809
781
 
810
782
  throw new Error('Failed to create the Custom Application.');
811
783
 
812
- case 49:
784
+ case 48:
813
785
  _customAppLink = getMcUrlLink(mcApiUrl, organizationId, createdCustomApplication.id);
814
786
  console.log(chalk__default["default"].green(_concatInstanceProperty__default["default"](_context5 = "Custom Application created.\nThe \"applicationId\" in your local Custom Application config file should be updated with the application ID: ".concat(createdCustomApplication.id, ".\nYou can see the Custom Application data in the Merchant Center at ")).call(_context5, _customAppLink, ".")));
815
787
  return _context7.abrupt("return");
816
788
 
817
- case 52:
789
+ case 51:
818
790
  customAppLink = getMcUrlLink(mcApiUrl, fetchedCustomApplication.organizationId, fetchedCustomApplication.application.id);
819
791
  configDiff = getConfigDiff(fetchedCustomApplication.application, localCustomAppData);
820
792
 
821
793
  if (configDiff) {
822
- _context7.next = 57;
794
+ _context7.next = 56;
823
795
  break;
824
796
  }
825
797
 
826
798
  console.log(chalk__default["default"].green("Custom Application is already up to date.\nYou can see the Custom Application data in the Merchant Center at ".concat(customAppLink, ".")));
827
799
  return _context7.abrupt("return");
828
800
 
829
- case 57:
801
+ case 56:
830
802
  console.log(configDiff);
831
- _context7.next = 60;
803
+ _context7.next = 59;
832
804
  return prompts__default["default"]({
833
805
  type: 'text',
834
806
  name: 'confirmation',
@@ -836,23 +808,23 @@ function _run() {
836
808
  initial: 'yes'
837
809
  });
838
810
 
839
- case 60:
811
+ case 59:
840
812
  _yield$prompts3 = _context7.sent;
841
813
  confirmation = _yield$prompts3.confirmation;
842
814
 
843
815
  if (!(!confirmation || confirmation.toLowerCase().charAt(0) !== 'y')) {
844
- _context7.next = 65;
816
+ _context7.next = 64;
845
817
  break;
846
818
  }
847
819
 
848
820
  console.log(chalk__default["default"].red('Aborted.'));
849
821
  return _context7.abrupt("return");
850
822
 
851
- case 65:
823
+ case 64:
852
824
  data = omit__default["default"](localCustomAppData, ['id']);
853
825
 
854
- if (!options['dry-run']) {
855
- _context7.next = 71;
826
+ if (!options.dryRun) {
827
+ _context7.next = 70;
856
828
  break;
857
829
  }
858
830
 
@@ -861,8 +833,8 @@ function _run() {
861
833
  console.log(_JSON$stringify__default["default"](data));
862
834
  return _context7.abrupt("return");
863
835
 
864
- case 71:
865
- _context7.next = 73;
836
+ case 70:
837
+ _context7.next = 72;
866
838
  return updateCustomApplication({
867
839
  mcApiUrl: mcApiUrl,
868
840
  token: token,
@@ -871,10 +843,10 @@ function _run() {
871
843
  applicationId: fetchedCustomApplication.application.id
872
844
  });
873
845
 
874
- case 73:
846
+ case 72:
875
847
  console.log(chalk__default["default"].green("Custom Application updated.\nYou can see the Custom Application data in the Merchant Center at ".concat(customAppLink, ".")));
876
848
 
877
- case 74:
849
+ case 73:
878
850
  case "end":
879
851
  return _context7.stop();
880
852
  }