2021-11-10 15:35:51 +00:00
|
|
|
|
/* eslint-disable */
|
|
|
|
|
//const version = require('../../../lerna.json').version
|
2021-11-13 11:02:10 +00:00
|
|
|
|
const fs = require('fs')
|
2021-11-10 15:35:51 +00:00
|
|
|
|
const pkg = require('../package.json')
|
|
|
|
|
const { exec } = require('child_process')
|
|
|
|
|
|
|
|
|
|
async function main() {
|
2021-11-13 11:02:10 +00:00
|
|
|
|
if (fs.existsSync('./editor')) {
|
|
|
|
|
fs.rmSync('./editor', { recursive: true }, (e) => {
|
|
|
|
|
if (e) {
|
|
|
|
|
throw e
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if (fs.existsSync('./temp')) {
|
|
|
|
|
fs.rmSync('./temp', { recursive: true }, (e) => {
|
2021-11-10 15:35:51 +00:00
|
|
|
|
if (e) {
|
|
|
|
|
throw e
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-13 11:02:10 +00:00
|
|
|
|
fs.mkdirSync('./temp')
|
2021-11-10 15:35:51 +00:00
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
exec(
|
2021-11-13 11:02:10 +00:00
|
|
|
|
`cp -r ../editor/dist editor; vsce package; mv ${pkg.name}-${pkg.version}.vsix ${'./temp'}`,
|
2021-11-10 15:35:51 +00:00
|
|
|
|
(error, stdout, stderr) => {
|
|
|
|
|
if (error) {
|
|
|
|
|
throw new Error(error.message)
|
|
|
|
|
}
|
|
|
|
|
if (stderr && stderr.search('warning') !== 0) {
|
|
|
|
|
throw new Error(stderr)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.log(`× ${pkg.name}: Build failed due to an error.`)
|
|
|
|
|
console.log(e)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main()
|