@contentstack/cli-cm-seed 1.1.3 → 1.1.4

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.
@@ -6,12 +6,6 @@ const tar = require("tar");
6
6
  const mkdirp = require("mkdirp");
7
7
  const error_1 = require("./error");
8
8
  class GitHubClient {
9
- constructor(username, defaultStackPattern) {
10
- this.username = username;
11
- this.gitHubRepoUrl = `https://api.github.com/repos/${username}`;
12
- this.gitHubUserUrl = `https://api.github.com/search/repositories?q=org%3A${username}+in:name+${defaultStackPattern}`;
13
- this.httpClient = cli_utilities_1.HttpClient.create();
14
- }
15
9
  static parsePath(path) {
16
10
  const result = {
17
11
  username: '',
@@ -26,6 +20,12 @@ class GitHubClient {
26
20
  }
27
21
  return result;
28
22
  }
23
+ constructor(username, defaultStackPattern) {
24
+ this.username = username;
25
+ this.gitHubRepoUrl = `https://api.github.com/repos/${username}`;
26
+ this.gitHubUserUrl = `https://api.github.com/search/repositories?q=org%3A${username}+in:name+${defaultStackPattern}`;
27
+ this.httpClient = cli_utilities_1.HttpClient.create();
28
+ }
29
29
  async getAllRepos(count = 100) {
30
30
  try {
31
31
  const response = await this.httpClient.get(`${this.gitHubUserUrl}&per_page=${count}`);
package/lib/seed/index.js CHANGED
@@ -12,6 +12,9 @@ const DEFAULT_OWNER = 'contentstack';
12
12
  const DEFAULT_STACK_PATTERN = 'stack-';
13
13
  exports.ENGLISH_LOCALE = 'en-us';
14
14
  class ContentModelSeeder {
15
+ get ghPath() {
16
+ return `${this.ghUsername}/${this.ghRepo}`;
17
+ }
15
18
  constructor(options) {
16
19
  this.options = options;
17
20
  this.ghUsername = DEFAULT_OWNER;
@@ -23,9 +26,6 @@ class ContentModelSeeder {
23
26
  this.csClient = new client_1.default(options.cmaHost, options.authToken, limit);
24
27
  this.ghClient = new client_2.default(this.ghUsername, DEFAULT_STACK_PATTERN);
25
28
  }
26
- get ghPath() {
27
- return `${this.ghUsername}/${this.ghRepo}`;
28
- }
29
29
  async run() {
30
30
  let api_key;
31
31
  const { organizationResponse, stackResponse } = await this.getInput();
@@ -1 +1 @@
1
- {"version":"1.1.3","commands":{"cm:stacks:seed":{"id":"cm:stacks:seed","description":"Create a stack from existing content types, entries, assets, etc","usage":"cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>]","pluginName":"@contentstack/cli-cm-seed","pluginType":"core","aliases":["cm:seed"],"examples":["$ csdx cm:stacks:seed","$ csdx cm:stacks:seed --repo \"account\"","$ csdx cm:stacks:seed --repo \"account/repository\"","$ csdx cm:stacks:seed --repo \"account/repository\" --stack-api-key \"stack-api-key\" //seed content into specific stack","$ csdx cm:stacks:seed --repo \"account/repository\" --org \"your-org-uid\" --stack-name \"stack-name\" //create a new stack in given org uid"],"flags":{"repo":{"name":"repo","type":"option","char":"r","description":"GitHub account or GitHub account/repository","required":false},"org":{"name":"org","type":"option","char":"o","description":"Provide Organization UID to create a new stack","required":false},"stack-api-key":{"name":"stack-api-key","type":"option","char":"k","description":"Provide stack api key to seed content to","required":false},"stack-name":{"name":"stack-name","type":"option","char":"n","description":"Name of a new stack that needs to be created.","required":false},"fetch-limit":{"name":"fetch-limit","type":"option","char":"l","description":"Limit for number of Organizations or stacks to be fetched","hidden":true,"required":false},"yes":{"name":"yes","type":"option","char":"y","required":false},"stack":{"name":"stack","type":"option","char":"s","description":"Provide stack UID to seed content to","required":false}},"args":[]}}}
1
+ {"version":"1.1.4","commands":{"cm:stacks:seed":{"id":"cm:stacks:seed","description":"Create a stack from existing content types, entries, assets, etc","usage":"cm:stacks:seed [--repo <value>] [--org <value>] [-k <value>] [-n <value>] [-y <value>] [-s <value>]","pluginName":"@contentstack/cli-cm-seed","pluginType":"core","aliases":["cm:seed"],"examples":["$ csdx cm:stacks:seed","$ csdx cm:stacks:seed --repo \"account\"","$ csdx cm:stacks:seed --repo \"account/repository\"","$ csdx cm:stacks:seed --repo \"account/repository\" --stack-api-key \"stack-api-key\" //seed content into specific stack","$ csdx cm:stacks:seed --repo \"account/repository\" --org \"your-org-uid\" --stack-name \"stack-name\" //create a new stack in given org uid"],"flags":{"repo":{"name":"repo","type":"option","char":"r","description":"GitHub account or GitHub account/repository","required":false},"org":{"name":"org","type":"option","char":"o","description":"Provide Organization UID to create a new stack","required":false},"stack-api-key":{"name":"stack-api-key","type":"option","char":"k","description":"Provide stack api key to seed content to","required":false},"stack-name":{"name":"stack-name","type":"option","char":"n","description":"Name of a new stack that needs to be created.","required":false},"fetch-limit":{"name":"fetch-limit","type":"option","char":"l","description":"Limit for number of Organizations or stacks to be fetched","hidden":true,"required":false},"yes":{"name":"yes","type":"option","char":"y","required":false},"stack":{"name":"stack","type":"option","char":"s","description":"Provide stack UID to seed content to","required":false}},"args":[]}}}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-seed",
3
3
  "description": "create a Stack from existing content types, entries, assets, etc.",
4
- "version": "1.1.3",
4
+ "version": "1.1.4",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-cm-import": "^1.2.0",
8
+ "@contentstack/cli-cm-import": "^1.2.2",
9
9
  "@contentstack/cli-command": "^1.0.2",
10
10
  "@contentstack/cli-utilities": "^1.0.3",
11
11
  "@oclif/command": "^1.8.16",