endpoints-sdk-cli 2.5.1 → 2.6.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 +7 -4
- package/lib/classes/Config.d.ts +3 -1
- package/lib/classes/Config.js +2 -2
- package/lib/classes/Repository.d.ts +2 -1
- package/lib/classes/Repository.js +5 -5
- package/lib/commands/add.d.ts +1 -0
- package/lib/commands/add.js +6 -2
- package/lib/commands/install.js +2 -2
- package/lib/commands/update.js +3 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ $ npm install -g endpoints-sdk-cli
|
|
|
18
18
|
$ mes COMMAND
|
|
19
19
|
running command...
|
|
20
20
|
$ mes (-v|--version|version)
|
|
21
|
-
endpoints-sdk-cli/2.
|
|
21
|
+
endpoints-sdk-cli/2.6.0 darwin-x64 node-v18.17.1
|
|
22
22
|
$ mes --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ mes COMMAND
|
|
@@ -41,6 +41,7 @@ USAGE
|
|
|
41
41
|
$ mes add [REPOSITORY]
|
|
42
42
|
|
|
43
43
|
OPTIONS
|
|
44
|
+
-b, --branch=branch branch name to clone
|
|
44
45
|
-v, --version=version latest or commit hash
|
|
45
46
|
-w, --workspace=workspace a path to workspace containing .endpoints.json
|
|
46
47
|
|
|
@@ -69,13 +70,15 @@ EXAMPLES
|
|
|
69
70
|
$ mes add [username/repository] -v latest
|
|
70
71
|
$ mes add [username/repository] --workspace [workspace directory]
|
|
71
72
|
$ mes add [username/repository] -w [workspace directory]
|
|
73
|
+
$ mes add [username/repository] --branch [branch name]
|
|
74
|
+
$ mes add [username/repository] -b [branch name]
|
|
72
75
|
$ mes add /Users/.../local-repository/
|
|
73
76
|
$ mes add ./local-repository
|
|
74
77
|
$ mes add git@github.com:[username/repository].git
|
|
75
78
|
$ mes add https://github.com/[username/repository].git
|
|
76
79
|
```
|
|
77
80
|
|
|
78
|
-
_See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.
|
|
81
|
+
_See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.6.0/src/commands/add.ts)_
|
|
79
82
|
|
|
80
83
|
## `mes help [COMMAND]`
|
|
81
84
|
|
|
@@ -103,7 +106,7 @@ USAGE
|
|
|
103
106
|
$ mes install
|
|
104
107
|
```
|
|
105
108
|
|
|
106
|
-
_See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.
|
|
109
|
+
_See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.6.0/src/commands/install.ts)_
|
|
107
110
|
|
|
108
111
|
## `mes update [SERVICE]`
|
|
109
112
|
|
|
@@ -114,7 +117,7 @@ USAGE
|
|
|
114
117
|
$ mes update [SERVICE]
|
|
115
118
|
```
|
|
116
119
|
|
|
117
|
-
_See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.
|
|
120
|
+
_See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.6.0/src/commands/update.ts)_
|
|
118
121
|
<!-- commandsstop -->
|
|
119
122
|
|
|
120
123
|
|
package/lib/classes/Config.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface Dependencies {
|
|
|
7
7
|
repository: string;
|
|
8
8
|
roots?: Roots;
|
|
9
9
|
workspaces?: string[];
|
|
10
|
+
branch?: string;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
13
|
interface ConfigData {
|
|
@@ -23,11 +24,12 @@ export declare class Config {
|
|
|
23
24
|
output: string;
|
|
24
25
|
environment_identifier: string;
|
|
25
26
|
constructor();
|
|
26
|
-
push({ name, path, version, workspace }: {
|
|
27
|
+
push({ name, path, version, workspace, branch }: {
|
|
27
28
|
name: string;
|
|
28
29
|
path: string;
|
|
29
30
|
version: string;
|
|
30
31
|
workspace?: string;
|
|
32
|
+
branch: string | undefined;
|
|
31
33
|
}): void;
|
|
32
34
|
publish(): void;
|
|
33
35
|
}
|
package/lib/classes/Config.js
CHANGED
|
@@ -30,13 +30,13 @@ class Config {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
push({ name, path, version, workspace }) {
|
|
33
|
+
push({ name, path, version, workspace, branch }) {
|
|
34
34
|
var _a, _b, _c;
|
|
35
35
|
const workspaces = (0, unique_1.unique)([
|
|
36
36
|
...(((_b = (_a = this.dependencies) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.workspaces) || []),
|
|
37
37
|
workspace,
|
|
38
38
|
]).filter((w) => Boolean(w));
|
|
39
|
-
this.dependencies = Object.assign(Object.assign({}, this.dependencies), { [name]: Object.assign(Object.assign({}, (_c = this.dependencies) === null || _c === void 0 ? void 0 : _c[name]), { version, repository: path, workspaces: workspaces.length > 0 ? workspaces : undefined }) });
|
|
39
|
+
this.dependencies = Object.assign(Object.assign({}, this.dependencies), { [name]: Object.assign(Object.assign({}, (_c = this.dependencies) === null || _c === void 0 ? void 0 : _c[name]), { version, repository: path, branch, workspaces: workspaces.length > 0 ? workspaces : undefined }) });
|
|
40
40
|
}
|
|
41
41
|
publish() {
|
|
42
42
|
const data = Object.assign(Object.assign({}, this.data), { output: this.output, environment_identifier: this.environment_identifier, dependencies: this.dependencies });
|
|
@@ -34,9 +34,10 @@ export declare class Repository {
|
|
|
34
34
|
hash: string;
|
|
35
35
|
data: Data;
|
|
36
36
|
constructor(str: string);
|
|
37
|
-
clone({ version, workspace }: {
|
|
37
|
+
clone({ version, workspace, branch }: {
|
|
38
38
|
version?: string;
|
|
39
39
|
workspace?: string;
|
|
40
|
+
branch: string | undefined;
|
|
40
41
|
}): void;
|
|
41
42
|
private checkout;
|
|
42
43
|
private revParse;
|
|
@@ -14,18 +14,18 @@ class Repository {
|
|
|
14
14
|
this.name = this.getName();
|
|
15
15
|
this.cache = path.resolve(`./node_modules/.endpoints-tmp/${Math.random().toString(36).slice(-8)}`);
|
|
16
16
|
}
|
|
17
|
-
clone({ version, workspace = '' }) {
|
|
17
|
+
clone({ version, workspace = '', branch }) {
|
|
18
18
|
(0, node_child_process_1.execSync)(`git clone --no-checkout --quiet ${this.path} ${this.cache}`);
|
|
19
19
|
this.reset(version);
|
|
20
20
|
this.hash = this.revParse();
|
|
21
|
-
this.data = this.checkout(workspace);
|
|
21
|
+
this.data = this.checkout(workspace, branch);
|
|
22
22
|
}
|
|
23
|
-
checkout(workspace) {
|
|
23
|
+
checkout(workspace, branch) {
|
|
24
24
|
const file = path.resolve(this.cache, workspace, '.endpoints.json');
|
|
25
|
-
const
|
|
25
|
+
const targetBranch = branch ? `origin/${branch}` : (0, node_child_process_1.execSync)(`cd ${this.cache}; git rev-parse --abbrev-ref origin/HEAD`)
|
|
26
26
|
.toString()
|
|
27
27
|
.trim();
|
|
28
|
-
(0, node_child_process_1.execSync)(`cd ${this.cache}; git checkout ${
|
|
28
|
+
(0, node_child_process_1.execSync)(`cd ${this.cache}; git checkout ${targetBranch} -- ${file}`);
|
|
29
29
|
return JSON.parse(fs.readFileSync(file).toString());
|
|
30
30
|
}
|
|
31
31
|
revParse() {
|
package/lib/commands/add.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export default class Add extends Command {
|
|
|
7
7
|
static flags: {
|
|
8
8
|
version: flags.IOptionFlag<string | undefined>;
|
|
9
9
|
workspace: flags.IOptionFlag<string | undefined>;
|
|
10
|
+
branch: flags.IOptionFlag<string | undefined>;
|
|
10
11
|
};
|
|
11
12
|
static examples: string[];
|
|
12
13
|
run(): Promise<void>;
|
package/lib/commands/add.js
CHANGED
|
@@ -7,10 +7,10 @@ const Repository_1 = require("../classes/Repository");
|
|
|
7
7
|
const makeFiles_1 = require("../makeFiles");
|
|
8
8
|
class Add extends command_1.Command {
|
|
9
9
|
async run() {
|
|
10
|
-
const { flags: { version, workspace }, args } = this.parse(Add);
|
|
10
|
+
const { flags: { version, workspace, branch }, args } = this.parse(Add);
|
|
11
11
|
const repository = new Repository_1.Repository(args.repository);
|
|
12
12
|
try {
|
|
13
|
-
repository.clone({ version, workspace });
|
|
13
|
+
repository.clone({ version, workspace, branch });
|
|
14
14
|
const config = new Config_1.Config();
|
|
15
15
|
(0, makeFiles_1.makeFiles)({ repository, config, workspace });
|
|
16
16
|
config.push({
|
|
@@ -18,6 +18,7 @@ class Add extends command_1.Command {
|
|
|
18
18
|
path: repository.path,
|
|
19
19
|
version: version || repository.hash,
|
|
20
20
|
workspace,
|
|
21
|
+
branch,
|
|
21
22
|
});
|
|
22
23
|
config.publish();
|
|
23
24
|
this.log(`${color_1.color.green('success')}: ${repository.name} updated!`);
|
|
@@ -57,6 +58,7 @@ Add.flags = {
|
|
|
57
58
|
char: 'w',
|
|
58
59
|
description: 'a path to workspace containing .endpoints.json',
|
|
59
60
|
}),
|
|
61
|
+
branch: command_1.flags.string({ char: 'b', description: 'branch name to clone' }),
|
|
60
62
|
};
|
|
61
63
|
Add.examples = [
|
|
62
64
|
'$ mes add [username/repository]',
|
|
@@ -65,6 +67,8 @@ Add.examples = [
|
|
|
65
67
|
'$ mes add [username/repository] -v latest',
|
|
66
68
|
'$ mes add [username/repository] --workspace [workspace directory]',
|
|
67
69
|
'$ mes add [username/repository] -w [workspace directory]',
|
|
70
|
+
'$ mes add [username/repository] --branch [branch name]',
|
|
71
|
+
'$ mes add [username/repository] -b [branch name]',
|
|
68
72
|
'$ mes add /Users/.../local-repository/',
|
|
69
73
|
'$ mes add ./local-repository',
|
|
70
74
|
'$ mes add git@github.com:[username/repository].git',
|
package/lib/commands/install.js
CHANGED
|
@@ -13,11 +13,11 @@ class Install extends command_1.Command {
|
|
|
13
13
|
if (!config.dependencies) {
|
|
14
14
|
throw new Error('Dependencies property of the endpoints.config.json does not exist. Use the add command to add dependencies before installing');
|
|
15
15
|
}
|
|
16
|
-
for (const { repository: path, version, workspaces = [''], roots } of Object.values(config.dependencies)) {
|
|
16
|
+
for (const { repository: path, version, workspaces = [''], roots, branch } of Object.values(config.dependencies)) {
|
|
17
17
|
for (const workspace of workspaces) {
|
|
18
18
|
const repository = new Repository_1.Repository(path);
|
|
19
19
|
repositories.push(repository);
|
|
20
|
-
repository.clone({ version, workspace });
|
|
20
|
+
repository.clone({ version, workspace, branch });
|
|
21
21
|
(0, makeFiles_1.makeFiles)({ repository, workspace, config, roots });
|
|
22
22
|
}
|
|
23
23
|
}
|
package/lib/commands/update.js
CHANGED
|
@@ -17,16 +17,17 @@ class Update extends command_1.Command {
|
|
|
17
17
|
if (!(args.service in config.dependencies)) {
|
|
18
18
|
throw new Error('The service does not exist in the dependency. Check dependencies property of the endpoints.config.json. Or use the add command to add dependencies before installing');
|
|
19
19
|
}
|
|
20
|
-
const { repository: path, version, workspaces = [''], roots } = config.dependencies[args.service];
|
|
20
|
+
const { repository: path, version, workspaces = [''], roots, branch } = config.dependencies[args.service];
|
|
21
21
|
for (const workspace of workspaces) {
|
|
22
22
|
const repository = new Repository_1.Repository(path);
|
|
23
|
-
repository.clone({ version, workspace });
|
|
23
|
+
repository.clone({ version, workspace, branch });
|
|
24
24
|
(0, makeFiles_1.makeFiles)({ repository, config, workspace, roots });
|
|
25
25
|
config.push({
|
|
26
26
|
name: repository.name,
|
|
27
27
|
path: repository.path,
|
|
28
28
|
version: repository.hash,
|
|
29
29
|
workspace,
|
|
30
|
+
branch,
|
|
30
31
|
});
|
|
31
32
|
repositories.push(repository);
|
|
32
33
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
1
|
+
{"version":"2.6.0","commands":{"add":{"id":"add","description":"\nadd service to dependencies & make endpoints files.\n\n1. make endpoints.config.json for version control.\n\n{\n \"dependencies\": {\n \"service-name\": {\n \"version\": \"26177ed7e673daf0cc5a69e9793dd863424d272f\",\n \"repository\": \"git@github.com:[username/repository].git\"\n }\n }\n}\n\n> service name is inferred from Repository name.\n\n2. make src/endpoints/[service-name].ts\n","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"examples":["$ mes add [username/repository]","$ mes add [username/repository] --version [commmit hash]","$ mes add [username/repository] -v [commmit hash]","$ mes add [username/repository] -v latest","$ mes add [username/repository] --workspace [workspace directory]","$ mes add [username/repository] -w [workspace directory]","$ mes add [username/repository] --branch [branch name]","$ mes add [username/repository] -b [branch name]","$ mes add /Users/.../local-repository/","$ mes add ./local-repository","$ mes add git@github.com:[username/repository].git","$ mes add https://github.com/[username/repository].git"],"flags":{"version":{"name":"version","type":"option","char":"v","description":"latest or commit hash"},"workspace":{"name":"workspace","type":"option","char":"w","description":"a path to workspace containing .endpoints.json"},"branch":{"name":"branch","type":"option","char":"b","description":"branch name to clone"}},"args":[{"name":"repository"}]},"install":{"id":"install","description":"generate endpoints files based on endpoints.config.json","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"update":{"id":"update","description":"update service version & regenerate endpoints files","pluginName":"endpoints-sdk-cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"service"}]}}}
|