Implement loading dumped data for the handbook

This commit is contained in:
KingRainbow44 2023-04-06 04:54:10 -04:00
parent 7c4186f5df
commit 12898f6228
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
7 changed files with 26 additions and 2 deletions

View File

@ -22,3 +22,6 @@ dist-ssr
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
# Handbook data
data/

View File

@ -0,0 +1,7 @@
# Handbook Data
Use Grasscutter's dumpers to generate the data to put here.
## Files Required
- `avatars.json`
- `commands.json`
- `items.csv`

View File

@ -28,6 +28,7 @@
"vite-tsconfig-paths": "^4.0.7", "vite-tsconfig-paths": "^4.0.7",
"vite-plugin-singlefile": "^0.13.5", "vite-plugin-singlefile": "^0.13.5",
"@vitejs/plugin-react-swc": "^3.0.0", "@vitejs/plugin-react-swc": "^3.0.0",
"@rollup/plugin-dsv": "^3.0.2",
"sass": "^1.58.3", "sass": "^1.58.3",
"cssnano": "^5.1.15", "cssnano": "^5.1.15",

View File

@ -0,0 +1,5 @@
import avatars from "@data/avatars.json";
import commands from "@data/commands.json";
import items from "@data/items.csv";
console.log(avatars, commands, items);

View File

@ -1,3 +1,8 @@
declare module "*.svg" { declare module "*.svg" {
export const ReactComponent: React.FunctionComponent<React.SVGAttributes<SVGElement>>; export const ReactComponent: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
} }
declare module "*.csv" {
const content: any[];
export default content;
}

View File

@ -24,7 +24,8 @@
"@components/*": ["src/ui/*"], "@components/*": ["src/ui/*"],
"@icons/*": ["src/icons/*"], "@icons/*": ["src/icons/*"],
"@views/*": ["src/ui/views/*"], "@views/*": ["src/ui/views/*"],
"@pages/*": ["src/ui/pages/*"] "@pages/*": ["src/ui/pages/*"],
"@data/*": ["data/*"]
} }
}, },
"include": ["src"], "include": ["src"],

View File

@ -5,6 +5,7 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc"; import react from "@vitejs/plugin-react-swc";
import tsconfigPaths from "vite-tsconfig-paths"; import tsconfigPaths from "vite-tsconfig-paths";
import dsv from "@rollup/plugin-dsv";
import viteSvgr from "vite-plugin-svgr"; import viteSvgr from "vite-plugin-svgr";
import { viteSingleFile } from "vite-plugin-singlefile"; import { viteSingleFile } from "vite-plugin-singlefile";
@ -12,6 +13,7 @@ import postcss from "./cfg/postcss.config.js";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ react(), tsconfigPaths(), viteSvgr(), viteSingleFile() ], plugins: [ react(), tsconfigPaths(), dsv(),
viteSvgr(), viteSingleFile() ],
css: { postcss } css: { postcss }
}); });