WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit ec5f338

Browse files
authored
Merge pull request #109 from inlovewithgo/fix/env-copy-path
2 parents 8fefaf4 + 62cc9b1 commit ec5f338

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/copy-env-files.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { access, constants, copyFile, readFile } from "node:fs/promises";
33
import { getRootEnvFiles } from "./utils/glob-patterns";
44
import { dirname, join } from "node:path";
55
import { fileURLToPath } from "node:url";
6+
import { basename } from "node:path";
67
import { glob } from "glob";
78

89
const __filename = fileURLToPath(import.meta.url);
@@ -48,7 +49,7 @@ async function main() {
4849
return;
4950
}
5051

51-
console.log(`🔍 Found .env files: ${envFiles.map(f => f.split("/").pop()).join(", ")}`);
52+
console.log(`🔍 Found .env files: ${envFiles.map(f => basename(f)).join(", ")}`);
5253

5354
// Process each workspace pattern
5455
for (const workspacePattern of packageJson.workspaces) {
@@ -73,7 +74,7 @@ async function main() {
7374

7475
// Copy each .env* file to the workspace
7576
for (const envFile of envFiles) {
76-
const fileName = envFile.split("/").pop()!;
77+
const fileName = basename(envFile);
7778
const destPath = join(workspaceDir, fileName);
7879

7980
if (isDryRun) {

0 commit comments

Comments
 (0)