use @decky/rollup rollup config template

This commit is contained in:
AAGaming 2024-07-08 20:28:57 -04:00
parent 64310bcf71
commit 93ef11096f
No known key found for this signature in database
GPG key ID: 00CFCD925A3E0C50
4 changed files with 81 additions and 159 deletions

View file

@ -4,7 +4,7 @@
"description": "A template to quickly create decky plugins from scratch, based on TypeScript and webpack",
"type": "module",
"scripts": {
"build": "shx rm -rf dist && rollup -c",
"build": "rollup -c",
"watch": "rollup -c -w",
"test": "echo \"Error: no test specified\" && exit 1"
},
@ -26,26 +26,18 @@
},
"homepage": "https://github.com/SteamDeckHomebrew/decky-plugin-template#readme",
"devDependencies": {
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-typescript": "^11.1.6",
"@decky/rollup": "^1.0.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@types/webpack": "^5.28.5",
"rollup": "^4.18.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-external-globals": "^0.10.0",
"rollup-plugin-import-assets": "^1.1.1",
"shx": "^0.3.4",
"tslib": "^2.6.3",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
},
"dependencies": {
"@decky/api": "^1.0.5",
"@decky/ui": "^4.0.3",
"react-icons": "^5.2.1"
"react-icons": "^5.2.1",
"tslib": "^2.6.3"
},
"pnpm": {
"peerDependencyRules": {

View file

@ -14,23 +14,14 @@ dependencies:
react-icons:
specifier: ^5.2.1
version: 5.2.1
tslib:
specifier: ^2.6.3
version: 2.6.3
devDependencies:
'@rollup/plugin-commonjs':
specifier: ^26.0.1
version: 26.0.1(rollup@4.18.0)
'@rollup/plugin-json':
specifier: ^6.1.0
version: 6.1.0(rollup@4.18.0)
'@rollup/plugin-node-resolve':
specifier: ^15.2.3
version: 15.2.3(rollup@4.18.0)
'@rollup/plugin-replace':
specifier: ^5.0.7
version: 5.0.7(rollup@4.18.0)
'@rollup/plugin-typescript':
specifier: ^11.1.6
version: 11.1.6(rollup@4.18.0)(tslib@2.6.3)(typescript@5.4.5)
'@decky/rollup':
specifier: ^1.0.0
version: 1.0.0
'@types/react':
specifier: 18.3.3
version: 18.3.3
@ -43,24 +34,9 @@ devDependencies:
rollup:
specifier: ^4.18.0
version: 4.18.0
rollup-plugin-delete:
specifier: ^2.0.0
version: 2.0.0
rollup-plugin-external-globals:
specifier: ^0.10.0
version: 0.10.0(rollup@4.18.0)
rollup-plugin-import-assets:
specifier: ^1.1.1
version: 1.1.1(rollup@4.18.0)
shx:
specifier: ^0.3.4
version: 0.3.4
tslib:
specifier: ^2.6.3
version: 2.6.3
typescript:
specifier: ^5.4.5
version: 5.4.5
specifier: ^5.5.3
version: 5.5.3
packages:
@ -68,6 +44,23 @@ packages:
resolution: {integrity: sha512-ghIewwXzedYDq0l5eik21Rg0Fd3DFeniCIjL6M90Zc/bOH7vlKpgUGl+V/5/TvaGKkYW51hsMV6Usfy5OZFM7Q==}
dev: false
/@decky/rollup@1.0.0:
resolution: {integrity: sha512-8v8IMOoxf+e4yioD0O1Td+P4E62TRPxm2b3tuqRHM1xtUrUcrFA8ooC8AyCBaYP1QXwPZmhUURWBqLB4CgKE6w==}
dependencies:
'@rollup/plugin-commonjs': 26.0.1(rollup@4.18.0)
'@rollup/plugin-json': 6.1.0(rollup@4.18.0)
'@rollup/plugin-node-resolve': 15.2.3(rollup@4.18.0)
'@rollup/plugin-replace': 5.0.7(rollup@4.18.0)
'@rollup/plugin-typescript': 11.1.6(rollup@4.18.0)(tslib@2.6.3)(typescript@5.5.3)
merge-anything: 6.0.2
rollup: 4.18.0
rollup-plugin-delete: 2.0.0
rollup-plugin-external-globals: 0.11.0(rollup@4.18.0)
rollup-plugin-import-assets: 1.1.1(rollup@4.18.0)
tslib: 2.6.3
typescript: 5.5.3
dev: true
/@decky/ui@4.0.3:
resolution: {integrity: sha512-hlpf0QL3mrnv/Bl3T7AP9vHCbZhGPtlQVk1XJkvOdd43LJH9q6ErxdKe0YCvGTnvYcDm6vS90flYUGUY4zmEvw==}
dev: false
@ -161,7 +154,7 @@ packages:
'@rollup/pluginutils': 5.1.0(rollup@4.18.0)
commondir: 1.0.1
estree-walker: 2.0.2
glob: 10.4.1
glob: 10.4.4
is-reference: 1.2.1
magic-string: 0.30.10
rollup: 4.18.0
@ -212,7 +205,7 @@ packages:
rollup: 4.18.0
dev: true
/@rollup/plugin-typescript@11.1.6(rollup@4.18.0)(tslib@2.6.3)(typescript@5.4.5):
/@rollup/plugin-typescript@11.1.6(rollup@4.18.0)(tslib@2.6.3)(typescript@5.5.3):
resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==}
engines: {node: '>=14.0.0'}
peerDependencies:
@ -229,7 +222,7 @@ packages:
resolve: 1.22.8
rollup: 4.18.0
tslib: 2.6.3
typescript: 5.4.5
typescript: 5.5.3
dev: true
/@rollup/pluginutils@5.1.0(rollup@4.18.0):
@ -857,8 +850,8 @@ packages:
to-regex-range: 5.0.1
dev: true
/foreground-child@3.2.0:
resolution: {integrity: sha512-CrWQNaEl1/6WeZoarcM9LHupTo3RpZO2Pdk1vktwzPiQTsJnAKJmm3TACKeG5UZbWDfaH2AbvYxzP96y0MT7fA==}
/foreground-child@3.2.1:
resolution: {integrity: sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==}
engines: {node: '>=14'}
dependencies:
cross-spawn: 7.0.3
@ -892,15 +885,16 @@ packages:
resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==}
dev: true
/glob@10.4.1:
resolution: {integrity: sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==}
engines: {node: '>=16 || 14 >=14.18'}
/glob@10.4.4:
resolution: {integrity: sha512-XsOKvHsu38Xe19ZQupE6N/HENeHQBA05o3hV8labZZT2zYDg1+emxWHnc/Bm9AcCMPXfD6jt+QC7zC5JSFyumw==}
engines: {node: 14 >=14.21 || 16 >=16.20 || 18 || 20 || >=22}
hasBin: true
dependencies:
foreground-child: 3.2.0
jackspeak: 3.4.0
minimatch: 9.0.4
foreground-child: 3.2.1
jackspeak: 3.4.2
minimatch: 9.0.5
minipass: 7.1.2
package-json-from-dist: 1.0.0
path-scurry: 1.11.1
dev: true
@ -968,11 +962,6 @@ packages:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
dev: true
/interpret@1.4.0:
resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==}
engines: {node: '>= 0.10'}
dev: true
/is-builtin-module@3.2.1:
resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==}
engines: {node: '>=6'}
@ -980,8 +969,9 @@ packages:
builtin-modules: 3.3.0
dev: true
/is-core-module@2.13.1:
resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==}
/is-core-module@2.14.0:
resolution: {integrity: sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==}
engines: {node: '>= 0.4'}
dependencies:
hasown: 2.0.2
dev: true
@ -1034,13 +1024,18 @@ packages:
'@types/estree': 1.0.5
dev: true
/is-what@5.0.2:
resolution: {integrity: sha512-vI7Ui0qzNQ2ClDZd0bC7uqRk3T1imbX5cZODmVlqqdqiwmSIUX3CNSiRgFjFMJ987sVCMSa7xZeEDtpJduPg4A==}
engines: {node: '>=18'}
dev: true
/isexe@2.0.0:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
dev: true
/jackspeak@3.4.0:
resolution: {integrity: sha512-JVYhQnN59LVPFCEcVa2C3CrEKYacvjRfqIQl+h8oi91aLYQVWRYbxjPcv1bUiUy/kLmQaANrYfNMCO3kuEDHfw==}
engines: {node: '>=14'}
/jackspeak@3.4.2:
resolution: {integrity: sha512-qH3nOSj8q/8+Eg8LUPOq3C+6HWkpUioIjDsq1+D4zY91oZvpPttw8GwtF1nReRYKXl+1AORyFqtm2f5Q1SB6/Q==}
engines: {node: 14 >=14.21 || 16 >=16.20 || >=18}
dependencies:
'@isaacs/cliui': 8.0.2
optionalDependencies:
@ -1069,9 +1064,9 @@ packages:
engines: {node: '>=6.11.5'}
dev: true
/lru-cache@10.2.2:
resolution: {integrity: sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==}
engines: {node: 14 || >=16.14}
/lru-cache@10.4.1:
resolution: {integrity: sha512-8h/JsUc/2+Dm9RPJnBAmObGnUqTMmsIKThxixMLOkrebSihRhTV0wLD/8BSk6OU6Pbj8hiDTbsI3fLjBJSlhDg==}
engines: {node: 14 >= 14.21 || 16 >= 16.20 || 18 >=18.20 || 20 || >=22}
dev: true
/magic-string@0.30.10:
@ -1080,6 +1075,13 @@ packages:
'@jridgewell/sourcemap-codec': 1.4.15
dev: true
/merge-anything@6.0.2:
resolution: {integrity: sha512-U8x6DL/YVudOcf82B6hd8GFg+6gF6hEHYwzqdo67GrH6vnDZ5YBq6BYX3hHWyCnG3CcqJDB1a9tj9fzMI3RL9Q==}
engines: {node: '>=18'}
dependencies:
is-what: 5.0.2
dev: true
/merge-stream@2.0.0:
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
dev: true
@ -1115,17 +1117,13 @@ packages:
brace-expansion: 1.1.11
dev: true
/minimatch@9.0.4:
resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==}
/minimatch@9.0.5:
resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
engines: {node: '>=16 || 14 >=14.17'}
dependencies:
brace-expansion: 2.0.1
dev: true
/minimist@1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
dev: true
/minipass@7.1.2:
resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==}
engines: {node: '>=16 || 14 >=14.17'}
@ -1152,6 +1150,10 @@ packages:
aggregate-error: 3.1.0
dev: true
/package-json-from-dist@1.0.0:
resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==}
dev: true
/path-is-absolute@1.0.1:
resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==}
engines: {node: '>=0.10.0'}
@ -1170,7 +1172,7 @@ packages:
resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
engines: {node: '>=16 || 14 >=14.18'}
dependencies:
lru-cache: 10.2.2
lru-cache: 10.4.1
minipass: 7.1.2
dev: true
@ -1212,18 +1214,11 @@ packages:
optional: true
dev: false
/rechoir@0.6.2:
resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==}
engines: {node: '>= 0.10'}
dependencies:
resolve: 1.22.8
dev: true
/resolve@1.22.8:
resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==}
hasBin: true
dependencies:
is-core-module: 2.13.1
is-core-module: 2.14.0
path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0
dev: true
@ -1248,8 +1243,8 @@ packages:
del: 5.1.0
dev: true
/rollup-plugin-external-globals@0.10.0(rollup@4.18.0):
resolution: {integrity: sha512-RXlupZrmn97AaaS5dWnktkjM+Iy+od0E+8L0mUkMIs3iuoUXNJebueQocQKV7Ircd54fSGGmkBaXwNzY05J1yQ==}
/rollup-plugin-external-globals@0.11.0(rollup@4.18.0):
resolution: {integrity: sha512-LR+sH2WkgWMPxsA5o5rT7uW7BeWXSeygLe60QQi9qoN/ufaCuHDaVOIbndIkqDPnZt/wZugJh5DCzkZFdSWlLQ==}
peerDependencies:
rollup: ^2.25.0 || ^3.3.0 || ^4.1.4
dependencies:
@ -1339,25 +1334,6 @@ packages:
engines: {node: '>=8'}
dev: true
/shelljs@0.8.5:
resolution: {integrity: sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==}
engines: {node: '>=4'}
hasBin: true
dependencies:
glob: 7.2.3
interpret: 1.4.0
rechoir: 0.6.2
dev: true
/shx@0.3.4:
resolution: {integrity: sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g==}
engines: {node: '>=6'}
hasBin: true
dependencies:
minimist: 1.2.8
shelljs: 0.8.5
dev: true
/signal-exit@4.1.0:
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
engines: {node: '>=14'}
@ -1473,10 +1449,9 @@ packages:
/tslib@2.6.3:
resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==}
dev: true
/typescript@5.4.5:
resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==}
/typescript@5.5.3:
resolution: {integrity: sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==}
engines: {node: '>=14.17'}
hasBin: true
dev: true

