feat(plugins): improve on infrastructre for bundled plugins

This commit is contained in:
Johannes Millan 2025-11-26 16:22:01 +01:00
parent cd06b09439
commit 6e25ed7053
16 changed files with 568 additions and 763 deletions

210
package-lock.json generated
View file

@ -5054,7 +5054,6 @@
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5071,7 +5070,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5088,7 +5086,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5105,7 +5102,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5122,7 +5118,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5139,7 +5134,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5156,7 +5150,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5173,7 +5166,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5190,7 +5182,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5207,7 +5198,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5224,7 +5214,6 @@
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5241,7 +5230,6 @@
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5258,7 +5246,6 @@
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5275,7 +5262,6 @@
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5292,7 +5278,6 @@
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5309,7 +5294,6 @@
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5326,7 +5310,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5343,7 +5326,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5360,7 +5342,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5377,7 +5358,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5394,7 +5374,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5411,7 +5390,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5428,7 +5406,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5445,7 +5422,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5462,7 +5438,6 @@
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -5479,7 +5454,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -6455,7 +6429,7 @@
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
"integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.0",
@ -6464,7 +6438,7 @@
},
"node_modules/@jridgewell/resolve-uri": {
"version": "3.1.2",
"dev": true,
"devOptional": true,
"license": "MIT",
"engines": {
"node": ">=6.0.0"
@ -6472,7 +6446,7 @@
},
"node_modules/@jridgewell/source-map": {
"version": "0.3.6",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
@ -6481,14 +6455,14 @@
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.5.0",
"dev": true,
"devOptional": true,
"license": "MIT"
},
"node_modules/@jridgewell/trace-mapping": {
"version": "0.3.30",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.30.tgz",
"integrity": "sha512-GQ7Nw5G2lTu/BtHTKfXhKHok2WGetd4XYcVKGx00SjAk8GMwgJM3zr6zORiPGuOE+/vkc90KtTosSSvaCjKb2Q==",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
@ -7921,7 +7895,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -7935,7 +7908,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -7949,7 +7921,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -7975,7 +7946,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -7989,7 +7959,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8003,7 +7972,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8017,7 +7985,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8031,7 +7998,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8045,7 +8011,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8059,7 +8024,6 @@
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8073,7 +8037,6 @@
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8087,7 +8050,6 @@
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8101,7 +8063,6 @@
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8115,7 +8076,6 @@
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8140,7 +8100,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8154,7 +8113,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8168,7 +8126,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8182,7 +8139,6 @@
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8196,7 +8152,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -8721,6 +8676,10 @@
"resolved": "packages/plugin-dev",
"link": true
},
"node_modules/@super-productivity/vite-plugin": {
"resolved": "packages/vite-plugin",
"link": true
},
"node_modules/@szmarczak/http-timer": {
"version": "4.0.6",
"dev": true,
@ -9147,7 +9106,6 @@
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/express": {
@ -9264,7 +9222,7 @@
},
"node_modules/@types/node": {
"version": "20.12.4",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"undici-types": "~5.26.4"
@ -10094,7 +10052,7 @@
"version": "8.15.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"devOptional": true,
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
@ -11207,7 +11165,7 @@
},
"node_modules/buffer-from": {
"version": "1.1.2",
"dev": true,
"devOptional": true,
"license": "MIT"
},
"node_modules/builder-util": {
@ -12270,7 +12228,7 @@
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz",
"integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"is-what": "^3.14.1"
@ -14312,7 +14270,6 @@
"version": "0.25.9",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.9.tgz",
"integrity": "sha512-CRbODhYyQx3qp7ZEwzxOk4JBqmD/seJrzPa/cGjY1VtIn5E09Oi9/dB4JwctnfZ8Q8iT7rioVv5k/FNT/uf54g==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
@ -15361,7 +15318,6 @@
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12.0.0"
@ -15762,7 +15718,6 @@
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
@ -16720,7 +16675,7 @@
},
"node_modules/immutable": {
"version": "5.1.1",
"dev": true,
"devOptional": true,
"license": "MIT"
},
"node_modules/import-fresh": {
@ -17355,7 +17310,7 @@
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz",
"integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==",
"dev": true,
"devOptional": true,
"license": "MIT"
},
"node_modules/is-wsl": {
@ -17668,7 +17623,7 @@
},
"node_modules/jiti": {
"version": "1.21.6",
"dev": true,
"devOptional": true,
"license": "MIT",
"bin": {
"jiti": "bin/jiti.js"
@ -18199,7 +18154,7 @@
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/less/-/less-4.4.0.tgz",
"integrity": "sha512-kdTwsyRuncDfjEs0DlRILWNvxhDG/Zij4YLO4TMJgDLW+8OzpfkdPnRgrsRuY1o+oaxJGWsps5f/RVBgGmmN0w==",
"dev": true,
"devOptional": true,
"license": "Apache-2.0",
"dependencies": {
"copy-anything": "^2.0.1",
@ -21004,7 +20959,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz",
"integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==",
"dev": true,
"devOptional": true,
"license": "MIT",
"engines": {
"node": ">= 0.10"
@ -21215,12 +21170,10 @@
},
"node_modules/picocolors": {
"version": "1.1.1",
"dev": true,
"license": "ISC"
},
"node_modules/picomatch": {
"version": "4.0.2",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
@ -21360,7 +21313,6 @@
"version": "8.5.6",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
"integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",
"dev": true,
"funding": [
{
"type": "opencollective",
@ -21588,7 +21540,6 @@
"version": "3.3.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
"dev": true,
"funding": [
{
"type": "github",
@ -22508,7 +22459,6 @@
"version": "4.52.3",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.3.tgz",
"integrity": "sha512-RIDh866U8agLgiIcdpB+COKnlCreHJLfIhWC3LVflku5YHfpnsIKigRZeFfMfCc4dVcqNVfQQ5gO/afOck064A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "1.0.8"
@ -22553,7 +22503,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -22567,7 +22516,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@ -22753,7 +22701,7 @@
"version": "1.90.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.90.0.tgz",
"integrity": "sha512-9GUyuksjw70uNpb1MTYWsH9MQHOHY6kwfnkafC24+7aOMZn9+rVMBxRbLvw756mrBFbIsFg6Xw9IkR2Fnn3k+Q==",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"chokidar": "^4.0.0",
@ -22815,7 +22763,7 @@
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
"integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"readdirp": "^4.0.1"
@ -22831,7 +22779,7 @@
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
"integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
"dev": true,
"devOptional": true,
"license": "MIT",
"engines": {
"node": ">= 14.18.0"
@ -23500,7 +23448,6 @@
},
"node_modules/source-map-js": {
"version": "1.2.1",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@ -23529,7 +23476,7 @@
},
"node_modules/source-map-support": {
"version": "0.5.21",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"buffer-from": "^1.0.0",
@ -23538,7 +23485,7 @@
},
"node_modules/source-map-support/node_modules/source-map": {
"version": "0.6.1",
"dev": true,
"devOptional": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@ -24403,7 +24350,7 @@
"version": "5.43.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz",
"integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==",
"dev": true,
"devOptional": true,
"license": "BSD-2-Clause",
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
@ -24455,7 +24402,7 @@
},
"node_modules/terser/node_modules/commander": {
"version": "2.20.3",
"dev": true,
"devOptional": true,
"license": "MIT"
},
"node_modules/text-table": {
@ -24534,7 +24481,6 @@
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz",
"integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"fdir": "^6.4.4",
@ -24772,7 +24718,7 @@
},
"node_modules/tslib": {
"version": "2.8.1",
"dev": true,
"devOptional": true,
"license": "0BSD"
},
"node_modules/tuf-js": {
@ -25291,7 +25237,7 @@
},
"node_modules/undici-types": {
"version": "5.26.5",
"dev": true,
"devOptional": true,
"license": "MIT"
},
"node_modules/unicode-canonical-property-names-ecmascript": {
@ -25528,6 +25474,80 @@
"license": "MIT",
"optional": true
},
"node_modules/vite": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz",
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
"license": "MIT",
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.4.4",
"picomatch": "^4.0.2",
"postcss": "^8.5.3",
"rollup": "^4.34.9",
"tinyglobby": "^0.2.13"
},
"bin": {
"vite": "bin/vite.js"
},
"engines": {
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
},
"funding": {
"url": "https://github.com/vitejs/vite?sponsor=1"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
},
"peerDependencies": {
"@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
"jiti": ">=1.21.0",
"less": "*",
"lightningcss": "^1.21.0",
"sass": "*",
"sass-embedded": "*",
"stylus": "*",
"sugarss": "*",
"terser": "^5.16.0",
"tsx": "^4.8.1",
"yaml": "^2.4.2"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
},
"jiti": {
"optional": true
},
"less": {
"optional": true
},
"lightningcss": {
"optional": true
},
"sass": {
"optional": true
},
"sass-embedded": {
"optional": true
},
"stylus": {
"optional": true
},
"sugarss": {
"optional": true
},
"terser": {
"optional": true
},
"tsx": {
"optional": true
},
"yaml": {
"optional": true
}
}
},
"node_modules/void-elements": {
"version": "2.0.1",
"dev": true,
@ -26538,6 +26558,34 @@
"devDependencies": {
"@super-productivity/plugin-api": "file:../plugin-api"
}
},
"packages/vite-plugin": {
"name": "@super-productivity/vite-plugin",
"version": "1.0.0",
"dependencies": {
"vite": "^6.0.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"typescript": "^5.0.0"
}
},
"packages/vite-plugin/node_modules/@types/node": {
"version": "22.19.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.1.tgz",
"integrity": "sha512-LCCV0HdSZZZb34qifBsyWlUmok6W7ouER+oQIGBScS8EsZsQbrtFTUrDX4hOl+CS6p7cnNC4td+qrSVGSCTUfQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
}
},
"packages/vite-plugin/node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"dev": true,
"license": "MIT"
}
}
}

View file

@ -21,46 +21,56 @@ function log(message, color = '') {
console.log(`${color}${message}${colors.reset}`);
}
// Plugin configurations
const plugins = [
{
async function getPlugins() {
const pluginDevDir = path.join(__dirname, 'plugin-dev');
const entries = await fs.readdir(pluginDevDir, { withFileTypes: true });
const plugins = [];
// Add plugin-api first as it's a dependency
plugins.push({
name: 'plugin-api',
path: 'packages/plugin-api',
buildCommand: 'npm run build',
skipCopy: true, // TypeScript definitions, no need to copy
},
{
name: 'api-test-plugin',
path: 'packages/plugin-dev/api-test-plugin',
files: ['manifest.json', 'plugin.js', 'index.html', 'icon.svg', 'config-schema.json'],
},
{
name: 'procrastination-buster',
path: 'packages/plugin-dev/procrastination-buster',
skipCopy: true,
});
// Add vite-plugin second as it's a build dependency
plugins.push({
name: 'vite-plugin',
path: 'packages/vite-plugin',
buildCommand: 'npm run build',
skipCopy: true, // inline-assets.js handles the copying with inlined assets
},
{
name: 'yesterday-tasks-plugin',
path: 'packages/plugin-dev/yesterday-tasks-plugin',
files: ['manifest.json', 'plugin.js', 'index.html', 'icon.svg'],
},
{
name: 'sync-md',
path: 'packages/plugin-dev/sync-md',
buildCommand: 'npm run build',
distFiles: ['manifest.json', 'plugin.js', 'index.html', 'icon.svg'],
sourcePath: 'dist',
},
{
name: 'ai-productivity-prompts',
path: 'packages/plugin-dev/ai-productivity-prompts',
buildCommand: 'npm run build',
skipCopy: true, // inline-assets.js handles the copying with inlined assets
},
// Explicitly excluding:
// - boilerplate-solid-js
];
skipCopy: true,
});
for (const entry of entries) {
if (entry.isDirectory()) {
const pluginPath = path.join(pluginDevDir, entry.name);
const packageJsonPath = path.join(pluginPath, 'package.json');
try {
await fs.access(packageJsonPath);
// It's a valid package
// Skip boilerplate
if (entry.name === 'boilerplate-solid-js') continue;
plugins.push({
name: entry.name,
path: `packages/plugin-dev/${entry.name}`,
buildCommand: 'npm run build',
// Standard files to copy for bundled plugins
files: ['manifest.json', 'plugin.js', 'index.html', 'icon.svg'],
sourcePath: 'dist',
});
} catch (e) {
// Not a package, skip
}
}
}
return plugins;
}
async function ensureDir(dir) {
try {
@ -76,7 +86,10 @@ async function copyFile(src, dest) {
return true;
} catch (error) {
if (error.code !== 'ENOENT') {
log(` ⚠️ Failed to copy ${path.basename(src)}: ${error.message}`, colors.yellow);
// Only log if it's not a "file not found" error, as some plugins might not have all assets
// e.g. no index.html or icon.svg
// But for bundled plugins we generally expect them.
// Let's be silent about ENOENT for optional files
}
return false;
}
@ -122,7 +135,7 @@ async function buildPlugin(plugin) {
const targetDir = path.join('src/assets/bundled-plugins', plugin.name);
await ensureDir(targetDir);
const filesToCopy = plugin.distFiles || plugin.files || [];
const filesToCopy = plugin.files || [];
const sourcePath = plugin.sourcePath
? path.join(pluginPath, plugin.sourcePath)
: pluginPath;
@ -157,6 +170,8 @@ async function buildAll() {
log('🚀 Building all packages...', colors.bright);
const startTime = Date.now();
const plugins = await getPlugins();
// Build plugins sequentially to avoid conflicts
const results = [];
for (const plugin of plugins) {

View file

@ -1,25 +1,50 @@
{
"name": "sp-plugin-boilerplate-solid",
"name": "boilerplate-solid-js",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sp-plugin-boilerplate-solid",
"name": "boilerplate-solid-js",
"version": "1.0.0",
"dependencies": {
"@super-productivity/plugin-api": "file:../plugin-api"
},
"devDependencies": {
"@types/node": "^22.15.33",
"@solidjs/router": "^0.14.10",
"@super-productivity/plugin-api": "file:../../plugin-api",
"@super-productivity/vite-plugin": "file:../../vite-plugin",
"archiver": "^7.0.1",
"solid-js": "^1.9.7",
"typescript": "^5.8.3",
"vite": "^7.1.12",
"vite-plugin-solid": "^2.11.10"
"solid-js": "^1.8.18",
"typescript": "^5.5.3",
"vite": "^5.3.4",
"vite-plugin-solid": "^2.10.2"
}
},
"../plugin-api": {},
"../../plugin-api": {
"name": "@super-productivity/plugin-api",
"version": "1.0.1",
"dev": true,
"license": "MIT",
"devDependencies": {
"typescript": "^5.0.0"
},
"engines": {
"node": ">=18.0.0"
}
},
"../../vite-plugin": {
"name": "@super-productivity/vite-plugin",
"version": "1.0.0",
"dev": true,
"dependencies": {
"vite": "^6.0.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"typescript": "^5.0.0"
}
},
"../plugin-api": {
"extraneous": true
},
"node_modules/@ampproject/remapping": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
@ -282,403 +307,394 @@
}
},
"node_modules/@esbuild/aix-ppc64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.5.tgz",
"integrity": "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",
"integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/android-arm": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz",
"integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz",
"integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/android-arm64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.5.tgz",
"integrity": "sha512-VGzGhj4lJO+TVGV1v8ntCZWJktV7SGCs3Pn1GRWI1SBFtRALoomm8k5E9Pmwg3HOAal2VDc2F9+PM/rEY6oIDg==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",
"integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/android-x64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.5.tgz",
"integrity": "sha512-D2GyJT1kjvO//drbRT3Hib9XPwQeWd9vZoBJn+bu/lVsOZ13cqNdDeqIF/xQ5/VmWvMduP6AmXvylO/PIc2isw==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz",
"integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/darwin-arm64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.5.tgz",
"integrity": "sha512-GtaBgammVvdF7aPIgH2jxMDdivezgFu6iKpmT+48+F8Hhg5J/sfnDieg0aeG/jfSvkYQU2/pceFPDKlqZzwnfQ==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",
"integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/darwin-x64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.5.tgz",
"integrity": "sha512-1iT4FVL0dJ76/q1wd7XDsXrSW+oLoquptvh4CLR4kITDtqi2e/xwXwdCVH8hVHU43wgJdsq7Gxuzcs6Iq/7bxQ==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",
"integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz",
"integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",
"integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/freebsd-x64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.5.tgz",
"integrity": "sha512-PrikaNjiXdR2laW6OIjlbeuCPrPaAl0IwPIaRv+SMV8CiM8i2LqVUHFC1+8eORgWyY7yhQY+2U2fA55mBzReaw==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",
"integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-arm": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.5.tgz",
"integrity": "sha512-cPzojwW2okgh7ZlRpcBEtsX7WBuqbLrNXqLU89GxWbNt6uIg78ET82qifUy3W6OVww6ZWobWub5oqZOVtwolfw==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",
"integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-arm64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.5.tgz",
"integrity": "sha512-Z9kfb1v6ZlGbWj8EJk9T6czVEjjq2ntSYLY2cw6pAZl4oKtfgQuS4HOq41M/BcoLPzrUbNd+R4BXFyH//nHxVg==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",
"integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-ia32": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.5.tgz",
"integrity": "sha512-sQ7l00M8bSv36GLV95BVAdhJ2QsIbCuCjh/uYrWiMQSUuV+LpXwIqhgJDcvMTj+VsQmqAHL2yYaasENvJ7CDKA==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",
"integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-loong64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.5.tgz",
"integrity": "sha512-0ur7ae16hDUC4OL5iEnDb0tZHDxYmuQyhKhsPBV8f99f6Z9KQM02g33f93rNH5A30agMS46u2HP6qTdEt6Q1kg==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",
"integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",
"cpu": [
"loong64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-mips64el": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.5.tgz",
"integrity": "sha512-kB/66P1OsHO5zLz0i6X0RxlQ+3cu0mkxS3TKFvkb5lin6uwZ/ttOkP3Z8lfR9mJOBk14ZwZ9182SIIWFGNmqmg==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",
"integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",
"cpu": [
"mips64el"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-ppc64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.5.tgz",
"integrity": "sha512-UZCmJ7r9X2fe2D6jBmkLBMQetXPXIsZjQJCjgwpVDz+YMcS6oFR27alkgGv3Oqkv07bxdvw7fyB71/olceJhkQ==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",
"integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-riscv64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.5.tgz",
"integrity": "sha512-kTxwu4mLyeOlsVIFPfQo+fQJAV9mh24xL+y+Bm6ej067sYANjyEw1dNHmvoqxJUCMnkBdKpvOn0Ahql6+4VyeA==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",
"integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",
"cpu": [
"riscv64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-s390x": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.5.tgz",
"integrity": "sha512-K2dSKTKfmdh78uJ3NcWFiqyRrimfdinS5ErLSn3vluHNeHVnBAFWC8a4X5N+7FgVE1EjXS1QDZbpqZBjfrqMTQ==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",
"integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/linux-x64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.5.tgz",
"integrity": "sha512-uhj8N2obKTE6pSZ+aMUbqq+1nXxNjZIIjCjGLfsWvVpy7gKCOL6rsY1MhRh9zLtUtAI7vpgLMK6DxjO8Qm9lJw==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",
"integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/netbsd-arm64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.5.tgz",
"integrity": "sha512-pwHtMP9viAy1oHPvgxtOv+OkduK5ugofNTVDilIzBLpoWAM16r7b/mxBvfpuQDpRQFMfuVr5aLcn4yveGvBZvw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/netbsd-x64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.5.tgz",
"integrity": "sha512-WOb5fKrvVTRMfWFNCroYWWklbnXH0Q5rZppjq0vQIdlsQKuw6mdSihwSo4RV/YdQ5UCKKvBy7/0ZZYLBZKIbwQ==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",
"integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=18"
}
},
"node_modules/@esbuild/openbsd-arm64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.5.tgz",
"integrity": "sha512-7A208+uQKgTxHd0G0uqZO8UjK2R0DDb4fDmERtARjSHWxqMTye4Erz4zZafx7Di9Cv+lNHYuncAkiGFySoD+Mw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/openbsd-x64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz",
"integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",
"integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/sunos-x64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz",
"integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",
"integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/win32-arm64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz",
"integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",
"integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/win32-ia32": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz",
"integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",
"integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@esbuild/win32-x64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz",
"integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",
"integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=18"
"node": ">=12"
}
},
"node_modules/@isaacs/cliui": {
@ -1016,8 +1032,22 @@
"win32"
]
},
"node_modules/@solidjs/router": {
"version": "0.14.10",
"resolved": "https://registry.npmjs.org/@solidjs/router/-/router-0.14.10.tgz",
"integrity": "sha512-5B8LVgvvXijfXyXWPVLUm7RQ05BhjIpAyRkYVDZtrR3OaSvftXobWc6qSEwk4ICLoGi/IE9CUp2LUdCBIs9AXg==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"solid-js": "^1.8.6"
}
},
"node_modules/@super-productivity/plugin-api": {
"resolved": "../plugin-api",
"resolved": "../../plugin-api",
"link": true
},
"node_modules/@super-productivity/vite-plugin": {
"resolved": "../../vite-plugin",
"link": true
},
"node_modules/@types/babel__core": {
@ -1072,6 +1102,8 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.33.tgz",
"integrity": "sha512-wzoocdnnpSxZ+6CjW4ADCK1jVmd1S/J3ArNWfn8FDDQtRm8dkDg7TA+mvek2wNrfCgwuZxqEOiB9B1XCJ6+dbw==",
"dev": true,
"optional": true,
"peer": true,
"dependencies": {
"undici-types": "~6.21.0"
}
@ -1467,43 +1499,42 @@
}
},
"node_modules/esbuild": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz",
"integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==",
"version": "0.21.5",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",
"integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
"esbuild": "bin/esbuild"
},
"engines": {
"node": ">=18"
"node": ">=12"
},
"optionalDependencies": {
"@esbuild/aix-ppc64": "0.25.5",
"@esbuild/android-arm": "0.25.5",
"@esbuild/android-arm64": "0.25.5",
"@esbuild/android-x64": "0.25.5",
"@esbuild/darwin-arm64": "0.25.5",
"@esbuild/darwin-x64": "0.25.5",
"@esbuild/freebsd-arm64": "0.25.5",
"@esbuild/freebsd-x64": "0.25.5",
"@esbuild/linux-arm": "0.25.5",
"@esbuild/linux-arm64": "0.25.5",
"@esbuild/linux-ia32": "0.25.5",
"@esbuild/linux-loong64": "0.25.5",
"@esbuild/linux-mips64el": "0.25.5",
"@esbuild/linux-ppc64": "0.25.5",
"@esbuild/linux-riscv64": "0.25.5",
"@esbuild/linux-s390x": "0.25.5",
"@esbuild/linux-x64": "0.25.5",
"@esbuild/netbsd-arm64": "0.25.5",
"@esbuild/netbsd-x64": "0.25.5",
"@esbuild/openbsd-arm64": "0.25.5",
"@esbuild/openbsd-x64": "0.25.5",
"@esbuild/sunos-x64": "0.25.5",
"@esbuild/win32-arm64": "0.25.5",
"@esbuild/win32-ia32": "0.25.5",
"@esbuild/win32-x64": "0.25.5"
"@esbuild/aix-ppc64": "0.21.5",
"@esbuild/android-arm": "0.21.5",
"@esbuild/android-arm64": "0.21.5",
"@esbuild/android-x64": "0.21.5",
"@esbuild/darwin-arm64": "0.21.5",
"@esbuild/darwin-x64": "0.21.5",
"@esbuild/freebsd-arm64": "0.21.5",
"@esbuild/freebsd-x64": "0.21.5",
"@esbuild/linux-arm": "0.21.5",
"@esbuild/linux-arm64": "0.21.5",
"@esbuild/linux-ia32": "0.21.5",
"@esbuild/linux-loong64": "0.21.5",
"@esbuild/linux-mips64el": "0.21.5",
"@esbuild/linux-ppc64": "0.21.5",
"@esbuild/linux-riscv64": "0.21.5",
"@esbuild/linux-s390x": "0.21.5",
"@esbuild/linux-x64": "0.21.5",
"@esbuild/netbsd-x64": "0.21.5",
"@esbuild/openbsd-x64": "0.21.5",
"@esbuild/sunos-x64": "0.21.5",
"@esbuild/win32-arm64": "0.21.5",
"@esbuild/win32-ia32": "0.21.5",
"@esbuild/win32-x64": "0.21.5"
}
},
"node_modules/escalade": {
@ -1539,24 +1570,6 @@
"integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
"dev": true
},
"node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12.0.0"
},
"peerDependencies": {
"picomatch": "^3 || ^4"
},
"peerDependenciesMeta": {
"picomatch": {
"optional": true
}
}
},
"node_modules/foreground-child": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
@ -1934,19 +1947,6 @@
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"dev": true
},
"node_modules/picomatch": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/postcss": {
"version": "8.5.6",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
@ -2321,23 +2321,6 @@
"b4a": "^1.6.4"
}
},
"node_modules/tinyglobby": {
"version": "0.2.15",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
"integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"fdir": "^6.5.0",
"picomatch": "^4.0.3"
},
"engines": {
"node": ">=12.0.0"
},
"funding": {
"url": "https://github.com/sponsors/SuperchupuDev"
}
},
"node_modules/typescript": {
"version": "5.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
@ -2355,7 +2338,9 @@
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"dev": true
"dev": true,
"optional": true,
"peer": true
},
"node_modules/update-browserslist-db": {
"version": "1.1.3",
@ -2400,24 +2385,21 @@
"dev": true
},
"node_modules/vite": {
"version": "7.1.12",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.12.tgz",
"integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==",
"version": "5.4.21",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.5.0",
"picomatch": "^4.0.3",
"postcss": "^8.5.6",
"rollup": "^4.43.0",
"tinyglobby": "^0.2.15"
"esbuild": "^0.21.3",
"postcss": "^8.4.43",
"rollup": "^4.20.0"
},
"bin": {
"vite": "bin/vite.js"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
"node": "^18.0.0 || >=20.0.0"
},
"funding": {
"url": "https://github.com/vitejs/vite?sponsor=1"
@ -2426,25 +2408,19 @@
"fsevents": "~2.3.3"
},
"peerDependencies": {
"@types/node": "^20.19.0 || >=22.12.0",
"jiti": ">=1.21.0",
"less": "^4.0.0",
"@types/node": "^18.0.0 || >=20.0.0",
"less": "*",
"lightningcss": "^1.21.0",
"sass": "^1.70.0",
"sass-embedded": "^1.70.0",
"stylus": ">=0.54.8",
"sugarss": "^5.0.0",
"terser": "^5.16.0",
"tsx": "^4.8.1",
"yaml": "^2.4.2"
"sass": "*",
"sass-embedded": "*",
"stylus": "*",
"sugarss": "*",
"terser": "^5.4.0"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
},
"jiti": {
"optional": true
},
"less": {
"optional": true
},
@ -2465,12 +2441,6 @@
},
"terser": {
"optional": true
},
"tsx": {
"optional": true
},
"yaml": {
"optional": true
}
}
},

