From f2ed16ff7ec2d3c2c64fb0d1d5a0150e98270fcd Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Tue, 31 Aug 2021 13:37:06 +0100 Subject: [PATCH] Fix build --- packages/core/scripts/build.js | 8 +++++--- packages/tldraw/scripts/build.js | 14 ++++++-------- packages/tldraw/scripts/pre-dev.js | 1 - 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/core/scripts/build.js b/packages/core/scripts/build.js index 6f8463f34..a91430b36 100644 --- a/packages/core/scripts/build.js +++ b/packages/core/scripts/build.js @@ -36,9 +36,11 @@ async function main() { external: ['react', 'react-dom'], }) - fs.copyFile('./README.md', './dist/README.md', (err) => { - if (err) throw err - }) + for (const file of ['package.json', 'README.md']) { + fs.copyFile(file, `dist/${file}'`, fs.constants.COPYFILE_EXCL, (err) => { + if (err) throw err + }) + } console.log(`✔ ${name}: Built package.`) } catch (e) { diff --git a/packages/tldraw/scripts/build.js b/packages/tldraw/scripts/build.js index a1efb7642..b0bfe3886 100644 --- a/packages/tldraw/scripts/build.js +++ b/packages/tldraw/scripts/build.js @@ -9,14 +9,6 @@ async function main() { fs.mkdirSync('./dist') } - fs.copyFileSync('package.json', 'dist/package.json', (err) => { - if (err) throw err - }) - - fs.copyFileSync('README.md', 'dist/README.md', (err) => { - if (err) throw err - }) - try { esbuild.buildSync({ entryPoints: ['./src/index.ts'], @@ -44,6 +36,12 @@ async function main() { external: ['react', 'react-dom'], }) + for (const file of ['package.json', 'README.md']) { + fs.copyFile(file, `dist/${file}'`, fs.constants.COPYFILE_EXCL, (err) => { + if (err) throw err + }) + } + console.log(`✔ ${name}: Built package.`) } catch (e) { console.log(`× ${name}: Build failed due to an error.`) diff --git a/packages/tldraw/scripts/pre-dev.js b/packages/tldraw/scripts/pre-dev.js index 37db38547..a8c513301 100644 --- a/packages/tldraw/scripts/pre-dev.js +++ b/packages/tldraw/scripts/pre-dev.js @@ -1,6 +1,5 @@ /* eslint-disable */ const fs = require('fs') -const path = require('path') const esbuild = require('esbuild') async function main() {