Fix build

This commit is contained in:
Steve Ruiz 2021-08-31 13:37:06 +01:00
parent fbc81620fb
commit f2ed16ff7e
3 changed files with 11 additions and 12 deletions

View file

@ -36,9 +36,11 @@ async function main() {
external: ['react', 'react-dom'],
})
fs.copyFile('./README.md', './dist/README.md', (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) {

View file

@ -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.`)

View file

@ -1,6 +1,5 @@
/* eslint-disable */
const fs = require('fs')
const path = require('path')
const esbuild = require('esbuild')
async function main() {