@contentstack/cli-cm-seed 2.0.0-beta.1 → 2.0.0-beta.11
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 +1 -1
- package/README.md +7 -48
- package/lib/commands/cm/stacks/seed.d.ts +0 -1
- package/lib/commands/cm/stacks/seed.js +9 -23
- package/lib/seed/contentstack/client.d.ts +2 -2
- package/lib/seed/github/client.d.ts +1 -1
- package/lib/seed/github/client.js +18 -1
- package/lib/seed/importer.js +8 -3
- package/lib/seed/index.d.ts +1 -1
- package/lib/seed/index.js +7 -37
- package/lib/seed/interactive.js +11 -12
- package/oclif.manifest.json +10 -27
- package/package.json +23 -23
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -10,69 +10,28 @@ To import content to your stack, you can choose from the following two sources:
|
|
|
10
10
|
<!-- usagestop -->
|
|
11
11
|
## Commands
|
|
12
12
|
<!-- commands -->
|
|
13
|
-
* [`csdx cm:stacks:seed [--repo <value>] [--org <value>] [-
|
|
14
|
-
* [`csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>] [--locale <value>]`](#csdx-cmstacksseed---repo-value---org-value--k-value--n-value--y-value--s-value---locale-value)
|
|
13
|
+
* [`csdx cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [-y] [--alias <value>] [--locale <value>]`](#csdx-cmstacksseed---repo-value---org-value---stack-api-key-value---stack-name-value--y---alias-value---locale-value)
|
|
15
14
|
|
|
16
|
-
## `csdx cm:stacks:seed [--repo <value>] [--org <value>] [-
|
|
15
|
+
## `csdx cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [-y] [--alias <value>] [--locale <value>]`
|
|
17
16
|
|
|
18
17
|
Create a stack from existing content types, entries, assets, etc
|
|
19
18
|
|
|
20
19
|
```
|
|
21
20
|
USAGE
|
|
22
|
-
$ csdx cm:
|
|
23
|
-
<value>] [--locale <value>]
|
|
21
|
+
$ csdx cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [-y]
|
|
22
|
+
[--alias <value>] [--locale <value>]
|
|
24
23
|
|
|
25
24
|
FLAGS
|
|
26
25
|
-a, --alias=<value> Alias of the management token
|
|
27
26
|
-k, --stack-api-key=<value> Provide stack API key to seed content to
|
|
28
27
|
-n, --stack-name=<value> Name of a new stack that needs to be created.
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-y, --yes=<value> [Optional] Skip the stack confirmation.
|
|
28
|
+
-y, --yes [Optional] Skip the stack confirmation.
|
|
29
|
+
--org=<value> Provide Organization UID to create a new stack
|
|
30
|
+
--repo=<value> GitHub organization name or GitHub user name/repository name.
|
|
33
31
|
|
|
34
32
|
DESCRIPTION
|
|
35
33
|
Create a stack from existing content types, entries, assets, etc
|
|
36
34
|
|
|
37
|
-
ALIASES
|
|
38
|
-
$ csdx cm:seed
|
|
39
|
-
|
|
40
|
-
EXAMPLES
|
|
41
|
-
$ csdx cm:stacks:seed
|
|
42
|
-
|
|
43
|
-
$ csdx cm:stacks:seed --repo "account"
|
|
44
|
-
|
|
45
|
-
$ csdx cm:stacks:seed --repo "account/repository"
|
|
46
|
-
|
|
47
|
-
$ csdx cm:stacks:seed --repo "account/repository" --stack-api-key "stack-api-key" //seed content into specific stack
|
|
48
|
-
|
|
49
|
-
$ csdx cm:stacks:seed --repo "account/repository" --org "your-org-uid" --stack-name "stack-name" //create a new stack in given org uid
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## `csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>] [--locale <value>]`
|
|
53
|
-
|
|
54
|
-
Create a stack from existing content types, entries, assets, etc
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
USAGE
|
|
58
|
-
$ csdx cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>]
|
|
59
|
-
[--locale <value>]
|
|
60
|
-
|
|
61
|
-
FLAGS
|
|
62
|
-
-a, --alias=<value> Alias of the management token
|
|
63
|
-
-k, --stack-api-key=<value> Provide stack API key to seed content to
|
|
64
|
-
-n, --stack-name=<value> Name of a new stack that needs to be created.
|
|
65
|
-
-o, --org=<value> Provide Organization UID to create a new stack
|
|
66
|
-
-r, --repo=<value> GitHub organization name or GitHub user name/repository name.
|
|
67
|
-
-s, --stack=<value> Provide the stack UID to seed content.
|
|
68
|
-
-y, --yes=<value> [Optional] Skip the stack confirmation.
|
|
69
|
-
|
|
70
|
-
DESCRIPTION
|
|
71
|
-
Create a stack from existing content types, entries, assets, etc
|
|
72
|
-
|
|
73
|
-
ALIASES
|
|
74
|
-
$ csdx cm:seed
|
|
75
|
-
|
|
76
35
|
EXAMPLES
|
|
77
36
|
$ csdx cm:stacks:seed
|
|
78
37
|
|
|
@@ -20,10 +20,10 @@ class SeedCommand extends cli_command_1.Command {
|
|
|
20
20
|
cmaHost: this.cmaHost,
|
|
21
21
|
gitHubPath: seedFlags.repo,
|
|
22
22
|
orgUid: seedFlags.org,
|
|
23
|
-
stackUid: seedFlags['stack-api-key']
|
|
23
|
+
stackUid: seedFlags['stack-api-key'],
|
|
24
24
|
stackName: seedFlags['stack-name'],
|
|
25
25
|
fetchLimit: seedFlags['fetch-limit'],
|
|
26
|
-
skipStackConfirmation: seedFlags
|
|
26
|
+
skipStackConfirmation: seedFlags.yes,
|
|
27
27
|
isAuthenticated: (0, cli_utilities_1.isAuthenticated)(),
|
|
28
28
|
alias: managementTokenAlias,
|
|
29
29
|
master_locale: seedFlags['locale'],
|
|
@@ -48,7 +48,6 @@ class SeedCommand extends cli_command_1.Command {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
exports.default = SeedCommand;
|
|
52
51
|
SeedCommand.description = 'Create a stack from existing content types, entries, assets, etc';
|
|
53
52
|
SeedCommand.examples = [
|
|
54
53
|
'$ csdx cm:stacks:seed',
|
|
@@ -57,65 +56,52 @@ SeedCommand.examples = [
|
|
|
57
56
|
'$ csdx cm:stacks:seed --repo "account/repository" --stack-api-key "stack-api-key" //seed content into specific stack',
|
|
58
57
|
'$ csdx cm:stacks:seed --repo "account/repository" --org "your-org-uid" --stack-name "stack-name" //create a new stack in given org uid',
|
|
59
58
|
];
|
|
60
|
-
SeedCommand.usage = 'cm:stacks:seed [--repo <value>] [--org <value>] [-
|
|
59
|
+
SeedCommand.usage = 'cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [-y] [--alias <value>] [--locale <value>]';
|
|
61
60
|
SeedCommand.flags = {
|
|
62
61
|
repo: cli_utilities_1.flags.string({
|
|
63
|
-
char: 'r',
|
|
64
62
|
description: 'GitHub organization name or GitHub user name/repository name.',
|
|
65
63
|
multiple: false,
|
|
66
64
|
required: false,
|
|
67
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['-r'], ['--repo']),
|
|
68
65
|
}),
|
|
69
66
|
org: cli_utilities_1.flags.string({
|
|
70
|
-
char: 'o',
|
|
71
67
|
description: 'Provide Organization UID to create a new stack',
|
|
72
68
|
multiple: false,
|
|
73
69
|
required: false,
|
|
74
|
-
exclusive: ['stack'],
|
|
75
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['-o'], ['--org']),
|
|
70
|
+
exclusive: ['stack-api-key'],
|
|
76
71
|
}),
|
|
77
72
|
'stack-api-key': cli_utilities_1.flags.string({
|
|
78
73
|
char: 'k',
|
|
79
74
|
description: 'Provide stack API key to seed content to',
|
|
80
75
|
multiple: false,
|
|
81
76
|
required: false,
|
|
82
|
-
exclusive: ['org'],
|
|
77
|
+
exclusive: ['org', 'stack-name'],
|
|
83
78
|
}),
|
|
84
79
|
'stack-name': cli_utilities_1.flags.string({
|
|
85
80
|
char: 'n',
|
|
86
81
|
description: 'Name of a new stack that needs to be created.',
|
|
87
82
|
multiple: false,
|
|
88
83
|
required: false,
|
|
89
|
-
exclusive: ['stack'],
|
|
84
|
+
exclusive: ['stack-api-key'],
|
|
90
85
|
}),
|
|
91
86
|
'fetch-limit': cli_utilities_1.flags.string({
|
|
92
|
-
char: 'l',
|
|
93
87
|
description: 'Limit for number of organizations or stacks to be fetched.',
|
|
94
88
|
multiple: false,
|
|
95
89
|
required: false,
|
|
96
90
|
hidden: true,
|
|
97
91
|
}),
|
|
98
|
-
yes: cli_utilities_1.flags.
|
|
92
|
+
yes: cli_utilities_1.flags.boolean({
|
|
99
93
|
char: 'y',
|
|
100
94
|
required: false,
|
|
101
95
|
description: '[Optional] Skip the stack confirmation.',
|
|
102
96
|
}),
|
|
103
|
-
//To be deprecated
|
|
104
|
-
stack: cli_utilities_1.flags.string({
|
|
105
|
-
char: 's',
|
|
106
|
-
description: 'Provide the stack UID to seed content.',
|
|
107
|
-
multiple: false,
|
|
108
|
-
required: false,
|
|
109
|
-
exclusive: ['org', 'name'],
|
|
110
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['s', 'stack'], ['-k', 'stack-api-key']),
|
|
111
|
-
}),
|
|
112
97
|
alias: cli_utilities_1.flags.string({
|
|
113
98
|
char: 'a',
|
|
114
99
|
description: 'Alias of the management token',
|
|
115
100
|
}),
|
|
116
101
|
locale: cli_utilities_1.flags.string({
|
|
117
102
|
description: 'Master Locale of the stack',
|
|
103
|
+
default: 'en-us',
|
|
118
104
|
hidden: true,
|
|
119
105
|
}),
|
|
120
106
|
};
|
|
121
|
-
|
|
107
|
+
exports.default = SeedCommand;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ContentstackClient as ContentstackAPIClient } from '@contentstack/cli-utilities';
|
|
2
2
|
export interface Organization {
|
|
3
3
|
uid: string;
|
|
4
4
|
name: string;
|
|
@@ -35,7 +35,7 @@ export interface createManagementTokenOptions {
|
|
|
35
35
|
}[];
|
|
36
36
|
}
|
|
37
37
|
export default class ContentstackClient {
|
|
38
|
-
instance: Promise<
|
|
38
|
+
instance: Promise<ContentstackAPIClient>;
|
|
39
39
|
limit: number;
|
|
40
40
|
constructor(cmaHost: string, limit: number);
|
|
41
41
|
getOrganization(org_uid: string): Promise<Organization>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Stream } from 'stream';
|
|
3
2
|
export default class GitHubClient {
|
|
4
3
|
username: string;
|
|
@@ -15,6 +14,7 @@ export default class GitHubClient {
|
|
|
15
14
|
makeHeadApiCall(repo: string): Promise<any>;
|
|
16
15
|
makeGetApiCall(repo: string): Promise<any>;
|
|
17
16
|
checkIfRepoExists(repo: string): Promise<boolean>;
|
|
17
|
+
getMasterLocaleFromRepo(repo: string): Promise<string | null>;
|
|
18
18
|
getLatestTarballUrl(repo: string): Promise<any>;
|
|
19
19
|
streamRelease(url: string): Promise<Stream>;
|
|
20
20
|
extract(destination: string, stream: Stream): Promise<void>;
|
|
@@ -95,11 +95,28 @@ class GitHubClient {
|
|
|
95
95
|
return response.statusCode === 200;
|
|
96
96
|
}
|
|
97
97
|
catch (error) {
|
|
98
|
-
console.log(error);
|
|
98
|
+
console.log('Error', error);
|
|
99
99
|
// do nothing
|
|
100
100
|
}
|
|
101
101
|
return false;
|
|
102
102
|
}
|
|
103
|
+
async getMasterLocaleFromRepo(repo) {
|
|
104
|
+
var _a;
|
|
105
|
+
try {
|
|
106
|
+
const response = await this.httpClient.get(`https://raw.githubusercontent.com/${this.username}/${repo}/main/stack/locales/master-locale.json`);
|
|
107
|
+
if (response.data) {
|
|
108
|
+
const localeData = response.data;
|
|
109
|
+
const localeKey = Object.keys(localeData)[0];
|
|
110
|
+
if (localeKey && ((_a = localeData[localeKey]) === null || _a === void 0 ? void 0 : _a.code)) {
|
|
111
|
+
return localeData[localeKey].code;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.log('Could not fetch master locale from repository', error);
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
103
120
|
async getLatestTarballUrl(repo) {
|
|
104
121
|
try {
|
|
105
122
|
const response = await this.httpClient.get(`${this.gitHubRepoUrl}/${repo}/releases/latest`);
|
package/lib/seed/importer.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.run =
|
|
3
|
+
exports.run = run;
|
|
4
|
+
const fs = require("fs");
|
|
4
5
|
const process = require("process");
|
|
5
6
|
const path = require("path");
|
|
6
7
|
const cli_cm_import_1 = require("@contentstack/cli-cm-import");
|
|
7
8
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
8
9
|
const STACK_FOLDER = 'stack';
|
|
9
10
|
async function run(options) {
|
|
10
|
-
const
|
|
11
|
+
const tmpPathResolved = path.resolve((0, cli_utilities_1.sanitizePath)(options.tmpPath));
|
|
12
|
+
const stackPath = path.join(tmpPathResolved, STACK_FOLDER);
|
|
13
|
+
// Support both structures: repo with stack/ folder (per docs) or content at root
|
|
14
|
+
const importPath = fs.existsSync(stackPath)
|
|
15
|
+
? (0, cli_utilities_1.pathValidator)(stackPath)
|
|
16
|
+
: (0, cli_utilities_1.pathValidator)(tmpPathResolved);
|
|
11
17
|
const args = options.alias
|
|
12
18
|
? ['-k', options.api_key, '-d', importPath, '--alias', options.alias]
|
|
13
19
|
: ['-k', options.api_key, '-d', importPath];
|
|
14
20
|
process.chdir(options.tmpPath);
|
|
15
21
|
await cli_cm_import_1.default.run(args.concat('--skip-audit'));
|
|
16
22
|
}
|
|
17
|
-
exports.run = run;
|
package/lib/seed/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface ContentModelSeederOptions {
|
|
|
10
10
|
stackUid: string | undefined;
|
|
11
11
|
stackName: string | undefined;
|
|
12
12
|
fetchLimit: string | undefined;
|
|
13
|
-
skipStackConfirmation:
|
|
13
|
+
skipStackConfirmation: boolean | undefined;
|
|
14
14
|
isAuthenticated: boolean | false;
|
|
15
15
|
managementToken?: string | undefined;
|
|
16
16
|
alias?: string | undefined;
|
package/lib/seed/index.js
CHANGED
|
@@ -127,48 +127,18 @@ class ContentModelSeeder {
|
|
|
127
127
|
return newStack.api_key;
|
|
128
128
|
}
|
|
129
129
|
async shouldProceed(api_key) {
|
|
130
|
-
let count;
|
|
131
130
|
const stack_details = await this.csClient.getStack(api_key);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
const repoMasterLocale = await this.ghClient.getMasterLocaleFromRepo(this.ghRepo);
|
|
132
|
+
const expectedLocale = repoMasterLocale || this.options.master_locale || exports.ENGLISH_LOCALE;
|
|
133
|
+
if (stack_details.master_locale !== expectedLocale) {
|
|
134
|
+
cli_utilities_1.cliux.print(`Repository '${this.ghRepo}' requires the master locale to be set to '${expectedLocale}', but your stack has '${stack_details.master_locale}'.`, {
|
|
135
|
+
color: 'yellow',
|
|
135
136
|
bold: true,
|
|
136
137
|
});
|
|
137
138
|
return false;
|
|
138
139
|
}
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
"description": "This is a compass app management token.",
|
|
142
|
-
"scope": [
|
|
143
|
-
{
|
|
144
|
-
"module": "content_type",
|
|
145
|
-
"acl": {
|
|
146
|
-
"read": true,
|
|
147
|
-
"write": true
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"module": "branch",
|
|
152
|
-
"branches": [
|
|
153
|
-
"main"
|
|
154
|
-
],
|
|
155
|
-
"acl": {
|
|
156
|
-
"read": true
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
],
|
|
160
|
-
"expires_on": "3000-01-01",
|
|
161
|
-
"is_email_notification_enabled": false
|
|
162
|
-
};
|
|
163
|
-
let managementTokenResult = await this.csClient.createManagementToken(api_key, this.managementToken, managementBody);
|
|
164
|
-
if ((managementTokenResult === null || managementTokenResult === void 0 ? void 0 : managementTokenResult.response_code) == "161" || (managementTokenResult === null || managementTokenResult === void 0 ? void 0 : managementTokenResult.response_code) == "401") {
|
|
165
|
-
cli_utilities_1.cliux.print(`Info: Failed to generate a management token.\nNote: Management token is not available in your plan. Please contact the admin for support.`, {
|
|
166
|
-
color: 'red',
|
|
167
|
-
});
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
count = await this.csClient.getContentTypeCount(api_key, this.managementToken);
|
|
171
|
-
if (count > 0 && this._options.skipStackConfirmation !== 'yes') {
|
|
140
|
+
const count = await this.csClient.getContentTypeCount(api_key, this.managementToken);
|
|
141
|
+
if (count > 0 && !this._options.skipStackConfirmation) {
|
|
172
142
|
const proceed = await (0, interactive_1.inquireProceed)();
|
|
173
143
|
if (!proceed) {
|
|
174
144
|
return false;
|
package/lib/seed/interactive.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.inquireRepo = inquireRepo;
|
|
4
|
+
exports.inquireOrganization = inquireOrganization;
|
|
5
|
+
exports.inquireProceed = inquireProceed;
|
|
6
|
+
exports.inquireStack = inquireStack;
|
|
7
|
+
const inquirer_1 = require("inquirer");
|
|
5
8
|
async function inquireRepo(repos) {
|
|
6
9
|
if (!repos || repos.length === 0)
|
|
7
10
|
throw new Error('Precondition failed: No Repositories found.');
|
|
@@ -11,7 +14,7 @@ async function inquireRepo(repos) {
|
|
|
11
14
|
const choices = repos.map((r) => {
|
|
12
15
|
return { name: formatStackName(r.name), value: extractRepoName(r.html_url) };
|
|
13
16
|
});
|
|
14
|
-
const response = await
|
|
17
|
+
const response = await inquirer_1.default.prompt([
|
|
15
18
|
{
|
|
16
19
|
type: 'list',
|
|
17
20
|
name: 'choice',
|
|
@@ -21,7 +24,6 @@ async function inquireRepo(repos) {
|
|
|
21
24
|
]);
|
|
22
25
|
return response;
|
|
23
26
|
}
|
|
24
|
-
exports.inquireRepo = inquireRepo;
|
|
25
27
|
async function inquireOrganization(organizations) {
|
|
26
28
|
if (!organizations || organizations.length === 0)
|
|
27
29
|
throw new Error('Precondition failed: No Organizations found.');
|
|
@@ -31,7 +33,7 @@ async function inquireOrganization(organizations) {
|
|
|
31
33
|
const choices = organizations.map((r) => {
|
|
32
34
|
return { name: r.name, value: r.uid };
|
|
33
35
|
});
|
|
34
|
-
const response = await
|
|
36
|
+
const response = await inquirer_1.default.prompt([
|
|
35
37
|
{
|
|
36
38
|
type: 'list',
|
|
37
39
|
name: 'uid',
|
|
@@ -41,9 +43,8 @@ async function inquireOrganization(organizations) {
|
|
|
41
43
|
]);
|
|
42
44
|
return organizations.find((r) => r.uid === response.uid);
|
|
43
45
|
}
|
|
44
|
-
exports.inquireOrganization = inquireOrganization;
|
|
45
46
|
async function inquireProceed() {
|
|
46
|
-
const createResponse = await
|
|
47
|
+
const createResponse = await inquirer_1.default.prompt([
|
|
47
48
|
{
|
|
48
49
|
type: 'confirm',
|
|
49
50
|
name: 'choice',
|
|
@@ -52,12 +53,11 @@ async function inquireProceed() {
|
|
|
52
53
|
]);
|
|
53
54
|
return createResponse.choice;
|
|
54
55
|
}
|
|
55
|
-
exports.inquireProceed = inquireProceed;
|
|
56
56
|
async function inquireStack(stacks, stackName) {
|
|
57
57
|
const result = {};
|
|
58
58
|
const hasStacks = stacks !== null && stacks.length > 0;
|
|
59
59
|
if (hasStacks && !stackName) {
|
|
60
|
-
const createResponse = await
|
|
60
|
+
const createResponse = await inquirer_1.default.prompt([
|
|
61
61
|
{
|
|
62
62
|
type: 'list',
|
|
63
63
|
name: 'choice',
|
|
@@ -83,7 +83,7 @@ async function inquireStack(stacks, stackName) {
|
|
|
83
83
|
if (stackName)
|
|
84
84
|
result.name = stackName.trim();
|
|
85
85
|
else {
|
|
86
|
-
const nameResponse = await
|
|
86
|
+
const nameResponse = await inquirer_1.default.prompt([
|
|
87
87
|
{
|
|
88
88
|
type: 'input',
|
|
89
89
|
name: 'name',
|
|
@@ -105,7 +105,7 @@ async function inquireStack(stacks, stackName) {
|
|
|
105
105
|
return { name: `${s.name}`, value: s.uid };
|
|
106
106
|
});
|
|
107
107
|
choices.sort((a, b) => (a.name > b.name ? 1 : -1));
|
|
108
|
-
const selectResponse = await
|
|
108
|
+
const selectResponse = await inquirer_1.default.prompt([
|
|
109
109
|
{
|
|
110
110
|
type: 'list',
|
|
111
111
|
name: 'uid',
|
|
@@ -120,7 +120,6 @@ async function inquireStack(stacks, stackName) {
|
|
|
120
120
|
}
|
|
121
121
|
return result;
|
|
122
122
|
}
|
|
123
|
-
exports.inquireStack = inquireStack;
|
|
124
123
|
function formatStackName(name) {
|
|
125
124
|
return name
|
|
126
125
|
.replace('stack-', '')
|
package/oclif.manifest.json
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
3
|
"cm:stacks:seed": {
|
|
4
|
-
"aliases": [
|
|
5
|
-
"cm:seed"
|
|
6
|
-
],
|
|
4
|
+
"aliases": [],
|
|
7
5
|
"args": {},
|
|
8
6
|
"description": "Create a stack from existing content types, entries, assets, etc",
|
|
9
7
|
"examples": [
|
|
@@ -15,7 +13,6 @@
|
|
|
15
13
|
],
|
|
16
14
|
"flags": {
|
|
17
15
|
"repo": {
|
|
18
|
-
"char": "r",
|
|
19
16
|
"description": "GitHub organization name or GitHub user name/repository name.",
|
|
20
17
|
"name": "repo",
|
|
21
18
|
"required": false,
|
|
@@ -24,10 +21,9 @@
|
|
|
24
21
|
"type": "option"
|
|
25
22
|
},
|
|
26
23
|
"org": {
|
|
27
|
-
"char": "o",
|
|
28
24
|
"description": "Provide Organization UID to create a new stack",
|
|
29
25
|
"exclusive": [
|
|
30
|
-
"stack"
|
|
26
|
+
"stack-api-key"
|
|
31
27
|
],
|
|
32
28
|
"name": "org",
|
|
33
29
|
"required": false,
|
|
@@ -39,7 +35,8 @@
|
|
|
39
35
|
"char": "k",
|
|
40
36
|
"description": "Provide stack API key to seed content to",
|
|
41
37
|
"exclusive": [
|
|
42
|
-
"org"
|
|
38
|
+
"org",
|
|
39
|
+
"stack-name"
|
|
43
40
|
],
|
|
44
41
|
"name": "stack-api-key",
|
|
45
42
|
"required": false,
|
|
@@ -51,7 +48,7 @@
|
|
|
51
48
|
"char": "n",
|
|
52
49
|
"description": "Name of a new stack that needs to be created.",
|
|
53
50
|
"exclusive": [
|
|
54
|
-
"stack"
|
|
51
|
+
"stack-api-key"
|
|
55
52
|
],
|
|
56
53
|
"name": "stack-name",
|
|
57
54
|
"required": false,
|
|
@@ -60,7 +57,6 @@
|
|
|
60
57
|
"type": "option"
|
|
61
58
|
},
|
|
62
59
|
"fetch-limit": {
|
|
63
|
-
"char": "l",
|
|
64
60
|
"description": "Limit for number of organizations or stacks to be fetched.",
|
|
65
61
|
"hidden": true,
|
|
66
62
|
"name": "fetch-limit",
|
|
@@ -74,22 +70,8 @@
|
|
|
74
70
|
"description": "[Optional] Skip the stack confirmation.",
|
|
75
71
|
"name": "yes",
|
|
76
72
|
"required": false,
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"type": "option"
|
|
80
|
-
},
|
|
81
|
-
"stack": {
|
|
82
|
-
"char": "s",
|
|
83
|
-
"description": "Provide the stack UID to seed content.",
|
|
84
|
-
"exclusive": [
|
|
85
|
-
"org",
|
|
86
|
-
"name"
|
|
87
|
-
],
|
|
88
|
-
"name": "stack",
|
|
89
|
-
"required": false,
|
|
90
|
-
"hasDynamicHelp": false,
|
|
91
|
-
"multiple": false,
|
|
92
|
-
"type": "option"
|
|
73
|
+
"allowNo": false,
|
|
74
|
+
"type": "boolean"
|
|
93
75
|
},
|
|
94
76
|
"alias": {
|
|
95
77
|
"char": "a",
|
|
@@ -103,6 +85,7 @@
|
|
|
103
85
|
"description": "Master Locale of the stack",
|
|
104
86
|
"hidden": true,
|
|
105
87
|
"name": "locale",
|
|
88
|
+
"default": "en-us",
|
|
106
89
|
"hasDynamicHelp": false,
|
|
107
90
|
"multiple": false,
|
|
108
91
|
"type": "option"
|
|
@@ -115,7 +98,7 @@
|
|
|
115
98
|
"pluginName": "@contentstack/cli-cm-seed",
|
|
116
99
|
"pluginType": "core",
|
|
117
100
|
"strict": true,
|
|
118
|
-
"usage": "cm:stacks:seed [--repo <value>] [--org <value>] [-
|
|
101
|
+
"usage": "cm:stacks:seed [--repo <value>] [--org <value>] [--stack-api-key <value>] [--stack-name <value>] [-y] [--alias <value>] [--locale <value>]",
|
|
119
102
|
"isESM": false,
|
|
120
103
|
"relativePath": [
|
|
121
104
|
"lib",
|
|
@@ -126,5 +109,5 @@
|
|
|
126
109
|
]
|
|
127
110
|
}
|
|
128
111
|
},
|
|
129
|
-
"version": "2.0.0-beta.
|
|
112
|
+
"version": "2.0.0-beta.11"
|
|
130
113
|
}
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-seed",
|
|
3
3
|
"description": "create a Stack from existing content types, entries, assets, etc.",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.11",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-cm-import": "~2.0.0-beta.
|
|
9
|
-
"@contentstack/cli-command": "~
|
|
10
|
-
"@contentstack/cli-utilities": "~
|
|
11
|
-
"
|
|
12
|
-
"inquirer": "8.2.6",
|
|
8
|
+
"@contentstack/cli-cm-import": "~2.0.0-beta.12",
|
|
9
|
+
"@contentstack/cli-command": "~2.0.0-beta.3",
|
|
10
|
+
"@contentstack/cli-utilities": "~2.0.0-beta.3",
|
|
11
|
+
"inquirer": "12.11.1",
|
|
13
12
|
"mkdirp": "^1.0.4",
|
|
14
|
-
"tar": "^
|
|
15
|
-
"tmp": "^0.2.
|
|
13
|
+
"tar": "^7.5.11",
|
|
14
|
+
"tmp": "^0.2.5"
|
|
16
15
|
},
|
|
17
16
|
"devDependencies": {
|
|
18
|
-
"@types/inquirer": "^9.0.
|
|
17
|
+
"@types/inquirer": "^9.0.9",
|
|
19
18
|
"@types/jest": "^26.0.24",
|
|
20
19
|
"@types/mkdirp": "^1.0.2",
|
|
21
|
-
"@types/node": "^
|
|
20
|
+
"@types/node": "^18.11.9",
|
|
22
21
|
"@types/tar": "^6.1.13",
|
|
23
22
|
"@types/tmp": "^0.2.6",
|
|
24
|
-
"axios": "^1.
|
|
23
|
+
"axios": "^1.13.5",
|
|
25
24
|
"eslint": "^8.57.1",
|
|
26
|
-
"eslint-config-oclif": "^6.0.
|
|
25
|
+
"eslint-config-oclif": "^6.0.137",
|
|
27
26
|
"eslint-config-oclif-typescript": "^3.1.14",
|
|
28
27
|
"jest": "^29.7.0",
|
|
29
28
|
"oclif": "^4.17.46",
|
|
30
|
-
"
|
|
29
|
+
"@oclif/plugin-help": "^6.2.28",
|
|
30
|
+
"ts-jest": "^29.4.6",
|
|
31
31
|
"ts-node": "^8.10.2",
|
|
32
|
-
"typescript": "^
|
|
32
|
+
"typescript": "^5.9.3"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=14.0.0"
|
|
@@ -50,15 +50,14 @@
|
|
|
50
50
|
"oclif": {
|
|
51
51
|
"commands": "./lib/commands",
|
|
52
52
|
"bin": "csdx",
|
|
53
|
+
"devPlugins": [
|
|
54
|
+
"@oclif/plugin-help"
|
|
55
|
+
],
|
|
53
56
|
"repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-seed/<%- commandPath %>"
|
|
54
57
|
},
|
|
55
58
|
"csdxConfig": {
|
|
56
|
-
"expiredCommands": {
|
|
57
|
-
"cm:seed": "csdx cm:stacks:seed"
|
|
58
|
-
},
|
|
59
59
|
"shortCommandName": {
|
|
60
|
-
"cm:stacks:seed": "SEED"
|
|
61
|
-
"cm:seed": "O-SEED"
|
|
60
|
+
"cm:stacks:seed": "SEED"
|
|
62
61
|
}
|
|
63
62
|
},
|
|
64
63
|
"repository": "contentstack/cli",
|
|
@@ -66,9 +65,10 @@
|
|
|
66
65
|
"test": "jest",
|
|
67
66
|
"pack": "npm pack --dry-run",
|
|
68
67
|
"postpack": "rm -f oclif.manifest.json",
|
|
69
|
-
"
|
|
70
|
-
"prepack": "rm -rf lib && tsc -b && oclif manifest && oclif readme",
|
|
68
|
+
"prepack": "pnpm compile && oclif manifest && oclif readme",
|
|
71
69
|
"version": "oclif readme && git add README.md",
|
|
72
|
-
"clean": "rm -rf ./node_modules tsconfig.
|
|
70
|
+
"clean": "rm -rf ./lib ./node_modules tsconfig.tsbuildinfo",
|
|
71
|
+
"compile": "tsc -b tsconfig.json",
|
|
72
|
+
"build": "pnpm compile && oclif manifest && oclif readme"
|
|
73
73
|
}
|
|
74
|
-
}
|
|
74
|
+
}
|