View file

@ -1,49 +1,5 @@
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import typescript from '@rollup/plugin-typescript';
import { defineConfig } from 'rollup';
import del from 'rollup-plugin-delete';
import importAssets from 'rollup-plugin-import-assets';
import externalGlobals from 'rollup-plugin-external-globals';
import deckyPlugin from "@decky/rollup";
// replace "assert" with "with" once node implements that
import manifest from './plugin.json' assert { type: 'json' };
export default defineConfig({
input: './src/index.tsx',
plugins: [
del({ targets: './dist/*', force: true }),
commonjs(),
nodeResolve({
browser: true
}),
externalGlobals({
react: 'SP_REACT',
'react-dom': 'SP_REACTDOM',
'@decky/ui': 'DFL',
'@decky/manifest': JSON.stringify(manifest)
}),
typescript(),
json(),
replace({
preventAssignment: false,
'process.env.NODE_ENV': JSON.stringify('production'),
}),
importAssets({
publicPath: `http://127.0.0.1:1337/plugins/${manifest.name}/`
export default deckyPlugin({
// Add your extra Rollup options here
})
],
context: 'window',
external: ['react', 'react-dom', '@decky/ui'],
output: {
dir: 'dist',
format: 'esm',
sourcemap: true,
// **Don't** change this.
sourcemapPathTransform: (relativeSourcePath) => relativeSourcePath.replace(/^\.\.\//, `decky://decky/plugin/${encodeURIComponent(manifest.name)}/`),
exports: 'default'
},
});

View file

@ -2,9 +2,8 @@ import {
ButtonItem,
PanelSection,
PanelSectionRow,
Router,
// ServerAPI,
staticClasses,
Navigation,
staticClasses
} from "@decky/ui";
import {
addEventListener,