endpoints-sdk-cli 2.4.1 → 2.5.1
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
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.5.1 darwin-x64 node-v18.17.1
|
|
22
22
|
$ mes --help [COMMAND]
|
|
23
23
|
USAGE
|
|
24
24
|
$ mes COMMAND
|
|
@@ -75,7 +75,7 @@ EXAMPLES
|
|
|
75
75
|
$ mes add https://github.com/[username/repository].git
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
_See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.
|
|
78
|
+
_See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.5.1/src/commands/add.ts)_
|
|
79
79
|
|
|
80
80
|
## `mes help [COMMAND]`
|
|
81
81
|
|
|
@@ -103,7 +103,7 @@ USAGE
|
|
|
103
103
|
$ mes install
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
_See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.
|
|
106
|
+
_See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.5.1/src/commands/install.ts)_
|
|
107
107
|
|
|
108
108
|
## `mes update [SERVICE]`
|
|
109
109
|
|
|
@@ -114,7 +114,7 @@ USAGE
|
|
|
114
114
|
$ mes update [SERVICE]
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
_See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.
|
|
117
|
+
_See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.5.1/src/commands/update.ts)_
|
|
118
118
|
<!-- commandsstop -->
|
|
119
119
|
|
|
120
120
|
|
|
@@ -4,10 +4,18 @@ export interface Env {
|
|
|
4
4
|
prod: string;
|
|
5
5
|
[key: string]: string;
|
|
6
6
|
}
|
|
7
|
+
export declare type AuthSchema = {
|
|
8
|
+
type: 'Bearer' | 'Basic';
|
|
9
|
+
header: 'Authorization';
|
|
10
|
+
} | {
|
|
11
|
+
type: 'ApiKey';
|
|
12
|
+
header: 'X-Access-Token';
|
|
13
|
+
};
|
|
7
14
|
export interface Endpoint {
|
|
8
15
|
path: string;
|
|
9
16
|
desc: string;
|
|
10
17
|
method?: string;
|
|
18
|
+
authSchema?: AuthSchema;
|
|
11
19
|
}
|
|
12
20
|
export interface Api {
|
|
13
21
|
[endpoint: string]: Endpoint;
|
|
@@ -22,7 +22,9 @@ class Repository {
|
|
|
22
22
|
}
|
|
23
23
|
checkout(workspace) {
|
|
24
24
|
const file = path.resolve(this.cache, workspace, '.endpoints.json');
|
|
25
|
-
const mainBranch = (0, node_child_process_1.execSync)(`cd ${this.cache}; git rev-parse --abbrev-ref origin/HEAD`)
|
|
25
|
+
const mainBranch = (0, node_child_process_1.execSync)(`cd ${this.cache}; git rev-parse --abbrev-ref origin/HEAD`)
|
|
26
|
+
.toString()
|
|
27
|
+
.trim();
|
|
26
28
|
(0, node_child_process_1.execSync)(`cd ${this.cache}; git checkout ${mainBranch} -- ${file}`);
|
|
27
29
|
return JSON.parse(fs.readFileSync(file).toString());
|
|
28
30
|
}
|
package/lib/commands/update.js
CHANGED
|
@@ -17,11 +17,11 @@ 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 = [''] } = config.dependencies[args.service];
|
|
20
|
+
const { repository: path, version, workspaces = [''], roots } = config.dependencies[args.service];
|
|
21
21
|
for (const workspace of workspaces) {
|
|
22
22
|
const repository = new Repository_1.Repository(path);
|
|
23
23
|
repository.clone({ version, workspace });
|
|
24
|
-
(0, makeFiles_1.makeFiles)({ repository, config, workspace });
|
|
24
|
+
(0, makeFiles_1.makeFiles)({ repository, config, workspace, roots });
|
|
25
25
|
config.push({
|
|
26
26
|
name: repository.name,
|
|
27
27
|
path: repository.path,
|
|
@@ -86,6 +86,7 @@ const endpoint = (name, e) => {
|
|
|
86
86
|
return __queries ? \`\${__path}?\${__queries}\` : __path;
|
|
87
87
|
};
|
|
88
88
|
`,
|
|
89
|
-
e.method ? `${name}.method='${e.method}' as const;` : null
|
|
89
|
+
e.method ? `${name}.method='${e.method}' as const;` : null,
|
|
90
|
+
e.authSchema ? `${name}.authSchema=${JSON.stringify(e.authSchema)} as const;` : null].filter(Boolean).join('\n');
|
|
90
91
|
};
|
|
91
92
|
exports.endpoint = endpoint;
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
1
|
+
{"version":"2.5.1","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 /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"}},"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"}]}}}
|