View file

@ -1,28 +1,24 @@
{
"name": "sp-plugin-boilerplate-solid",
"name": "boilerplate-solid-js",
"version": "1.0.0",
"description": "A boilerplate Super Productivity plugin using Solid.js and TypeScript",
"description": "Solid.js Boilerplate Plugin for Super Productivity",
"type": "module",
"scripts": {
"dev": "vite",
"dev:watch": "node scripts/watch-and-build.js",
"build": "vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"package": "npm run build && node scripts/build-plugin.js",
"deploy": "npm run build && node scripts/inline-assets.js && node scripts/build-plugin.js",
"clean": "rm -rf dist node_modules *.zip",
"lint": "tsc --noEmit"
"package": "node scripts/build-plugin.js",
"deploy": "npm run build"
},
"devDependencies": {
"@types/node": "^22.15.33",
"solid-js": "^1.9.7",
"typescript": "^5.8.3",
"vite": "^7.1.12",
"vite-plugin-solid": "^2.11.10",
"archiver": "^7.0.1"
},
"dependencies": {
"@super-productivity/plugin-api": "file:../plugin-api"
"@solidjs/router": "^0.14.10",
"@super-productivity/plugin-api": "file:../../plugin-api",
"@super-productivity/vite-plugin": "file:../../vite-plugin",
"archiver": "^7.0.1",
"solid-js": "^1.8.18",
"typescript": "^5.5.3",
"vite": "^5.3.4",
"vite-plugin-solid": "^2.10.2"
}
}

