[skip ci] dev: add scripts and description how to test plugins locally (#1601)

* add scripts and description how to test plugins locally

* add serve as an explicit dependency
This commit is contained in:
Karol
2025-03-31 07:45:42 +02:00
committed by GitHub
parent c372089462
commit a83ab58080
6 changed files with 1477 additions and 26 deletions
+7
View File
@@ -0,0 +1,7 @@
# Override the default user content base path
# Default when empty: https://raw.githubusercontent.com/${USERNAME}/${REPO}/${CURRENT_BRANCH}
#
# for android emulator use 10.0.2.2
# for iOS simulator use 127.0.0.1 or localhost
# for a real device use the IP address of your computer in the local network (e.g. 192.168.21.37)
USER_CONTENT_BASE=http://localhost:3000
+1 -1
View File
@@ -14,4 +14,4 @@ src/plugins/*/*\[*\]*.ts
dist
total.svg
src/plugins/index.ts
.history
.history
+7 -2
View File
@@ -30,8 +30,13 @@ Repository to host plugins and related issues, and requests for
#### via an app
1. Run `npm run host-linux` or `npm run host-windows` (depending on your operating system)
2. Add your `https://raw.githubusercontent.com/<username>/<repo>/plugins/<tag>/.dist/plugins.min.json` to app repository
1. Plugins from GitHub
* Run `npm run host-linux` or `npm run host-windows` (depending on your operating system)
* Add your `https://raw.githubusercontent.com/<username>/<repo>/plugins/<tag>/.dist/plugins.min.json` to app repository
2. Plugins from localhost
* Copy `.env.template` to `.env` and update `USER_CONTENT_BASE` according to the comment there
* Run `npm run host-dev`
* Add plugin listing to app repository (e.g. for android emulator `http://10.0.2.2/.dist/plugins.min.json`)
---
+1456 -21
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -11,8 +11,9 @@
"generate": "node ./scripts/multisrc/generate.js",
"host-linux": "chmod +x ./host.sh && ./host.sh",
"host-windows": "powershell ./host.ps1",
"host-dev": "npx tsc --project tsconfig.production.json && node --env-file=.env ./scripts/json_plugins.js && serve",
"icons": "npm run clearMultisrc && npm run generate && npx tsc --project tsconfig.production.json && npm run json && node ./scripts/icon_reloading.js",
"json": " node ./scripts/json_plugins.js",
"json": "node ./scripts/json_plugins.js",
"lint": "npx eslint .",
"prepare": "husky install",
"prettier": "prettier --write \"./**/*.{js,ts}\"",
@@ -58,6 +59,7 @@
"react-virtuoso": "^4.12.2",
"react-window": "^1.8.10",
"sanitize-html": "^2.13.1",
"serve": "^14.2.4",
"typescript-eslint": "^7.14.1",
"urlencode": "^2.0.0",
"vite": "^5.2.0",
+3 -1
View File
@@ -14,7 +14,9 @@ const matched = REMOTE.match(/([^:/]+?)\/([^/.]+)(\.git)?$/);
if (!matched) throw Error('Cant parse git url');
const USERNAME = matched[1];
const REPO = matched[2];
const USER_CONTENT_LINK = `https://raw.githubusercontent.com/${USERNAME}/${REPO}/${CURRENT_BRANCH}`;
const USER_CONTENT_LINK = process.env.USER_CONTENT_BASE
? process.env.USER_CONTENT_BASE
: `https://raw.githubusercontent.com/${USERNAME}/${REPO}/${CURRENT_BRANCH}`;
const STATIC_LINK = `${USER_CONTENT_LINK}/public/static`;
const PLUGIN_LINK = `${USER_CONTENT_LINK}/.js/src/plugins`;