@squiz/dxp-cli-next 1.11.0 → 2.0.0-develop.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.
@@ -14,6 +14,7 @@ describe('dxp', () => {
14
14
  expect(commandsText).toEqual([
15
15
  'auth log into the sxc',
16
16
  'td Template deployment commands',
17
+ 'cmp Component Service Commands',
17
18
  ]);
18
19
  });
19
20
  });
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ declare const deployCommand: Command;
3
+ export default deployCommand;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const commander_1 = require("commander");
16
+ const component_cli_lib_1 = require("@squiz/component-cli-lib");
17
+ const cli_color_1 = __importDefault(require("cli-color"));
18
+ const deployCommand = new commander_1.Command()
19
+ .name('deploy')
20
+ .argument('<source>', 'folder/file path containing the template files to deploy')
21
+ .addOption(new commander_1.Option('-url, --component-service-url <string>', 'Required: Url for the component service')
22
+ .env('COMPONENT_SERVICE_URL')
23
+ .makeOptionMandatory(true))
24
+ .action((source, options, self) => __awaiter(void 0, void 0, void 0, function* () {
25
+ try {
26
+ return yield (0, component_cli_lib_1.uploadComponentFolder)(source, options.componentServiceUrl);
27
+ }
28
+ catch (error) {
29
+ if (error.message) {
30
+ deployCommand.error(cli_color_1.default.red(error.message));
31
+ }
32
+ else {
33
+ console.error(error);
34
+ deployCommand.error('An unknown error occurred');
35
+ }
36
+ }
37
+ }));
38
+ exports.default = deployCommand;
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ declare const cmpCommand: Command;
3
+ export default cmpCommand;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const commander_1 = require("commander");
7
+ const deploy_1 = __importDefault(require("./deploy"));
8
+ const cmpCommand = new commander_1.Command('cmp');
9
+ cmpCommand.description('Component Service Commands').addCommand(deploy_1.default);
10
+ exports.default = cmpCommand;
package/lib/dxp.js CHANGED
@@ -11,6 +11,7 @@ const pkg = require('../package.json');
11
11
  });
12
12
  const auth_1 = __importDefault(require("./auth"));
13
13
  const td_1 = __importDefault(require("./td"));
14
+ const cmp_1 = __importDefault(require("./cmp"));
14
15
  const program = new commander_1.default.Command();
15
16
  const packageJson = require('../package.json');
16
17
  const version = packageJson.version;
@@ -20,6 +21,7 @@ program
20
21
  .description('dxp commands')
21
22
  .addCommand(auth_1.default)
22
23
  .addCommand(td_1.default)
24
+ .addCommand(cmp_1.default)
23
25
  .action(() => {
24
26
  program.help();
25
27
  })
@@ -16,7 +16,7 @@ const commander_1 = require("commander");
16
16
  const deployment_service_lib_1 = require("@squiz/deployment-service-lib");
17
17
  const cli_color_1 = __importDefault(require("cli-color"));
18
18
  const setExternalIdsCommand = new commander_1.Command()
19
- .name('setExternalIds')
19
+ .name('set-external-ids')
20
20
  .argument('<root-asset-id>', 'root asset ID to set external ids for')
21
21
  .addOption(new commander_1.Option('-f, --force', 'Optional: Do a force reset. This will reset all the external ids for the given root asset id').default(false, 'default is false'))
22
22
  .addOption(new commander_1.Option('-api, --matrix-api-url <string>', 'Required: Matrix asset management api url')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/dxp-cli-next",
3
- "version": "1.11.0",
3
+ "version": "2.0.0-develop.1",
4
4
  "repository": {
5
5
  "url": "https://gitlab.squiz.net/developer-experience/dxp-cli-next"
6
6
  },
@@ -40,6 +40,7 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@squiz/deployment-service-lib": "1.1.5-alpha.67",
43
+ "@squiz/component-cli-lib": "1.2.1-alpha.30",
43
44
  "cli-color": "^2.0.1",
44
45
  "commander": "^9.0.0",
45
46
  "update-notifier": "^5.1.0"