@konvert7/klint 0.21.0 → 0.22.0
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konvert7/klint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Architecture-as-Code linter for TypeScript. Enforce layer boundaries, import rules, and singleton patterns in YAML.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"zod": "^4.4.3"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@konvert7/klint-darwin-arm64": "0.
|
|
68
|
-
"@konvert7/klint-darwin-x64": "0.
|
|
69
|
-
"@konvert7/klint-linux-x64": "0.
|
|
70
|
-
"@konvert7/klint-win32-x64": "0.
|
|
67
|
+
"@konvert7/klint-darwin-arm64": "0.22.0",
|
|
68
|
+
"@konvert7/klint-darwin-x64": "0.22.0",
|
|
69
|
+
"@konvert7/klint-linux-x64": "0.22.0",
|
|
70
|
+
"@konvert7/klint-win32-x64": "0.22.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@biomejs/biome": "2.4.7",
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
interface Options {
|
|
6
|
+
name: string;
|
|
7
|
+
root: string;
|
|
8
|
+
version: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const repoRoot = fileURLToPath(new URL("..", import.meta.url));
|
|
12
|
+
const options = parseArgs();
|
|
13
|
+
const pythonRoot = join(options.root, "python");
|
|
14
|
+
const pyprojectPath = join(pythonRoot, "pyproject.toml");
|
|
15
|
+
const initPath = join(pythonRoot, "klint", "__init__.py");
|
|
16
|
+
|
|
17
|
+
const pyproject = readFileSync(pyprojectPath, "utf-8");
|
|
18
|
+
const nextPyproject = replaceRequired(
|
|
19
|
+
replaceRequired(pyproject, /^name = ".+"$/m, `name = "${options.name}"`, pyprojectPath),
|
|
20
|
+
/^version = ".+"$/m,
|
|
21
|
+
`version = "${options.version}"`,
|
|
22
|
+
pyprojectPath
|
|
23
|
+
);
|
|
24
|
+
writeFileSync(pyprojectPath, nextPyproject);
|
|
25
|
+
|
|
26
|
+
const init = readFileSync(initPath, "utf-8");
|
|
27
|
+
const nextInit = replaceRequired(
|
|
28
|
+
init,
|
|
29
|
+
/^__version__ = ".+"$/m,
|
|
30
|
+
`__version__ = "${options.version}"`,
|
|
31
|
+
initPath
|
|
32
|
+
);
|
|
33
|
+
writeFileSync(initPath, nextInit);
|
|
34
|
+
|
|
35
|
+
process.stdout.write(
|
|
36
|
+
`prepared Python release metadata: ${options.name}@${options.version}\n`
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
function parseArgs(): Options {
|
|
40
|
+
const args = process.argv.slice(2);
|
|
41
|
+
const name = valueAfter(args, "--name");
|
|
42
|
+
const version = valueAfter(args, "--version");
|
|
43
|
+
if (!name || !version) {
|
|
44
|
+
fail(
|
|
45
|
+
"Usage: bun tools/prepare-python-release.ts --name <package-name> --version <version> [--root <repo-root>]"
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
name,
|
|
51
|
+
version,
|
|
52
|
+
root: resolve(valueAfter(args, "--root") ?? repoRoot),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function replaceRequired(
|
|
57
|
+
input: string,
|
|
58
|
+
pattern: RegExp,
|
|
59
|
+
replacement: string,
|
|
60
|
+
path: string
|
|
61
|
+
): string {
|
|
62
|
+
if (!pattern.test(input)) {
|
|
63
|
+
fail(`Expected release metadata pattern ${pattern} in ${path}`);
|
|
64
|
+
}
|
|
65
|
+
return input.replace(pattern, replacement);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function valueAfter(args: string[], name: string): string | undefined {
|
|
69
|
+
const index = args.indexOf(name);
|
|
70
|
+
return index >= 0 ? args[index + 1] : undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function fail(message: string): never {
|
|
74
|
+
process.stderr.write(`${message}\n`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|