d36e8ec85f
* remove test_web * integrate reactjs-vite * update lint-staged * simple cors proxy server which handles cookies and redirections * overrider global fetch with proxy call * simple examples for set cookies and fetch request * app bar * add redux * loadPlugins. error: cant load urlencode module * add ts-node for transforming * plugin search & select * plugin slice * accordion components * path item & popular novel * optional for filters * search novel * parse novel * parseChapter * update cookies * default filters * fix: import path * bundler module resolution * new json_plugins * fix: generate multisrc (missing filters) * fix: host scripts * fix: plugin code path * remove typechecking action
41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
import list from './sources.json' with { type: 'json' };
|
|
import { readFileSync } from 'fs';
|
|
|
|
export const generateAll = function () {
|
|
return list.map(source => {
|
|
let filters = {};
|
|
try {
|
|
filters = require(`./filters/${source.id}`);
|
|
source.filters = filters.filters;
|
|
} catch (e) {}
|
|
console.log(
|
|
`[lightnovelwp] Generating: ${source.id}${' '.repeat(20 - source.id.length)} ${source.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
|
|
);
|
|
return generator(source);
|
|
});
|
|
};
|
|
|
|
const generator = function generator(source) {
|
|
const LightNovelWPTemplate = readFileSync(
|
|
'./scripts/multisrc/lightnovelwp/template.ts',
|
|
{
|
|
encoding: 'utf-8',
|
|
},
|
|
);
|
|
|
|
const pluginScript = `
|
|
${LightNovelWPTemplate.replace(
|
|
'// CustomJS HERE',
|
|
source.options?.customJs || '',
|
|
)}
|
|
const plugin = new LightNovelWPPlugin(${JSON.stringify(source)});
|
|
export default plugin;
|
|
`.trim();
|
|
|
|
return {
|
|
lang: source.options?.lang || 'English',
|
|
filename: source.sourceName,
|
|
pluginScript,
|
|
};
|
|
};
|