fix: support Korean project paths on Windows
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@kri/create-spring-app",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@kri/create-spring-app",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"license": "UNLICENSED",
|
||||
"bin": {
|
||||
"kri-create-spring-app": "dist/cli.js"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kri/create-spring-app",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"description": "Create a KRI standard Spring Boot application",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
@@ -84,6 +84,14 @@ tasks.withType(JavaCompile).configureEach {
|
||||
options.generatedSourceOutputDirectory.set(file(querydslDir))
|
||||
}
|
||||
|
||||
tasks.withType(Test).configureEach {
|
||||
jvmArgs '-Dfile.encoding=UTF-8'
|
||||
}
|
||||
|
||||
tasks.withType(JavaExec).configureEach {
|
||||
jvmArgs '-Dfile.encoding=UTF-8'
|
||||
}
|
||||
|
||||
tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
|
||||
# Keep the Gradle daemon on the platform charset so Windows JDK 17 can read
|
||||
# worker classpath files containing non-ASCII project paths.
|
||||
org.gradle.jvmargs=-Xmx2g
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
|
||||
@@ -8,9 +8,9 @@ import { parseArguments } from "../dist/args.js";
|
||||
import { composeAgentHarness } from "../dist/harness.js";
|
||||
|
||||
async function createFixture(t) {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "kri-create-spring-harness-"));
|
||||
const harnessRoot = path.join(root, "_________AgentHarnessBase");
|
||||
const targetDir = path.join(root, "sample-server");
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "kri-create-spring-한글 공백-"));
|
||||
const harnessRoot = path.join(root, "_________Agent Harness 기준");
|
||||
const targetDir = path.join(root, "샘플 server");
|
||||
const logPath = path.join(root, "calls.jsonl");
|
||||
await mkdir(path.join(harnessRoot, "dist"), { recursive: true });
|
||||
await mkdir(targetDir, { recursive: true });
|
||||
@@ -52,7 +52,7 @@ test("registers shared, composes, and verifies in deterministic order", async (t
|
||||
.split("\n")
|
||||
.map((line) => JSON.parse(line));
|
||||
assert.deepEqual(calls, [
|
||||
["register", "--project", "sample-server", "--path", "sample-server", "--shared"],
|
||||
["register", "--project", "sample-server", "--path", "샘플 server", "--shared"],
|
||||
["compose", "--project", "sample-server"],
|
||||
["verify", "--project", "sample-server"],
|
||||
]);
|
||||
|
||||
44
tests/path-safety.test.mjs
Normal file
44
tests/path-safety.test.mjs
Normal file
@@ -0,0 +1,44 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdtemp, mkdir, readFile, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import test from "node:test";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { run } from "../dist/process.js";
|
||||
|
||||
const repositoryRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
|
||||
test("keeps Gradle worker paths compatible with Windows JDK 17", async () => {
|
||||
const gradleProperties = await readFile(
|
||||
path.join(repositoryRoot, "templates", "base", "gradle.properties"),
|
||||
"utf8",
|
||||
);
|
||||
const buildGradle = await readFile(
|
||||
path.join(repositoryRoot, "templates", "base", "build.gradle"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
assert.doesNotMatch(
|
||||
gradleProperties,
|
||||
/org\.gradle\.jvmargs=.*-Dfile\.encoding=/,
|
||||
"Gradle daemon encoding must remain platform-compatible for worker classpath files",
|
||||
);
|
||||
assert.match(buildGradle, /tasks\.withType\(JavaCompile\)[\s\S]*options\.encoding = 'UTF-8'/);
|
||||
assert.match(buildGradle, /tasks\.withType\(Test\)[\s\S]*jvmArgs '-Dfile\.encoding=UTF-8'/);
|
||||
assert.match(buildGradle, /tasks\.withType\(JavaExec\)[\s\S]*jvmArgs '-Dfile\.encoding=UTF-8'/);
|
||||
});
|
||||
|
||||
test("runs a child process from a Korean path containing spaces", async (t) => {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "kri-create-spring-한글 공백-"));
|
||||
const targetDir = path.join(root, "생성 프로젝트");
|
||||
await mkdir(targetDir, { recursive: true });
|
||||
t.after(() => rm(root, { recursive: true, force: true }));
|
||||
|
||||
const markerName = "실행 결과.txt";
|
||||
const script = `require("node:fs").writeFileSync(${JSON.stringify(markerName)}, process.cwd(), "utf8")`;
|
||||
const nodeCommand = process.platform === "win32" ? path.basename(process.execPath) : process.execPath;
|
||||
await run(nodeCommand, ["-e", script], targetDir);
|
||||
|
||||
assert.equal(await readFile(path.join(targetDir, markerName), "utf8"), targetDir);
|
||||
});
|
||||
Reference in New Issue
Block a user