@contentstack/cli-migration 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Contentstack
3
+ Copyright (c) 2023 Contentstack
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration
21
21
  $ csdx COMMAND
22
22
  running command...
23
23
  $ csdx (--version)
24
- @contentstack/cli-migration/1.1.0 linux-x64 node-v16.19.0
24
+ @contentstack/cli-migration/1.3.0 linux-x64 node-v16.20.0
25
25
  $ csdx --help [COMMAND]
26
26
  USAGE
27
27
  $ csdx COMMAND
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.0",
2
+ "version": "1.3.0",
3
3
  "commands": {
4
4
  "cm:stacks:migration": {
5
5
  "id": "cm:stacks:migration",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@contentstack/cli-migration",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "author": "@contentstack",
5
5
  "bugs": "https://github.com/contentstack/cli/issues",
6
6
  "dependencies": {
7
- "@contentstack/cli-command": "^1.1.0",
8
- "@contentstack/cli-utilities": "^1.1.0",
7
+ "@contentstack/cli-command": "^1.2.1",
8
+ "@contentstack/cli-utilities": "^1.2.1",
9
9
  "@contentstack/management": "^1.6.1",
10
10
  "@oclif/command": "^1.8.16",
11
11
  "@oclif/config": "^1.18.3",
@@ -14,7 +14,7 @@
14
14
  "cardinal": "^2.1.1",
15
15
  "chalk": "^4.1.0",
16
16
  "dot-object": "^2.1.4",
17
- "dotenv": "^8.2.0",
17
+ "dotenv": "^16.0.3",
18
18
  "listr": "^0.14.3",
19
19
  "winston": "^3.7.2"
20
20
  },
@@ -22,8 +22,6 @@
22
22
  "@oclif/test": "^2.2.10",
23
23
  "chai": "^4.3.4",
24
24
  "eslint": "^8.18.0",
25
- "eslint-config-oclif": "^3.1.0",
26
- "eslint-config-oclif-typescript": "^0.2.0",
27
25
  "globby": "^10.0.2",
28
26
  "husky": "^4.2.5",
29
27
  "jsdoc": "^4.0.0",
@@ -58,13 +56,18 @@
58
56
  "postpack": "rm -f oclif.manifest.json",
59
57
  "posttest": "eslint ./src",
60
58
  "generate-api-ref-md-doc": "nyc jsdoc2md ./src/modules/* > ./docs/api-reference.md",
61
- "prepack": "oclif manifest && oclif readme && npm run generate-api-ref-md-doc",
59
+ "prepack": "oclif manifest && oclif readme && pnpm generate-api-ref-md-doc",
62
60
  "test": "nyc mocha \"test/**/*.test.js\"",
63
- "version": "oclif readme && git add README.md"
61
+ "version": "oclif readme && git add README.md",
62
+ "clean": "rm -rf ./node_modules tsconfig.build.tsbuildinfo"
64
63
  },
65
64
  "csdxConfig": {
66
65
  "expiredCommands": {
67
66
  "cm:migration": "csdx cm:stacks:migration"
67
+ },
68
+ "shortCommandName": {
69
+ "cm:stacks:migration": "MGRTN",
70
+ "cm:migration": "O-MGRTN"
68
71
  }
69
72
  }
70
73
  }
@@ -6,14 +6,13 @@
6
6
  // Dependencies
7
7
  const Listr = require('listr');
8
8
  const { resolve, extname } = require('path');
9
- const { Command, flags } = require('@contentstack/cli-command');
9
+ const { Command } = require('@contentstack/cli-command');
10
10
  const { waterfall } = require('async');
11
11
  const { Parser } = require('../../../modules');
12
12
  const { ActionList } = require('../../../actions');
13
13
  const fs = require('fs');
14
14
  const chalk = require('chalk');
15
- const { configHandler } = require('@contentstack/cli-utilities');
16
- const { printFlagDeprecation } = require('@contentstack/cli-utilities');
15
+ const { configHandler, printFlagDeprecation, managementSDKClient, flags } = require('@contentstack/cli-utilities');
17
16
 
18
17
  const { ApiError, SchemaValidator, MigrationError, FieldValidator } = require('../../../validators');
19
18
 
@@ -82,6 +81,7 @@ class MigrationCommand extends Command {
82
81
  set('config', mapInstance, configObj);
83
82
  }
84
83
 
84
+ const APIClient = await managementSDKClient({ host: this.cmaHost })
85
85
  let stackSDKInstance;
86
86
  if (branch) {
87
87
  set(BRANCH, mapInstance, branch);
@@ -93,13 +93,13 @@ class MigrationCommand extends Command {
93
93
  set(MANAGEMENT_TOKEN, mapInstance, managementToken);
94
94
  set(API_KEY, mapInstance, managementToken.apiKey);
95
95
  if (branch) {
96
- stackSDKInstance = this.managementAPIClient.stack({
96
+ stackSDKInstance = APIClient.stack({
97
97
  management_token: managementToken.token,
98
98
  api_key: managementToken.apiKey,
99
99
  branch_uid: branch,
100
100
  });
101
101
  } else {
102
- stackSDKInstance = this.managementAPIClient.stack({
102
+ stackSDKInstance = APIClient.stack({
103
103
  management_token: managementToken.token,
104
104
  api_key: managementToken.apiKey,
105
105
  });
@@ -108,19 +108,18 @@ class MigrationCommand extends Command {
108
108
  } else if (authtoken) {
109
109
  set(AUTH_TOKEN, mapInstance, authtoken);
110
110
  set(API_KEY, mapInstance, apiKey);
111
- this.managementAPIClient = { authtoken: this.authToken };
112
111
  if (branch) {
113
- stackSDKInstance = this.managementAPIClient.stack({
112
+ stackSDKInstance = APIClient.stack({
114
113
  api_key: apiKey,
115
114
  branch_uid: branch,
116
115
  });
117
116
  } else {
118
- stackSDKInstance = this.managementAPIClient.stack({ api_key: apiKey });
117
+ stackSDKInstance = APIClient.stack({ api_key: apiKey });
119
118
  }
120
119
  }
121
120
 
122
121
  set(MANAGEMENT_SDK, mapInstance, stackSDKInstance);
123
- set(MANAGEMENT_CLIENT, mapInstance, this.managementAPIClient);
122
+ set(MANAGEMENT_CLIENT, mapInstance, APIClient);
124
123
 
125
124
  if (multi) {
126
125
  await this.execMultiFiles(filePath, mapInstance);