View file

@ -1,47 +0,0 @@
import fs from 'fs';
import path from 'path';
import archiver from 'archiver';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const projectRoot = path.dirname(__dirname);
// Read manifest to get plugin name
const manifest = JSON.parse(
fs.readFileSync(path.join(projectRoot, 'src/manifest.json'), 'utf8'),
);
const outputFileName = `${manifest.id}-v${manifest.version}.zip`;
// Create output stream
const output = fs.createWriteStream(path.join(projectRoot, outputFileName));
const archive = archiver('zip', {
zlib: { level: 9 }, // Maximum compression
});
output.on('close', () => {
console.log(`Plugin packaged successfully: ${outputFileName}`);
console.log(`Total size: ${(archive.pointer() / 1024).toFixed(2)} KB`);
});
archive.on('error', (err) => {
throw err;
});
// Pipe archive data to the file
archive.pipe(output);
// Add dist files to the archive
const distPath = path.join(projectRoot, 'dist');
// Add manifest.json from src (it's copied to dist during build)
archive.file(path.join(projectRoot, 'src/manifest.json'), { name: 'manifest.json' });
// Add all files from dist
archive.glob('**/*', {
cwd: distPath,
ignore: ['manifest.json'], // We already added it from src
});
// Finalize the archive
archive.finalize();

