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'], external: ['react', 'react-dom'],
}) })
fs.copyFile('./README.md', './dist/README.md', (err) => { for (const file of ['package.json', 'README.md']) {
if (err) throw err fs.copyFile(file, `dist/${file}'`, fs.constants.COPYFILE_EXCL, (err) => {
}) if (err) throw err
})
}
console.log(`${name}: Built package.`) console.log(`${name}: Built package.`)
} catch (e) { } catch (e) {

View file

@ -9,14 +9,6 @@ async function main() {
fs.mkdirSync('./dist') 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 { try {
esbuild.buildSync({ esbuild.buildSync({
entryPoints: ['./src/index.ts'], entryPoints: ['./src/index.ts'],
@ -44,6 +36,12 @@ async function main() {
external: ['react', 'react-dom'], 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.`) console.log(`${name}: Built package.`)
} catch (e) { } catch (e) {
console.log(`× ${name}: Build failed due to an error.`) console.log(`× ${name}: Build failed due to an error.`)

View file

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