refactor: Overhaul Plugin Architecture & Playground UI (#1846)

* refactor: Move Plugins Out and Consolidate with Multisrc

* feat: Overhaul Playground UI

* feat: Add Filters to New UI

* feat: Persist Selected Plugin

* feat: Add Direct Parse Novel/Chapter Options and Feedback Toasts

[skip ci]

* feat: UX Improvements

* chore: Update Plugin Path in Publish Workflow

* fix: Add Backward Compatibility

* chore: Update Plugin Publishing Script
This commit is contained in:
Rajarshee Chatterjee
2025-10-20 22:54:08 +05:30
committed by GitHub
parent 252beff0bf
commit 20c2b75b01
363 changed files with 6848 additions and 3007 deletions
+63
View File
@@ -0,0 +1,63 @@
import list from './sources.json' with { type: 'json' };
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const folder = dirname(fileURLToPath(import.meta.url));
const FilterTypes = {
TextInput: 'Text',
Picker: 'Picker',
CheckboxGroup: 'Checkbox',
Switch: 'Switch',
ExcludableCheckboxGroup: 'XCheckbox',
};
const lang = {
en: 'english',
ru: 'russian',
es: 'spanish',
pt: 'portuguese',
th: 'turkish',
};
export const generateAll = function () {
return list
.map(p => {
const filters = {};
for (const k in p.filters) {
const f = p.filters[k];
if (f) {
filters[k] = {
...f,
type: FilterTypes.Picker,
};
}
}
return { ...p, filters };
})
.map(metadata => {
console.log(`[hotnovelpub]: Generating`, metadata.id);
return generator(metadata);
});
};
const generator = function generator(metadata) {
const HotNovelPubTemplate = readFileSync(join(folder, 'template.ts'), {
encoding: 'utf-8',
});
const pluginScript = `
${HotNovelPubTemplate}
const plugin = new HotNovelPubPlugin(${JSON.stringify(metadata).replace(
/"type":"([^"]+)"/g,
'"type":FilterTypes.$1',
)});
export default plugin;
`.trim();
return {
lang: lang[metadata?.options?.lang || 'en'] || 'english',
filename: metadata.sourceName,
pluginScript,
};
};