Skip to content

Commit 7c05a57

Browse files
committed
fix: Correctly calculate relative destination paths for copied files and simplify directory creation.
1 parent 8230ccb commit 7c05a57

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/scripts/check-gs.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ async function checkProject(project: Project, rootDir: string): Promise<CheckRes
132132
mkdirSync(projectTempDir, {recursive: true});
133133

134134
for (const file of project.files) {
135-
const relPath = project.path;
136-
const destPath = join(projectTempDir, relPath.replace(/\.gs$/, '.js'));
135+
const fileRelPath = relative(rootDir, file);
136+
const destPath = join(projectTempDir, fileRelPath.replace(/\.gs$/, '.js'));
137137
const destDir = dirname(destPath);
138-
if (!existsSync(destDir)) mkdirSync(destDir, {recursive: true});
138+
mkdirSync(destDir, {recursive: true});
139139
copyFileSync(file, destPath);
140140
}
141141

@@ -163,7 +163,10 @@ async function checkProject(project: Project, rootDir: string): Promise<CheckRes
163163

164164
const rewritten = rawOutput.split('\n').map((line: string) => {
165165
if (line.includes(projectTempDir)) {
166-
let newLine = line.split(projectTempDir + sep).join(project.path + sep);
166+
let newLine = line.split(projectTempDir + sep).pop();
167+
if (!newLine) {
168+
return line;
169+
}
167170
newLine = newLine.replace(/\.js(:|\()/g, '.gs$1');
168171
return newLine;
169172
}

0 commit comments

Comments
 (0)