@dbx-tools/projen 0.6.149 → 0.6.150
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/package.json +4 -4
- package/src/project-rs.ts +12 -7
- package/tasks/bump.ts +32 -0
package/package.json
CHANGED
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@clack/prompts": "^1.7.0",
|
|
29
|
-
"@dbx-tools/core": "0.6.
|
|
30
|
-
"@dbx-tools/path": "0.6.
|
|
31
|
-
"@dbx-tools/shared-core": "0.6.
|
|
29
|
+
"@dbx-tools/core": "0.6.150",
|
|
30
|
+
"@dbx-tools/path": "0.6.150",
|
|
31
|
+
"@dbx-tools/shared-core": "0.6.150",
|
|
32
32
|
"commander": "^15.0.0",
|
|
33
33
|
"concurrently": "^10.0.3",
|
|
34
34
|
"constructs": "^10.6.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"main": "index.ts",
|
|
50
50
|
"license": "Apache-2.0",
|
|
51
|
-
"version": "0.6.
|
|
51
|
+
"version": "0.6.150",
|
|
52
52
|
"types": "index.ts",
|
|
53
53
|
"type": "module",
|
|
54
54
|
"exports": {
|
package/src/project-rs.ts
CHANGED
|
@@ -142,11 +142,16 @@ const RUST_CACHE_ENV = {
|
|
|
142
142
|
|
|
143
143
|
function rustCacheSteps(sharedKey: string): readonly Record<string, unknown>[] {
|
|
144
144
|
return [
|
|
145
|
-
{ name: "Setup sccache", uses: "mozilla-actions/sccache-action@v0.0.
|
|
145
|
+
{ name: "Setup sccache", uses: "mozilla-actions/sccache-action@v0.0.11" },
|
|
146
146
|
{
|
|
147
147
|
name: "Cache Cargo registry",
|
|
148
|
-
uses: "Swatinem/rust-cache@v2",
|
|
149
|
-
with: {
|
|
148
|
+
uses: "Swatinem/rust-cache@v2.9.2",
|
|
149
|
+
with: {
|
|
150
|
+
"cache-targets": false,
|
|
151
|
+
"add-job-id-key": false,
|
|
152
|
+
"add-rust-environment-hash-key": false,
|
|
153
|
+
"shared-key": sharedKey,
|
|
154
|
+
},
|
|
150
155
|
},
|
|
151
156
|
];
|
|
152
157
|
}
|
|
@@ -441,12 +446,12 @@ export class DBXToolsRustWorkspace {
|
|
|
441
446
|
node.package.addField("private", true);
|
|
442
447
|
node.package.file.addDeletionOverride("publishConfig");
|
|
443
448
|
node.package.addField("description", `Node bindings for ${binding.crateName}`);
|
|
444
|
-
const
|
|
449
|
+
const nativeTargets = releaseTargets(options);
|
|
445
450
|
if (options.release ?? true) {
|
|
446
451
|
node.package.addField(
|
|
447
452
|
"optionalDependencies",
|
|
448
453
|
Object.fromEntries(
|
|
449
|
-
|
|
454
|
+
nativeTargets.map((target) => [
|
|
450
455
|
`@${string.toSlug(options.scope)}/${directory}-${target.node}`,
|
|
451
456
|
readWorkspaceVersion(project.outdir),
|
|
452
457
|
]),
|
|
@@ -575,7 +580,7 @@ export class DBXToolsRustWorkspace {
|
|
|
575
580
|
uses: "dtolnay/rust-toolchain@stable",
|
|
576
581
|
with: { targets: "${{ matrix.target.cargo }}" },
|
|
577
582
|
},
|
|
578
|
-
...rustCacheSteps("
|
|
583
|
+
...rustCacheSteps("release-${{ matrix.target.cargo }}"),
|
|
579
584
|
{
|
|
580
585
|
name: "Install Linux native dependencies",
|
|
581
586
|
if: "${{ matrix.target.os == 'linux' }}",
|
|
@@ -616,7 +621,7 @@ export class DBXToolsRustWorkspace {
|
|
|
616
621
|
uses: "dtolnay/rust-toolchain@stable",
|
|
617
622
|
with: { targets: "${{ matrix.target.cargo }}" },
|
|
618
623
|
},
|
|
619
|
-
...rustCacheSteps("
|
|
624
|
+
...rustCacheSteps("release-${{ matrix.target.cargo }}"),
|
|
620
625
|
{
|
|
621
626
|
name: "Install Linux native dependencies",
|
|
622
627
|
if: "${{ matrix.target.os == 'linux' }}",
|
package/tasks/bump.ts
CHANGED
|
@@ -67,7 +67,11 @@ import {
|
|
|
67
67
|
|
|
68
68
|
const logger = log.logger("projen:bump");
|
|
69
69
|
const LEVELS = ["patch", "minor", "major"] as const;
|
|
70
|
+
const RELEASE_OSES = ["darwin", "linux", "win32"] as const;
|
|
71
|
+
const RELEASE_ARCHES = ["arm64", "x64"] as const;
|
|
70
72
|
type Level = (typeof LEVELS)[number];
|
|
73
|
+
type ReleaseOs = (typeof RELEASE_OSES)[number];
|
|
74
|
+
type ReleaseArch = (typeof RELEASE_ARCHES)[number];
|
|
71
75
|
|
|
72
76
|
/** A standalone in-repo project released alongside the root, on its own tag prefix. */
|
|
73
77
|
interface Sibling {
|
|
@@ -89,6 +93,10 @@ function parseSibling(value: string, previous: Sibling[]): Sibling[] {
|
|
|
89
93
|
return [...previous, { dir: value.slice(0, at), prefix: value.slice(at + 1) }];
|
|
90
94
|
}
|
|
91
95
|
|
|
96
|
+
function collectValue<T extends string>(value: T, previous: T[]): T[] {
|
|
97
|
+
return [...previous, value];
|
|
98
|
+
}
|
|
99
|
+
|
|
92
100
|
function increment(v: Semver, level: Level): Semver {
|
|
93
101
|
if (level === "major") return [v[0] + 1, 0, 0];
|
|
94
102
|
if (level === "minor") return [v[0], v[1] + 1, 0];
|
|
@@ -174,6 +182,18 @@ program
|
|
|
174
182
|
parseSibling,
|
|
175
183
|
[] as Sibling[],
|
|
176
184
|
)
|
|
185
|
+
.addOption(
|
|
186
|
+
new Option("--os <os>", "release operating system, repeatable; crossed with every --arch")
|
|
187
|
+
.choices([...RELEASE_OSES])
|
|
188
|
+
.argParser((value, previous: ReleaseOs[]) => collectValue(value as ReleaseOs, previous))
|
|
189
|
+
.default([] as ReleaseOs[]),
|
|
190
|
+
)
|
|
191
|
+
.addOption(
|
|
192
|
+
new Option("--arch <arch>", "release CPU architecture, repeatable; crossed with every --os")
|
|
193
|
+
.choices([...RELEASE_ARCHES])
|
|
194
|
+
.argParser((value, previous: ReleaseArch[]) => collectValue(value as ReleaseArch, previous))
|
|
195
|
+
.default([] as ReleaseArch[]),
|
|
196
|
+
)
|
|
177
197
|
// Declared in the `--no-` form so commander creates a boolean that defaults to
|
|
178
198
|
// `true` and is turned off by `--no-synth` / `--no-version` / ... (the
|
|
179
199
|
// positive `--synth` etc. also work and are no-ops on the default).
|
|
@@ -200,6 +220,8 @@ program
|
|
|
200
220
|
level: Level;
|
|
201
221
|
prefix: string;
|
|
202
222
|
sibling: Sibling[];
|
|
223
|
+
os: ReleaseOs[];
|
|
224
|
+
arch: ReleaseArch[];
|
|
203
225
|
synth: boolean;
|
|
204
226
|
version: boolean;
|
|
205
227
|
commit: boolean;
|
|
@@ -212,6 +234,9 @@ program
|
|
|
212
234
|
}) => {
|
|
213
235
|
const pkgPath = resolve(process.cwd(), "package.json");
|
|
214
236
|
if (!existsSync(pkgPath)) throw new Error(`no package.json in ${process.cwd()}`);
|
|
237
|
+
if ((opts.os.length === 0) !== (opts.arch.length === 0)) {
|
|
238
|
+
throw new Error("--os and --arch must be used together");
|
|
239
|
+
}
|
|
215
240
|
|
|
216
241
|
const siblings = opts.sibling.map((s) => ({ ...s, pkgPath: resolve(s.dir, "package.json") }));
|
|
217
242
|
for (const s of siblings) {
|
|
@@ -260,12 +285,19 @@ program
|
|
|
260
285
|
|
|
261
286
|
if (opts.synth) {
|
|
262
287
|
logger.info("synthesizing (projen)");
|
|
288
|
+
const releasePlatforms = opts.os
|
|
289
|
+
.flatMap((os) => opts.arch.map((arch) => `${os}:${arch}`))
|
|
290
|
+
.join(",");
|
|
263
291
|
exec.spawnSync("bun", [".projenrc.ts"], {
|
|
264
292
|
cwd: process.cwd(),
|
|
265
293
|
stdout: "inherit",
|
|
266
294
|
stderr: "inherit",
|
|
267
295
|
stdin: "ignore",
|
|
268
296
|
check: true,
|
|
297
|
+
env: {
|
|
298
|
+
...process.env,
|
|
299
|
+
...(releasePlatforms ? { DBX_TOOLS_RELEASE_PLATFORMS: releasePlatforms } : {}),
|
|
300
|
+
},
|
|
269
301
|
});
|
|
270
302
|
}
|
|
271
303
|
|