endpoints-sdk-cli 2.3.3 → 2.4.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
@@ -9,6 +9,7 @@ Endpoints SDK for JavaScript
9
9
  * [Usage](#usage)
10
10
  * [Commands](#commands)
11
11
  * [Support of `create-react-app`](#support-of-create-react-app)
12
+ * [Override root url](#override-root-url)
12
13
  <!-- tocstop -->
13
14
  # Usage
14
15
  <!-- usage -->
@@ -17,7 +18,7 @@ $ npm install -g endpoints-sdk-cli
17
18
  $ mes COMMAND
18
19
  running command...
19
20
  $ mes (-v|--version|version)
20
- endpoints-sdk-cli/2.3.3 darwin-x64 node-v16.16.0
21
+ endpoints-sdk-cli/2.4.1 darwin-x64 node-v18.15.0
21
22
  $ mes --help [COMMAND]
22
23
  USAGE
23
24
  $ mes COMMAND
@@ -74,7 +75,7 @@ EXAMPLES
74
75
  $ mes add https://github.com/[username/repository].git
75
76
  ```
76
77
 
77
- _See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.3.3/src/commands/add.ts)_
78
+ _See code: [src/commands/add.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.4.1/src/commands/add.ts)_
78
79
 
79
80
  ## `mes help [COMMAND]`
80
81
 
@@ -102,7 +103,7 @@ USAGE
102
103
  $ mes install
103
104
  ```
104
105
 
105
- _See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.3.3/src/commands/install.ts)_
106
+ _See code: [src/commands/install.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.4.1/src/commands/install.ts)_
106
107
 
107
108
  ## `mes update [SERVICE]`
108
109
 
@@ -113,7 +114,7 @@ USAGE
113
114
  $ mes update [SERVICE]
114
115
  ```
115
116
 
116
- _See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.3.3/src/commands/update.ts)_
117
+ _See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sdk-cli/blob/v2.4.1/src/commands/update.ts)_
117
118
  <!-- commandsstop -->
118
119
 
119
120
 
@@ -124,3 +125,21 @@ _See code: [src/commands/update.ts](https://github.com/matsuri-tech/endpoints-sd
124
125
  "environment_identifier": "process.env.REACT_APP_ENV",
125
126
  }
126
127
  ```
128
+
129
+ # Override root url
130
+
131
+ ```json
132
+ {
133
+ "dependencies": {
134
+ "my-service": {
135
+ "version": "ba832b61d0319f42b3cbb30c815cbdecfece959a",
136
+ "repository": "git@github.com:hoge/my-service.git",
137
+ "roots":{
138
+ "dev": "https://dev.hoge.com",
139
+ "prod": "https://hoge.com",
140
+ "local": "http://localhost:3000"
141
+ }
142
+ },
143
+ }
144
+ }
145
+ ```
@@ -1,11 +1,24 @@
1
- export declare class Config {
2
- dependencies: {
3
- [service: string]: {
4
- version: string;
5
- repository: string;
6
- workspaces?: string[];
7
- };
1
+ export interface Roots {
2
+ [env: string]: string;
3
+ }
4
+ interface Dependencies {
5
+ [service: string]: {
6
+ version: string;
7
+ repository: string;
8
+ roots?: Roots;
9
+ workspaces?: string[];
8
10
  };
11
+ }
12
+ interface ConfigData {
13
+ $shema: string;
14
+ dependencies: Dependencies;
15
+ path: string;
16
+ output: string;
17
+ environment_identifier: string;
18
+ }
19
+ export declare class Config {
20
+ data: Partial<ConfigData>;
21
+ dependencies: Dependencies;
9
22
  path: string;
10
23
  output: string;
11
24
  environment_identifier: string;
@@ -18,3 +31,4 @@ export declare class Config {
18
31
  }): void;
19
32
  publish(): void;
20
33
  }
34
+ export {};
@@ -8,12 +8,14 @@ const prettier = tslib_1.__importStar(require("prettier"));
8
8
  const unique_1 = require("../utils/unique");
9
9
  class Config {
10
10
  constructor() {
11
+ this.data = {};
11
12
  this.dependencies = {};
12
13
  this.path = 'endpoints.config.json';
13
14
  this.output = fs.existsSync(path.resolve('./src')) ? './src/endpoints/' : './endpoints/';
14
15
  this.environment_identifier = 'process.env.NODE_ENV';
15
16
  if (fs.existsSync(this.path)) {
16
17
  const data = JSON.parse(fs.readFileSync(this.path).toString());
18
+ this.data = data;
17
19
  if (data.dependencies) {
18
20
  this.dependencies = data.dependencies;
19
21
  }
@@ -29,23 +31,15 @@ class Config {
29
31
  }
30
32
  }
31
33
  push({ name, path, version, workspace }) {
32
- var _a, _b;
34
+ var _a, _b, _c;
33
35
  const workspaces = (0, unique_1.unique)([
34
36
  ...(((_b = (_a = this.dependencies) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.workspaces) || []),
35
37
  workspace,
36
38
  ]).filter((w) => Boolean(w));
37
- this.dependencies = Object.assign(Object.assign({}, this.dependencies), { [name]: {
38
- version,
39
- repository: path,
40
- workspaces: workspaces.length > 0 ? workspaces : undefined,
41
- } });
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 }) });
42
40
  }
43
41
  publish() {
44
- const data = {
45
- output: this.output,
46
- environment_identifier: this.environment_identifier,
47
- dependencies: this.dependencies,
48
- };
42
+ const data = Object.assign(Object.assign({}, this.data), { output: this.output, environment_identifier: this.environment_identifier, dependencies: this.dependencies });
49
43
  fs.writeFileSync(this.path, prettier.format(JSON.stringify(data, null, 2), { parser: 'json' }));
50
44
  }
51
45
  }
@@ -13,12 +13,12 @@ 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 = [''] } of Object.values(config.dependencies)) {
16
+ for (const { repository: path, version, workspaces = [''], roots } 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
20
  repository.clone({ version, workspace });
21
- (0, makeFiles_1.makeFiles)({ repository, workspace, config });
21
+ (0, makeFiles_1.makeFiles)({ repository, workspace, config, roots });
22
22
  }
23
23
  }
24
24
  }
@@ -0,0 +1,4 @@
1
+ import * as v1 from "./m2m-core.v1";
2
+ export declare const m2mCore: {
3
+ v1: typeof v1;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.m2mCore = void 0;
4
+ const tslib_1 = require("tslib");
5
+ /* eslint-disable */
6
+ const v1 = tslib_1.__importStar(require("./m2m-core.v1"));
7
+ exports.m2mCore = { v1 };