20efcf404c
* set target to ES5 * refactor types * use .gitkeep * use dot to make dist/js dirs on top * add hako * add Hako * add madara * fix: url path js -> .js * fix: branch * freestyle for using UA, cookie * add parseNovels for Hako * update readme * fix: conflict types * add Kolnovel, remove node-fetch * add bestlightnovel * add plugins * WQMangaStreamScraper * PandaMTL * NobleMTL * LightNovelBrasil * WPMangaStream * add filters for popularNovels * fix undefined json * Linovelib (#26) * linovelib CN * icon for linovelib * fix undefined chapter * add check * fix: add artist * TuNovelaLigera ES + Madara Fix (#28) * app repo test * POST is now working * update madara template + run generator * template fix didnt get pushed commited idk why * template update POST * generated * fix: useNewChapterEndpoint update (#29) * useNewChapterEndpoint update * Update Selectors --------- Co-authored-by: K1ngfish3r <trulyihu@gmail.com>
29 lines
816 B
TypeScript
29 lines
816 B
TypeScript
import { ScrpitGeneratorFunction } from "../generate";
|
|
import list from "./sources.json";
|
|
import { MadaraMetadata } from "./template";
|
|
import { readFileSync } from 'fs';
|
|
import path from "path";
|
|
|
|
|
|
export const generateAll: ScrpitGeneratorFunction = function () {
|
|
return list.map((metadata: MadaraMetadata) => {
|
|
return generator(metadata);
|
|
});
|
|
};
|
|
|
|
const generator = function generator(metadata: MadaraMetadata) {
|
|
const lang = metadata.options?.lang || "English";
|
|
|
|
const madaraTemplate = readFileSync(path.join(__dirname, 'template.ts'), {encoding: 'utf-8'});
|
|
const pluginScript = `
|
|
${madaraTemplate}
|
|
const plugin = new MadaraPlugin(${JSON.stringify(metadata)});
|
|
export default plugin;
|
|
`
|
|
return {
|
|
lang,
|
|
filename: metadata.sourceName,
|
|
pluginScript,
|
|
};
|
|
};
|