View file

@ -1,48 +0,0 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const distDir = path.join(__dirname, '..', 'dist');
const htmlPath = path.join(distDir, 'index.html');
const jsPath = path.join(distDir, 'index.js');
const cssPath = path.join(distDir, 'index.css');
if (!fs.existsSync(htmlPath)) {
console.error('index.html not found in dist directory');
process.exit(1);
}
let html = fs.readFileSync(htmlPath, 'utf8');
// Read and inline JavaScript
if (fs.existsSync(jsPath)) {
const js = fs.readFileSync(jsPath, 'utf8');
// Replace the script tag, preserving the type="module" attribute if present
html = html.replace(
/<script([^>]*)src="[^"]*index\.js"[^>]*><\/script>/g,
(match, attrs) => {
// Check if type="module" is in the attributes or in the match
if (attrs.includes('type="module"') || match.includes('type="module"')) {
return `<script type="module">${js}</script>`;
}
return `<script>${js}</script>`;
},
);
}
// Read and inline CSS
if (fs.existsSync(cssPath)) {
const css = fs.readFileSync(cssPath, 'utf8');
// Replace the link tag with style tag
html = html.replace(
/<link[^>]*rel="stylesheet"[^>]*href="[^"]*index\.css"[^>]*>/g,
`<style>${css}</style>`,
);
}
// Write the updated HTML back
fs.writeFileSync(htmlPath, html);
console.log('✅ Assets inlined successfully');

