-
Notifications
You must be signed in to change notification settings - Fork 12
/
ghjk.ts
202 lines (182 loc) · 4.87 KB
/
ghjk.ts
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0
// @ts-nocheck: Deno file
import { METATYPE_VERSION, PUBLISHED_VERSION } from "./tools/consts.ts";
import { file, ports, sedLock, semver, stdDeps } from "./tools/deps.ts";
import installs from "./tools/installs.ts";
import tasks from "./tools/tasks/mod.ts";
const ghjk = file({
defaultEnv: Deno.env.get("CI") ? "ci" : Deno.env.get("OCI") ? "oci" : "dev",
tasks,
});
export const sophon = ghjk.sophon;
const { env, task } = ghjk;
env("main")
.install(installs.deno)
.vars({
RUST_LOG:
"info,typegate=debug,deno=warn,swc_ecma_codegen=off,tracing::span=off,quaint=off",
TYPEGRAPH_VERSION: "0.0.3",
CLICOLOR_FORCE: "1",
CROSS_CONFIG: "tools/Cross.toml",
GIT_CLIFF_CONFIG: "tools/cliff.toml",
})
.allowedBuildDeps(
...stdDeps(),
installs.python_latest,
installs.node,
installs.rust_stable,
);
env("_rust").install(
// use rustup for the actual toolchain
ports.protoc({ version: "v28.2" }),
ports.cmake()[0],
);
if (Deno.build.os == "linux" && !Deno.env.has("NO_MOLD")) {
const mold = ports.mold({
version: "v2.4.0",
replaceLd: true,
});
env("dev").install(mold);
env("oci").install(mold);
env("ci").install(mold);
}
env("_ecma").install(
installs.node,
ports.pnpm({ version: "v9.4.0" }),
ports.npmi({ packageName: "node-gyp", version: "10.0.1" })[0],
);
env("_python").install(
installs.python,
ports.pipi({
packageName: "ruff",
version: "0.4.7",
})[0],
ports.pipi({
packageName: "poetry",
version: "1.8.3",
})[0],
);
env("_wasm").install(
ports.cargobi({
crateName: "wasm-opt",
version: "0.116.1",
locked: true,
}),
ports.cargobi({
crateName: "wasm-tools",
version: "1.208.1",
locked: true,
}),
ports.pipi({ packageName: "componentize-py", version: "0.13.4" })[0],
// FIXME: jco installs node as a dep
ports.npmi({
packageName: "@bytecodealliance/jco",
version: "1.3.0",
})[0],
);
env("oci").inherit(["_rust", "_wasm"]);
env("ci")
.inherit(["_rust", "_python", "_ecma", "_wasm"])
.install(
ports.pipi({ packageName: "pre-commit", version: "3.7.1" })[0],
ports.temporal_cli({ version: "v0.13.1" }),
ports.cargobi({
crateName: "cargo-insta",
version: "1.33.0",
locked: true,
}),
ports.cargobi({
crateName: "cross",
version: "0.2.5",
locked: true,
}),
);
env("dev")
.inherit("ci")
// debug v8 to fix MET-633: segementation fault bug with custom deno rt
// doesn't appear in CI so only dev envs get it
.var("V8_FORCE_DEBUG", "true")
.install(
ports.act(),
ports.cargobi({ crateName: "whiz", locked: true }),
ports.cargobi({ crateName: "wit-deps-cli", locked: true }),
ports.cargobi({ crateName: "git-cliff", locked: true }),
);
task("version-print", () => console.log(METATYPE_VERSION), {
desc: "Print $METATYPE_VERSION",
});
task("version-bump", async ($) => {
const bumps = [
"major",
"premajor",
"minor",
"preminor",
"patch",
"prepatch",
"prerelease",
];
const bump = $.argv[0];
if (!bumps.includes(bump)) {
throw new Error(
`invalid argument "${bump}", valid are: ${bumps.join(", ")}`,
);
}
const newVersion = semver.format(
semver.increment(
semver.parse(METATYPE_VERSION),
bump as semver.ReleaseType,
{
prerelease: "rc",
},
),
);
$.logStep(`Bumping ${METATYPE_VERSION} → ${newVersion}`);
const lines = [[/^(export const METATYPE_VERSION = ").*(";)$/, newVersion]];
if (bump === "prerelease") {
$.logStep(
`Bumping published version ${PUBLISHED_VERSION} → ${METATYPE_VERSION}`,
);
lines.push([
/^(export const PUBLISHED_VERSION = ").*(";)$/,
METATYPE_VERSION,
]);
}
await sedLock($.workingDir, {
lines: {
"./tools/consts.ts": lines,
},
});
await $`ghjk x lock-sed`;
});
task(
"clean-rust",
($) =>
$.co([
$`cargo clean`,
$`cargo clean`.cwd("tests/runtimes/wasm_reflected/rust"),
$`cargo clean`.cwd("tests/runtimes/wasm_wire/rust"),
$`cargo clean`.cwd("tests/metagen/typegraphs/sample/rs"),
$`cargo clean`.cwd("tests/metagen/typegraphs/identities/rs"),
$`cargo clean`.cwd("./examples/typegraphs/metagen/"),
]),
{ inherit: "_rust", desc: "Clean cache of all cargo workspaces in repo." },
);
task(
"clean-node",
($) =>
$.co([
$.path("./docs/metatype.dev/node_modules"),
$.path("./docs/metatype.dev/build"),
$.path("./tests/e2e/nextjs/apollo/node_modules"),
$.path("./tests/runtimes/temporal/worker/node_modules"),
].map(async (path) => {
if (await path.exists()) {
await path.remove({ recursive: true });
}
})),
{
inherit: "_ecma",
desc: "Remove all node_modules directories in tree and other js artifacts.",
},
);