@dbx-tools/projen 0.9.19 → 0.9.28
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/README.md +83 -229
- package/index.ts +11 -18
- package/package.json +9 -5
- package/src/_task-command.ts +75 -0
- package/src/barrels.ts +1 -74
- package/src/module-exports.ts +175 -1
- package/src/openapi.ts +5 -72
- package/src/packages.ts +45 -0
- package/src/project-js.ts +5 -48
- package/src/project-predicate.ts +1 -2
- package/src/project-py.ts +87 -199
- package/src/project.ts +2 -2
- package/src/python-node-bindings.ts +138 -0
- package/src/python-node-bundle.ts +92 -0
- package/src/release-catalog.ts +40 -208
- package/src/{release-dispatch.ts → release-context.ts} +0 -11
- package/src/release.ts +74 -778
- package/src/scaffold.ts +2 -6
- package/src/workspace-version.ts +9 -121
- package/tasks/bump.ts +17 -34
- package/tasks/databricks-cli-assets.ts +129 -0
- package/tasks/local-publish.ts +61 -138
- package/tasks/publish-npm.ts +71 -30
- package/tasks/publish-python.ts +61 -148
- package/tasks/publish.ts +32 -182
- package/tasks/python-node-bindings-watch.ts +47 -0
- package/tasks/python-node-bindings.ts +1017 -0
- package/tasks/python-registry.ts +2 -9
- package/tasks/python-release.ts +74 -0
- package/tasks/release-version.ts +23 -2
- package/tasks/release.ts +99 -0
- package/tasks/sync.ts +13 -18
- package/tasks/version-check.ts +13 -72
- package/src/_rust-project.ts +0 -429
- package/src/_rust-release-workflow.ts +0 -698
- package/src/project-rs.ts +0 -1127
- package/src/release-plan.ts +0 -269
- package/src/release-please.ts +0 -242
- package/src/uniffi.ts +0 -65
- package/tasks/publish-uniffi-local.ts +0 -314
- package/tasks/release-assets.ts +0 -476
- package/tasks/release-bootstrap.ts +0 -59
- package/tasks/release-candidate.ts +0 -383
- package/tasks/release-manifest.ts +0 -273
- package/tasks/release-plan.ts +0 -89
- package/tasks/release-please.ts +0 -162
- package/tasks/release-pr.ts +0 -563
- package/tasks/release-request.ts +0 -166
- package/tasks/release-summary-units.ts +0 -75
- package/tasks/release-summary.ts +0 -381
- package/tasks/rust.ts +0 -178
- package/tasks/stamp-python.ts +0 -13
- package/tasks/uniffi-python.d.ts +0 -61
- package/tasks/uniffi-python.js +0 -191
- package/tasks/uniffi-release.mjs +0 -573
- package/tasks/uniffi.ts +0 -271
package/tasks/release-plan.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S bun
|
|
2
|
-
/** Build the affected release plan for the reviewed manifest change. */
|
|
3
|
-
|
|
4
|
-
import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { dirname, resolve } from "node:path";
|
|
6
|
-
import * as exec from "@dbx-tools/core/exec";
|
|
7
|
-
import { json, log } from "@dbx-tools/shared-core";
|
|
8
|
-
import { Command } from "commander";
|
|
9
|
-
import type { ReleaseUnitGraph } from "../src/release-catalog.ts";
|
|
10
|
-
import { buildRecoveryReleasePlan, buildReleasePlan } from "../src/release-plan.ts";
|
|
11
|
-
|
|
12
|
-
const logger = log.logger("projen:release-plan");
|
|
13
|
-
|
|
14
|
-
function graphAtRef(root: string, ref: string): ReleaseUnitGraph | undefined {
|
|
15
|
-
const result = exec.spawnSync("git", ["show", `${ref}:.projen/release-units.json`], {
|
|
16
|
-
cwd: root,
|
|
17
|
-
stdout: "capture",
|
|
18
|
-
stderr: "ignore",
|
|
19
|
-
stdin: "ignore",
|
|
20
|
-
check: false,
|
|
21
|
-
});
|
|
22
|
-
if (result.exitCode !== 0 || !result.stdout) return undefined;
|
|
23
|
-
return json.parse(result.stdout) as ReleaseUnitGraph;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function writeOutput(name: string, value: unknown): void {
|
|
27
|
-
const output = process.env.GITHUB_OUTPUT;
|
|
28
|
-
if (output) {
|
|
29
|
-
const rendered = typeof value === "string" ? value : JSON.stringify(value);
|
|
30
|
-
appendFileSync(output, `${name}=${rendered}\n`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
new Command()
|
|
35
|
-
.option("--root <path>", "repository root", ".")
|
|
36
|
-
.option("--base-ref <ref>", "previous release graph ref", "HEAD^")
|
|
37
|
-
.option("--component <component>", "component to recover")
|
|
38
|
-
.option("--version <version>", "component version to recover")
|
|
39
|
-
.option("--docs", "include documentation without a package release")
|
|
40
|
-
.option("--output <path>", "release plan output", "dist/release-plan.json")
|
|
41
|
-
.action(
|
|
42
|
-
(options: {
|
|
43
|
-
root: string;
|
|
44
|
-
baseRef: string;
|
|
45
|
-
output: string;
|
|
46
|
-
component?: string;
|
|
47
|
-
version?: string;
|
|
48
|
-
docs?: boolean;
|
|
49
|
-
}) => {
|
|
50
|
-
const root = resolve(options.root);
|
|
51
|
-
const current = json.parse(
|
|
52
|
-
readFileSync(resolve(root, ".projen/release-units.json"), "utf8"),
|
|
53
|
-
) as ReleaseUnitGraph;
|
|
54
|
-
if (Boolean(options.component) !== Boolean(options.version)) {
|
|
55
|
-
throw new Error("Recovery requires both --component and --version");
|
|
56
|
-
}
|
|
57
|
-
const planned =
|
|
58
|
-
options.component && options.version
|
|
59
|
-
? buildRecoveryReleasePlan(current, options.component, options.version)
|
|
60
|
-
: buildReleasePlan(current, graphAtRef(root, options.baseRef));
|
|
61
|
-
const plan = options.docs
|
|
62
|
-
? {
|
|
63
|
-
...planned,
|
|
64
|
-
stages: { ...planned.stages, docs: true },
|
|
65
|
-
omittedStages: planned.omittedStages.filter((stage) => stage !== "docs"),
|
|
66
|
-
}
|
|
67
|
-
: planned;
|
|
68
|
-
const output = resolve(root, options.output);
|
|
69
|
-
mkdirSync(dirname(output), { recursive: true });
|
|
70
|
-
writeFileSync(output, `${JSON.stringify(plan, null, 2)}\n`);
|
|
71
|
-
writeOutput("plan", plan);
|
|
72
|
-
writeOutput("release_sha", process.env.GITHUB_SHA ?? "");
|
|
73
|
-
writeOutput("units", plan.units);
|
|
74
|
-
writeOutput("node_packages", plan.nodePackages);
|
|
75
|
-
writeOutput("python_packages", plan.pythonPackages);
|
|
76
|
-
writeOutput("rust_packages", plan.rustPackages);
|
|
77
|
-
writeOutput("artifacts", plan.artifacts);
|
|
78
|
-
writeOutput("rust_targets", plan.rustTargets);
|
|
79
|
-
writeOutput("stages", plan.stages);
|
|
80
|
-
for (const [stage, enabled] of Object.entries(plan.stages)) {
|
|
81
|
-
writeOutput(stage, enabled);
|
|
82
|
-
}
|
|
83
|
-
logger.success("release plan generated", {
|
|
84
|
-
units: plan.units.length,
|
|
85
|
-
omittedStages: plan.omittedStages,
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
)
|
|
89
|
-
.parse();
|
package/tasks/release-please.ts
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S bun
|
|
2
|
-
/** Run Release Please with the generated cross-language release-unit plugin. */
|
|
3
|
-
|
|
4
|
-
import { appendFileSync, readFileSync } from "node:fs";
|
|
5
|
-
import { resolve } from "node:path";
|
|
6
|
-
import * as exec from "@dbx-tools/core/exec";
|
|
7
|
-
import { log } from "@dbx-tools/shared-core";
|
|
8
|
-
import { Command } from "commander";
|
|
9
|
-
import { GitHub } from "release-please";
|
|
10
|
-
import { Manifest } from "release-please/build/src/manifest.js";
|
|
11
|
-
import type { Scm } from "release-please/build/src/scm.js";
|
|
12
|
-
import type { ReleaseUnitGraph } from "../src/release-catalog.ts";
|
|
13
|
-
import { addReleaseUnitPlugin } from "../src/release-please.ts";
|
|
14
|
-
|
|
15
|
-
const logger = log.logger("projen:release-please");
|
|
16
|
-
|
|
17
|
-
export interface ReleasePleaseRunOptions {
|
|
18
|
-
readonly github: Scm;
|
|
19
|
-
readonly targetBranch: string;
|
|
20
|
-
readonly graph: ReleaseUnitGraph;
|
|
21
|
-
readonly configFile?: string;
|
|
22
|
-
readonly manifestFile?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Create component releases and refresh the combined release pull request. */
|
|
26
|
-
export async function runReleasePlease(options: ReleasePleaseRunOptions) {
|
|
27
|
-
const configFile = options.configFile ?? "release-please-config.json";
|
|
28
|
-
const manifestFile = options.manifestFile ?? ".release-please-manifest.json";
|
|
29
|
-
const manifest = await Manifest.fromManifest(
|
|
30
|
-
options.github,
|
|
31
|
-
options.targetBranch,
|
|
32
|
-
configFile,
|
|
33
|
-
manifestFile,
|
|
34
|
-
);
|
|
35
|
-
addReleaseUnitPlugin(
|
|
36
|
-
manifest.plugins,
|
|
37
|
-
options.github,
|
|
38
|
-
options.targetBranch,
|
|
39
|
-
manifest.repositoryConfig,
|
|
40
|
-
options.graph,
|
|
41
|
-
manifestFile,
|
|
42
|
-
);
|
|
43
|
-
const releases = (await manifest.createReleases()).filter(
|
|
44
|
-
(release): release is NonNullable<typeof release> => release !== undefined,
|
|
45
|
-
);
|
|
46
|
-
const pullRequests = (await manifest.createPullRequests()).filter(
|
|
47
|
-
(pullRequest): pullRequest is NonNullable<typeof pullRequest> => pullRequest !== undefined,
|
|
48
|
-
);
|
|
49
|
-
return { releases, pullRequests };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function writeOutput(name: string, value: unknown): void {
|
|
53
|
-
const output = process.env.GITHUB_OUTPUT;
|
|
54
|
-
if (!output) return;
|
|
55
|
-
appendFileSync(output, `${name}=${JSON.stringify(value)}\n`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Parse GitHub owner and repository from HTTPS, SSH, or SSH-alias syntax. */
|
|
59
|
-
export function parseGitHubRepository(remote: string): { owner: string; repo: string } {
|
|
60
|
-
const location = remote
|
|
61
|
-
.replace(/^git@[^:]+:/, "")
|
|
62
|
-
.replace(/^ssh:\/\/git@[^/]+\//, "")
|
|
63
|
-
.replace(/^https?:\/\/[^/]+\//, "")
|
|
64
|
-
.replace(/\.git$/, "");
|
|
65
|
-
const [owner, repo, ...extra] = location.split("/");
|
|
66
|
-
if (!owner || !repo || extra.length > 0) {
|
|
67
|
-
throw new Error(`Could not resolve GitHub repository from ${remote}`);
|
|
68
|
-
}
|
|
69
|
-
return { owner, repo };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Resolve GitHub owner and repository from environment or the configured remote. */
|
|
73
|
-
export function repositoryCoordinates(root: string): { owner: string; repo: string } {
|
|
74
|
-
const configured = process.env.GITHUB_REPOSITORY;
|
|
75
|
-
const remote = configured
|
|
76
|
-
? configured
|
|
77
|
-
: (exec
|
|
78
|
-
.spawnSync("git", ["remote", "get-url", "origin"], {
|
|
79
|
-
cwd: root,
|
|
80
|
-
stdout: "capture",
|
|
81
|
-
stderr: "ignore",
|
|
82
|
-
stdin: "ignore",
|
|
83
|
-
check: true,
|
|
84
|
-
})
|
|
85
|
-
.stdout?.trim() ?? "");
|
|
86
|
-
return parseGitHubRepository(remote);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function githubToken(): string {
|
|
90
|
-
if (process.env.GITHUB_TOKEN) return process.env.GITHUB_TOKEN;
|
|
91
|
-
return (
|
|
92
|
-
exec
|
|
93
|
-
.spawnSync("gh", ["auth", "token"], {
|
|
94
|
-
stdout: "capture",
|
|
95
|
-
stderr: "inherit",
|
|
96
|
-
stdin: "ignore",
|
|
97
|
-
check: true,
|
|
98
|
-
})
|
|
99
|
-
.stdout?.trim() ?? ""
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (import.meta.main) {
|
|
104
|
-
await new Command()
|
|
105
|
-
.option("--owner <owner>", "GitHub repository owner")
|
|
106
|
-
.option("--repo <repo>", "GitHub repository name")
|
|
107
|
-
.option("--target-branch <branch>", "release target branch", "main")
|
|
108
|
-
.option("--root <path>", "repository root", ".")
|
|
109
|
-
.option("--config-file <path>", "Release Please config", "release-please-config.json")
|
|
110
|
-
.option(
|
|
111
|
-
"--manifest-file <path>",
|
|
112
|
-
"Release Please version manifest",
|
|
113
|
-
".release-please-manifest.json",
|
|
114
|
-
)
|
|
115
|
-
.action(
|
|
116
|
-
async (options: {
|
|
117
|
-
owner?: string;
|
|
118
|
-
repo?: string;
|
|
119
|
-
targetBranch: string;
|
|
120
|
-
root: string;
|
|
121
|
-
configFile: string;
|
|
122
|
-
manifestFile: string;
|
|
123
|
-
}) => {
|
|
124
|
-
const root = resolve(options.root);
|
|
125
|
-
const repository =
|
|
126
|
-
options.owner && options.repo
|
|
127
|
-
? { owner: options.owner, repo: options.repo }
|
|
128
|
-
: repositoryCoordinates(root);
|
|
129
|
-
const graph = JSON.parse(
|
|
130
|
-
readFileSync(resolve(root, ".projen/release-units.json"), "utf8"),
|
|
131
|
-
) as ReleaseUnitGraph;
|
|
132
|
-
const github = await GitHub.create({
|
|
133
|
-
owner: repository.owner,
|
|
134
|
-
repo: repository.repo,
|
|
135
|
-
defaultBranch: options.targetBranch,
|
|
136
|
-
token: githubToken(),
|
|
137
|
-
...(process.env.GITHUB_API_URL ? { apiUrl: process.env.GITHUB_API_URL } : {}),
|
|
138
|
-
...(process.env.GITHUB_GRAPHQL_URL
|
|
139
|
-
? {
|
|
140
|
-
graphqlUrl: process.env.GITHUB_GRAPHQL_URL.replace(/\/graphql\/?$/, ""),
|
|
141
|
-
}
|
|
142
|
-
: {}),
|
|
143
|
-
});
|
|
144
|
-
const result = await runReleasePlease({
|
|
145
|
-
github,
|
|
146
|
-
targetBranch: options.targetBranch,
|
|
147
|
-
graph,
|
|
148
|
-
configFile: options.configFile,
|
|
149
|
-
manifestFile: options.manifestFile,
|
|
150
|
-
});
|
|
151
|
-
logger.success("release state refreshed", {
|
|
152
|
-
releases: result.releases.length,
|
|
153
|
-
pullRequests: result.pullRequests.length,
|
|
154
|
-
});
|
|
155
|
-
writeOutput("releases_created", result.releases.length > 0);
|
|
156
|
-
writeOutput("prs_created", result.pullRequests.length > 0);
|
|
157
|
-
writeOutput("releases", result.releases);
|
|
158
|
-
writeOutput("prs", result.pullRequests);
|
|
159
|
-
},
|
|
160
|
-
)
|
|
161
|
-
.parseAsync();
|
|
162
|
-
}
|