@dbx-tools/projen 0.9.28 → 0.9.30
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/index.ts +1 -3
- package/package.json +4 -4
- package/src/release.ts +3 -1
- package/tasks/bump.ts +12 -21
- package/src/_release-platform.ts +0 -78
- package/src/release-github.ts +0 -109
package/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
4
|
|
|
5
5
|
export const PACKAGE_IDENTIFIER = "@dbx-tools/projen";
|
|
6
|
-
export const PACKAGE_VERSION = "0.9.
|
|
6
|
+
export const PACKAGE_VERSION = "0.9.30";
|
|
7
7
|
export * as barrels from "./src/barrels.ts";
|
|
8
8
|
export * as bunApp from "./src/bun-app.ts";
|
|
9
9
|
export * as bunWorkflow from "./src/bun-workflow.ts";
|
|
@@ -28,7 +28,6 @@ export * as pythonNodeBundle from "./src/python-node-bundle.ts";
|
|
|
28
28
|
export * as release from "./src/release.ts";
|
|
29
29
|
export * as releaseCatalog from "./src/release-catalog.ts";
|
|
30
30
|
export * as releaseContext from "./src/release-context.ts";
|
|
31
|
-
export * as releaseGithub from "./src/release-github.ts";
|
|
32
31
|
export * as scaffold from "./src/scaffold.ts";
|
|
33
32
|
export * as tags from "./src/tags.ts";
|
|
34
33
|
export * as tsconfig from "./src/tsconfig.ts";
|
|
@@ -64,7 +63,6 @@ export type { ReleaseStage, ReleaseDocsOptions, DBXToolsReleaseOptions } from ".
|
|
|
64
63
|
export { DBXToolsReleaseCatalog } from "./src/release-catalog.ts";
|
|
65
64
|
export type { ReleaseProjectLanguage, ReleaseArtifactKind, ReleaseEdgeKind, ReleasePropagation, ReleaseUnitRule, DBXToolsReleaseCatalogOptions, ReleaseDependencyInput, ReleaseProjectRegistration, ExternalReleaseProjectRegistration, ReleaseArtifactRegistration, ReleaseProjectNode, ReleaseArtifact, ReleaseDependencyEdge, ReleaseUnit, ReleaseUnitGraph } from "./src/release-catalog.ts";
|
|
66
65
|
export { RELEASE_TAG, RELEASE_SHA, RELEASE_VERSION } from "./src/release-context.ts";
|
|
67
|
-
export type { GithubRepositoryIdentity, GithubAuthenticatedAccount, GithubRepositoryPermissions } from "./src/release-github.ts";
|
|
68
66
|
export { AGNOSTIC_COMPILER_OPTIONS, PACKAGE_TAG_MIXINS } from "./src/tags.ts";
|
|
69
67
|
export type { PackageTag } from "./src/tags.ts";
|
|
70
68
|
export { DBXToolsRootTsconfig } from "./src/tsconfig.ts";
|
package/package.json
CHANGED
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@clack/prompts": "^1.7.0",
|
|
37
|
-
"@dbx-tools/core": "^0.9.
|
|
38
|
-
"@dbx-tools/path": "^0.9.
|
|
39
|
-
"@dbx-tools/shared-core": "^0.9.
|
|
37
|
+
"@dbx-tools/core": "^0.9.30",
|
|
38
|
+
"@dbx-tools/path": "^0.9.30",
|
|
39
|
+
"@dbx-tools/shared-core": "^0.9.30",
|
|
40
40
|
"commander": "^15.0.0",
|
|
41
41
|
"concurrently": "^10.0.3",
|
|
42
42
|
"constructs": "^10.6.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"main": "index.ts",
|
|
58
58
|
"license": "Apache-2.0",
|
|
59
|
-
"version": "0.9.
|
|
59
|
+
"version": "0.9.30",
|
|
60
60
|
"types": "index.ts",
|
|
61
61
|
"type": "module",
|
|
62
62
|
"exports": {
|
package/src/release.ts
CHANGED
|
@@ -133,7 +133,9 @@ function refreshDocsRegistryDependencies(workflow: GithubWorkflow): void {
|
|
|
133
133
|
const registryJobs = Object.keys(workflow.jobs).filter(
|
|
134
134
|
(name) => name === "publish-node" || name.startsWith("publish-pypi-"),
|
|
135
135
|
);
|
|
136
|
-
if (registryJobs.length > 0)
|
|
136
|
+
if (registryJobs.length > 0) {
|
|
137
|
+
workflow.updateJob("build-docs", { ...docs, needs: ["verify-context", ...registryJobs] });
|
|
138
|
+
}
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
/** Keep documentation publication behind every configured package registry. */
|
package/tasks/bump.ts
CHANGED
|
@@ -6,43 +6,34 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as projectUtils from "@dbx-tools/core/project-utils";
|
|
8
8
|
import { log } from "@dbx-tools/shared-core";
|
|
9
|
-
import { Command } from "commander";
|
|
9
|
+
import { Command, Option } from "commander";
|
|
10
|
+
import { runTaskCommand } from "../src/_task-command.ts";
|
|
10
11
|
import {
|
|
11
|
-
|
|
12
|
-
releaseLevelOption,
|
|
13
|
-
releaseOperatingSystemOption,
|
|
14
|
-
releasePlatformFilter,
|
|
15
|
-
type ReleaseArch,
|
|
16
|
-
type ReleaseOs,
|
|
12
|
+
resolveNextVersion,
|
|
17
13
|
type VersionLevel,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { resolveNextVersion, writeWorkspaceVersion } from "../src/workspace-version.ts";
|
|
14
|
+
writeWorkspaceVersion,
|
|
15
|
+
} from "../src/workspace-version.ts";
|
|
21
16
|
|
|
22
17
|
const logger = log.logger("projen:bump");
|
|
23
18
|
|
|
24
19
|
const program = new Command();
|
|
25
20
|
program
|
|
26
21
|
.description("Increment VERSION and synchronize generated workspace versions")
|
|
27
|
-
.addOption(
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
.addOption(
|
|
23
|
+
new Option("-l, --level <level>", "semver increment")
|
|
24
|
+
.choices(["patch", "minor", "major"])
|
|
25
|
+
.default("patch"),
|
|
26
|
+
)
|
|
30
27
|
.option("--no-synth", "write VERSION without synchronizing generated files")
|
|
31
|
-
.action((opts: { level: VersionLevel;
|
|
28
|
+
.action((opts: { level: VersionLevel; synth: boolean }) => {
|
|
32
29
|
const root = projectUtils.root() ?? process.cwd();
|
|
33
30
|
const next = resolveNextVersion(root, opts.level);
|
|
34
|
-
const releasePlatforms = releasePlatformFilter(opts.os, opts.arch);
|
|
35
31
|
|
|
36
32
|
logger.info(`bump ${next.base} -> ${next.version} (${opts.level})`);
|
|
37
33
|
writeWorkspaceVersion(root, next.version);
|
|
38
34
|
|
|
39
35
|
if (opts.synth) {
|
|
40
|
-
runTaskCommand(root, process.execPath, [".projenrc.ts"]
|
|
41
|
-
env: {
|
|
42
|
-
...process.env,
|
|
43
|
-
...(releasePlatforms ? { DBX_TOOLS_RELEASE_PLATFORMS: releasePlatforms } : {}),
|
|
44
|
-
},
|
|
45
|
-
});
|
|
36
|
+
runTaskCommand(root, process.execPath, [".projenrc.ts"]);
|
|
46
37
|
}
|
|
47
38
|
logger.success(`workspace version synchronized at ${next.version}`);
|
|
48
39
|
});
|
package/src/_release-platform.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Option } from "commander";
|
|
2
|
-
import type { VersionLevel } from "./workspace-version.ts";
|
|
3
|
-
|
|
4
|
-
/** Supported semantic version increments for release commands. */
|
|
5
|
-
export const RELEASE_LEVELS = [
|
|
6
|
-
"patch",
|
|
7
|
-
"minor",
|
|
8
|
-
"major",
|
|
9
|
-
] as const satisfies readonly VersionLevel[];
|
|
10
|
-
|
|
11
|
-
/** Supported release operating systems. */
|
|
12
|
-
export const RELEASE_OSES = ["darwin", "linux", "win32"] as const;
|
|
13
|
-
|
|
14
|
-
/** Supported release CPU architectures. */
|
|
15
|
-
export const RELEASE_ARCHES = ["arm64", "x64"] as const;
|
|
16
|
-
|
|
17
|
-
/** Release operating system selector. */
|
|
18
|
-
export type ReleaseOs = (typeof RELEASE_OSES)[number];
|
|
19
|
-
|
|
20
|
-
/** Release CPU architecture selector. */
|
|
21
|
-
export type ReleaseArch = (typeof RELEASE_ARCHES)[number];
|
|
22
|
-
|
|
23
|
-
export type { VersionLevel } from "./workspace-version.ts";
|
|
24
|
-
|
|
25
|
-
/** Stable archive name for one native release binary. */
|
|
26
|
-
export function releaseBinaryAssetName(
|
|
27
|
-
binaryName: string,
|
|
28
|
-
nodeTarget: string,
|
|
29
|
-
operatingSystem: ReleaseOs,
|
|
30
|
-
): string {
|
|
31
|
-
const extension = operatingSystem === "win32" ? "zip" : "tar.gz";
|
|
32
|
-
return `${binaryName}-${nodeTarget}.${extension}`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function collectValue<T extends string>(value: T, previous: T[]): T[] {
|
|
36
|
-
return [...previous, value];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Commander option for selecting the semantic release increment. */
|
|
40
|
-
export function releaseLevelOption(): Option {
|
|
41
|
-
return new Option("-l, --level <level>", "semver increment")
|
|
42
|
-
.choices([...RELEASE_LEVELS])
|
|
43
|
-
.default("patch");
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Repeatable Commander option for release operating systems. */
|
|
47
|
-
export function releaseOperatingSystemOption(): Option {
|
|
48
|
-
return new Option("--os <os>", "release operating system, repeatable; crossed with every --arch")
|
|
49
|
-
.choices([...RELEASE_OSES])
|
|
50
|
-
.argParser((value, previous: ReleaseOs[]) => collectValue(value as ReleaseOs, previous))
|
|
51
|
-
.default([] as ReleaseOs[]);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** Repeatable Commander option for release CPU architectures. */
|
|
55
|
-
export function releaseArchitectureOption(): Option {
|
|
56
|
-
return new Option(
|
|
57
|
-
"--arch <arch>",
|
|
58
|
-
"release CPU architecture, repeatable; crossed with every --os",
|
|
59
|
-
)
|
|
60
|
-
.choices([...RELEASE_ARCHES])
|
|
61
|
-
.argParser((value, previous: ReleaseArch[]) => collectValue(value as ReleaseArch, previous))
|
|
62
|
-
.default([] as ReleaseArch[]);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** Cartesian-product release target filter shared by release commands. */
|
|
66
|
-
export function releasePlatformFilter(
|
|
67
|
-
operatingSystems: readonly string[],
|
|
68
|
-
architectures: readonly string[],
|
|
69
|
-
): string {
|
|
70
|
-
if ((operatingSystems.length === 0) !== (architectures.length === 0)) {
|
|
71
|
-
throw new Error("--os and --arch must be used together");
|
|
72
|
-
}
|
|
73
|
-
return operatingSystems
|
|
74
|
-
.flatMap((operatingSystem) =>
|
|
75
|
-
architectures.map((architecture) => `${operatingSystem}:${architecture}`),
|
|
76
|
-
)
|
|
77
|
-
.join(",");
|
|
78
|
-
}
|
package/src/release-github.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { json, object } from "@dbx-tools/shared-core";
|
|
2
|
-
|
|
3
|
-
/** GitHub repository identity used by release preparation. */
|
|
4
|
-
export interface GithubRepositoryIdentity {
|
|
5
|
-
hostname: string;
|
|
6
|
-
owner: string;
|
|
7
|
-
repository: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/** Parse a GitHub repository URL without treating its owner as the authenticated actor. */
|
|
11
|
-
export function githubRepositoryIdentity(repositoryUrl: string): GithubRepositoryIdentity {
|
|
12
|
-
const url = new URL(repositoryUrl);
|
|
13
|
-
const [owner, name] = url.pathname.split("/").filter(Boolean);
|
|
14
|
-
if (!owner || !name) {
|
|
15
|
-
throw new Error(`Cannot determine GitHub repository identity from ${repositoryUrl}`);
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
hostname: url.hostname,
|
|
19
|
-
owner,
|
|
20
|
-
repository: name.replace(/\.git$/, ""),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** One authenticated GitHub CLI account available on a repository host. */
|
|
25
|
-
export interface GithubAuthenticatedAccount {
|
|
26
|
-
login: string;
|
|
27
|
-
active: boolean;
|
|
28
|
-
scopes: string[];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Repository capabilities returned for one authenticated actor. */
|
|
32
|
-
export interface GithubRepositoryPermissions {
|
|
33
|
-
readonly push: boolean;
|
|
34
|
-
readonly maintain: boolean;
|
|
35
|
-
readonly admin: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** Read normalized repository permissions from a GitHub repository response. */
|
|
39
|
-
export function githubRepositoryPermissions(value: unknown): GithubRepositoryPermissions {
|
|
40
|
-
const repository = object.isRecord(value) ? value : undefined;
|
|
41
|
-
const permissions = object.isRecord(repository?.permissions) ? repository.permissions : undefined;
|
|
42
|
-
return {
|
|
43
|
-
push: permissions?.push === true,
|
|
44
|
-
maintain: permissions?.maintain === true,
|
|
45
|
-
admin: permissions?.admin === true,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Whether the actor can manage releases rather than only push source. */
|
|
50
|
-
export function githubRepositoryCanManage(permissions: GithubRepositoryPermissions): boolean {
|
|
51
|
-
return permissions.maintain || permissions.admin;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** Parse successful GitHub CLI accounts with the active account first. */
|
|
55
|
-
export function githubAuthenticatedAccounts(
|
|
56
|
-
statusOutput: string,
|
|
57
|
-
hostname: string,
|
|
58
|
-
): GithubAuthenticatedAccount[] {
|
|
59
|
-
const status = json.parseRecord(statusOutput);
|
|
60
|
-
const hosts = object.isRecord(status?.hosts) ? status.hosts : undefined;
|
|
61
|
-
const entries = hosts?.[hostname];
|
|
62
|
-
if (!Array.isArray(entries)) return [];
|
|
63
|
-
return entries
|
|
64
|
-
.flatMap((entry) => {
|
|
65
|
-
if (!object.isRecord(entry) || entry.state !== "success" || typeof entry.login !== "string") {
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
const scopes =
|
|
69
|
-
typeof entry.scopes === "string"
|
|
70
|
-
? entry.scopes
|
|
71
|
-
.split(",")
|
|
72
|
-
.map((scope) => scope.trim())
|
|
73
|
-
.filter(Boolean)
|
|
74
|
-
: [];
|
|
75
|
-
return [{ login: entry.login, active: entry.active === true, scopes }];
|
|
76
|
-
})
|
|
77
|
-
.filter(
|
|
78
|
-
(account, index, accounts) =>
|
|
79
|
-
accounts.findIndex((candidate) => candidate.login === account.login) === index,
|
|
80
|
-
)
|
|
81
|
-
.sort((left, right) => Number(right.active) - Number(left.active));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/** Whether an account can update workflow files when using a classic OAuth token. */
|
|
85
|
-
export function githubAccountSupportsWorkflowChanges(account: GithubAuthenticatedAccount): boolean {
|
|
86
|
-
return !account.scopes.includes("repo") || account.scopes.includes("workflow");
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** Ask GitHub CLI for one account token on the repository host. */
|
|
90
|
-
export function githubTokenArguments(hostname: string, user?: string): string[] {
|
|
91
|
-
return ["auth", "token", "--hostname", hostname, ...(user ? ["--user", user] : [])];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** GitHub CLI token variable for a public, data-residency, or enterprise host. */
|
|
95
|
-
export function githubTokenEnvironmentName(hostname: string): "GH_TOKEN" | "GH_ENTERPRISE_TOKEN" {
|
|
96
|
-
return hostname === "github.com" || hostname.endsWith(".ghe.com")
|
|
97
|
-
? "GH_TOKEN"
|
|
98
|
-
: "GH_ENTERPRISE_TOKEN";
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/** Host-qualified repository selector consumed by GitHub CLI. */
|
|
102
|
-
export function githubRepositorySpecifier(identity: GithubRepositoryIdentity): string {
|
|
103
|
-
return `${identity.hostname}/${identity.owner}/${identity.repository}`;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** GitHub REST path for the detected repository. */
|
|
107
|
-
export function githubRepositoryApiPath(identity: GithubRepositoryIdentity): string {
|
|
108
|
-
return `repos/${identity.owner}/${identity.repository}`;
|
|
109
|
-
}
|