@dbx-tools/projen 0.6.211 → 0.6.212
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 +2 -2
- package/package.json +4 -4
- package/src/_release-platform.ts +55 -1
- package/src/project-js.ts +62 -1
- package/src/project-py.ts +5 -2
- package/src/project-rs.ts +923 -671
- package/src/release.ts +11 -1
- package/src/tags.ts +7 -2
- package/tasks/bump.ts +12 -29
- package/tasks/release-pr.ts +12 -29
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.6.
|
|
6
|
+
export const PACKAGE_VERSION = "0.6.212";
|
|
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";
|
|
@@ -46,7 +46,7 @@ export type { RecordedPackage } from "./src/packages.ts";
|
|
|
46
46
|
export { PnpmWorkspaceState } from "./src/pnpm-workspace.ts";
|
|
47
47
|
export type { Catalog, AllowBuilds, DBXToolsPNPMWorkspaceOptions } from "./src/pnpm-workspace.ts";
|
|
48
48
|
export type { DBXToolsProjectLanguage, DBXToolsProjectOptions, DBXToolsProject, ApplyToProjectsOptions } from "./src/project.ts";
|
|
49
|
-
export { PackageIdentifier, PROJEN_VERSION, DBXToolsNodeProject, ROOT_INSTALL_ONLY_MIXIN, DBXToolsTypeScriptProject } from "./src/project-js.ts";
|
|
49
|
+
export { PackageIdentifier, PROJEN_VERSION, DBX_TOOLS_LICENSE, DBXToolsNodeProject, ROOT_INSTALL_ONLY_MIXIN, DBXToolsTypeScriptProject } from "./src/project-js.ts";
|
|
50
50
|
export type { DBXToolsJavaScriptProject, DBXToolsJavaScriptProjectOptions, DBXToolsTypeScriptProjectOptions } from "./src/project-js.ts";
|
|
51
51
|
export { DBXToolsPythonProject, DBXToolsPythonWorkspace } from "./src/project-py.ts";
|
|
52
52
|
export type { PythonRepositoryOptions, PythonPackageOptions, PythonTrustedPublisherOptions, DBXToolsPythonProjectOptions, PythonReleaseOptions, DBXToolsPythonWorkspaceOptions } from "./src/project-py.ts";
|
package/package.json
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@clack/prompts": "^1.7.0",
|
|
28
|
-
"@dbx-tools/core": "0.6.
|
|
29
|
-
"@dbx-tools/path": "0.6.
|
|
30
|
-
"@dbx-tools/shared-core": "0.6.
|
|
28
|
+
"@dbx-tools/core": "0.6.212",
|
|
29
|
+
"@dbx-tools/path": "0.6.212",
|
|
30
|
+
"@dbx-tools/shared-core": "0.6.212",
|
|
31
31
|
"commander": "^15.0.0",
|
|
32
32
|
"concurrently": "^10.0.3",
|
|
33
33
|
"constructs": "^10.6.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"main": "index.ts",
|
|
49
49
|
"license": "Apache-2.0",
|
|
50
|
-
"version": "0.6.
|
|
50
|
+
"version": "0.6.212",
|
|
51
51
|
"types": "index.ts",
|
|
52
52
|
"type": "module",
|
|
53
53
|
"exports": {
|
package/src/_release-platform.ts
CHANGED
|
@@ -1,4 +1,58 @@
|
|
|
1
|
-
|
|
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
|
+
function collectValue<T extends string>(value: T, previous: T[]): T[] {
|
|
26
|
+
return [...previous, value];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Commander option for selecting the semantic release increment. */
|
|
30
|
+
export function releaseLevelOption(): Option {
|
|
31
|
+
return new Option("-l, --level <level>", "semver increment")
|
|
32
|
+
.choices([...RELEASE_LEVELS])
|
|
33
|
+
.default("patch");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Repeatable Commander option for release operating systems. */
|
|
37
|
+
export function releaseOperatingSystemOption(): Option {
|
|
38
|
+
return new Option("--os <os>", "release operating system, repeatable; crossed with every --arch")
|
|
39
|
+
.choices([...RELEASE_OSES])
|
|
40
|
+
.argParser((value, previous: ReleaseOs[]) => collectValue(value as ReleaseOs, previous))
|
|
41
|
+
.default([] as ReleaseOs[]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Repeatable Commander option for release CPU architectures. */
|
|
45
|
+
export function releaseArchitectureOption(): Option {
|
|
46
|
+
return new Option(
|
|
47
|
+
"--arch <arch>",
|
|
48
|
+
"release CPU architecture, repeatable; crossed with every --os",
|
|
49
|
+
)
|
|
50
|
+
.choices([...RELEASE_ARCHES])
|
|
51
|
+
.argParser((value, previous: ReleaseArch[]) => collectValue(value as ReleaseArch, previous))
|
|
52
|
+
.default([] as ReleaseArch[]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Cartesian-product release target filter shared by release commands. */
|
|
2
56
|
export function releasePlatformFilter(
|
|
3
57
|
operatingSystems: readonly string[],
|
|
4
58
|
architectures: readonly string[],
|
package/src/project-js.ts
CHANGED
|
@@ -378,6 +378,9 @@ const PRETTIER_SETTINGS: javascript.PrettierSettings = {
|
|
|
378
378
|
*/
|
|
379
379
|
export const PROJEN_VERSION = "^0.101.16";
|
|
380
380
|
|
|
381
|
+
/** SPDX license shared by generated JavaScript, Python, and Rust packages. */
|
|
382
|
+
export const DBX_TOOLS_LICENSE = "Apache-2.0";
|
|
383
|
+
|
|
381
384
|
/**
|
|
382
385
|
* The engine's opinionated `NodeProject` defaults. A caller's own options override
|
|
383
386
|
* these (they are spread AFTER this). Root-only concerns key off `options.parent`,
|
|
@@ -432,7 +435,8 @@ function defaultProjectOptions(
|
|
|
432
435
|
jest: false,
|
|
433
436
|
github: false,
|
|
434
437
|
npmignoreEnabled: false,
|
|
435
|
-
|
|
438
|
+
license: DBX_TOOLS_LICENSE,
|
|
439
|
+
licensed: true,
|
|
436
440
|
entrypoint: "",
|
|
437
441
|
depsUpgrade: false,
|
|
438
442
|
// Bins are declared explicitly via `p.package.addBin(...)`. projen's default
|
|
@@ -527,6 +531,12 @@ export interface DBXToolsJavaScriptProjectOptions
|
|
|
527
531
|
* Only a ROOT scans. Defaults to {@link DEFAULT_PACKAGE_ROOTS}.
|
|
528
532
|
*/
|
|
529
533
|
readonly packageRoots?: readonly string[];
|
|
534
|
+
/**
|
|
535
|
+
* Descriptions for published packages, keyed by repository-relative package
|
|
536
|
+
* directory. When configured, synthesis rejects every public JavaScript
|
|
537
|
+
* package whose final manifest has no non-empty description.
|
|
538
|
+
*/
|
|
539
|
+
readonly packageDescriptions?: Readonly<Record<string, string>>;
|
|
530
540
|
/**
|
|
531
541
|
* Leading path segment(s) dropped from a discovered package's relative path
|
|
532
542
|
* before its npm name is derived, so a tier folder doesn't become a name
|
|
@@ -1062,6 +1072,48 @@ function registerRootTasks(project: javascript.NodeProject): void {
|
|
|
1062
1072
|
});
|
|
1063
1073
|
}
|
|
1064
1074
|
|
|
1075
|
+
function descendantJavaScriptProjects(
|
|
1076
|
+
parent: Project,
|
|
1077
|
+
): Array<DBXToolsNodeProject | DBXToolsTypeScriptProject> {
|
|
1078
|
+
return parent.subprojects.flatMap((subproject) => [
|
|
1079
|
+
...(subproject instanceof DBXToolsNodeProject || subproject instanceof DBXToolsTypeScriptProject
|
|
1080
|
+
? [subproject]
|
|
1081
|
+
: []),
|
|
1082
|
+
...descendantJavaScriptProjects(subproject),
|
|
1083
|
+
]);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
class PublishedPackageDescriptionValidation extends Component {
|
|
1087
|
+
constructor(
|
|
1088
|
+
project: DBXToolsNodeProject | DBXToolsTypeScriptProject,
|
|
1089
|
+
private readonly configuredDescriptions: Readonly<Record<string, string>>,
|
|
1090
|
+
) {
|
|
1091
|
+
super(project);
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
public override preSynthesize(): void {
|
|
1095
|
+
const root = this.project as DBXToolsNodeProject | DBXToolsTypeScriptProject;
|
|
1096
|
+
const packages = new Map(
|
|
1097
|
+
descendantJavaScriptProjects(root).map((pkg) => [
|
|
1098
|
+
toPosix(relative(root.outdir, pkg.outdir)),
|
|
1099
|
+
pkg,
|
|
1100
|
+
]),
|
|
1101
|
+
);
|
|
1102
|
+
for (const packagePath of Object.keys(this.configuredDescriptions)) {
|
|
1103
|
+
if (!packages.has(packagePath)) {
|
|
1104
|
+
throw new Error(`Package description targets unknown package ${packagePath}`);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
for (const [packagePath, pkg] of packages) {
|
|
1108
|
+
if (pkg.package.manifest.private === true) continue;
|
|
1109
|
+
const description = pkg.package.manifest.description;
|
|
1110
|
+
if (typeof description !== "string" || !description.trim()) {
|
|
1111
|
+
throw new Error(`Published package ${packagePath} requires a non-empty description`);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1065
1117
|
/**
|
|
1066
1118
|
* `bun node_modules/@dbx-tools/projen/tasks/<script>` command for a projen task.
|
|
1067
1119
|
*
|
|
@@ -1289,6 +1341,15 @@ function initProject(
|
|
|
1289
1341
|
});
|
|
1290
1342
|
}
|
|
1291
1343
|
|
|
1344
|
+
if (options.packageDescriptions) {
|
|
1345
|
+
for (const pkg of descendantJavaScriptProjects(project)) {
|
|
1346
|
+
const packagePath = toPosix(relative(rootAbs, pkg.outdir));
|
|
1347
|
+
const description = options.packageDescriptions[packagePath];
|
|
1348
|
+
if (description !== undefined) pkg.package.addField("description", description.trim());
|
|
1349
|
+
}
|
|
1350
|
+
new PublishedPackageDescriptionValidation(project, options.packageDescriptions);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1292
1353
|
// The root project may itself carry tags (via a `""`/`"."` tag-path key).
|
|
1293
1354
|
const rootTags = [...new Set([...(tagPaths[""] ?? []), ...(tagPaths["."] ?? [])])];
|
|
1294
1355
|
if (rootTags.length) project.dbxToolsConfig.tags.push(...rootTags);
|
package/src/project-py.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** Reusable uv workspace generation for Python packages hosted in a projen tree. */
|
|
2
2
|
import { project as coreProject } from "@dbx-tools/core";
|
|
3
3
|
import { string } from "@dbx-tools/shared-core";
|
|
4
|
-
import { Component, TextFile, type Project, javascript, python, vscode } from "projen";
|
|
4
|
+
import { Component, License, TextFile, type Project, javascript, python, vscode } from "projen";
|
|
5
5
|
import type { IResolver } from "projen/lib/file";
|
|
6
6
|
import { JobPermission } from "projen/lib/github/workflows-model";
|
|
7
7
|
import { parse, stringify } from "smol-toml";
|
|
8
8
|
import { BUN_VERSION, bunCacheRestoreSteps, bunCacheSaveStep } from "./bun-workflow.ts";
|
|
9
|
-
import { projectReleaseBranch, projectRepositoryUrl } from "./project-js.ts";
|
|
9
|
+
import { DBX_TOOLS_LICENSE, projectReleaseBranch, projectRepositoryUrl } from "./project-js.ts";
|
|
10
10
|
import { isDBXToolsJavaScriptProject } from "./project-predicate.ts";
|
|
11
11
|
import type { DBXToolsProject, DBXToolsProjectOptions } from "./project.ts";
|
|
12
12
|
import { RELEASE_VERSION, releaseSourceSteps } from "./release-dispatch.ts";
|
|
@@ -169,6 +169,7 @@ export class DBXToolsPythonProject extends python.PythonProject implements DBXTo
|
|
|
169
169
|
authorEmail: "",
|
|
170
170
|
version: options.version,
|
|
171
171
|
description: pkg.description,
|
|
172
|
+
license: DBX_TOOLS_LICENSE,
|
|
172
173
|
github: false,
|
|
173
174
|
sample: false,
|
|
174
175
|
pytest: false,
|
|
@@ -187,6 +188,7 @@ export class DBXToolsPythonProject extends python.PythonProject implements DBXTo
|
|
|
187
188
|
version: options.version,
|
|
188
189
|
description: pkg.description,
|
|
189
190
|
readme: "README.md",
|
|
191
|
+
licenseFiles: ["LICENSE"],
|
|
190
192
|
requiresPython: options.requiresPython,
|
|
191
193
|
dependencies: [...(pkg.dependencies ?? [])],
|
|
192
194
|
urls: {
|
|
@@ -206,6 +208,7 @@ export class DBXToolsPythonProject extends python.PythonProject implements DBXTo
|
|
|
206
208
|
},
|
|
207
209
|
},
|
|
208
210
|
});
|
|
211
|
+
new License(this, { spdx: DBX_TOOLS_LICENSE });
|
|
209
212
|
this.packageOptions = pkg;
|
|
210
213
|
if (!(this.packagingManager instanceof python.Uv)) {
|
|
211
214
|
throw new Error(`Expected uv packaging for ${pkg.name}`);
|