@contentstack/cli-cm-clone 1.20.0 → 1.21.0-beta.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/README.md +1 -1
- package/lib/commands/cm/stacks/clone.d.ts +21 -0
- package/lib/commands/cm/stacks/clone.js +315 -0
- package/lib/core/helpers/command-helpers.d.ts +31 -0
- package/lib/core/helpers/command-helpers.js +79 -0
- package/lib/core/util/abort-controller.d.ts +30 -0
- package/lib/core/util/abort-controller.js +58 -0
- package/lib/core/util/clone-handler.d.ts +55 -0
- package/lib/core/util/clone-handler.js +763 -0
- package/lib/core/util/dummyConfig.json +1 -0
- package/lib/types/clone-config.d.ts +35 -0
- package/lib/types/clone-config.js +2 -0
- package/lib/types/clone-context.d.ts +10 -0
- package/lib/types/clone-context.js +2 -0
- package/lib/types/command-types.d.ts +39 -0
- package/lib/types/command-types.js +2 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +6 -0
- package/lib/utils/constants.d.ts +25 -0
- package/lib/utils/constants.js +40 -0
- package/oclif.manifest.json +169 -0
- package/package.json +8 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CloneContext } from './clone-context';
|
|
2
|
+
/**
|
|
3
|
+
* Clone configuration interface
|
|
4
|
+
*/
|
|
5
|
+
export interface CloneConfig {
|
|
6
|
+
cloneContext?: CloneContext;
|
|
7
|
+
source_stack?: string;
|
|
8
|
+
sourceStackName?: string;
|
|
9
|
+
sourceOrg?: string;
|
|
10
|
+
sourceStackBranch?: string;
|
|
11
|
+
sourceStackBranchAlias?: string;
|
|
12
|
+
source_alias?: string;
|
|
13
|
+
target_stack?: string;
|
|
14
|
+
destinationStackName?: string;
|
|
15
|
+
targetOrg?: string;
|
|
16
|
+
targetStackBranch?: string;
|
|
17
|
+
targetStackBranchAlias?: string;
|
|
18
|
+
destination_alias?: string;
|
|
19
|
+
cloneType?: 'a' | 'b';
|
|
20
|
+
stackName?: string;
|
|
21
|
+
importWebhookStatus?: 'disable' | 'current';
|
|
22
|
+
skipAudit?: boolean;
|
|
23
|
+
forceStopMarketplaceAppsPrompt?: boolean;
|
|
24
|
+
data?: string;
|
|
25
|
+
modules?: string[];
|
|
26
|
+
filteredModules?: string[];
|
|
27
|
+
pathDir?: string;
|
|
28
|
+
auth_token?: string;
|
|
29
|
+
management_token?: string;
|
|
30
|
+
host?: string;
|
|
31
|
+
cdn?: string;
|
|
32
|
+
export?: Record<string, any>;
|
|
33
|
+
import?: Record<string, any>;
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command interface for the command pattern
|
|
3
|
+
*/
|
|
4
|
+
export interface ICommand {
|
|
5
|
+
execute(params?: any): Promise<any>;
|
|
6
|
+
undo?(params?: any): Promise<void>;
|
|
7
|
+
params?: any;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Command parameters for organization selection
|
|
11
|
+
*/
|
|
12
|
+
export interface OrgCommandParams {
|
|
13
|
+
msg?: string;
|
|
14
|
+
isSource?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Command parameters for stack selection
|
|
18
|
+
*/
|
|
19
|
+
export interface StackCommandParams {
|
|
20
|
+
org?: {
|
|
21
|
+
Organization: string;
|
|
22
|
+
};
|
|
23
|
+
msg?: string;
|
|
24
|
+
isSource?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Command parameters for branch selection
|
|
28
|
+
*/
|
|
29
|
+
export interface BranchCommandParams {
|
|
30
|
+
api_key?: string;
|
|
31
|
+
isSource?: boolean;
|
|
32
|
+
returnBranch?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Command parameters for stack creation
|
|
36
|
+
*/
|
|
37
|
+
export interface CreateStackCommandParams {
|
|
38
|
+
orgUid: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./clone-config"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./clone-context"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./command-types"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for clone operations
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* List of structure modules (excluding entries and assets)
|
|
6
|
+
*/
|
|
7
|
+
export declare const STRUCTURE_LIST: string[];
|
|
8
|
+
/**
|
|
9
|
+
* Stack creation confirmation prompt configuration
|
|
10
|
+
*/
|
|
11
|
+
export declare const STACK_CREATION_CONFIRMATION: readonly [{
|
|
12
|
+
readonly type: "confirm";
|
|
13
|
+
readonly name: "stackCreate";
|
|
14
|
+
readonly message: "Want to clone content into a new stack ?";
|
|
15
|
+
readonly initial: true;
|
|
16
|
+
}];
|
|
17
|
+
/**
|
|
18
|
+
* Stack name prompt configuration
|
|
19
|
+
*/
|
|
20
|
+
export declare const STACK_NAME_PROMPT: {
|
|
21
|
+
readonly type: "input";
|
|
22
|
+
readonly name: "stack";
|
|
23
|
+
readonly default: "ABC";
|
|
24
|
+
readonly message: "Enter name for the new stack to store the cloned content ?";
|
|
25
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Constants for clone operations
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.STACK_NAME_PROMPT = exports.STACK_CREATION_CONFIRMATION = exports.STRUCTURE_LIST = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* List of structure modules (excluding entries and assets)
|
|
9
|
+
*/
|
|
10
|
+
exports.STRUCTURE_LIST = [
|
|
11
|
+
'locales',
|
|
12
|
+
'environments',
|
|
13
|
+
'extensions',
|
|
14
|
+
'marketplace-apps',
|
|
15
|
+
'webhooks',
|
|
16
|
+
'global-fields',
|
|
17
|
+
'content-types',
|
|
18
|
+
'workflows',
|
|
19
|
+
'labels',
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Stack creation confirmation prompt configuration
|
|
23
|
+
*/
|
|
24
|
+
exports.STACK_CREATION_CONFIRMATION = [
|
|
25
|
+
{
|
|
26
|
+
type: 'confirm',
|
|
27
|
+
name: 'stackCreate',
|
|
28
|
+
message: 'Want to clone content into a new stack ?',
|
|
29
|
+
initial: true,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Stack name prompt configuration
|
|
34
|
+
*/
|
|
35
|
+
exports.STACK_NAME_PROMPT = {
|
|
36
|
+
type: 'input',
|
|
37
|
+
name: 'stack',
|
|
38
|
+
default: 'ABC',
|
|
39
|
+
message: 'Enter name for the new stack to store the cloned content ?',
|
|
40
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
{
|
|
2
|
+
"commands": {
|
|
3
|
+
"cm:stacks:clone": {
|
|
4
|
+
"aliases": [
|
|
5
|
+
"cm:stack-clone"
|
|
6
|
+
],
|
|
7
|
+
"args": {},
|
|
8
|
+
"description": "Clone data (structure/content or both) of a stack into another stack\nUse this plugin to automate the process of cloning a stack in few steps.\n",
|
|
9
|
+
"examples": [
|
|
10
|
+
"csdx cm:stacks:clone",
|
|
11
|
+
"csdx cm:stacks:clone --source-branch <source-branch-name> --target-branch <target-branch-name> --yes",
|
|
12
|
+
"csdx cm:stacks:clone --source-stack-api-key <apiKey> --destination-stack-api-key <apiKey>",
|
|
13
|
+
"csdx cm:stacks:clone --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>",
|
|
14
|
+
"csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias>",
|
|
15
|
+
"csdx cm:stacks:clone --source-branch --target-branch --source-management-token-alias <management token alias> --destination-management-token-alias <management token alias> --type <value a or b>"
|
|
16
|
+
],
|
|
17
|
+
"flags": {
|
|
18
|
+
"source-branch": {
|
|
19
|
+
"description": "Branch of the source stack.",
|
|
20
|
+
"exclusive": [
|
|
21
|
+
"source-branch-alias"
|
|
22
|
+
],
|
|
23
|
+
"name": "source-branch",
|
|
24
|
+
"required": false,
|
|
25
|
+
"hasDynamicHelp": false,
|
|
26
|
+
"multiple": false,
|
|
27
|
+
"type": "option"
|
|
28
|
+
},
|
|
29
|
+
"source-branch-alias": {
|
|
30
|
+
"description": "Alias of Branch of the source stack.",
|
|
31
|
+
"exclusive": [
|
|
32
|
+
"source-branch"
|
|
33
|
+
],
|
|
34
|
+
"name": "source-branch-alias",
|
|
35
|
+
"required": false,
|
|
36
|
+
"hasDynamicHelp": false,
|
|
37
|
+
"multiple": false,
|
|
38
|
+
"type": "option"
|
|
39
|
+
},
|
|
40
|
+
"target-branch": {
|
|
41
|
+
"description": "Branch of the target stack.",
|
|
42
|
+
"exclusive": [
|
|
43
|
+
"target-branch-alias"
|
|
44
|
+
],
|
|
45
|
+
"name": "target-branch",
|
|
46
|
+
"required": false,
|
|
47
|
+
"hasDynamicHelp": false,
|
|
48
|
+
"multiple": false,
|
|
49
|
+
"type": "option"
|
|
50
|
+
},
|
|
51
|
+
"target-branch-alias": {
|
|
52
|
+
"description": "Alias of Branch of the target stack.",
|
|
53
|
+
"exclusive": [
|
|
54
|
+
"target-branch"
|
|
55
|
+
],
|
|
56
|
+
"name": "target-branch-alias",
|
|
57
|
+
"required": false,
|
|
58
|
+
"hasDynamicHelp": false,
|
|
59
|
+
"multiple": false,
|
|
60
|
+
"type": "option"
|
|
61
|
+
},
|
|
62
|
+
"source-management-token-alias": {
|
|
63
|
+
"description": "Source management token alias.",
|
|
64
|
+
"name": "source-management-token-alias",
|
|
65
|
+
"required": false,
|
|
66
|
+
"hasDynamicHelp": false,
|
|
67
|
+
"multiple": false,
|
|
68
|
+
"type": "option"
|
|
69
|
+
},
|
|
70
|
+
"destination-management-token-alias": {
|
|
71
|
+
"description": "Destination management token alias.",
|
|
72
|
+
"name": "destination-management-token-alias",
|
|
73
|
+
"required": false,
|
|
74
|
+
"hasDynamicHelp": false,
|
|
75
|
+
"multiple": false,
|
|
76
|
+
"type": "option"
|
|
77
|
+
},
|
|
78
|
+
"stack-name": {
|
|
79
|
+
"char": "n",
|
|
80
|
+
"description": "Provide a name for the new stack to store the cloned content.",
|
|
81
|
+
"name": "stack-name",
|
|
82
|
+
"required": false,
|
|
83
|
+
"hasDynamicHelp": false,
|
|
84
|
+
"multiple": false,
|
|
85
|
+
"type": "option"
|
|
86
|
+
},
|
|
87
|
+
"type": {
|
|
88
|
+
"description": " Type of data to clone. You can select option a or b.\n a) Structure (all modules except entries & assets).\n b) Structure with content (all modules including entries & assets).\n ",
|
|
89
|
+
"name": "type",
|
|
90
|
+
"required": false,
|
|
91
|
+
"hasDynamicHelp": false,
|
|
92
|
+
"multiple": false,
|
|
93
|
+
"options": [
|
|
94
|
+
"a",
|
|
95
|
+
"b"
|
|
96
|
+
],
|
|
97
|
+
"type": "option"
|
|
98
|
+
},
|
|
99
|
+
"source-stack-api-key": {
|
|
100
|
+
"description": "Source stack API key",
|
|
101
|
+
"name": "source-stack-api-key",
|
|
102
|
+
"hasDynamicHelp": false,
|
|
103
|
+
"multiple": false,
|
|
104
|
+
"type": "option"
|
|
105
|
+
},
|
|
106
|
+
"destination-stack-api-key": {
|
|
107
|
+
"description": "Destination stack API key",
|
|
108
|
+
"name": "destination-stack-api-key",
|
|
109
|
+
"hasDynamicHelp": false,
|
|
110
|
+
"multiple": false,
|
|
111
|
+
"type": "option"
|
|
112
|
+
},
|
|
113
|
+
"import-webhook-status": {
|
|
114
|
+
"description": "[default: disable] (optional) The status of the import webhook. <options: disable|current>",
|
|
115
|
+
"name": "import-webhook-status",
|
|
116
|
+
"required": false,
|
|
117
|
+
"default": "disable",
|
|
118
|
+
"hasDynamicHelp": false,
|
|
119
|
+
"multiple": false,
|
|
120
|
+
"options": [
|
|
121
|
+
"disable",
|
|
122
|
+
"current"
|
|
123
|
+
],
|
|
124
|
+
"type": "option"
|
|
125
|
+
},
|
|
126
|
+
"yes": {
|
|
127
|
+
"char": "y",
|
|
128
|
+
"description": "Force override all Marketplace prompts.",
|
|
129
|
+
"name": "yes",
|
|
130
|
+
"required": false,
|
|
131
|
+
"allowNo": false,
|
|
132
|
+
"type": "boolean"
|
|
133
|
+
},
|
|
134
|
+
"skip-audit": {
|
|
135
|
+
"description": " (optional) Skips the audit fix that occurs during an import operation.",
|
|
136
|
+
"name": "skip-audit",
|
|
137
|
+
"allowNo": false,
|
|
138
|
+
"type": "boolean"
|
|
139
|
+
},
|
|
140
|
+
"config": {
|
|
141
|
+
"char": "c",
|
|
142
|
+
"description": "Path for the external configuration",
|
|
143
|
+
"name": "config",
|
|
144
|
+
"required": false,
|
|
145
|
+
"hasDynamicHelp": false,
|
|
146
|
+
"multiple": false,
|
|
147
|
+
"type": "option"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"hasDynamicHelp": false,
|
|
151
|
+
"hiddenAliases": [],
|
|
152
|
+
"id": "cm:stacks:clone",
|
|
153
|
+
"pluginAlias": "@contentstack/cli-cm-clone",
|
|
154
|
+
"pluginName": "@contentstack/cli-cm-clone",
|
|
155
|
+
"pluginType": "core",
|
|
156
|
+
"strict": true,
|
|
157
|
+
"usage": "cm:stacks:clone [--source-branch <value>] [--target-branch <value>] [--source-management-token-alias <value>] [--destination-management-token-alias <value>] [-n <value>] [--type a|b] [--source-stack-api-key <value>] [--destination-stack-api-key <value>] [--import-webhook-status disable|current]",
|
|
158
|
+
"isESM": false,
|
|
159
|
+
"relativePath": [
|
|
160
|
+
"lib",
|
|
161
|
+
"commands",
|
|
162
|
+
"cm",
|
|
163
|
+
"stacks",
|
|
164
|
+
"clone.js"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"version": "1.21.0-beta.0"
|
|
169
|
+
}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-clone",
|
|
3
3
|
"description": "Contentstack stack clone plugin",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.21.0-beta.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@colors/colors": "^1.6.0",
|
|
9
|
-
"@contentstack/cli-cm-export": "~1.
|
|
10
|
-
"@contentstack/cli-cm-import": "~1.
|
|
11
|
-
"@contentstack/cli-command": "~1.
|
|
12
|
-
"@contentstack/cli-utilities": "~1.
|
|
9
|
+
"@contentstack/cli-cm-export": "~1.24.0-beta.0",
|
|
10
|
+
"@contentstack/cli-cm-import": "~1.32.0-beta.0",
|
|
11
|
+
"@contentstack/cli-command": "~1.8.0-beta.0",
|
|
12
|
+
"@contentstack/cli-utilities": "~1.18.0-beta.0",
|
|
13
13
|
"@oclif/core": "^4.3.0",
|
|
14
14
|
"@oclif/plugin-help": "^6.2.28",
|
|
15
15
|
"chalk": "^4.1.2",
|
|
16
16
|
"inquirer": "8.2.7",
|
|
17
|
-
"lodash": "^4.17.
|
|
17
|
+
"lodash": "^4.17.23",
|
|
18
18
|
"merge": "^2.1.1",
|
|
19
19
|
"ora": "^5.4.1",
|
|
20
20
|
"prompt": "^1.3.0",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"repository": "https://github.com/contentstack/cli",
|
|
63
63
|
"scripts": {
|
|
64
|
-
"build": "
|
|
65
|
-
"clean": "rm -rf ./lib ./node_modules tsconfig.
|
|
64
|
+
"build": "pnpm compile && oclif manifest && oclif readme",
|
|
65
|
+
"clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo",
|
|
66
66
|
"compile": "tsc -b tsconfig.json",
|
|
67
67
|
"postpack": "rm -f oclif.manifest.json",
|
|
68
68
|
"prepack": "pnpm compile && oclif manifest && oclif readme",
|