diff --git a/vscode/extension/.vscodeignore b/vscode/extension/.vscodeignore new file mode 100644 index 000000000..e69de29bb diff --git a/vscode/extension/package.json b/vscode/extension/package.json index 0991f31dc..d868697e5 100644 --- a/vscode/extension/package.json +++ b/vscode/extension/package.json @@ -79,4 +79,4 @@ "typescript": "^4.4.3", "vsce": "^2.2.0" } -} +} \ No newline at end of file diff --git a/vscode/extension/scripts/build.js b/vscode/extension/scripts/build.js index 9ad0ced9c..7d6e96b64 100644 --- a/vscode/extension/scripts/build.js +++ b/vscode/extension/scripts/build.js @@ -15,7 +15,7 @@ async function main() { esbuild.buildSync({ entryPoints: ['./src/extension.ts'], outdir: 'dist/web', - minify: true, + minify: false, bundle: true, format: 'cjs', target: 'es6', @@ -24,7 +24,6 @@ async function main() { }, tsconfig: './tsconfig.json', external: ['vscode'], - metafile: true, }) console.log(`Built package.`) } catch (e) { diff --git a/vscode/extension/scripts/dev.js b/vscode/extension/scripts/dev.js index d62087a50..42386d6fb 100644 --- a/vscode/extension/scripts/dev.js +++ b/vscode/extension/scripts/dev.js @@ -12,7 +12,7 @@ async function main() { } try { - esbuild.buildSync({ + await esbuild.build({ entryPoints: ['./src/extension.ts'], outdir: 'dist/web', minify: false, @@ -25,6 +25,12 @@ async function main() { }, tsconfig: './tsconfig.json', external: ['vscode'], + incremental: true, + watch: { + onRebuild(err) { + err ? console.error('❌ Failed') : console.log('✅ Updated') + }, + }, }) console.log(`Built package.`) diff --git a/vscode/extension/scripts/package.js b/vscode/extension/scripts/package.js index 1855fd92a..f3a8441f1 100644 --- a/vscode/extension/scripts/package.js +++ b/vscode/extension/scripts/package.js @@ -1,24 +1,30 @@ /* eslint-disable */ //const version = require('../../../lerna.json').version +const fs = require('fs') const pkg = require('../package.json') const { exec } = require('child_process') -const fs = require('fs') -const dir = './temp' async function main() { - if (fs.existsSync(dir)) { - fs.rmSync(dir, { recursive: true }, (e) => { + if (fs.existsSync('./editor')) { + fs.rmSync('./editor', { recursive: true }, (e) => { + if (e) { + throw e + } + }) + } + if (fs.existsSync('./temp')) { + fs.rmSync('./temp', { recursive: true }, (e) => { if (e) { throw e } }) } - fs.mkdirSync(dir) + fs.mkdirSync('./temp') try { exec( - `cp -r ../editor/dist editor; vsce package; mv ${pkg.name}-${pkg.version}.vsix ${dir}`, + `cp -r ../editor/dist editor; vsce package; mv ${pkg.name}-${pkg.version}.vsix ${'./temp'}`, (error, stdout, stderr) => { if (error) { throw new Error(error.message)