20c2b75b01
* 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
32 lines
798 B
JavaScript
32 lines
798 B
JavaScript
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));
|
|
|
|
export const generateAll = function () {
|
|
return list.map(metadata => {
|
|
console.log(`[ranobes]: Generating`, metadata.id);
|
|
return generator(metadata);
|
|
});
|
|
};
|
|
|
|
const generator = function generator(metadata) {
|
|
const RanobesTemplate = readFileSync(join(folder, 'template.ts'), {
|
|
encoding: 'utf-8',
|
|
});
|
|
|
|
const pluginScript = `
|
|
${RanobesTemplate}
|
|
const plugin = new RanobesPlugin(${JSON.stringify(metadata)});
|
|
export default plugin;
|
|
`.trim();
|
|
|
|
return {
|
|
lang: metadata.options.lang,
|
|
filename: metadata.sourceName,
|
|
pluginScript,
|
|
};
|
|
};
|