You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* eslint-disable */
  2. //const version = require('../../../lerna.json').version
  3. const fs = require('fs')
  4. const pkg = require('../package.json')
  5. const { exec } = require('child_process')
  6. async function main() {
  7. if (fs.existsSync('./editor')) {
  8. fs.rmSync('./editor', { recursive: true }, (e) => {
  9. if (e) {
  10. throw e
  11. }
  12. })
  13. }
  14. if (fs.existsSync('./temp')) {
  15. fs.rmSync('./temp', { recursive: true }, (e) => {
  16. if (e) {
  17. throw e
  18. }
  19. })
  20. }
  21. fs.mkdirSync('./temp')
  22. try {
  23. exec(
  24. `cp -r ../editor/dist editor; vsce package; mv ${pkg.name}-${pkg.version}.vsix ${'./temp'}`,
  25. (error, stdout, stderr) => {
  26. if (error) {
  27. throw new Error(error.message)
  28. }
  29. if (stderr && stderr.search('warning') !== 0) {
  30. throw new Error(stderr)
  31. }
  32. }
  33. )
  34. } catch (e) {
  35. console.log(`× ${pkg.name}: Build failed due to an error.`)
  36. console.log(e)
  37. }
  38. }
  39. main()