-
Notifications
You must be signed in to change notification settings - Fork 611
/
Copy pathsingle-service.js
53 lines (43 loc) · 1.65 KB
/
single-service.js
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
const yargs = require("yargs");
const { normalize, join } = require("path");
const { generateClient } = require("./code-gen");
const { codeOrdering } = require("./code-ordering");
const { copyToClients } = require("./copy-to-clients");
const SDK_CLIENTS_DIR = normalize(join(__dirname, "..", "..", "clients"));
const { solo } = yargs(process.argv.slice(2))
.string("solo")
.describe("solo", "The service name of the service to codegen")
.help().argv;
(async () => {
try {
await generateClient(solo);
await copyToClients(
normalize(join(__dirname, "..", "..", "codegen", "sdk-codegen", "build-single", solo)),
SDK_CLIENTS_DIR,
solo
);
await codeOrdering(join(SDK_CLIENTS_DIR, `client-${solo}`));
if (solo === "workspaces-thin-client") {
require("./customizations/workspaces-thin-client")();
}
// post-generation transforms
const clientFolder = join(SDK_CLIENTS_DIR, `client-${solo}`);
const libFolder = join(SDK_CLIENTS_DIR, "..", "lib", `lib-${solo}`);
// examples merging
require("../api-examples/get-examples");
require("../api-examples/merge-examples").merge(void 0, solo);
console.log("================ starting wasm-fmt biome ================", "\n", new Date().toString(), solo);
const target = `${clientFolder}/src`;
const { runWasmFmtBiome } = await import("./run-wasm-fmt-biome.mjs");
runWasmFmtBiome(target);
if (solo === "dynamodb") {
const target = `${libFolder}/src`;
runWasmFmtBiome(target);
}
const compress = require("../endpoints-ruleset/compress");
compress(solo);
} catch (e) {
console.error(e);
process.exit(1);
}
})();