Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uninstaller #79

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,20 @@
},
"scripts": {
"postinstall": "yarn dlx @yarnpkg/sdks vscode",
"vscode:uninstall": "node ./dist/vscodeUninstaller.mjs",
"vscode:prepublish": "yarn run package",
"compile-uninstaller": "rollup -c uninstall.rollup.config.mjs --environment BUILD:production",
"compile": "rollup -c",
"watch": "rollup -cw",
"package": "rimraf dist && node scripts/build.mjs",
"package": "rimraf dist && node scripts/build.mjs && yarn run compile-uninstaller",
"lint": "eslint src",
"test": "yarn run lint"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@types/adm-zip": "^0.5.5",
"@types/ini": "^4.1.1",
Expand Down
3 changes: 2 additions & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ 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',
output: {
//dir: 'dist',
file: 'dist/extension.cjs',
format: 'cjs',
// isProduction ? "hidden" : true
sourcemap: true,
exports: 'named',
},
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
11 changes: 11 additions & 0 deletions scripts/vscodeUninstaller.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { homedir } from "os";
import { join } from "path";
import { rimraf } from "rimraf";

const picoSdkRoot = join(homedir(), ".pico-sdk");

rimraf(picoSdkRoot, { glob: false }).then(() => {
console.log("Pico SDK has been uninstalled successfully.");
}).catch((err) => {
console.error("Error occurred while uninstalling Pico SDK:", err);
});
20 changes: 20 additions & 0 deletions uninstall.rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';

export default {
input: 'scripts/vscodeUninstaller.mjs',
output: {
file: 'dist/vscodeUninstaller.mjs',
format: 'es',
sourcemap: false,
exports: 'named',
},
plugins: [
nodeResolve({
preferBuiltins: true,
}),
commonjs(),
terser(),
],
};
143 changes: 141 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,65 @@ __metadata:
languageName: node
linkType: hard

"@jridgewell/gen-mapping@npm:^0.3.5":
version: 0.3.5
resolution: "@jridgewell/gen-mapping@npm:0.3.5"
dependencies:
"@jridgewell/set-array": "npm:^1.2.1"
"@jridgewell/sourcemap-codec": "npm:^1.4.10"
"@jridgewell/trace-mapping": "npm:^0.3.24"
checksum: 10/81587b3c4dd8e6c60252122937cea0c637486311f4ed208b52b62aae2e7a87598f63ec330e6cd0984af494bfb16d3f0d60d3b21d7e5b4aedd2602ff3fe9d32e2
languageName: node
linkType: hard

"@jridgewell/resolve-uri@npm:^3.1.0":
version: 3.1.2
resolution: "@jridgewell/resolve-uri@npm:3.1.2"
checksum: 10/97106439d750a409c22c8bff822d648f6a71f3aa9bc8e5129efdc36343cd3096ddc4eeb1c62d2fe48e9bdd4db37b05d4646a17114ecebd3bbcacfa2de51c3c1d
languageName: node
linkType: hard

"@jridgewell/set-array@npm:^1.2.1":
version: 1.2.1
resolution: "@jridgewell/set-array@npm:1.2.1"
checksum: 10/832e513a85a588f8ed4f27d1279420d8547743cc37fcad5a5a76fc74bb895b013dfe614d0eed9cb860048e6546b798f8f2652020b4b2ba0561b05caa8c654b10
languageName: node
linkType: hard

"@jridgewell/source-map@npm:^0.3.3":
version: 0.3.6
resolution: "@jridgewell/source-map@npm:0.3.6"
dependencies:
"@jridgewell/gen-mapping": "npm:^0.3.5"
"@jridgewell/trace-mapping": "npm:^0.3.25"
checksum: 10/0a9aca9320dc9044014ba0ef989b3a8411b0d778895553e3b7ca2ac0a75a20af4a5ad3f202acfb1879fa40466036a4417e1d5b38305baed8b9c1ebe6e4b3e7f5
languageName: node
linkType: hard

"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14":
version: 1.5.0
resolution: "@jridgewell/sourcemap-codec@npm:1.5.0"
checksum: 10/4ed6123217569a1484419ac53f6ea0d9f3b57e5b57ab30d7c267bdb27792a27eb0e4b08e84a2680aa55cc2f2b411ffd6ec3db01c44fdc6dc43aca4b55f8374fd
languageName: node
linkType: hard

"@jridgewell/sourcemap-codec@npm:^1.4.15":
version: 1.4.15
resolution: "@jridgewell/sourcemap-codec@npm:1.4.15"
checksum: 10/89960ac087781b961ad918978975bcdf2051cd1741880469783c42de64239703eab9db5230d776d8e6a09d73bb5e4cb964e07d93ee6e2e7aea5a7d726e865c09
languageName: node
linkType: hard

"@jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25":
version: 0.3.25
resolution: "@jridgewell/trace-mapping@npm:0.3.25"
dependencies:
"@jridgewell/resolve-uri": "npm:^3.1.0"
"@jridgewell/sourcemap-codec": "npm:^1.4.14"
checksum: 10/dced32160a44b49d531b80a4a2159dceab6b3ddf0c8e95a0deae4b0e894b172defa63d5ac52a19c2068e1fe7d31ea4ba931fbeec103233ecb4208953967120fc
languageName: node
linkType: hard

"@nodelib/fs.scandir@npm:2.1.5":
version: 2.1.5
resolution: "@nodelib/fs.scandir@npm:2.1.5"
Expand Down Expand Up @@ -195,6 +247,22 @@ __metadata:
languageName: node
linkType: hard

"@rollup/plugin-terser@npm:^0.4.4":
version: 0.4.4
resolution: "@rollup/plugin-terser@npm:0.4.4"
dependencies:
serialize-javascript: "npm:^6.0.1"
smob: "npm:^1.0.0"
terser: "npm:^5.17.4"
peerDependencies:
rollup: ^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
checksum: 10/a5e066ddea55fc8c32188bc8b484cca619713516f10e3a06801881ec98bf37459ca24e5fe8711f93a5fa7f26a6e9132a47bc1a61c01e0b513dfd79a96cdc6eb7
languageName: node
linkType: hard

"@rollup/plugin-typescript@npm:^11.1.6":
version: 11.1.6
resolution: "@rollup/plugin-typescript@npm:11.1.6"
Expand Down Expand Up @@ -578,7 +646,7 @@ __metadata:
languageName: node
linkType: hard

"acorn@npm:^8.12.0":
"acorn@npm:^8.12.0, acorn@npm:^8.8.2":
version: 8.12.1
resolution: "acorn@npm:8.12.1"
bin:
Expand Down Expand Up @@ -732,6 +800,13 @@ __metadata:
languageName: node
linkType: hard

"buffer-from@npm:^1.0.0":
version: 1.1.2
resolution: "buffer-from@npm:1.1.2"
checksum: 10/0448524a562b37d4d7ed9efd91685a5b77a50672c556ea254ac9a6d30e3403a517d8981f10e565db24e8339413b43c97ca2951f10e399c6125a0d8911f5679bb
languageName: node
linkType: hard

"builtin-modules@npm:^3.3.0":
version: 3.3.0
resolution: "builtin-modules@npm:3.3.0"
Expand Down Expand Up @@ -815,6 +890,13 @@ __metadata:
languageName: node
linkType: hard

"commander@npm:^2.20.0":
version: 2.20.3
resolution: "commander@npm:2.20.3"
checksum: 10/90c5b6898610cd075984c58c4f88418a4fb44af08c1b1415e9854c03171bec31b336b7f3e4cefe33de994b3f12b03c5e2d638da4316df83593b9e82554e7e95b
languageName: node
linkType: hard

"commondir@npm:^1.0.1":
version: 1.0.1
resolution: "commondir@npm:1.0.1"
Expand Down Expand Up @@ -2181,13 +2263,23 @@ __metadata:
languageName: node
linkType: hard

"randombytes@npm:^2.1.0":
version: 2.1.0
resolution: "randombytes@npm:2.1.0"
dependencies:
safe-buffer: "npm:^5.1.0"
checksum: 10/4efd1ad3d88db77c2d16588dc54c2b52fd2461e70fe5724611f38d283857094fe09040fa2c9776366803c3152cf133171b452ef717592b65631ce5dc3a2bdafc
languageName: node
linkType: hard

"raspberry-pi-pico@workspace:.":
version: 0.0.0-use.local
resolution: "raspberry-pi-pico@workspace:."
dependencies:
"@eslint/js": "npm:^9.9.0"
"@rollup/plugin-commonjs": "npm:^26.0.1"
"@rollup/plugin-node-resolve": "npm:^15.2.3"
"@rollup/plugin-terser": "npm:^0.4.4"
"@rollup/plugin-typescript": "npm:^11.1.6"
"@types/adm-zip": "npm:^0.5.5"
"@types/ini": "npm:^4.1.1"
Expand Down Expand Up @@ -2363,7 +2455,7 @@ __metadata:
languageName: node
linkType: hard

"safe-buffer@npm:~5.2.0":
"safe-buffer@npm:^5.1.0, safe-buffer@npm:~5.2.0":
version: 5.2.1
resolution: "safe-buffer@npm:5.2.1"
checksum: 10/32872cd0ff68a3ddade7a7617b8f4c2ae8764d8b7d884c651b74457967a9e0e886267d3ecc781220629c44a865167b61c375d2da6c720c840ecd73f45d5d9451
Expand Down Expand Up @@ -2397,6 +2489,15 @@ __metadata:
languageName: node
linkType: hard

"serialize-javascript@npm:^6.0.1":
version: 6.0.2
resolution: "serialize-javascript@npm:6.0.2"
dependencies:
randombytes: "npm:^2.1.0"
checksum: 10/445a420a6fa2eaee4b70cbd884d538e259ab278200a2ededd73253ada17d5d48e91fb1f4cd224a236ab62ea7ba0a70c6af29fc93b4f3d3078bf7da1c031fde58
languageName: node
linkType: hard

"set-blocking@npm:^2.0.0":
version: 2.0.0
resolution: "set-blocking@npm:2.0.0"
Expand Down Expand Up @@ -2448,6 +2549,13 @@ __metadata:
languageName: node
linkType: hard

"smob@npm:^1.0.0":
version: 1.5.0
resolution: "smob@npm:1.5.0"
checksum: 10/a1ea453bcea89989062626ea30a1fcb42c62e96255619c8641ffa1d7ab42baf415975c67c718127036901b9e487d8bf4c46219e50cec54295412c1227700b8fe
languageName: node
linkType: hard

"socks-proxy-agent@npm:^7.0.0":
version: 7.0.0
resolution: "socks-proxy-agent@npm:7.0.0"
Expand All @@ -2469,6 +2577,23 @@ __metadata:
languageName: node
linkType: hard

"source-map-support@npm:~0.5.20":
version: 0.5.21
resolution: "source-map-support@npm:0.5.21"
dependencies:
buffer-from: "npm:^1.0.0"
source-map: "npm:^0.6.0"
checksum: 10/8317e12d84019b31e34b86d483dd41d6f832f389f7417faf8fc5c75a66a12d9686e47f589a0554a868b8482f037e23df9d040d29387eb16fa14cb85f091ba207
languageName: node
linkType: hard

"source-map@npm:^0.6.0":
version: 0.6.1
resolution: "source-map@npm:0.6.1"
checksum: 10/59ef7462f1c29d502b3057e822cdbdae0b0e565302c4dd1a95e11e793d8d9d62006cdc10e0fd99163ca33ff2071360cf50ee13f90440806e7ed57d81cba2f7ff
languageName: node
linkType: hard

"ssri@npm:^10.0.0":
version: 10.0.4
resolution: "ssri@npm:10.0.4"
Expand Down Expand Up @@ -2564,6 +2689,20 @@ __metadata:
languageName: node
linkType: hard

"terser@npm:^5.17.4":
version: 5.31.6
resolution: "terser@npm:5.31.6"
dependencies:
"@jridgewell/source-map": "npm:^0.3.3"
acorn: "npm:^8.8.2"
commander: "npm:^2.20.0"
source-map-support: "npm:~0.5.20"
bin:
terser: bin/terser
checksum: 10/78057c58025151c9bdad82a050f0b51175f9fe3117d8ee369ca7effe038cdd540da2fd5985a4f8ee08dba5616e7911e1392d40670698ff42a49fec338d369e80
languageName: node
linkType: hard

"text-table@npm:^0.2.0":
version: 0.2.0
resolution: "text-table@npm:0.2.0"
Expand Down
Loading