@cosmicdrift/kumiko-feature-ast 0.390.1 → 0.391.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": "@cosmicdrift/kumiko-feature-ast",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.391.0",
|
|
4
4
|
"description": "Feature-file AST for Kumiko: parse, patch and render feature definitions, the pattern library, and the codemods kumiko-upgrade runs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
26
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
25
|
+
"@cosmicdrift/kumiko-framework": "0.391.0",
|
|
26
|
+
"@cosmicdrift/kumiko-types": "0.391.0",
|
|
27
27
|
"ts-morph": "^28.0.0",
|
|
28
28
|
"zod": "^4.6.7"
|
|
29
29
|
},
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.391.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Codemods no longer fail when git is not installed",
|
|
6
|
+
"detail": "collectSourceFiles asks git check-ignore which files the repository's .gitignore excludes. Without a git executable Bun.spawnSync threw ENOENT and kumiko-upgrade --apply aborted at the first codemod, for example ctx-namespaces in the customer-app builder image. A missing git is now treated like a directory outside a repository: no file is filtered."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.390.1",
|
|
4
10
|
"type": "fix",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { lstatSync, readdirSync, statSync } from "node:fs";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { errorCodeOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
3
4
|
|
|
4
5
|
export const BUILD_AND_VENDOR_DIR_NAMES: readonly string[] = [
|
|
5
6
|
"node_modules",
|
|
@@ -68,15 +69,26 @@ export function envWithoutGitRepositoryOverrides(): Record<string, string> {
|
|
|
68
69
|
// a codemod must not rewrite them.
|
|
69
70
|
function withoutGitIgnored(cwd: string, files: readonly string[]): readonly string[] {
|
|
70
71
|
if (files.length === 0) return files;
|
|
71
|
-
const result =
|
|
72
|
-
|
|
73
|
-
cwd,
|
|
74
|
-
env: envWithoutGitRepositoryOverrides(),
|
|
75
|
-
stdin: Buffer.from(`${files.join("\0")}\0`),
|
|
76
|
-
stdout: "pipe",
|
|
77
|
-
stderr: "pipe",
|
|
78
|
-
});
|
|
79
|
-
if (result.exitCode !== GIT_CHECK_IGNORE_SOME_IGNORED) return files;
|
|
72
|
+
const result = runGitCheckIgnore(cwd, files);
|
|
73
|
+
if (result === undefined || result.exitCode !== GIT_CHECK_IGNORE_SOME_IGNORED) return files;
|
|
80
74
|
const ignored = new Set(result.stdout.toString().split("\0"));
|
|
81
75
|
return files.filter((file) => !ignored.has(file));
|
|
82
76
|
}
|
|
77
|
+
|
|
78
|
+
function runGitCheckIgnore(cwd: string, files: readonly string[]) {
|
|
79
|
+
try {
|
|
80
|
+
return Bun.spawnSync({
|
|
81
|
+
cmd: ["git", "check-ignore", "--stdin", "-z"],
|
|
82
|
+
cwd,
|
|
83
|
+
env: envWithoutGitRepositoryOverrides(),
|
|
84
|
+
stdin: Buffer.from(`${files.join("\0")}\0`),
|
|
85
|
+
stdout: "pipe",
|
|
86
|
+
stderr: "pipe",
|
|
87
|
+
});
|
|
88
|
+
} catch (error) {
|
|
89
|
+
// Build images such as the customer-app builder ship without git; like outside a repository,
|
|
90
|
+
// there is no .gitignore to honour then.
|
|
91
|
+
if (errorCodeOf(error) === "ENOENT") return undefined;
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|