From eb5f2978ccd9e8b5930748beadd4bc4b8a14dfa3 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Wed, 25 May 2022 16:21:27 +0200 Subject: [PATCH] Fix a problem with build when switching branch When switching between master and fx102 bogus files were created outside of the build/ directory. That's because previously we had a symlinked file itembox.css and now we compile a file itemBox.css into the same directory. However when running `npm start`, after switching branch, the symlink still existed and thus when writing a new file, symlink was followed and output has been written inside a source file instead. Build system will now run cleanup step first (where it checks if files frim `.signatures.json` still exist in src), then proceed with build, so old symlinks will be removed thus producing a valid build. This problem probably only happened on case-insensitive file-systems (like default config on macOS HFS+). --- scripts/build.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/build.js b/scripts/build.js index 089f6b86dd..5e920db6d8 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -24,6 +24,11 @@ if (require.main === module) { .concat([`!${formatDirsForMatcher(copyDirs)}/**`]); const signatures = await getSignatures(); + + // Check if all files in signatures are still present in src; Needed to avoid a problem + // where what was a symlink before, now is compiled, resulting in polluting source files + onSuccess(await cleanUp(signatures)); + const results = await Promise.all([ getBrowserify(signatures), getCopy(copyDirs.map(d => `${d}/**`), { ignore: ignoreMask }, signatures), @@ -31,7 +36,6 @@ if (require.main === module) { ...scssFiles.map(scf => getSass(scf, { ignore: ignoreMask }, signatures)), getSymlinks(symlinks, { nodir: true, ignore: ignoreMask }, signatures), getSymlinks(symlinkDirs, { ignore: ignoreMask }, signatures), - cleanUp(signatures), getPDFReader(signatures), getPDFWorker(signatures), getZoteroNoteEditor(signatures)