@polytric/openws-sdkgen 0.0.8 → 0.0.9
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/dist/main.cjs +2 -5
- package/dist/main.js +2 -5
- package/dist/plans/typescript.cjs +29 -45
- package/dist/plans/typescript.js +29 -45
- package/dist/templates/typescript/src/index.ts.ejs +5 -2
- package/dist/templates/typescript/src/sdk/role.ts.ejs +3 -4
- package/package.json +2 -2
- package/dist/templates/typescript/src/core/index.ts.ejs +0 -6
- /package/dist/templates/typescript/src/{core/models → models}/index.ts.ejs +0 -0
- /package/dist/templates/typescript/src/{core/models → models}/model.ts.ejs +0 -0
- /package/dist/templates/typescript/src/{core/network.ts.ejs → network.ts.ejs} +0 -0
- /package/dist/templates/typescript/src/{core/roles → roles}/index.ts.ejs +0 -0
- /package/dist/templates/typescript/src/{core/roles → roles}/role.ts.ejs +0 -0
package/dist/main.cjs
CHANGED
|
@@ -390,7 +390,6 @@ async function executePlan(ctx) {
|
|
|
390
390
|
const { getData, template, output } = step;
|
|
391
391
|
if (!getData || !template) continue;
|
|
392
392
|
const data = getData();
|
|
393
|
-
console.log(data);
|
|
394
393
|
import_node_fs.default.mkdirSync(import_node_path2.default.dirname(output), { recursive: true });
|
|
395
394
|
const rendered = renderTemplate(template, { ctx: data });
|
|
396
395
|
import_node_fs.default.writeFileSync(output, await formatRenderedOutput(output, rendered));
|
|
@@ -514,7 +513,7 @@ function getNetworkOutputPaths(ctx) {
|
|
|
514
513
|
const networkFolder = pascalCase(request.network);
|
|
515
514
|
return [import_node_path3.default.join(request.outputPath, assemblyName, networkFolder)];
|
|
516
515
|
}
|
|
517
|
-
return [import_node_path3.default.join(request.outputPath,
|
|
516
|
+
return [import_node_path3.default.join(request.outputPath, kebabCase(spec.name), kebabCase(request.network))];
|
|
518
517
|
}
|
|
519
518
|
|
|
520
519
|
// src/main.ts
|
|
@@ -534,9 +533,7 @@ async function main() {
|
|
|
534
533
|
}
|
|
535
534
|
return ctx;
|
|
536
535
|
}
|
|
537
|
-
main().
|
|
538
|
-
console.log(JSON.stringify(result, null, 2));
|
|
539
|
-
}).catch((err) => {
|
|
536
|
+
main().catch((err) => {
|
|
540
537
|
console.error(err);
|
|
541
538
|
process.exit(1);
|
|
542
539
|
});
|
package/dist/main.js
CHANGED
|
@@ -367,7 +367,6 @@ async function executePlan(ctx) {
|
|
|
367
367
|
const { getData, template, output } = step;
|
|
368
368
|
if (!getData || !template) continue;
|
|
369
369
|
const data = getData();
|
|
370
|
-
console.log(data);
|
|
371
370
|
fs.mkdirSync(path2.dirname(output), { recursive: true });
|
|
372
371
|
const rendered = renderTemplate(template, { ctx: data });
|
|
373
372
|
fs.writeFileSync(output, await formatRenderedOutput(output, rendered));
|
|
@@ -491,7 +490,7 @@ function getNetworkOutputPaths(ctx) {
|
|
|
491
490
|
const networkFolder = pascalCase(request.network);
|
|
492
491
|
return [path3.join(request.outputPath, assemblyName, networkFolder)];
|
|
493
492
|
}
|
|
494
|
-
return [path3.join(request.outputPath,
|
|
493
|
+
return [path3.join(request.outputPath, kebabCase(spec.name), kebabCase(request.network))];
|
|
495
494
|
}
|
|
496
495
|
|
|
497
496
|
// src/main.ts
|
|
@@ -511,9 +510,7 @@ async function main() {
|
|
|
511
510
|
}
|
|
512
511
|
return ctx;
|
|
513
512
|
}
|
|
514
|
-
main().
|
|
515
|
-
console.log(JSON.stringify(result, null, 2));
|
|
516
|
-
}).catch((err) => {
|
|
513
|
+
main().catch((err) => {
|
|
517
514
|
console.error(err);
|
|
518
515
|
process.exit(1);
|
|
519
516
|
});
|
|
@@ -44,9 +44,8 @@ var import_node_url = require("url");
|
|
|
44
44
|
var __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
45
45
|
var TEMPLATE_DIR = import_node_path.default.join(__dirname, "../templates/typescript");
|
|
46
46
|
var SRC_TEMPLATE_DIR = import_node_path.default.join(TEMPLATE_DIR, "src");
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var MODELS_TEMPLATE_DIR = import_node_path.default.join(CORE_TEMPLATE_DIR, "models");
|
|
47
|
+
var ROLES_TEMPLATE_DIR = import_node_path.default.join(SRC_TEMPLATE_DIR, "roles");
|
|
48
|
+
var MODELS_TEMPLATE_DIR = import_node_path.default.join(SRC_TEMPLATE_DIR, "models");
|
|
50
49
|
var SDK_TEMPLATE_DIR = import_node_path.default.join(SRC_TEMPLATE_DIR, "sdk");
|
|
51
50
|
function pascalCase(str) {
|
|
52
51
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -65,7 +64,10 @@ function createPlan(ctx) {
|
|
|
65
64
|
const language = Object.keys(request.target)[0];
|
|
66
65
|
const isTypeScript = language === "typescript";
|
|
67
66
|
const extension = isTypeScript ? "ts" : "js";
|
|
68
|
-
const
|
|
67
|
+
const serviceFileName = kebabCase(ir.package.service);
|
|
68
|
+
const networkFileName = kebabCase(request.network);
|
|
69
|
+
const packageOutputPath = import_node_path.default.join(request.outputPath, serviceFileName, networkFileName);
|
|
70
|
+
const packageName = `@${kebabCase(ir.package.project)}/${serviceFileName}-${networkFileName}-openws-sdk`;
|
|
69
71
|
const plan = [
|
|
70
72
|
{
|
|
71
73
|
name: `${language} package manifest`,
|
|
@@ -74,11 +76,11 @@ function createPlan(ctx) {
|
|
|
74
76
|
isTypeScript,
|
|
75
77
|
packageName,
|
|
76
78
|
description: ir.package.description,
|
|
77
|
-
version: ir.package.version ?? "0.0.
|
|
79
|
+
version: ir.package.version ?? "0.0.1",
|
|
78
80
|
extension
|
|
79
81
|
}),
|
|
80
82
|
template: import_node_path.default.join(TEMPLATE_DIR, "package.json.ejs"),
|
|
81
|
-
output: import_node_path.default.join(
|
|
83
|
+
output: import_node_path.default.join(packageOutputPath, "package.json")
|
|
82
84
|
}
|
|
83
85
|
];
|
|
84
86
|
if (isTypeScript) {
|
|
@@ -88,26 +90,24 @@ function createPlan(ctx) {
|
|
|
88
90
|
command: "render",
|
|
89
91
|
getData: () => ({}),
|
|
90
92
|
template: import_node_path.default.join(TEMPLATE_DIR, "tsconfig.json.ejs"),
|
|
91
|
-
output: import_node_path.default.join(
|
|
93
|
+
output: import_node_path.default.join(packageOutputPath, "tsconfig.json")
|
|
92
94
|
},
|
|
93
95
|
{
|
|
94
96
|
name: `${language} tsup config`,
|
|
95
97
|
command: "render",
|
|
96
98
|
getData: () => ({}),
|
|
97
99
|
template: import_node_path.default.join(TEMPLATE_DIR, "tsup.config.ts.ejs"),
|
|
98
|
-
output: import_node_path.default.join(
|
|
100
|
+
output: import_node_path.default.join(packageOutputPath, "tsup.config.ts")
|
|
99
101
|
}
|
|
100
102
|
);
|
|
101
103
|
}
|
|
102
|
-
const networkExports = [];
|
|
103
104
|
const selectedNetworkSpec = spec.networks[request.network];
|
|
104
105
|
if (!selectedNetworkSpec) {
|
|
105
106
|
throw new Error(`Network "${request.network}" does not exist in the spec`);
|
|
106
107
|
}
|
|
107
108
|
for (const [networkName, networkSpec] of [[request.network, selectedNetworkSpec]]) {
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const sdkOutputPath = import_node_path.default.join(request.outputPath, "src", "sdk");
|
|
109
|
+
const sourceOutputPath = import_node_path.default.join(packageOutputPath, "src");
|
|
110
|
+
const sdkOutputPath = import_node_path.default.join(sourceOutputPath, "sdk");
|
|
111
111
|
const allRoles = Object.values(networkSpec.roles).map(toRoleInfo);
|
|
112
112
|
const rolesByName = new Map(allRoles.map((role) => [role.roleName, role]));
|
|
113
113
|
const hostRoles = request.hostRoles.map((hostRole) => {
|
|
@@ -120,10 +120,6 @@ function createPlan(ctx) {
|
|
|
120
120
|
return role;
|
|
121
121
|
});
|
|
122
122
|
const modelScopes = buildModelScopes(buildSpecModels(networkSpec));
|
|
123
|
-
networkExports.push({
|
|
124
|
-
exportName: camelCase(networkName),
|
|
125
|
-
fileName: networkFileName
|
|
126
|
-
});
|
|
127
123
|
plan.push({
|
|
128
124
|
name: `${language} network ${networkName}`,
|
|
129
125
|
command: "render",
|
|
@@ -137,19 +133,8 @@ function createPlan(ctx) {
|
|
|
137
133
|
allRoles,
|
|
138
134
|
extension
|
|
139
135
|
}),
|
|
140
|
-
template: import_node_path.default.join(
|
|
141
|
-
output: import_node_path.default.join(
|
|
142
|
-
});
|
|
143
|
-
plan.push({
|
|
144
|
-
name: `${language} network exports ${networkName}`,
|
|
145
|
-
command: "render",
|
|
146
|
-
getData: () => ({
|
|
147
|
-
isTypeScript,
|
|
148
|
-
extension,
|
|
149
|
-
modelScopes
|
|
150
|
-
}),
|
|
151
|
-
template: import_node_path.default.join(CORE_TEMPLATE_DIR, "index.ts.ejs"),
|
|
152
|
-
output: import_node_path.default.join(networkOutputPath, `index.${extension}`)
|
|
136
|
+
template: import_node_path.default.join(SRC_TEMPLATE_DIR, "network.ts.ejs"),
|
|
137
|
+
output: import_node_path.default.join(sourceOutputPath, `network.${extension}`)
|
|
153
138
|
});
|
|
154
139
|
const roleMessagesByName = /* @__PURE__ */ new Map();
|
|
155
140
|
for (const role of allRoles) {
|
|
@@ -174,7 +159,7 @@ function createPlan(ctx) {
|
|
|
174
159
|
...role
|
|
175
160
|
}),
|
|
176
161
|
template: import_node_path.default.join(ROLES_TEMPLATE_DIR, "role.ts.ejs"),
|
|
177
|
-
output: import_node_path.default.join(
|
|
162
|
+
output: import_node_path.default.join(sourceOutputPath, "roles", `${role.fileName}.${extension}`)
|
|
178
163
|
});
|
|
179
164
|
}
|
|
180
165
|
plan.push({
|
|
@@ -186,7 +171,7 @@ function createPlan(ctx) {
|
|
|
186
171
|
roles: allRoles
|
|
187
172
|
}),
|
|
188
173
|
template: import_node_path.default.join(ROLES_TEMPLATE_DIR, "index.ts.ejs"),
|
|
189
|
-
output: import_node_path.default.join(
|
|
174
|
+
output: import_node_path.default.join(sourceOutputPath, "roles", `index.${extension}`)
|
|
190
175
|
});
|
|
191
176
|
for (const modelScope of modelScopes) {
|
|
192
177
|
plan.push({
|
|
@@ -199,7 +184,7 @@ function createPlan(ctx) {
|
|
|
199
184
|
}),
|
|
200
185
|
template: import_node_path.default.join(MODELS_TEMPLATE_DIR, "index.ts.ejs"),
|
|
201
186
|
output: import_node_path.default.join(
|
|
202
|
-
|
|
187
|
+
sourceOutputPath,
|
|
203
188
|
"models",
|
|
204
189
|
modelScope.fileName,
|
|
205
190
|
`index.${extension}`
|
|
@@ -215,7 +200,7 @@ function createPlan(ctx) {
|
|
|
215
200
|
}),
|
|
216
201
|
template: import_node_path.default.join(MODELS_TEMPLATE_DIR, "model.ts.ejs"),
|
|
217
202
|
output: import_node_path.default.join(
|
|
218
|
-
|
|
203
|
+
sourceOutputPath,
|
|
219
204
|
"models",
|
|
220
205
|
modelScope.fileName,
|
|
221
206
|
`${model.fileName}.${extension}`
|
|
@@ -253,7 +238,6 @@ function createPlan(ctx) {
|
|
|
253
238
|
extension,
|
|
254
239
|
handlers: roleHandlers,
|
|
255
240
|
networkName,
|
|
256
|
-
networkFileName,
|
|
257
241
|
networkDescription: networkSpec.description,
|
|
258
242
|
networkVersion: networkSpec.version,
|
|
259
243
|
remoteRoles,
|
|
@@ -274,18 +258,18 @@ function createPlan(ctx) {
|
|
|
274
258
|
template: import_node_path.default.join(SDK_TEMPLATE_DIR, "index.ts.ejs"),
|
|
275
259
|
output: import_node_path.default.join(sdkOutputPath, `index.${extension}`)
|
|
276
260
|
});
|
|
261
|
+
plan.push({
|
|
262
|
+
name: `${language} package exports`,
|
|
263
|
+
command: "render",
|
|
264
|
+
getData: () => ({
|
|
265
|
+
isTypeScript,
|
|
266
|
+
extension,
|
|
267
|
+
modelScopes
|
|
268
|
+
}),
|
|
269
|
+
template: import_node_path.default.join(SRC_TEMPLATE_DIR, "index.ts.ejs"),
|
|
270
|
+
output: import_node_path.default.join(sourceOutputPath, `index.${extension}`)
|
|
271
|
+
});
|
|
277
272
|
}
|
|
278
|
-
plan.push({
|
|
279
|
-
name: `${language} package exports`,
|
|
280
|
-
command: "render",
|
|
281
|
-
getData: () => ({
|
|
282
|
-
isTypeScript,
|
|
283
|
-
extension,
|
|
284
|
-
networkExports
|
|
285
|
-
}),
|
|
286
|
-
template: import_node_path.default.join(SRC_TEMPLATE_DIR, "index.ts.ejs"),
|
|
287
|
-
output: import_node_path.default.join(request.outputPath, "src", `index.${extension}`)
|
|
288
|
-
});
|
|
289
273
|
return {
|
|
290
274
|
...ctx,
|
|
291
275
|
plan
|
package/dist/plans/typescript.js
CHANGED
|
@@ -4,9 +4,8 @@ import { fileURLToPath } from "url";
|
|
|
4
4
|
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
5
|
var TEMPLATE_DIR = path.join(__dirname, "../templates/typescript");
|
|
6
6
|
var SRC_TEMPLATE_DIR = path.join(TEMPLATE_DIR, "src");
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var MODELS_TEMPLATE_DIR = path.join(CORE_TEMPLATE_DIR, "models");
|
|
7
|
+
var ROLES_TEMPLATE_DIR = path.join(SRC_TEMPLATE_DIR, "roles");
|
|
8
|
+
var MODELS_TEMPLATE_DIR = path.join(SRC_TEMPLATE_DIR, "models");
|
|
10
9
|
var SDK_TEMPLATE_DIR = path.join(SRC_TEMPLATE_DIR, "sdk");
|
|
11
10
|
function pascalCase(str) {
|
|
12
11
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -25,7 +24,10 @@ function createPlan(ctx) {
|
|
|
25
24
|
const language = Object.keys(request.target)[0];
|
|
26
25
|
const isTypeScript = language === "typescript";
|
|
27
26
|
const extension = isTypeScript ? "ts" : "js";
|
|
28
|
-
const
|
|
27
|
+
const serviceFileName = kebabCase(ir.package.service);
|
|
28
|
+
const networkFileName = kebabCase(request.network);
|
|
29
|
+
const packageOutputPath = path.join(request.outputPath, serviceFileName, networkFileName);
|
|
30
|
+
const packageName = `@${kebabCase(ir.package.project)}/${serviceFileName}-${networkFileName}-openws-sdk`;
|
|
29
31
|
const plan = [
|
|
30
32
|
{
|
|
31
33
|
name: `${language} package manifest`,
|
|
@@ -34,11 +36,11 @@ function createPlan(ctx) {
|
|
|
34
36
|
isTypeScript,
|
|
35
37
|
packageName,
|
|
36
38
|
description: ir.package.description,
|
|
37
|
-
version: ir.package.version ?? "0.0.
|
|
39
|
+
version: ir.package.version ?? "0.0.1",
|
|
38
40
|
extension
|
|
39
41
|
}),
|
|
40
42
|
template: path.join(TEMPLATE_DIR, "package.json.ejs"),
|
|
41
|
-
output: path.join(
|
|
43
|
+
output: path.join(packageOutputPath, "package.json")
|
|
42
44
|
}
|
|
43
45
|
];
|
|
44
46
|
if (isTypeScript) {
|
|
@@ -48,26 +50,24 @@ function createPlan(ctx) {
|
|
|
48
50
|
command: "render",
|
|
49
51
|
getData: () => ({}),
|
|
50
52
|
template: path.join(TEMPLATE_DIR, "tsconfig.json.ejs"),
|
|
51
|
-
output: path.join(
|
|
53
|
+
output: path.join(packageOutputPath, "tsconfig.json")
|
|
52
54
|
},
|
|
53
55
|
{
|
|
54
56
|
name: `${language} tsup config`,
|
|
55
57
|
command: "render",
|
|
56
58
|
getData: () => ({}),
|
|
57
59
|
template: path.join(TEMPLATE_DIR, "tsup.config.ts.ejs"),
|
|
58
|
-
output: path.join(
|
|
60
|
+
output: path.join(packageOutputPath, "tsup.config.ts")
|
|
59
61
|
}
|
|
60
62
|
);
|
|
61
63
|
}
|
|
62
|
-
const networkExports = [];
|
|
63
64
|
const selectedNetworkSpec = spec.networks[request.network];
|
|
64
65
|
if (!selectedNetworkSpec) {
|
|
65
66
|
throw new Error(`Network "${request.network}" does not exist in the spec`);
|
|
66
67
|
}
|
|
67
68
|
for (const [networkName, networkSpec] of [[request.network, selectedNetworkSpec]]) {
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const sdkOutputPath = path.join(request.outputPath, "src", "sdk");
|
|
69
|
+
const sourceOutputPath = path.join(packageOutputPath, "src");
|
|
70
|
+
const sdkOutputPath = path.join(sourceOutputPath, "sdk");
|
|
71
71
|
const allRoles = Object.values(networkSpec.roles).map(toRoleInfo);
|
|
72
72
|
const rolesByName = new Map(allRoles.map((role) => [role.roleName, role]));
|
|
73
73
|
const hostRoles = request.hostRoles.map((hostRole) => {
|
|
@@ -80,10 +80,6 @@ function createPlan(ctx) {
|
|
|
80
80
|
return role;
|
|
81
81
|
});
|
|
82
82
|
const modelScopes = buildModelScopes(buildSpecModels(networkSpec));
|
|
83
|
-
networkExports.push({
|
|
84
|
-
exportName: camelCase(networkName),
|
|
85
|
-
fileName: networkFileName
|
|
86
|
-
});
|
|
87
83
|
plan.push({
|
|
88
84
|
name: `${language} network ${networkName}`,
|
|
89
85
|
command: "render",
|
|
@@ -97,19 +93,8 @@ function createPlan(ctx) {
|
|
|
97
93
|
allRoles,
|
|
98
94
|
extension
|
|
99
95
|
}),
|
|
100
|
-
template: path.join(
|
|
101
|
-
output: path.join(
|
|
102
|
-
});
|
|
103
|
-
plan.push({
|
|
104
|
-
name: `${language} network exports ${networkName}`,
|
|
105
|
-
command: "render",
|
|
106
|
-
getData: () => ({
|
|
107
|
-
isTypeScript,
|
|
108
|
-
extension,
|
|
109
|
-
modelScopes
|
|
110
|
-
}),
|
|
111
|
-
template: path.join(CORE_TEMPLATE_DIR, "index.ts.ejs"),
|
|
112
|
-
output: path.join(networkOutputPath, `index.${extension}`)
|
|
96
|
+
template: path.join(SRC_TEMPLATE_DIR, "network.ts.ejs"),
|
|
97
|
+
output: path.join(sourceOutputPath, `network.${extension}`)
|
|
113
98
|
});
|
|
114
99
|
const roleMessagesByName = /* @__PURE__ */ new Map();
|
|
115
100
|
for (const role of allRoles) {
|
|
@@ -134,7 +119,7 @@ function createPlan(ctx) {
|
|
|
134
119
|
...role
|
|
135
120
|
}),
|
|
136
121
|
template: path.join(ROLES_TEMPLATE_DIR, "role.ts.ejs"),
|
|
137
|
-
output: path.join(
|
|
122
|
+
output: path.join(sourceOutputPath, "roles", `${role.fileName}.${extension}`)
|
|
138
123
|
});
|
|
139
124
|
}
|
|
140
125
|
plan.push({
|
|
@@ -146,7 +131,7 @@ function createPlan(ctx) {
|
|
|
146
131
|
roles: allRoles
|
|
147
132
|
}),
|
|
148
133
|
template: path.join(ROLES_TEMPLATE_DIR, "index.ts.ejs"),
|
|
149
|
-
output: path.join(
|
|
134
|
+
output: path.join(sourceOutputPath, "roles", `index.${extension}`)
|
|
150
135
|
});
|
|
151
136
|
for (const modelScope of modelScopes) {
|
|
152
137
|
plan.push({
|
|
@@ -159,7 +144,7 @@ function createPlan(ctx) {
|
|
|
159
144
|
}),
|
|
160
145
|
template: path.join(MODELS_TEMPLATE_DIR, "index.ts.ejs"),
|
|
161
146
|
output: path.join(
|
|
162
|
-
|
|
147
|
+
sourceOutputPath,
|
|
163
148
|
"models",
|
|
164
149
|
modelScope.fileName,
|
|
165
150
|
`index.${extension}`
|
|
@@ -175,7 +160,7 @@ function createPlan(ctx) {
|
|
|
175
160
|
}),
|
|
176
161
|
template: path.join(MODELS_TEMPLATE_DIR, "model.ts.ejs"),
|
|
177
162
|
output: path.join(
|
|
178
|
-
|
|
163
|
+
sourceOutputPath,
|
|
179
164
|
"models",
|
|
180
165
|
modelScope.fileName,
|
|
181
166
|
`${model.fileName}.${extension}`
|
|
@@ -213,7 +198,6 @@ function createPlan(ctx) {
|
|
|
213
198
|
extension,
|
|
214
199
|
handlers: roleHandlers,
|
|
215
200
|
networkName,
|
|
216
|
-
networkFileName,
|
|
217
201
|
networkDescription: networkSpec.description,
|
|
218
202
|
networkVersion: networkSpec.version,
|
|
219
203
|
remoteRoles,
|
|
@@ -234,18 +218,18 @@ function createPlan(ctx) {
|
|
|
234
218
|
template: path.join(SDK_TEMPLATE_DIR, "index.ts.ejs"),
|
|
235
219
|
output: path.join(sdkOutputPath, `index.${extension}`)
|
|
236
220
|
});
|
|
221
|
+
plan.push({
|
|
222
|
+
name: `${language} package exports`,
|
|
223
|
+
command: "render",
|
|
224
|
+
getData: () => ({
|
|
225
|
+
isTypeScript,
|
|
226
|
+
extension,
|
|
227
|
+
modelScopes
|
|
228
|
+
}),
|
|
229
|
+
template: path.join(SRC_TEMPLATE_DIR, "index.ts.ejs"),
|
|
230
|
+
output: path.join(sourceOutputPath, `index.${extension}`)
|
|
231
|
+
});
|
|
237
232
|
}
|
|
238
|
-
plan.push({
|
|
239
|
-
name: `${language} package exports`,
|
|
240
|
-
command: "render",
|
|
241
|
-
getData: () => ({
|
|
242
|
-
isTypeScript,
|
|
243
|
-
extension,
|
|
244
|
-
networkExports
|
|
245
|
-
}),
|
|
246
|
-
template: path.join(SRC_TEMPLATE_DIR, "index.ts.ejs"),
|
|
247
|
-
output: path.join(request.outputPath, "src", `index.${extension}`)
|
|
248
|
-
});
|
|
249
233
|
return {
|
|
250
234
|
...ctx,
|
|
251
235
|
plan
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export *
|
|
1
|
+
export * from './network<%= ctx.isTypeScript ? '' : '.js' %>'
|
|
2
|
+
export * from './roles<%= ctx.isTypeScript ? '' : '/index.js' %>'
|
|
3
|
+
export * as roles from './roles<%= ctx.isTypeScript ? '' : '/index.js' %>'
|
|
4
|
+
<% for (const modelScope of ctx.modelScopes) { -%>
|
|
5
|
+
export * as <%= modelScope.varName %>Models from './models/<%= modelScope.fileName %><%= ctx.isTypeScript ? '' : '/index.js' %>'
|
|
3
6
|
<% } -%>
|
|
4
7
|
export * as sdk from './sdk<%= ctx.isTypeScript ? '' : '/index.js' %>'
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
<% const
|
|
2
|
-
<% const
|
|
3
|
-
<% const
|
|
4
|
-
<% const rolesImport = ctx.isTypeScript ? `../${networkDir}/roles` : `../${networkDir}/roles/index.js` -%>
|
|
1
|
+
<% const networkImport = ctx.isTypeScript ? '../network' : '../network.js' -%>
|
|
2
|
+
<% const modelImportPath = ctx.isTypeScript ? `../models/${ctx.fileName}` : `../models/${ctx.fileName}/index.js` -%>
|
|
3
|
+
<% const rolesImport = ctx.isTypeScript ? '../roles' : '../roles/index.js' -%>
|
|
5
4
|
<% if (ctx.isTypeScript) { -%>
|
|
6
5
|
import * as WS from '@polytric/openws/class'
|
|
7
6
|
import * as Fluent from '@polytric/openws/fluent'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polytric/openws-sdkgen",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "OpenWS SDK generator CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"ajv": "^8.17.1",
|
|
38
38
|
"ejs": "^3.1.10",
|
|
39
39
|
"prettier": "^3.7.4",
|
|
40
|
-
"yargs": "^
|
|
40
|
+
"yargs": "^17.7.2",
|
|
41
41
|
"@polytric/openws-spec": "0.0.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from './network<%= ctx.isTypeScript ? '' : '.js' %>'
|
|
2
|
-
export * from './roles<%= ctx.isTypeScript ? '' : '/index.js' %>'
|
|
3
|
-
export * as roles from './roles<%= ctx.isTypeScript ? '' : '/index.js' %>'
|
|
4
|
-
<% for (const modelScope of ctx.modelScopes) { -%>
|
|
5
|
-
export * as <%= modelScope.varName %>Models from './models/<%= modelScope.fileName %><%= ctx.isTypeScript ? '' : '/index.js' %>'
|
|
6
|
-
<% } -%>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|