Refactor imports and paths: implement base URL aliasing with @
, adjust TypeScript configuration, and update all relevant imports.
This commit is contained in:
16
package-lock.json
generated
16
package-lock.json
generated
@@ -9,6 +9,7 @@
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@tailwindcss/vite": "^4.1.11",
|
||||
"@types/node": "^24.0.10",
|
||||
"js-yaml": "^4.1.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
@@ -1637,6 +1638,15 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.10.tgz",
|
||||
"integrity": "sha512-ENHwaH+JIRTDIEEbDK6QSQntAYGtbvdDXnMXnZaZ6k13Du1dPMmprkEHIL7ok2Wl2aZevetwTAb5S+7yIF+enA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~7.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/react": {
|
||||
"version": "19.1.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.8.tgz",
|
||||
@@ -3899,6 +3909,12 @@
|
||||
"typescript": ">=4.8.4 <5.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
|
||||
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/universalify": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
|
||||
|
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/vite": "^4.1.11",
|
||||
"@types/node": "^24.0.10",
|
||||
"js-yaml": "^4.1.0",
|
||||
"react": "^19.1.0",
|
||||
"react-dom": "^19.1.0",
|
||||
|
10
src/App.tsx
10
src/App.tsx
@@ -1,9 +1,9 @@
|
||||
import './App.css'
|
||||
import Main from "./modules/main/components/Main.tsx";
|
||||
import Footer from "./modules/footer/components/Footer.tsx";
|
||||
import '@/App.css'
|
||||
import {useState} from "react";
|
||||
import type {CharacterData} from "./types/CharacterJson.ts";
|
||||
import Header from "./modules/header/components/Header.tsx";
|
||||
import type {CharacterData} from "@/types/CharacterJson.ts";
|
||||
import Header from "@/modules/header/components/Header.tsx";
|
||||
import Footer from "@/modules/footer/components/Footer.tsx";
|
||||
import Main from "@/modules/main/components/Main.tsx";
|
||||
|
||||
function App() {
|
||||
const [jsonData, setJsonData] = useState<CharacterData | null>(null);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App'
|
||||
import './index.css'
|
||||
import App from '@/App'
|
||||
import '@/index.css'
|
||||
|
||||
// Ensure root element exists
|
||||
const rootElement = document.getElementById('root');
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import ImportButton from "./ImportButton";
|
||||
import type { CharacterData } from '../../../types/CharacterJson.ts';
|
||||
import type {CharacterData} from '@/types/CharacterJson.ts';
|
||||
import ImportButton from "@/modules/header/components/ImportButton";
|
||||
|
||||
interface HeaderProps {
|
||||
onFileLoad: (data: CharacterData) => void;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import {useRef} from 'react';
|
||||
import type { CharacterData } from '../../../../types/CharacterJson.ts';
|
||||
import type {CharacterData} from '@/types/CharacterJson.ts';
|
||||
|
||||
interface ImportButtonProps {
|
||||
onFileLoad: (data: CharacterData) => void;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import Tabs from "./Tabs";
|
||||
import SheetHeader from "../modules/sheetHeader/components/SheetHeader.tsx";
|
||||
import type {CharacterData} from "../../../types/CharacterJson.ts";
|
||||
import type {CharacterData} from "@/types/CharacterJson.ts";
|
||||
import SheetHeader from "@/modules/main/modules/sheetHeader/components/SheetHeader.tsx";
|
||||
import Tabs from "@/modules/main/components/Tabs.tsx";
|
||||
|
||||
export default function Main({jsonData}: { jsonData: CharacterData }) {
|
||||
return (
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import {useState} from "react";
|
||||
import Skills from "../modules/skills/components/Skills.tsx";
|
||||
import Combat from "../modules/combat/components/Combat.tsx";
|
||||
import Equipment from "../modules/equipment/components/Equipment.tsx";
|
||||
import Attributes from "../modules/attributes/components/Attributes.tsx";
|
||||
import State from "../modules/state/components/State.tsx";
|
||||
import Magic from "../modules/magic/components/Magic.tsx";
|
||||
import Religion from "../modules/religion/components/Religion.tsx";
|
||||
import Notes from "../modules/notes/components/Notes.tsx";
|
||||
import type {CharacterData} from "../../../types/CharacterJson.ts";
|
||||
import Skills from "@/modules/main/modules/skills/components/Skills.tsx";
|
||||
import Combat from "@/modules/main/modules/combat/components/Combat.tsx";
|
||||
import Attributes from "@/modules/main/modules/attributes/components/Attributes.tsx";
|
||||
import Equipment from "@/modules/main/modules/equipment/components/Equipment.tsx";
|
||||
import State from "@/modules/main/modules/state/components/State.tsx";
|
||||
import Magic from "@/modules/main/modules/magic/components/Magic.tsx";
|
||||
import Religion from "@/modules/main/modules/religion/components/Religion.tsx";
|
||||
import Notes from "@/modules/main/modules/notes/components/Notes.tsx";
|
||||
import type {CharacterData} from "@/types/CharacterJson.ts";
|
||||
|
||||
export default function Tabs({jsonData}: { jsonData: CharacterData }) {
|
||||
const [activeTab, setActiveTab] = useState("skills");
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import type {CharacterData} from "../../../../../types/CharacterJson.ts";
|
||||
import type {CharacterData} from "@/types/CharacterJson.ts";
|
||||
import {
|
||||
type AttributeWithValue,
|
||||
loadAttributesWithValues,
|
||||
loadProfession,
|
||||
loadRace,
|
||||
loadRaceVariant
|
||||
} from "../../../../../utils/loaders";
|
||||
} from "@/utils/loaders";
|
||||
import {useEffect, useState} from 'react';
|
||||
|
||||
export default function SheetHeader({jsonData}: { jsonData: CharacterData }) {
|
||||
@@ -61,7 +61,7 @@ export default function SheetHeader({jsonData}: { jsonData: CharacterData }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex justify-between items-center py-5 px-5">
|
||||
<div className="flex justify-between items-end py-5 px-5">
|
||||
<div className="w-[30%]">
|
||||
<p className="border-b border-gray-500 font-semibold">
|
||||
{jsonData.name}
|
||||
@@ -93,7 +93,8 @@ export default function SheetHeader({jsonData}: { jsonData: CharacterData }) {
|
||||
<div key={attr.id} className="w-[10%] text-center">
|
||||
<div className="relative group cursor-help">
|
||||
<div className="font-bold">{attr.short}</div>
|
||||
<span className="absolute left-1/2 transform -translate-x-1/2 bottom-full mb-1 px-2 py-1 bg-gray-800 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap">
|
||||
<span
|
||||
className="absolute left-1/2 transform -translate-x-1/2 bottom-full mb-1 px-2 py-1 bg-gray-800 text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap">
|
||||
{attr.name}
|
||||
</span>
|
||||
</div>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import type { CharacterData } from '../../../../../types/CharacterJson';
|
||||
import { loadSkillsWithValues, type SkillWithValue } from '../../../../../utils/loaders';
|
||||
import {useEffect, useState} from 'react';
|
||||
import type {CharacterData} from '@/types/CharacterJson.ts';
|
||||
import {loadSkillsWithValues, type SkillWithValue} from '@/utils/loaders.ts';
|
||||
|
||||
export default function Skills({jsonData}: { jsonData: CharacterData }) {
|
||||
const [skills, setSkills] = useState<SkillWithValue[]>([]);
|
||||
|
@@ -1,65 +1,65 @@
|
||||
import type {Race} from '../types/Race';
|
||||
import type {Profession} from '../types/Profession';
|
||||
import type {Attribute} from '../types/Attribute';
|
||||
import type {AttributeValue} from '../types/CharacterJson';
|
||||
import type {Advantage} from '../types/Advantage';
|
||||
import type {AnimistForce} from '../types/AnimistForce';
|
||||
// import type { ArcaneBardTradition } from '../types/ArcaneBardTradition';
|
||||
// import type { ArcaneDancerTradition } from '../types/ArcaneDancerTradition';
|
||||
// import type { ArmorType } from '../types/ArmorType';
|
||||
// import type { Aspect } from '../types/Aspect';
|
||||
// import type { BlessedTradition } from '../types/BlessedTradition';
|
||||
// import type { Blessing } from '../types/Blessing';
|
||||
// import type { Book } from '../types/Book';
|
||||
// import type { Brew } from '../types/Brew';
|
||||
// import type { Cantrip } from '../types/Cantrip';
|
||||
// import type { CombatSpecialAbilityGroup } from '../types/CombatSpecialAbilityGroup';
|
||||
// import type { CombatTechniqueGroup } from '../types/CombatTechniqueGroup';
|
||||
// import type { CombatTechnique } from '../types/CombatTechnique';
|
||||
// import type { Condition } from '../types/Condition';
|
||||
// import type { Culture } from '../types/Culture';
|
||||
// import type { Curse } from '../types/Curse';
|
||||
// import type { DerivedCharacteristic } from '../types/DerivedCharacteristic';
|
||||
// import type { Disadvantage } from '../types/Disadvantage';
|
||||
// import type { DominationRitual } from '../types/DominationRitual';
|
||||
// import type { Element } from '../types/Element';
|
||||
// import type { ElvenMagicalSong } from '../types/ElvenMagicalSong';
|
||||
// import type { EquipmentGroup } from '../types/EquipmentGroup';
|
||||
// import type { EquipmentPackage } from '../types/EquipmentPackage';
|
||||
// import type { Equipment } from '../types/Equipment';
|
||||
// import type { ExperienceLevel } from '../types/ExperienceLevel';
|
||||
// import type { EyeColor } from '../types/EyeColor';
|
||||
// import type { FocusRule } from '../types/FocusRule';
|
||||
// import type { GeodeRitual } from '../types/GeodeRitual';
|
||||
// import type { HairColor } from '../types/HairColor';
|
||||
// import type { LiturgicalChantEnhancement } from '../types/LiturgicalChantEnhancement';
|
||||
// import type { LiturgicalChantGroup } from '../types/LiturgicalChantGroup';
|
||||
// import type { LiturgicalChant } from '../types/LiturgicalChant';
|
||||
// import type { MagicalDance } from '../types/MagicalDance';
|
||||
// import type { MagicalMelodie } from '../types/MagicalMelodie';
|
||||
// import type { MagicalTradition } from '../types/MagicalTradition';
|
||||
// import type { OptionalRule } from '../types/OptionalRule';
|
||||
// import type { Pact } from '../types/Pact';
|
||||
// import type { PatronCategorie } from '../types/PatronCategorie';
|
||||
// import type { Patron } from '../types/Patron';
|
||||
// import type { ProfessionVariant } from '../types/ProfessionVariant';
|
||||
// import type { Propertie } from '../types/Propertie';
|
||||
// import type { RaceVariant } from '../types/RaceVariant';
|
||||
// import type { Reache } from '../types/Reache';
|
||||
// import type { RogueSpell } from '../types/RogueSpell';
|
||||
// import type { SkillGroup } from '../types/SkillGroup';
|
||||
import type {Skill} from '../types/Skill';
|
||||
import type {RaceVariant} from "../types/RaceVariant.ts";
|
||||
// import type { SocialStatuse } from '../types/SocialStatuse';
|
||||
// import type { SpecialAbilitie } from '../types/SpecialAbilitie';
|
||||
// import type { SpecialAbilityGroup } from '../types/SpecialAbilityGroup';
|
||||
// import type { SpellEnhancement } from '../types/SpellEnhancement';
|
||||
// import type { SpellGroup } from '../types/SpellGroup';
|
||||
// import type { Spell } from '../types/Spell';
|
||||
// import type { State } from '../types/State';
|
||||
// import type { Subject } from '../types/Subject';
|
||||
// import type { Tribe } from '../types/Tribe';
|
||||
// import type { ZibiljaRitual } from '../types/ZibiljaRitual';
|
||||
import type {Race} from '@/types/Race';
|
||||
import type {Profession} from '@/types/Profession';
|
||||
import type {Attribute} from '@/types/Attribute';
|
||||
import type {AttributeValue} from '@/types/CharacterJson';
|
||||
import type {Advantage} from '@/types/Advantage';
|
||||
import type {AnimistForce} from '@/types/AnimistForce';
|
||||
// import type { ArcaneBardTradition } from '@/types/ArcaneBardTradition';
|
||||
// import type { ArcaneDancerTradition } from '@/types/ArcaneDancerTradition';
|
||||
// import type { ArmorType } from '@/types/ArmorType';
|
||||
// import type { Aspect } from '@/types/Aspect';
|
||||
// import type { BlessedTradition } from '@/types/BlessedTradition';
|
||||
// import type { Blessing } from '@/types/Blessing';
|
||||
// import type { Book } from '@/types/Book';
|
||||
// import type { Brew } from '@/types/Brew';
|
||||
// import type { Cantrip } from '@/types/Cantrip';
|
||||
// import type { CombatSpecialAbilityGroup } from '@/types/CombatSpecialAbilityGroup';
|
||||
// import type { CombatTechniqueGroup } from '@/types/CombatTechniqueGroup';
|
||||
// import type { CombatTechnique } from '@/types/CombatTechnique';
|
||||
// import type { Condition } from '@/types/Condition';
|
||||
// import type { Culture } from '@/types/Culture';
|
||||
// import type { Curse } from '@/types/Curse';
|
||||
// import type { DerivedCharacteristic } from '@/types/DerivedCharacteristic';
|
||||
// import type { Disadvantage } from '@/types/Disadvantage';
|
||||
// import type { DominationRitual } from '@/types/DominationRitual';
|
||||
// import type { Element } from '@/types/Element';
|
||||
// import type { ElvenMagicalSong } from '@/types/ElvenMagicalSong';
|
||||
// import type { EquipmentGroup } from '@/types/EquipmentGroup';
|
||||
// import type { EquipmentPackage } from '@/types/EquipmentPackage';
|
||||
// import type { Equipment } from '@/types/Equipment';
|
||||
// import type { ExperienceLevel } from '@/types/ExperienceLevel';
|
||||
// import type { EyeColor } from '@/types/EyeColor';
|
||||
// import type { FocusRule } from '@/types/FocusRule';
|
||||
// import type { GeodeRitual } from '@/types/GeodeRitual';
|
||||
// import type { HairColor } from '@/types/HairColor';
|
||||
// import type { LiturgicalChantEnhancement } from '@/types/LiturgicalChantEnhancement';
|
||||
// import type { LiturgicalChantGroup } from '@/types/LiturgicalChantGroup';
|
||||
// import type { LiturgicalChant } from '@/types/LiturgicalChant';
|
||||
// import type { MagicalDance } from '@/types/MagicalDance';
|
||||
// import type { MagicalMelodie } from '@/types/MagicalMelodie';
|
||||
// import type { MagicalTradition } from '@/types/MagicalTradition';
|
||||
// import type { OptionalRule } from '@/types/OptionalRule';
|
||||
// import type { Pact } from '@/types/Pact';
|
||||
// import type { PatronCategorie } from '@/types/PatronCategorie';
|
||||
// import type { Patron } from '@/types/Patron';
|
||||
// import type { ProfessionVariant } from '@/types/ProfessionVariant';
|
||||
// import type { Propertie } from '@/types/Propertie';
|
||||
// import type { RaceVariant } from '@/types/RaceVariant';
|
||||
// import type { Reache } from '@/types/Reache';
|
||||
// import type { RogueSpell } from '@/types/RogueSpell';
|
||||
// import type { SkillGroup } from '@/types/SkillGroup';
|
||||
import type {Skill} from '@/types/Skill';
|
||||
import type {RaceVariant} from "@/types/RaceVariant.ts";
|
||||
// import type { SocialStatuse } from '@/types/SocialStatuse';
|
||||
// import type { SpecialAbilitie } from '@/types/SpecialAbilitie';
|
||||
// import type { SpecialAbilityGroup } from '@/types/SpecialAbilityGroup';
|
||||
// import type { SpellEnhancement } from '@/types/SpellEnhancement';
|
||||
// import type { SpellGroup } from '@/types/SpellGroup';
|
||||
// import type { Spell } from '@/types/Spell';
|
||||
// import type { State } from '@/types/State';
|
||||
// import type { Subject } from '@/types/Subject';
|
||||
// import type { Tribe } from '@/types/Tribe';
|
||||
// import type { ZibiljaRitual } from '@/types/ZibiljaRitual';
|
||||
|
||||
/**
|
||||
* Generic function to load data from a JSON file
|
||||
|
@@ -3,10 +3,13 @@
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"DOM",
|
||||
"DOM.Iterable"
|
||||
],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
@@ -14,14 +17,21 @@
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src"]
|
||||
"noUncheckedSideEffectImports": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ import {defineConfig} from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import {viteStaticCopy} from "vite-plugin-static-copy";
|
||||
import path from 'path'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
@@ -12,9 +13,14 @@ export default defineConfig({
|
||||
targets: [
|
||||
{src: 'src/assets/database/*.json', dest: 'database'},
|
||||
],
|
||||
})
|
||||
}),
|
||||
],
|
||||
base: './',
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, 'src'),
|
||||
}
|
||||
},
|
||||
build: {
|
||||
minify: 'esbuild', // ← Statt terser
|
||||
rollupOptions: {
|
||||
|
Reference in New Issue
Block a user