mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-25 22:19:28 -04:00
fix(rewrite): setup.mjs
should work on both Unix-like and Windows, fixed message
function
This commit is contained in:
parent
1d3bfe52db
commit
c1d6551301
@ -7,14 +7,20 @@ console.log("Setting up project");
|
||||
let currentlySettingUp = "";
|
||||
|
||||
const url = new URL(import.meta.url);
|
||||
const projectDir = path.dirname(
|
||||
path.resolve(
|
||||
url.pathname
|
||||
.split("/")
|
||||
.filter((v) => v && v.length > 0)
|
||||
.join(path.sep)
|
||||
)
|
||||
let projectDir = path.resolve(
|
||||
url.pathname
|
||||
.split("/")
|
||||
.filter((v) => v && v.length > 0)
|
||||
.join(path.sep)
|
||||
);
|
||||
// This is a cheap but probably check to see if we're *not* on Windows.
|
||||
if (path.sep !== "\\") {
|
||||
// You could inline `path.sep` as "\" but why not go that extra mile
|
||||
// We're already using it so
|
||||
projectDir = path.sep + projectDir;
|
||||
}
|
||||
projectDir = path.dirname(projectDir);
|
||||
|
||||
const legacyDir = path.resolve(projectDir, "..");
|
||||
|
||||
function message(str) {
|
||||
@ -22,7 +28,7 @@ function message(str) {
|
||||
if (!!currentlySettingUp && currentlySettingUp.trim().length >= 0) {
|
||||
prefix = `[${currentlySettingUp}]`;
|
||||
}
|
||||
console.log(" " + str);
|
||||
console.log(" " + prefix + str);
|
||||
}
|
||||
|
||||
console.log(`
|
||||
@ -59,7 +65,7 @@ async function symlink(to, from) {
|
||||
message(`Missing .env file for backend, creating from example.env`);
|
||||
await fsp.cp(exampleEnvFile, envFile);
|
||||
} else {
|
||||
message(`[backend] Environment file already exists, continuing`);
|
||||
message(`Environment file already exists, continuing`);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user