From d6bd6ff4c5f5c60fece08e6212351412f0ed181d Mon Sep 17 00:00:00 2001 From: paulober <44974737+paulober@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:37:29 +0100 Subject: [PATCH] Fix uninstaller + bundling of the vsix Signed-off-by: paulober <44974737+paulober@users.noreply.github.com> --- .vscodeignore | 24 +++++++++++++++++++++--- README.md | 1 + rollup.config.mjs | 3 ++- scripts/build.mjs | 4 ++-- scripts/vscodeUninstaller.mjs | 12 +++++------- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/.vscodeignore b/.vscodeignore index d025a92f..3e804bb4 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -9,17 +9,35 @@ out/** .yarnrc .yarnrc.yml .npmrc -rollup.config.mjs +*rollup.config.mjs **/tsconfig.json **/.eslintrc.json -**/*.map +**/eslint.config.mjs **/*.ts .pnp* *.vsix +*.zip +*.tgz +*.tar.gz +*.tar +*.gz +*.rar +*.7z +*.exe tmp.py # make sure scripts and data are always included -!scripts/** +!scripts/blink.pio +!scripts/lwipopts.h +!scripts/pico_configs.tsv +!scripts/pico_project.py +!scripts/pico-vscode.cmake +!scripts/Pico.code-profile +!scripts/raspberrypi-swd.cfg !data/** scripts/*.ps1 scripts/fix_windows_reg.py +scripts/vscodeUninstaller.mjs +scripts/genCache.py +scripts/genExamples.py +scripts/build.mjs diff --git a/README.md b/README.md index 068bd0fe..36659cef 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ For comprehensive setup instructions, refer to the [Getting Started guide](https - One-Click Compilation: Compile projects directly from the status bar with your selected SDK and tools. - Offline Documentation: Access Pico SDK documentation offline. - Quick Project Setup: Quickly create new Pico projects from the Explorer view when no workspace is open. +- Includes an Uninstaller: Easily remove the extension along with all automatically installed tools and SDKs. ## Requirements by OS diff --git a/rollup.config.mjs b/rollup.config.mjs index b7624767..310e6bad 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -2,7 +2,7 @@ import commonjs from '@rollup/plugin-commonjs'; import { nodeResolve } from '@rollup/plugin-node-resolve'; import typescript from '@rollup/plugin-typescript'; -//const isProduction = process.env.BUILD === 'production'; +const isProduction = process.env.BUILD === 'production'; export default { input: 'src/extension.mts', @@ -10,6 +10,7 @@ export default { //dir: 'dist', file: 'dist/extension.cjs', format: 'cjs', + // isProduction ? "hidden" : true sourcemap: true, exports: 'named', }, diff --git a/scripts/build.mjs b/scripts/build.mjs index a05c47dd..533d2c9e 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -3,7 +3,7 @@ import { execSync } from 'child_process'; const buildEnv = process.env.BUILD_ENV || 'production'; const sourcemap = buildEnv === 'production' ? 'hidden' : 'true'; -console.debug("Building with:\nenvironment =", buildEnv, "\nsourcemap =", sourcemap); +console.debug("Building with:\nenvironment =", buildEnv, "\nsourcemap =", sourcemap, "(out of order, always true)"); -const command = `rollup -c --environment BUILD:${buildEnv} --sourcemap ${sourcemap}`; +const command = `rollup -c --environment BUILD:${buildEnv}`; execSync(command, { stdio: 'inherit' }); diff --git a/scripts/vscodeUninstaller.mjs b/scripts/vscodeUninstaller.mjs index 8488b84e..492e67cd 100644 --- a/scripts/vscodeUninstaller.mjs +++ b/scripts/vscodeUninstaller.mjs @@ -4,10 +4,8 @@ import { rimraf } from "rimraf"; const picoSdkRoot = join(homedir(), ".pico-sdk"); -rimraf(picoSdkRoot, (err) => { - if (err) { - console.error(err); - } else { - console.log(`Successfully uninstalled Pico SDK and it's dependencies from ${picoSdkRoot}.`); - } -}, { glob: false }); +rimraf(picoSdkRoot, { glob: false }).then(() => { + console.log("Pico SDK has been uninstalled successfully."); +}).catch((err) => { + console.error("Error occurred while uninstalling Pico SDK:", err); +});