Feat: Vite + React (#991)
* 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
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import list from './sources.json' with { type: 'json' };
|
||||
import { readFileSync } from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export const generateAll = function () {
|
||||
return list.map(metadata => {
|
||||
try {
|
||||
const { filters } = require(`./filters/${metadata.id}`);
|
||||
metadata.filters = filters;
|
||||
} catch (e) {}
|
||||
console.log(
|
||||
`[readwn] Generating: ${metadata.id}${' '.repeat(20 - metadata.id.length)} ${metadata.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
|
||||
);
|
||||
return generator(metadata);
|
||||
});
|
||||
};
|
||||
|
||||
const generator = function generator(metadata) {
|
||||
const readwnTemplate = readFileSync('./scripts/multisrc/readwn/template.ts', {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
|
||||
const pluginScript = `
|
||||
${readwnTemplate}
|
||||
const plugin = new ReadwnPlugin(${JSON.stringify(metadata)});
|
||||
export default plugin;
|
||||
`.trim();
|
||||
|
||||
return {
|
||||
lang: 'english',
|
||||
filename: metadata.sourceName,
|
||||
pluginScript,
|
||||
};
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
import { ScrpitGeneratorFunction } from '../generate';
|
||||
import { ReadwnMetadata } from './template';
|
||||
import list from './sources.json';
|
||||
import { readFileSync } from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export const generateAll: ScrpitGeneratorFunction = function (name) {
|
||||
return list.map((metadata: ReadwnMetadata) => {
|
||||
try {
|
||||
const { filters }: any = require(`./filters/${metadata.id}`);
|
||||
metadata.filters = filters;
|
||||
} catch (e) {}
|
||||
console.log(
|
||||
`[${name}] Generating: ${metadata.id}${' '.repeat(20 - metadata.id.length)} ${metadata.filters ? '🔎with filters🔍' : '🚫no filters🚫'}`,
|
||||
);
|
||||
return generator(metadata);
|
||||
});
|
||||
};
|
||||
|
||||
const generator = function generator(metadata: ReadwnMetadata) {
|
||||
const readwnTemplate = readFileSync(path.join(__dirname, 'template.ts'), {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
|
||||
const pluginScript = `
|
||||
${readwnTemplate}
|
||||
const plugin = new ReadwnPlugin(${JSON.stringify(metadata)});
|
||||
export default plugin;
|
||||
`.trim();
|
||||
|
||||
return {
|
||||
lang: 'english',
|
||||
filename: metadata.sourceName,
|
||||
pluginScript,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user