@dbx-tools/projen 0.9.31 → 0.9.36
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 +71 -65
- package/index.ts +5 -8
- package/package.json +8 -7
- package/src/_task-command.ts +0 -75
- package/src/barrels.ts +15 -23
- package/src/bun-app.ts +5 -6
- package/src/clean.ts +41 -15
- package/src/codegen.ts +2 -3
- package/src/dbx-tools-config.ts +23 -64
- package/src/generated.ts +7 -1
- package/src/module-exports.ts +35 -3
- package/src/openapi.ts +34 -38
- package/src/packages.ts +3 -30
- package/src/pnpm-workspace.ts +21 -26
- package/src/project-js.ts +152 -365
- package/src/project-predicate.ts +4 -5
- package/src/project-py.ts +55 -144
- package/src/publish.ts +1 -1
- package/src/python-node-bindings.ts +140 -67
- package/src/python-node-bundle.ts +6 -42
- package/src/release-context.ts +4 -4
- package/src/release.ts +88 -86
- package/src/tags.ts +20 -18
- package/src/tsconfig.ts +9 -5
- package/src/vscode.ts +47 -58
- package/src/watch.ts +2 -8
- package/src/workspace-version.ts +1 -6
- package/tasks/barrels.ts +43 -38
- package/tasks/bump.ts +24 -20
- package/tasks/clean.ts +54 -50
- package/tasks/compile-workspace.ts +2 -117
- package/tasks/lib/compile-workspace.ts +119 -0
- package/tasks/lib/local-publish.ts +122 -0
- package/tasks/lib/publish-npm.ts +458 -0
- package/tasks/lib/publish-python.ts +195 -0
- package/tasks/lib/publish.ts +264 -0
- package/tasks/lib/python-node-bindings.ts +1262 -0
- package/tasks/{python-registry.ts → lib/python-registry.ts} +21 -30
- package/tasks/{python-release.ts → lib/python-release.ts} +1 -0
- package/tasks/lib/release-version.ts +66 -0
- package/tasks/lib/release.ts +212 -0
- package/tasks/local-publish.ts +4 -105
- package/tasks/openapi.ts +25 -21
- package/tasks/projenrc.ts +14 -12
- package/tasks/publish-npm.ts +3 -364
- package/tasks/publish-python.ts +3 -184
- package/tasks/publish.ts +3 -279
- package/tasks/python-node-bindings.ts +3 -1014
- package/tasks/release-version.ts +3 -62
- package/tasks/release.ts +3 -96
- package/tasks/sync.ts +71 -70
- package/tasks/version-check.ts +3 -10
- package/src/release-catalog.ts +0 -684
- package/tasks/databricks-cli-assets.ts +0 -129
- package/tasks/python-node-bindings-watch.ts +0 -47
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S bun
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { dirname, join, resolve } from "node:path";
|
|
4
|
-
import { parseArgs } from "node:util";
|
|
5
|
-
|
|
6
|
-
import * as projectUtils from "@dbx-tools/core/project-utils";
|
|
7
|
-
|
|
8
|
-
import { makeReadonly, makeWritable } from "../src/generated.ts";
|
|
9
|
-
|
|
10
|
-
const MINIMUM_VERSION = "0.296.0";
|
|
11
|
-
const REPOSITORY = "databricks/cli";
|
|
12
|
-
const PLATFORM_ASSETS = {
|
|
13
|
-
"darwin-arm64": "darwin_arm64",
|
|
14
|
-
"darwin-x64": "darwin_amd64",
|
|
15
|
-
"linux-arm64": "linux_arm64",
|
|
16
|
-
"linux-x64": "linux_amd64",
|
|
17
|
-
"win32-arm64": "windows_arm64",
|
|
18
|
-
"win32-x64": "windows_amd64",
|
|
19
|
-
} as const;
|
|
20
|
-
|
|
21
|
-
interface GitHubAsset {
|
|
22
|
-
readonly browser_download_url: string;
|
|
23
|
-
readonly digest?: string;
|
|
24
|
-
readonly name: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface GitHubRelease {
|
|
28
|
-
readonly assets: GitHubAsset[];
|
|
29
|
-
readonly published_at: string;
|
|
30
|
-
readonly tag_name: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface CliAsset {
|
|
34
|
-
readonly sha256: string;
|
|
35
|
-
readonly url: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface CliAssetManifest {
|
|
39
|
-
readonly schemaVersion: 1;
|
|
40
|
-
readonly dbxToolsVersion: string;
|
|
41
|
-
readonly minimumVersion: string;
|
|
42
|
-
readonly version: string;
|
|
43
|
-
readonly publishedAt: string;
|
|
44
|
-
readonly assets: Record<keyof typeof PLATFORM_ASSETS, CliAsset>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function validManifest(value: unknown, dbxToolsVersion: string): value is CliAssetManifest {
|
|
48
|
-
if (!value || typeof value !== "object") return false;
|
|
49
|
-
const manifest = value as Partial<CliAssetManifest>;
|
|
50
|
-
return (
|
|
51
|
-
manifest.schemaVersion === 1 &&
|
|
52
|
-
manifest.dbxToolsVersion === dbxToolsVersion &&
|
|
53
|
-
manifest.minimumVersion === MINIMUM_VERSION &&
|
|
54
|
-
typeof manifest.version === "string" &&
|
|
55
|
-
typeof manifest.publishedAt === "string" &&
|
|
56
|
-
Boolean(manifest.assets) &&
|
|
57
|
-
Object.keys(PLATFORM_ASSETS).every((key) => {
|
|
58
|
-
const asset = manifest.assets?.[key as keyof typeof PLATFORM_ASSETS];
|
|
59
|
-
return (
|
|
60
|
-
typeof asset?.url === "string" &&
|
|
61
|
-
typeof asset.sha256 === "string" &&
|
|
62
|
-
/^[0-9a-f]{64}$/.test(asset.sha256)
|
|
63
|
-
);
|
|
64
|
-
})
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function latestManifest(dbxToolsVersion: string): Promise<CliAssetManifest> {
|
|
69
|
-
const response = await fetch(`https://api.github.com/repos/${REPOSITORY}/releases/latest`, {
|
|
70
|
-
headers: {
|
|
71
|
-
accept: "application/vnd.github+json",
|
|
72
|
-
"user-agent": `dbx-tools/${dbxToolsVersion}`,
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
if (!response.ok) {
|
|
76
|
-
throw new Error(`Could not resolve the latest Databricks CLI release (${response.status})`);
|
|
77
|
-
}
|
|
78
|
-
const release = (await response.json()) as GitHubRelease;
|
|
79
|
-
const version = release.tag_name.replace(/^v/, "");
|
|
80
|
-
const assets = Object.fromEntries(
|
|
81
|
-
Object.entries(PLATFORM_ASSETS).map(([platform, suffix]) => {
|
|
82
|
-
const name = `databricks_cli_${version}_${suffix}.tar.gz`;
|
|
83
|
-
const asset = release.assets.find((candidate) => candidate.name === name);
|
|
84
|
-
const sha256 = asset?.digest?.match(/^sha256:([0-9a-f]{64})$/i)?.[1]?.toLowerCase();
|
|
85
|
-
if (!asset || !sha256)
|
|
86
|
-
throw new Error(`Release ${release.tag_name} has no digest for ${name}`);
|
|
87
|
-
return [platform, { url: asset.browser_download_url, sha256 }];
|
|
88
|
-
}),
|
|
89
|
-
) as CliAssetManifest["assets"];
|
|
90
|
-
return {
|
|
91
|
-
schemaVersion: 1,
|
|
92
|
-
dbxToolsVersion,
|
|
93
|
-
minimumVersion: MINIMUM_VERSION,
|
|
94
|
-
version,
|
|
95
|
-
publishedAt: release.published_at,
|
|
96
|
-
assets,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const { values } = parseArgs({
|
|
101
|
-
options: {
|
|
102
|
-
check: { type: "boolean", default: false },
|
|
103
|
-
root: { type: "string" },
|
|
104
|
-
},
|
|
105
|
-
strict: true,
|
|
106
|
-
});
|
|
107
|
-
const root = resolve(values.root ?? projectUtils.root() ?? process.cwd());
|
|
108
|
-
const output = join(root, "packages/js/node/auth/src/generated/databricks-cli-assets.json");
|
|
109
|
-
const dbxToolsVersion = readFileSync(join(root, "VERSION"), "utf8").trim();
|
|
110
|
-
let current: unknown;
|
|
111
|
-
if (existsSync(output)) {
|
|
112
|
-
try {
|
|
113
|
-
current = JSON.parse(readFileSync(output, "utf8"));
|
|
114
|
-
} catch {
|
|
115
|
-
current = undefined;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (validManifest(current, dbxToolsVersion)) {
|
|
119
|
-
console.log(`verified ${output.slice(root.length + 1)}`);
|
|
120
|
-
} else if (values.check) {
|
|
121
|
-
throw new Error("Databricks CLI asset manifest is missing or stale");
|
|
122
|
-
} else {
|
|
123
|
-
const manifest = await latestManifest(dbxToolsVersion);
|
|
124
|
-
mkdirSync(dirname(output), { recursive: true });
|
|
125
|
-
makeWritable(output);
|
|
126
|
-
writeFileSync(output, `${JSON.stringify(manifest, undefined, 2)}\n`);
|
|
127
|
-
makeReadonly(output);
|
|
128
|
-
console.log(`generated ${output.slice(root.length + 1)}`);
|
|
129
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S bun
|
|
2
|
-
import { dirname, isAbsolute, resolve, sep } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { parseArgs } from "node:util";
|
|
5
|
-
import { log } from "@dbx-tools/shared-core";
|
|
6
|
-
import { runTaskCommand } from "../src/_task-command.ts";
|
|
7
|
-
import { pythonNodeBindingProjects, repoRoot } from "../src/packages.ts";
|
|
8
|
-
import {
|
|
9
|
-
pythonNodeBindingWatchInputs,
|
|
10
|
-
resolvePythonNodeBindings,
|
|
11
|
-
type ResolvedPythonNodeBindings,
|
|
12
|
-
} from "../src/python-node-bindings.ts";
|
|
13
|
-
import { watchLoop } from "../src/watch.ts";
|
|
14
|
-
|
|
15
|
-
const logger = log.logger("projen:python-node-bindings");
|
|
16
|
-
const task = resolve(dirname(fileURLToPath(import.meta.url)), "python-node-bindings.ts");
|
|
17
|
-
const { values } = parseArgs({ options: { project: { type: "string" } } });
|
|
18
|
-
const projects = values.project ? [values.project] : pythonNodeBindingProjects(repoRoot);
|
|
19
|
-
const configs = projects.map((project) => resolvePythonNodeBindings(repoRoot, project));
|
|
20
|
-
|
|
21
|
-
if (configs.length > 0) {
|
|
22
|
-
watchLoop(
|
|
23
|
-
"python-node-bindings",
|
|
24
|
-
[...new Set(configs.flatMap(pythonNodeBindingWatchInputs))],
|
|
25
|
-
(changed) => {
|
|
26
|
-
for (const config of configs.filter((candidate) => affected(candidate, changed))) {
|
|
27
|
-
logger.start(`generating ${config.project} Node bindings`);
|
|
28
|
-
runTaskCommand(repoRoot, "bun", [task, "--project", config.project]);
|
|
29
|
-
logger.success(`generated ${config.project} Node bindings`);
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
check: (changed) => configs.some((config) => affected(config, changed)),
|
|
34
|
-
},
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function affected(config: ResolvedPythonNodeBindings, changed: readonly string[]): boolean {
|
|
39
|
-
const inputs = pythonNodeBindingWatchInputs(config);
|
|
40
|
-
return changed.some((path) => inputs.some((input) => contains(input, path)));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function contains(input: string, candidate: string): boolean {
|
|
44
|
-
const root = isAbsolute(input) ? input : resolve(repoRoot, input);
|
|
45
|
-
const path = isAbsolute(candidate) ? candidate : resolve(repoRoot, candidate);
|
|
46
|
-
return path === root || path.startsWith(root + sep);
|
|
47
|
-
}
|