mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
refactor(es modules): set up aliases
This commit is contained in:
parent
7755d8b588
commit
9206f46c42
4 changed files with 27 additions and 18 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import {prompt} from "/src/scripts/prompt";
|
import {stored, byId, store} from "utils/shorthands";
|
||||||
import {byId, store, stored} from "/src/utils/shorthands";
|
|
||||||
import {layerIsOn} from "./utils";
|
import {layerIsOn} from "./utils";
|
||||||
|
|
||||||
export function initLayers() {
|
export function initLayers() {
|
||||||
|
|
@ -77,12 +76,14 @@ const defaultPresets = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function restoreCustomPresets() {
|
function restoreCustomPresets() {
|
||||||
const storedPresets = JSON.parse(stored("presets"));
|
const storedPresentsRaw = stored("presets");
|
||||||
if (!storedPresets) {
|
if (!storedPresentsRaw) {
|
||||||
presets = structuredClone(defaultPresets);
|
presets = structuredClone(defaultPresets);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const storedPresets = JSON.parse(storedPresentsRaw);
|
||||||
|
|
||||||
for (const preset in storedPresets) {
|
for (const preset in storedPresets) {
|
||||||
if (presets[preset]) continue;
|
if (presets[preset]) continue;
|
||||||
byId("layersPreset").add(new Option(preset, preset));
|
byId("layersPreset").add(new Option(preset, preset));
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {byId} from "/src/utils/shorthands";
|
import {byId} from "utils/shorthands";
|
||||||
import {updatePresetInput} from "./init";
|
import {updatePresetInput} from "./init";
|
||||||
|
|
||||||
export function layerIsOn(toggleId: string) {
|
export function layerIsOn(toggleId: string) {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"baseUrl": "."
|
"baseUrl": "src"
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,22 @@
|
||||||
// import {defineConfig} from "vite";
|
import {defineConfig} from "vite";
|
||||||
// import {fileURLToPath} from "url";
|
import {fileURLToPath} from "url";
|
||||||
// import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
// const pathName = path.dirname(fileURLToPath(import.meta.url));
|
const pathName = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
// export default defineConfig({
|
export default defineConfig({
|
||||||
// // base: "/Fantasy-Map-Generator/",
|
base: "/Fantasy-Map-Generator/",
|
||||||
// resolve: {
|
resolve: {
|
||||||
// alias: [
|
alias: [
|
||||||
// {find: "@", replacement: path.resolve(pathName, "./src")}
|
{find: "src", replacement: path.resolve(pathName, "./src")},
|
||||||
// ]
|
{find: "components", replacement: path.resolve(pathName, "./src/components")},
|
||||||
// }
|
{find: "config", replacement: path.resolve(pathName, "./src/config")},
|
||||||
// });
|
{find: "constants", replacement: path.resolve(pathName, "./src/constants")},
|
||||||
|
{find: "layers", replacement: path.resolve(pathName, "./src/layers")},
|
||||||
|
{find: "libs", replacement: path.resolve(pathName, "./src/libs")},
|
||||||
|
{find: "modules", replacement: path.resolve(pathName, "./src/modules")},
|
||||||
|
{find: "modules", replacement: path.resolve(pathName, "./src/modules")},
|
||||||
|
{find: "utils", replacement: path.resolve(pathName, "./src/utils")}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue