Resolve paths and add check for yarn/npx

This commit is contained in:
dennis.ludwig
2021-06-10 14:27:44 +02:00
parent 81923be958
commit 4afe9b3c4e
4 changed files with 42 additions and 13 deletions

19
config/paths.js Normal file
View File

@@ -0,0 +1,19 @@
"use strict";
const path = require("path");
const fs = require("fs");
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath = "") =>
path.resolve(appDirectory, relativePath);
const templateDirectory = fs.realpathSync(__dirname);
const resolveTemplate = (relativePath = "") =>
path.resolve(templateDirectory, "..", relativePath);
module.exports = {
template: resolveTemplate(),
templateBuild: resolveTemplate("build"),
appRdJson: resolveApp("build/rd.json"),
appBuild: resolveApp("build"),
appYarnLock: resolveApp("yarn.lock"),
};