Prettier (#852)
* add prettier * lint-staged * prettier * upgrade husky
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import { FilterTypes, Filters } from "../../../libs/filterInputs";
|
||||
import { ScrpitGeneratorFunction } from "../generate";
|
||||
import list from "./sources.json";
|
||||
import defaultSettings from "./settings.json";
|
||||
import { ReadwnMetadata } from "./template";
|
||||
import { readFileSync } from "fs";
|
||||
import path from "path";
|
||||
import { FilterTypes, Filters } from '../../../libs/filterInputs';
|
||||
import { ScrpitGeneratorFunction } from '../generate';
|
||||
import list from './sources.json';
|
||||
import defaultSettings from './settings.json';
|
||||
import { ReadwnMetadata } from './template';
|
||||
import { readFileSync } from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
export const generateAll: ScrpitGeneratorFunction = function (name) {
|
||||
return list
|
||||
.map<ReadwnMetadata>((p) => {
|
||||
.map<ReadwnMetadata>(p => {
|
||||
p.filters.tags.options.unshift(...defaultSettings.filters.tags.options);
|
||||
p.filters.genres.options.unshift(...defaultSettings.filters.genres.options);
|
||||
p.filters.genres.options.unshift(
|
||||
...defaultSettings.filters.genres.options,
|
||||
);
|
||||
p.filters = Object.assign(defaultSettings.filters, p.filters);
|
||||
|
||||
const d = false;
|
||||
@@ -33,8 +35,8 @@ export const generateAll: ScrpitGeneratorFunction = function (name) {
|
||||
};
|
||||
|
||||
const generator = function generator(metadata: ReadwnMetadata) {
|
||||
const readwnTemplate = readFileSync(path.join(__dirname, "template.ts"), {
|
||||
encoding: "utf-8",
|
||||
const readwnTemplate = readFileSync(path.join(__dirname, 'template.ts'), {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
|
||||
//metadata.filters = {
|
||||
@@ -45,14 +47,15 @@ const generator = function generator(metadata: ReadwnMetadata) {
|
||||
|
||||
const pluginScript = `
|
||||
${readwnTemplate}
|
||||
const plugin = new ReadwnPlugin(${
|
||||
JSON.stringify(metadata).replace(/"type":"([^"]+)"/g, '"type":FilterTypes.$1')
|
||||
});
|
||||
const plugin = new ReadwnPlugin(${JSON.stringify(metadata).replace(
|
||||
/"type":"([^"]+)"/g,
|
||||
'"type":FilterTypes.$1',
|
||||
)});
|
||||
export default plugin;
|
||||
`.trim();
|
||||
|
||||
return {
|
||||
lang: "english",
|
||||
lang: 'english',
|
||||
filename: metadata.sourceName,
|
||||
pluginScript,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user