-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenerate.mjs
executable file
·60 lines (53 loc) · 1.85 KB
/
generate.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env node
import cp from "child_process";
import path from "path";
import { fileURLToPath } from "url";
const dirname = path.dirname(fileURLToPath(import.meta.url));
const workspaceRoot = path.resolve(dirname);
const options = {
shell: true,
stdio: "inherit",
env: process.env,
cwd: workspaceRoot,
};
const packages = [
["schema-draft-04", "http://json-schema.org/draft-04/schema#"],
// ["schema-draft-06", "http://json-schema.org/draft-06/schema#"],
// ["schema-draft-07", "http://json-schema.org/draft-07/schema#"],
// ["schema-draft-2019-09", "https://json-schema.org/draft/2019-09/schema"],
["schema-draft-2020-12", "https://json-schema.org/draft/2020-12/schema"],
// ["schema-swagger-v2", "http://swagger.io/v2/schema.json#/definitions/schema"],
["schema-oas-v3-0", "https://spec.openapis.org/oas/3.0/schema/2021-09-28#/definitions/Schema"],
["schema-oas-v3-1", "https://spec.openapis.org/oas/3.1/dialect/base"],
["swagger-v2", "http://swagger.io/v2/schema.json#"],
["oas-v3-0", "https://spec.openapis.org/oas/3.0/schema/2021-09-28"],
["oas-v3-1", "https://spec.openapis.org/oas/3.1/schema/2022-10-07"],
];
cp.execFileSync("cargo", ["build"], options);
cp.execFileSync("npm", ["run", "--workspaces", "build"], options);
for (const [name, location] of packages) {
cp.execFileSync("cargo", [
"run",
"--package",
"jns42-generator",
"package",
location,
"--package-directory",
path.join(workspaceRoot, "generated", "cargo", name),
"--package-name",
name,
"--package-version",
"0.1.0",
]);
cp.execFileSync("node", [
path.join(workspaceRoot, "packages", "npm", "jns42-generator", "bundled", "program.js"),
"package",
location,
"--package-directory",
path.join(workspaceRoot, "generated", "npm", name),
"--package-name",
name,
"--package-version",
"0.1.0",
]);
}