View file

@ -1,64 +0,0 @@
#!/usr/bin/env node
import { spawn } from 'child_process';
import { fileURLToPath } from 'url';
import path from 'path';
import fs from 'fs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const projectRoot = path.dirname(__dirname);
console.log('🚀 Starting development server with auto-packaging...\n');
// Start Vite dev server
const viteProcess = spawn('npm', ['run', 'dev'], {
cwd: projectRoot,
stdio: 'inherit',
shell: true,
});
// Watch for changes and rebuild package
const srcPath = path.join(projectRoot, 'src');
let buildTimeout;
const rebuildPackage = () => {
if (buildTimeout) clearTimeout(buildTimeout);
buildTimeout = setTimeout(async () => {
console.log('\n📦 Building plugin package...');
const buildProcess = spawn('npm', ['run', 'package'], {
cwd: projectRoot,
stdio: 'inherit',
shell: true,
});
buildProcess.on('close', (code) => {
if (code === 0) {
console.log('✅ Plugin package built successfully!\n');
} else {
console.error('❌ Failed to build plugin package\n');
}
});
}, 1000); // Debounce for 1 second
};
// Watch src directory for changes
fs.watch(srcPath, { recursive: true }, (eventType, filename) => {
if (filename && !filename.includes('.swp') && !filename.includes('.tmp')) {
console.log(`📝 Change detected in ${filename}`);
rebuildPackage();
}
});
// Handle process termination
process.on('SIGINT', () => {
console.log('\n👋 Stopping development server...');
viteProcess.kill();
process.exit();
});
viteProcess.on('close', (code) => {
console.log(`Vite process exited with code ${code}`);
process.exit(code);
});

