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:
nyagami
2024-06-16 18:13:41 +07:00
committed by GitHub
parent a4cb781f32
commit d36e8ec85f
333 changed files with 5857 additions and 28579 deletions
+59
View File
@@ -0,0 +1,59 @@
import path from 'path';
import fs from 'fs';
// type GeneratedScript = {
// lang: string;
// filename: string;
// pluginScript: string;
// };
// export type ScrpitGeneratorFunction = () => GeneratedScript[];
const isScriptGenerator = s => {
return !!s && typeof s === 'function';
};
const generate = async name => {
try {
const generateAll = (await import(`./${name}/generator.js`)).generateAll;
if (!isScriptGenerator(generateAll)) return false;
const sources = generateAll();
for (let source of sources) {
const { lang, filename, pluginScript } = source;
if (!lang || !filename || !pluginScript) {
console.warn(name, ': lang, filename, pluginScript are required!');
continue;
}
const pluginsDir = './src/plugins';
const filePath = path.join(
pluginsDir,
lang.toLowerCase(),
filename.replace(/[\s-\.]+/g, '') + `[${name}].ts`,
);
fs.writeFileSync(filePath, pluginScript, { encoding: 'utf-8' });
}
return true;
} catch (e) {
console.log(`${name} is broken! ${e}\n`);
return false;
}
};
const MULTISRC_DIR = './scripts/multisrc';
const run = async () => {
const sources = fs
.readdirSync(MULTISRC_DIR)
.filter(
name =>
fs.lstatSync(path.join(MULTISRC_DIR, name)).isDirectory() &&
!name.endsWith('.broken'),
);
for (let name of sources) {
const success = await generate(name);
if (success) console.log(`[${name}] OK`);
}
};
run();