change build dir to "build" as in previous project

This commit is contained in:
Bruno Windels 2020-12-04 12:34:57 +01:00
parent c68e00f7a2
commit 9760b78f16
2 changed files with 5 additions and 5 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
node_modules node_modules
target build

View file

@ -48,7 +48,7 @@ async function build() {
// get version number // get version number
const version = JSON.parse(await fs.readFile(path.join(projectDir, "package.json"), "utf8")).version; const version = JSON.parse(await fs.readFile(path.join(projectDir, "package.json"), "utf8")).version;
// clear target dir // clear target dir
const targetDir = path.join(projectDir, "target/"); const targetDir = path.join(projectDir, "build/");
await removeDirIfExists(targetDir); await removeDirIfExists(targetDir);
await fs.mkdir(targetDir); await fs.mkdir(targetDir);
await fs.mkdir(path.join(targetDir, "images")); await fs.mkdir(path.join(targetDir, "images"));
@ -58,7 +58,7 @@ async function build() {
assets.addSubMap(imageAssets); assets.addSubMap(imageAssets);
await assets.write(`bundle-esm.js`, await buildJs("src/main.js", assets)); await assets.write(`bundle-esm.js`, await buildJs("src/main.js", assets));
await assets.write(`bundle-legacy.js`, await buildJsLegacy("src/main.js", assets, ["src/polyfill.js"])); await assets.write(`bundle-legacy.js`, await buildJsLegacy("src/main.js", assets, ["src/polyfill.js"]));
await assets.write(`bundle.css`, await buildCss("css/main.css", assets)); await assets.write(`bundle.css`, await buildCss("css/main.css", targetDir, assets));
await assets.writeUnhashed(".well-known/apple-app-site-association", buildAppleAssociatedAppsFile(createClients())); await assets.writeUnhashed(".well-known/apple-app-site-association", buildAppleAssociatedAppsFile(createClients()));
await assets.writeUnhashed("index.html", await buildHtml(assets)); await assets.writeUnhashed("index.html", await buildHtml(assets));
const globalHash = assets.hashForAll(); const globalHash = assets.hashForAll();
@ -152,11 +152,11 @@ function buildAppleAssociatedAppsFile(clients) {
}); });
} }
async function buildCss(entryPath, assets) { async function buildCss(entryPath, targetDir, assets) {
entryPath = path.join(projectDir, entryPath); entryPath = path.join(projectDir, entryPath);
const assetUrlMapper = ({absolutePath}) => { const assetUrlMapper = ({absolutePath}) => {
const relPath = absolutePath.substr(projectDir.length); const relPath = absolutePath.substr(projectDir.length);
return assets.resolve(path.join(projectDir, "target", relPath)); return assets.resolve(path.join(targetDir, relPath));
}; };
const preCss = await fs.readFile(entryPath, "utf8"); const preCss = await fs.readFile(entryPath, "utf8");