View file

@ -1,54 +1,7 @@
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
import { resolve } from 'path';
import fs from 'fs';
import path from 'path';
import { superProductivityPlugin } from '@super-productivity/vite-plugin';
export default defineConfig({
plugins: [
solidPlugin(),
{
name: 'copy-files',
closeBundle() {
// Copy manifest.json to dist
const manifestSrc = path.resolve(__dirname, 'src/manifest.json');
const manifestDest = path.resolve(__dirname, 'dist/manifest.json');
fs.copyFileSync(manifestSrc, manifestDest);
// Copy icon.svg to dist root
const iconSrc = path.resolve(__dirname, 'src/assets/icon.svg');
const iconDest = path.resolve(__dirname, 'dist/icon.svg');
fs.copyFileSync(iconSrc, iconDest);
// Move index.html from src subdirectory to root
const htmlSrc = path.resolve(__dirname, 'dist/src/index.html');
const htmlDest = path.resolve(__dirname, 'dist/index.html');
if (fs.existsSync(htmlSrc)) {
fs.renameSync(htmlSrc, htmlDest);
// Remove the src directory
fs.rmSync(path.resolve(__dirname, 'dist/src'), {
recursive: true,
force: true,
});
}
},
},
],
build: {
outDir: 'dist',
emptyOutDir: true,
rollupOptions: {
input: {
index: resolve(__dirname, 'src/index.html'),
plugin: resolve(__dirname, 'src/plugin.ts'),
},
output: {
entryFileNames: '[name].js',
chunkFileNames: '[name]-[hash].js',
assetFileNames: '[name].[ext]',
},
},
copyPublicDir: false,
},
publicDir: 'src/assets',
plugins: [solidPlugin(), superProductivityPlugin()],
});

