From 224e20d23ecff2e3c6d6a836b48ad40e4ea63f71 Mon Sep 17 00:00:00 2001 From: Rojikku Date: Thu, 5 Feb 2026 19:14:31 -0500 Subject: [PATCH 1/6] refactor: Consolidate npm scripts --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1d30a90d6..6f69323cf 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,11 @@ "main": "index.js", "type": "module", "scripts": { - "clean:multisrc": "find . -type f -wholename \"*plugins*\\[*\\]*.[t,j]s\" -delete", - "clean:multisrc:windows": "powershell -Command \"Get-ChildItem -Recurse -Include \\\"*].ts\\\",\\\"*].js\\\" | Where-Object { $_.FullName -like \\\"*plugins*\\\" } | Remove-Item\"", + "clean:multisrc": "git clean -dX ./plugins -i", "dev": "vite", - "dev:start": "node ./plugins/multisrc/generate-multisrc-plugins.js && node scripts/generate-plugin-index.js && vite", + "dev:start": "npm run dev:prep && vite", + "dev:auto": "npm run dev:prep && vite --no-open", + "dev:prep": "npm run build:multisrc && node scripts/generate-plugin-index.js", "build:multisrc": "node ./plugins/multisrc/generate-multisrc-plugins.js", "build:compile": "npx tsc --project tsconfig.production.json", "build:manifest": "node ./scripts/build-plugin-manifest.js", From 653d2fd99b8cbb749f7fc7bc6a5f87a1a470c2a3 Mon Sep 17 00:00:00 2001 From: Rojikku Date: Thu, 5 Feb 2026 19:14:51 -0500 Subject: [PATCH 2/6] feat: VScode defaults --- .vscode/extensions.json | 8 ++++++ .vscode/launch.json | 27 ++++++++++++++++++++ .vscode/tasks.json | 56 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..b320cd409 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + "recommendations": [ + "oderwat.indent-rainbow", + "tzachovadia.todo-list", + "esbenp.prettier-vscode", + "firefox-devtools.vscode-firefox-debug" + ] +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..316431651 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "npm run dev:start", + "name": "Run npm dev:start", + "request": "launch", + "type": "node-terminal" + }, + { + "name": "Chrome Debug", + "request": "launch", + "type": "chrome", + "url": "http://localhost:3000", + "webRoot": "${workspaceFolder}/src", + "preLaunchTask": "npm: dev:auto" + }, + { + "name": "Firefox Debug", + "request": "launch", + "type": "firefox", + "url": "http://localhost:3000", + "webRoot": "${workspaceFolder}/src", + "preLaunchTask": "npm: dev:auto" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 000000000..211b64e2d --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,56 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "dev:prep", + "problemMatcher": [], + "label": "npm: dev:prep", + "detail": "Builds multisource files and plugin index for use in Vite/Dev Playground", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "type": "npm", + "script": "dev:auto", + "label": "npm: dev:auto", + "detail": "Runs dev:prep, then starts vite daemon", + "isBackground": true, + "problemMatcher": [ + { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": "." + } + } + ] + }, + { + "type": "npm", + "script": "clean:multisrc", + "problemMatcher": [], + "label": "npm: clean:multisrc", + "detail": "Interactive git clean of ignored files under ./plugins" + }, + { + "type": "npm", + "script": "format", + "problemMatcher": [], + "label": "npm: format", + "detail": "Overwrite file with corrected formatting" + } + ] +} \ No newline at end of file From 07ba96dbb1d2a6480768f0f75dc519ced0757f35 Mon Sep 17 00:00:00 2001 From: Rojikku Date: Thu, 5 Feb 2026 19:16:22 -0500 Subject: [PATCH 3/6] feat: codespace defaults --- .devcontainer/devcontainer.json | 34 +++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 35 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..527ded244 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node +{ + "name": "lnreader-plugins", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/javascript-node:4.0-24-bookworm", + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + "settings": {}, + "extensions": [ + "streetsidesoftware.code-spell-checker", + "esbenp.prettier-vscode" + ] + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [3000], + // Use 'portsAttributes' to set default properties for specific forwarded ports. + // More info: https://containers.dev/implementors/json_reference/#port-attributes + "portsAttributes": { + "3000": { + "label": "Vite Dev Playground", + "onAutoForward": "notify" + } + }, + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "npm install" + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 99be8a8fe..488d50a7f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules .vscode +.devcontainer .idea .env config.json From a131c853c8d2c556bdcf4b3c982981894042a1ba Mon Sep 17 00:00:00 2001 From: Rojikku Date: Thu, 5 Feb 2026 19:56:00 -0500 Subject: [PATCH 4/6] Add more recommendations --- .vscode/extensions.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b320cd409..b476b1352 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,6 +3,8 @@ "oderwat.indent-rainbow", "tzachovadia.todo-list", "esbenp.prettier-vscode", - "firefox-devtools.vscode-firefox-debug" + "firefox-devtools.vscode-firefox-debug", + "ms-vscode-remote.remote-containers", + "github.vscode-pull-request-github" ] } \ No newline at end of file From ee57e4acba674140d46b09b7adef828d48e4e00e Mon Sep 17 00:00:00 2001 From: Rojikku Date: Thu, 5 Feb 2026 20:29:48 -0500 Subject: [PATCH 5/6] Update/Add codespaces to docs --- README.md | 12 ++++++++++++ docs/quickstart.md | 47 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6a24a9c95..0a5732080 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,18 @@ Add your repository URL to the app: https://raw.githubusercontent.com///plugins//.dist/plugins.min.json ``` +**From GitHub (Manual):** + +There is a npm command that will push your current code to the same link as above: + +``` +npm run publish:plugins +``` +Or on windows +``` +npm run publish:plugins:windows +``` + **From Localhost:** ```bash diff --git a/docs/quickstart.md b/docs/quickstart.md index ea36a23be..500111004 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -1,14 +1,16 @@ # Quick start 1. [Requirements](#requirements) -2. [Single plugin guide](#quick-guide) -3. [Multi-src guide](#creating-multi-src-plugins) +2. [Single plugin guide](#guide) +3. [Multi-src guide](#creating-multi-source-plugins) +3. [Dev Containers / Codespaces](#dev-containers--codespaces) +3. [VScode](#vscode) ### Requirements - [git](https://git-scm.com/doc/ext) basics - Typescript or Javascript basics -- Node >=18 +- Node >=20 - Installing the dependencies with `npm i` ### Guide @@ -20,6 +22,7 @@ #### Creating plugin script 1. Remember to create your plugin inside the language folder corresponding to the language of the novels +Recommend checking that the site doesn't have a wordpress theme, as it may be a simple addition to a multisrc config. 2. File should have the `.ts` extension Example `plugins/english/nobleMTL.ts` 3. Add an icon to `icons/src///icon.png` @@ -28,3 +31,41 @@ > Icon size should be 96x96px! ### Creating multi-source plugins +TBD, but in the meantime, you can check out `/plugins/multisrc` for examples! + +#### Adding a multi-source source +You edit `sources.json` inside the relevant `/plugins/multisrc/*/` folder for your website template/theme. + +Example +```json + { + "id": "totallyrealnovel", + "sourceSite": "https://veryreal.example.com/", + "sourceName": "TotallyRealNovel", + "options": { + "useNewChapterEndpoint": true + } + }, + ``` + +### Dev Containers / Codespaces +You can use the VScode [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension to spin up a docker container on your local machine with a valid dev environment, if you prefer. Do note a docker container requires more resources than setting up the environment properly, but can be simpler and more consistent. + +Codespaces will *mostly* work, but **it's not currently possible to fetch any pages from dev playground.** This is due to CORS, but even with that bypassed, the codespace is hosted in a datacenter, which is often IP blocked. + +Either will automatically run `npm install` + +### VScode + +#### Build +The multisrc generators generate `.ts` files inside the relevant language directories, and you will need these during local testing. It is setup within VScode as build. `Terminal > Run Build Task` will trigger it. + +#### Debug/Testing + +You can `Run > Start Debugging` or use the Run and Debug panel to launch vite, which will trigger the builds, and then launch vite the same as `npm run dev:start` would have. It will attach the debugger, to vite, which is probably less helpful than the browser's built in debugging tools and console. + +Vite will automatically reload when you save files, so you can edit the relevant `.ts` file, save it, and test immediately with results. The only exception is multisrc which must be rebuilt/regenerated. + +#### Extensions + +Recommended extensions for this repo have been set to pop up in the window. From c3420d7778f695a11295e702d404f397e3f47d76 Mon Sep 17 00:00:00 2001 From: Rojikku Date: Thu, 5 Feb 2026 21:00:45 -0500 Subject: [PATCH 6/6] Listen on all IPs --- vite.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vite.config.ts b/vite.config.ts index be796289f..a5529af90 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -31,6 +31,7 @@ export default defineConfig({ }, server: { port: 3000, + host: true, open: true, }, });