build: fix build copy

pull/20/head
Evan You 4 years ago
parent dcae3f330d
commit 796a1a6730

@ -29,9 +29,9 @@
"scripts": {
"dev": "run-p dev-client dev-client-copy dev-node",
"dev-client": "tsc -w -p src/client",
"dev-client-copy": "node scripts/copy",
"dev-client-copy": "node scripts/watchAndCopy",
"dev-node": "tsc -w -p src/node",
"build": "rm -rf dist && tsc -p src/client && tsc -p src/node",
"build": "rm -rf dist && tsc -p src/client && tsc -p src/node && node scripts/copy",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"prepublishOnly": "yarn build && yarn changelog",
"postpublish": "git add CHANGELOG.md && git commit -m 'chore: changelog [ci skip]'"

@ -1,13 +1,10 @@
// copy and watch non-ts files in src/client
const fs = require('fs-extra')
const chokidar = require('chokidar')
const glob = require('globby')
function toDest(file) {
return file.replace(/^src\//, 'dist/')
}
chokidar
.watch('src/client/**/!(*.ts|tsconfig.json)')
.on('change', (file) => fs.copy(file, toDest(file)))
.on('add', (file) => fs.copy(file, toDest(file)))
.on('unlink', (file) => fs.remove(toDest(file)))
glob.sync('src/client/**/!(*.ts|tsconfig.json)').forEach((file) => {
fs.copy(file, toDest(file))
})

@ -0,0 +1,13 @@
// copy and watch non-ts files in src/client
const fs = require('fs-extra')
const chokidar = require('chokidar')
function toDest(file) {
return file.replace(/^src\//, 'dist/')
}
chokidar
.watch('src/client/**/!(*.ts|tsconfig.json)')
.on('change', (file) => fs.copy(file, toDest(file)))
.on('add', (file) => fs.copy(file, toDest(file)))
.on('unlink', (file) => fs.remove(toDest(file)))
Loading…
Cancel
Save