Skip to content

Commit

Permalink
fix(build): Copies dist folder to docs/dist on dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
jeysonj2 committed Jun 9, 2023
1 parent 6bc038a commit 9ea358a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"url": "https://github.com/sponsors/claviska"
},
"scripts": {
"start": "node scripts/build.js --bundle --serve --dir \"docs/dist\"",
"start": "node scripts/build.js --bundle --serve",
"build": "node scripts/build.js --bundle --types --copydir \"docs/dist\"",
"verify": "npm run prettier:check && npm run lint && npm run build && npm run test",
"verify:fix": "npm run prettier && npm run lint:fix && npm run build && npm run test",
Expand Down
15 changes: 13 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ fs.mkdirSync(outdir, { recursive: true });
port: portNumbers(4000, 4999)
});

// Make sure docs/dist is empty since we're serving it virtually
// deleteSync('docs/dist');
// Copy the build output to docs/dist
const docsDir = 'docs/dist';
deleteSync(docsDir);
copy(outdir, docsDir);

const browserSyncConfig = {
startPath: '/',
Expand Down Expand Up @@ -149,6 +151,15 @@ fs.mkdirSync(outdir, { recursive: true });

execSync(`node scripts/make-metadata.js --outdir "${outdir}"`, { stdio: 'inherit' });
})
.then(() => {
deleteSync(docsDir);
copy(outdir, docsDir);

if (copydir) {
deleteSync(copydir);
copy(outdir, copydir);
}
})
.then(() => {
bs.reload();
})
Expand Down

0 comments on commit 9ea358a

Please sign in to comment.