From 5422e6431c2fb6691b2a75006c68c89f52c1e7a2 Mon Sep 17 00:00:00 2001 From: konnorrogers Date: Mon, 11 Dec 2023 16:25:24 -0500 Subject: [PATCH] fix copying cdn build to _site after its been built --- scripts/build.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/scripts/build.js b/scripts/build.js index 97d6a82b6..1cbbbb85a 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -212,17 +212,6 @@ await nextTask(`Copying CDN files to "${cdndir}"`, async () => { await copy(outdir, cdndir); }); -// Copy the CDN build to the docs (prod only; we use a virtual directory in dev) -if (!serve) { - await nextTask(`Copying the build to "${sitedir}"`, async () => { - await deleteAsync(sitedir); - - // We copy the CDN build because that has everything bundled. Yes this looks weird. - // But if we do "/cdn" it requires changes all the docs to do /cdn instead of /dist. - await copy(cdndir, path.join(sitedir, 'dist')); - }); -} - await nextTask('Building source files', async () => { buildResults = await buildTheSource(); }); @@ -303,7 +292,17 @@ if (serve) { // Build for production if (!serve) { - await nextTask('Building the docs', async () => await buildTheDocs()); + // Copy the CDN build to the docs (prod only; we use a virtual directory in dev) + await nextTask(`Copying the build to "${sitedir}"`, async () => { + await deleteAsync(sitedir); + + // We copy the CDN build because that has everything bundled. Yes this looks weird. + // But if we do "/cdn" it requires changes all the docs to do /cdn instead of /dist. + await copy(cdndir, path.join(sitedir, 'dist')); + }); + await nextTask('Building the docs', async () => { + await buildTheDocs() + }); } // Cleanup on exit