mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-27 15:05:38 -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 = "";
|
let currentlySettingUp = "";
|
||||||
|
|
||||||
const url = new URL(import.meta.url);
|
const url = new URL(import.meta.url);
|
||||||
const projectDir = path.dirname(
|
let projectDir = path.resolve(
|
||||||
path.resolve(
|
|
||||||
url.pathname
|
url.pathname
|
||||||
.split("/")
|
.split("/")
|
||||||
.filter((v) => v && v.length > 0)
|
.filter((v) => v && v.length > 0)
|
||||||
.join(path.sep)
|
.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, "..");
|
const legacyDir = path.resolve(projectDir, "..");
|
||||||
|
|
||||||
function message(str) {
|
function message(str) {
|
||||||
@ -22,7 +28,7 @@ function message(str) {
|
|||||||
if (!!currentlySettingUp && currentlySettingUp.trim().length >= 0) {
|
if (!!currentlySettingUp && currentlySettingUp.trim().length >= 0) {
|
||||||
prefix = `[${currentlySettingUp}]`;
|
prefix = `[${currentlySettingUp}]`;
|
||||||
}
|
}
|
||||||
console.log(" " + str);
|
console.log(" " + prefix + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`
|
console.log(`
|
||||||
@ -59,7 +65,7 @@ async function symlink(to, from) {
|
|||||||
message(`Missing .env file for backend, creating from example.env`);
|
message(`Missing .env file for backend, creating from example.env`);
|
||||||
await fsp.cp(exampleEnvFile, envFile);
|
await fsp.cp(exampleEnvFile, envFile);
|
||||||
} else {
|
} else {
|
||||||
message(`[backend] Environment file already exists, continuing`);
|
message(`Environment file already exists, continuing`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user