View file

@ -5,8 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"dev:watch": "node scripts/watch-and-build.js",
"build": "vite build && node scripts/inline-assets.js",
"build": "vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"deploy": "npm run build",
@ -20,7 +19,8 @@
"typescript": "^5.8.3",
"vite": "^7.2.0",
"vite-plugin-solid": "^2.11.10",
"archiver": "^7.0.1"
"archiver": "^7.0.1",
"@super-productivity/vite-plugin": "file:../../vite-plugin"
},
"dependencies": {
"@super-productivity/plugin-api": "file:../../plugin-api"

View file

@ -1,61 +0,0 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const distDir = path.join(__dirname, '../dist');
const targetDir = path.join(
__dirname,
'../../../../src/assets/bundled-plugins/procrastination-buster',
);
// Read the HTML file
const htmlPath = path.join(distDir, 'index.html');
let html = fs.readFileSync(htmlPath, 'utf8');
// Read and inline JavaScript
const jsPath = path.join(distDir, 'index.js');
if (fs.existsSync(jsPath)) {
const js = fs.readFileSync(jsPath, 'utf8');
// Find script tag and replace with inline version, preserving type="module"
html = html.replace(
/<script([^>]*)src="[^"]*index\.js"[^>]*><\/script>/g,
(match, attrs) => {
// Check if it has type="module"
if (attrs.includes('type="module"') || match.includes('type="module"')) {
return `<script type="module">${js}</script>`;
}
return `<script>${js}</script>`;
},
);
}
// Read and inline CSS
const cssPath = path.join(distDir, 'index.css');
if (fs.existsSync(cssPath)) {
const css = fs.readFileSync(cssPath, 'utf8');
html = html.replace(/<link[^>]*href="[^"]*index\.css"[^>]*>/g, `<style>${css}</style>`);
}
// Create target directory if it doesn't exist
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir, { recursive: true });
}
// Write the inlined HTML to the target directory
const targetHtmlPath = path.join(targetDir, 'index.html');
fs.writeFileSync(targetHtmlPath, html);
// Copy other required files
const filesToCopy = ['manifest.json', 'plugin.js', 'icon.svg'];
filesToCopy.forEach((file) => {
const srcPath = path.join(distDir, file);
const destPath = path.join(targetDir, file);
if (fs.existsSync(srcPath)) {
fs.copyFileSync(srcPath, destPath);
}
});
console.log('Assets inlined and deployed successfully!');

View file

@ -1,64 +0,0 @@
#!/usr/bin/env node
import { spawn } from 'child_process';
import { fileURLToPath } from 'url';
import path from 'path';
import fs from 'fs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const projectRoot = path.dirname(__dirname);
console.log('🚀 Starting development server with auto-packaging...\n');
// Start Vite dev server
const viteProcess = spawn('npm', ['run', 'dev'], {
cwd: projectRoot,
stdio: 'inherit',
shell: true,
});
// Watch for changes and rebuild package
const srcPath = path.join(projectRoot, 'src');
let buildTimeout;
const rebuildPackage = () => {
if (buildTimeout) clearTimeout(buildTimeout);
buildTimeout = setTimeout(async () => {
console.log('\n📦 Building plugin package...');
const buildProcess = spawn('npm', ['run', 'package'], {
cwd: projectRoot,
stdio: 'inherit',
shell: true,
});
buildProcess.on('close', (code) => {
if (code === 0) {
console.log('✅ Plugin package built successfully!\n');
} else {
console.error('❌ Failed to build plugin package\n');
}
});
}, 1000); // Debounce for 1 second
};
// Watch src directory for changes
fs.watch(srcPath, { recursive: true }, (eventType, filename) => {
if (filename && !filename.includes('.swp') && !filename.includes('.tmp')) {
console.log(`📝 Change detected in ${filename}`);
rebuildPackage();
}
});
// Handle process termination
process.on('SIGINT', () => {
console.log('\n👋 Stopping development server...');
viteProcess.kill();
process.exit();
});
viteProcess.on('close', (code) => {
console.log(`Vite process exited with code ${code}`);
process.exit(code);
});

View file

@ -1,55 +1,8 @@
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
import { resolve } from 'path';
import fs from 'fs';
import path from 'path';
import { superProductivityPlugin } from '@super-productivity/vite-plugin';
export default defineConfig({
base: './',
plugins: [
solidPlugin(),
{
name: 'copy-files',
closeBundle() {
// Copy manifest.json to dist
const manifestSrc = path.resolve(__dirname, 'src/manifest.json');
const manifestDest = path.resolve(__dirname, 'dist/manifest.json');
fs.copyFileSync(manifestSrc, manifestDest);
// Copy icon.svg to dist root
const iconSrc = path.resolve(__dirname, 'src/assets/icon.svg');
const iconDest = path.resolve(__dirname, 'dist/icon.svg');
fs.copyFileSync(iconSrc, iconDest);
// Move index.html from src subdirectory to root
const htmlSrc = path.resolve(__dirname, 'dist/src/index.html');
const htmlDest = path.resolve(__dirname, 'dist/index.html');
if (fs.existsSync(htmlSrc)) {
fs.renameSync(htmlSrc, htmlDest);
// Remove the src directory
fs.rmSync(path.resolve(__dirname, 'dist/src'), {
recursive: true,
force: true,
});
}
},
},
],
build: {
outDir: 'dist',
emptyOutDir: true,
rollupOptions: {
input: {
index: resolve(__dirname, 'src/index.html'),
plugin: resolve(__dirname, 'src/plugin.ts'),
},
output: {
entryFileNames: '[name].js',
chunkFileNames: '[name]-[hash].js',
assetFileNames: '[name].[ext]',
},
},
copyPublicDir: false,
},
publicDir: 'src/assets',
plugins: [solidPlugin(), superProductivityPlugin()],
});

3
packages/vite-plugin/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
node_modules
dist
*.tsbuildinfo

View file

@ -0,0 +1,17 @@
{
"name": "@super-productivity/vite-plugin",
"version": "1.0.0",
"description": "Vite plugin for Super Productivity plugins",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc"
},
"dependencies": {
"vite": "^6.0.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"typescript": "^5.0.0"
}
}

View file

@ -0,0 +1,120 @@
import { Plugin, UserConfig } from 'vite';
import path from 'path';
import fs from 'fs';
export interface SuperProductivityPluginOptions {
/**
* Whether to inline assets (JS/CSS) into index.html.
* Useful for plugins with UI that need to be single-file.
* Default: true
*/
inlineAssets?: boolean;
}
export function superProductivityPlugin(
options: SuperProductivityPluginOptions = {},
): Plugin {
const { inlineAssets = true } = options;
let config: UserConfig;
return {
name: 'super-productivity-plugin',
config(userConfig) {
config = userConfig;
return {
build: {
outDir: 'dist',
emptyOutDir: true,
rollupOptions: {
input: {
// We try to detect input files, but user can override
plugin: path.resolve(process.cwd(), 'src/plugin.ts'),
...(fs.existsSync(path.resolve(process.cwd(), 'src/index.html'))
? { index: path.resolve(process.cwd(), 'src/index.html') }
: {}),
},
output: {
entryFileNames: '[name].js',
chunkFileNames: '[name]-[hash].js',
assetFileNames: '[name].[ext]',
},
},
copyPublicDir: false,
},
publicDir: 'src/assets',
};
},
closeBundle: {
order: 'post',
handler() {
const distDir = path.resolve(process.cwd(), 'dist');
// 1. Copy manifest.json
const manifestSrc = path.resolve(process.cwd(), 'src/manifest.json');
const manifestDest = path.join(distDir, 'manifest.json');
if (fs.existsSync(manifestSrc)) {
fs.copyFileSync(manifestSrc, manifestDest);
}
// 2. Copy icon.svg
const iconSrc = path.resolve(process.cwd(), 'src/assets/icon.svg');
const iconDest = path.join(distDir, 'icon.svg');
if (fs.existsSync(iconSrc)) {
// Ensure dist exists (it should after build)
if (!fs.existsSync(distDir)) fs.mkdirSync(distDir, { recursive: true });
fs.copyFileSync(iconSrc, iconDest);
}
// 3. Handle index.html and inlining
const htmlPath = path.join(distDir, 'index.html');
// Sometimes Vite outputs index.html in dist/src/index.html depending on input config
// Let's try to find it and move it to root if needed
const nestedHtmlPath = path.join(distDir, 'src/index.html');
if (fs.existsSync(nestedHtmlPath) && !fs.existsSync(htmlPath)) {
fs.renameSync(nestedHtmlPath, htmlPath);
// Try to remove the src directory if empty or just contains html
try {
fs.rmSync(path.join(distDir, 'src'), { recursive: true, force: true });
} catch (e) {
// ignore
}
}
if (inlineAssets && fs.existsSync(htmlPath)) {
let html = fs.readFileSync(htmlPath, 'utf8');
const jsPath = path.join(distDir, 'index.js');
const cssPath = path.join(distDir, 'index.css');
// Inline JS
if (fs.existsSync(jsPath)) {
const js = fs.readFileSync(jsPath, 'utf8');
html = html.replace(
/<script([^>]*)src="[^"]*index\.js"[^>]*><\/script>/g,
(match, attrs) => {
if (attrs.includes('type="module"') || match.includes('type="module"')) {
return `<script type="module">${js}</script>`;
}
return `<script>${js}</script>`;
},
);
// Also handle module preload links which might be generated
html = html.replace(/<link rel="modulepreload" href="[^"]*index\.js">/g, '');
}
// Inline CSS
if (fs.existsSync(cssPath)) {
const css = fs.readFileSync(cssPath, 'utf8');
html = html.replace(
/<link[^>]*rel="stylesheet"[^>]*href="[^"]*index\.css"[^>]*>/g,
`<style>${css}</style>`,
);
}
fs.writeFileSync(htmlPath, html);
console.log('✅ Assets inlined successfully');
}
},
},
};
}

View file

@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true
},
"include": ["src/**/*"]
}