Migrated to Vite

This commit is contained in:
Prozilla 2024-06-03 18:28:47 +02:00
parent 445c10d68d
commit c3a28a5102
No known key found for this signature in database
GPG key ID: 5858DFE71CAF31EE
25 changed files with 1619 additions and 14492 deletions

1
.env
View file

@ -1 +0,0 @@
BROWSER=none

1
.gitignore vendored
View file

@ -10,6 +10,7 @@
# production
/build
/dist
# misc
.DS_Store

View file

@ -5,15 +5,15 @@ DOMAIN=os.prozilla.dev
COMMIT_MESSAGE="Deployed build to GitHub Pages"
REPO_URL="https://github.com/Prozilla/Prozilla-OS"
# You don't have to edit anything below this line
# ------- You don't need to edit anything below this line -------
echo Domain: $DOMAIN
echo Commit message: $COMMIT_MESSAGE
echo -e "Repository: $REPO_URL\n"
echo $DOMAIN > build/CNAME
echo $DOMAIN > dist/CNAME
echo Deploying to GitHub Pages...
if gh-pages -d build -m $COMMIT_MESSAGE -r $REPO_URL ; then
if gh-pages -d dist -m $COMMIT_MESSAGE -r $REPO_URL ; then
echo Successfully deployed to https://$DOMAIN/
else
echo Failed to deploy

View file

@ -25,8 +25,8 @@
### Building & deploying
1. Run `npm run build`, which will compile all the necessary files to the `build` directory.
2. Upload the contents of the `build` directory to your web server's root folder.
1. Run `npm run build`, which will bundle all your files in the `dist` directory.
2. Upload the contents of the `dist` directory to your web server's root folder.
#### Deploying to GitHub Pages
@ -56,7 +56,7 @@ See [docs/configuration](configuration/README.md) for more information.
You are here. This directory contains all documentation for this project.
- [build](../build) directory
- [dist](../dist) directory
Contains the static build files after [building](#building--deploying) the application. This directory is not included in the GitHub repository.

View file

@ -9,9 +9,9 @@
<link rel="canonical" href="https://os.prozilla.dev/">
<!-- Favicon -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"/>
<link rel="shortcut icon" type="image/svg+xml" href="%PUBLIC_URL%/assets/logo.svg"/>
<link rel="mask-icon" href="%PUBLIC_URL%/assets/logo.svg" color="#1dd1a1"/>
<link rel="manifest" href="/manifest.json"/>
<link rel="shortcut icon" type="image/svg+xml" href="/assets/logo.svg"/>
<link rel="mask-icon" href="/assets/logo.svg" color="#1dd1a1"/>
<meta name="msapplication-TileColor" content="#222f3e"/>
<meta name="theme-color" content="#54a0ff"/>
@ -20,18 +20,18 @@
<meta property="og:site_name" content="Prozilla OS"/>
<meta property="og:description" content="Prozilla OS is an open-source web-based operating system inspired by Ubuntu Linux and Windows made with React.js by Prozilla."/>
<meta property="og:type" content="website"/>
<meta property="og:image" content="%PUBLIC_URL%/assets/banner-logo-title.png"/>
<meta property="og:image" content="/assets/banner-logo-title.png"/>
<meta property="og:locale" content="en_US">
<!-- Twitter -->
<meta property="twitter:title" content="Prozilla OS | Web-based Operating System"/>
<meta property="twitter:description" content="Prozilla OS is an open-source web-based operating system inspired by Ubuntu Linux and Windows made with React.js by Prozilla."/>
<meta property="twitter:card" content="summary_large_image"/>
<meta property="twitter:image" content="%PUBLIC_URL%/assets/banner-logo-title.png"/>
<meta property="twitter:image" content="/assets/banner-logo-title.png"/>
<!-- Fonts -->
<link rel="preload" href="%PUBLIC_URL%/assets/fonts/outfit/Outfit-VariableFont_wght.ttf" as="font" type="font/ttf" crossorigin>
<link rel="preload" href="%PUBLIC_URL%/assets/fonts/roboto-mono/RobotoMono-VariableFont_wght.ttf" as="font" type="font/ttf" crossorigin>
<link rel="preload" href="/assets/fonts/outfit/Outfit-VariableFont_wght.ttf" as="font" type="font/ttf" crossorigin>
<link rel="preload" href="/assets/fonts/roboto-mono/RobotoMono-VariableFont_wght.ttf" as="font" type="font/ttf" crossorigin>
<!-- FAQ -->
<script type="application/ld+json">
@ -62,5 +62,7 @@
<body>
<noscript>You need to enable JavaScript to run Prozilla OS.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>

15878
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,9 +7,9 @@
"repository": "https://github.com/Prozilla/Prozilla-OS",
"type": "module",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"start": "vite --port 3000",
"build": "tsc && vite build",
"serve": "vite preview",
"predeploy": "npm run build",
"deploy": "sh deploy.sh"
},
@ -24,6 +24,7 @@
"@types/node": "^20.12.8",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"anser": "^2.1.1",
"core-js": "^3.37.0",
"escape-carriage": "^1.3.1",
@ -33,16 +34,17 @@
"react-draggable": "^4.4.5",
"react-error-boundary": "^4.0.13",
"react-ga4": "^2.1.0",
"react-scripts": "5.0.1",
"react-svg": "^16.1.18",
"react-syntax-highlighter": "^15.5.0",
"react-tabs": "^6.0.2",
"vite": "^5.2.12",
"vite-plugin-svgr": "^4.2.0",
"vite-tsconfig-paths": "^4.3.2",
"web-vitals": "^2.1.4"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@eslint/js": "^9.2.0",
"@types/jest": "^29.5.12",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/webpack-env": "^1.18.4",
"@typescript-eslint/eslint-plugin": "^7.8.0",
@ -51,9 +53,7 @@
"eslint-plugin-jsdoc": "^46.4.6",
"eslint-plugin-react": "^7.34.1",
"gh-pages": "^5.0.0",
"jest": "^27.5.1",
"ts-jest": "^29.1.2",
"typescript": "^4.9.5",
"typescript": "^5.4.5",
"typescript-eslint": "^7.8.0"
},
"browserslist": {

View file

@ -0,0 +1,41 @@
<svg width="199" height="200" viewBox="0 0 199 200" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_293_72)">
<mask id="mask0_293_72" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="199" height="200">
<path d="M68.4062 9.82812C68.4062 4.65879 64.2475 0.5 59.0781 0.5C53.9088 0.5 49.75 4.65879 49.75 9.82812V25.375C36.0299 25.375 24.875 36.5299 24.875 50.25H9.32812C4.15879 50.25 0 54.4088 0 59.5781C0 64.7475 4.15879 68.9062 9.32812 68.9062H24.875V90.6719H9.32812C4.15879 90.6719 0 94.8307 0 100C0 105.169 4.15879 109.328 9.32812 109.328H24.875V131.094H9.32812C4.15879 131.094 0 135.253 0 140.422C0 145.591 4.15879 149.75 9.32812 149.75H24.875C24.875 163.47 36.0299 174.625 49.75 174.625V190.172C49.75 195.341 53.9088 199.5 59.0781 199.5C64.2475 199.5 68.4062 195.341 68.4062 190.172V174.625H90.1719V190.172C90.1719 195.341 94.3307 199.5 99.5 199.5C104.669 199.5 108.828 195.341 108.828 190.172V174.625H130.594V190.172C130.594 195.341 134.753 199.5 139.922 199.5C145.091 199.5 149.25 195.341 149.25 190.172V174.625C162.97 174.625 174.125 163.47 174.125 149.75H189.672C194.841 149.75 199 145.591 199 140.422C199 135.253 194.841 131.094 189.672 131.094H174.125V109.328H189.672C194.841 109.328 199 105.169 199 100C199 94.8307 194.841 90.6719 189.672 90.6719H174.125V68.9062H189.672C194.841 68.9062 199 64.7475 199 59.5781C199 54.4088 194.841 50.25 189.672 50.25H174.125C174.125 36.5299 162.97 25.375 149.25 25.375V9.82812C149.25 4.65879 145.091 0.5 139.922 0.5C134.753 0.5 130.594 4.65879 130.594 9.82812V25.375H108.828V9.82812C108.828 4.65879 104.669 0.5 99.5 0.5C94.3307 0.5 90.1719 4.65879 90.1719 9.82812V25.375H68.4062V9.82812ZM62.1875 50.25H136.812C143.692 50.25 149.25 55.808 149.25 62.6875V137.312C149.25 144.192 143.692 149.75 136.812 149.75H62.1875C55.308 149.75 49.75 144.192 49.75 137.312V62.6875C49.75 55.808 55.308 50.25 62.1875 50.25ZM136.812 62.6875H62.1875V137.312H136.812V62.6875Z" fill="#222F3E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M149.25 62.6875C149.25 55.808 143.692 50.25 136.812 50.25H62.1875C55.308 50.25 49.75 55.808 49.75 62.6875V137.312C49.75 144.192 55.308 149.75 62.1875 149.75H136.812C143.692 149.75 149.25 144.192 149.25 137.312V62.6875ZM62.1875 62.6875H136.812V137.312H62.1875V62.6875Z" fill="#EE5253"/>
</mask>
<g mask="url(#mask0_293_72)">
<path d="M68.4062 9.82812C68.4062 4.65879 64.2475 0.5 59.0781 0.5C53.9088 0.5 49.75 4.65879 49.75 9.82812V25.375C36.0299 25.375 24.875 36.5299 24.875 50.25H9.32812C4.15879 50.25 0 54.4088 0 59.5781C0 64.7475 4.15879 68.9062 9.32812 68.9062H24.875V90.6719H9.32812C4.15879 90.6719 0 94.8307 0 100C0 105.169 4.15879 109.328 9.32812 109.328H24.875V131.094H9.32812C4.15879 131.094 0 135.253 0 140.422C0 145.591 4.15879 149.75 9.32812 149.75H24.875C24.875 163.47 36.0299 174.625 49.75 174.625V190.172C49.75 195.341 53.9088 199.5 59.0781 199.5C64.2475 199.5 68.4062 195.341 68.4062 190.172V174.625H90.1719V190.172C90.1719 195.341 94.3307 199.5 99.5 199.5C104.669 199.5 108.828 195.341 108.828 190.172V174.625H130.594V190.172C130.594 195.341 134.753 199.5 139.922 199.5C145.091 199.5 149.25 195.341 149.25 190.172V174.625C162.97 174.625 174.125 163.47 174.125 149.75H189.672C194.841 149.75 199 145.591 199 140.422C199 135.253 194.841 131.094 189.672 131.094H174.125V109.328H189.672C194.841 109.328 199 105.169 199 100C199 94.8307 194.841 90.6719 189.672 90.6719H174.125V68.9062H189.672C194.841 68.9062 199 64.7475 199 59.5781C199 54.4088 194.841 50.25 189.672 50.25H174.125C174.125 36.5299 162.97 25.375 149.25 25.375V9.82812C149.25 4.65879 145.091 0.5 139.922 0.5C134.753 0.5 130.594 4.65879 130.594 9.82812V25.375H108.828V9.82812C108.828 4.65879 104.669 0.5 99.5 0.5C94.3307 0.5 90.1719 4.65879 90.1719 9.82812V25.375H68.4062V9.82812Z" fill="#576574"/>
<g filter="url(#filter0_d_293_72)">
<path d="M24.875 50.25C24.875 36.5299 36.0299 25.375 49.75 25.375H149.25C162.97 25.375 174.125 36.5299 174.125 50.25V149.75C174.125 163.47 162.97 174.625 149.25 174.625H49.75C36.0299 174.625 24.875 163.47 24.875 149.75V50.25Z" fill="#222F3E"/>
</g>
<g filter="url(#filter1_d_293_72)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M149.25 62.6875C149.25 55.808 143.692 50.25 136.812 50.25H62.1875C55.308 50.25 49.75 55.808 49.75 62.6875V137.312C49.75 144.192 55.308 149.75 62.1875 149.75H136.812C143.692 149.75 149.25 144.192 149.25 137.312V62.6875ZM62.1875 62.6875H136.812V137.312H62.1875V62.6875Z" fill="#EE5253"/>
<path d="M136.812 62.6875H139.312V60.1875H136.812V62.6875ZM62.1875 62.6875V60.1875H59.6875V62.6875H62.1875ZM136.812 137.312V139.812H139.312V137.312H136.812ZM62.1875 137.312H59.6875V139.812H62.1875V137.312ZM136.812 52.75C142.311 52.75 146.75 57.1887 146.75 62.6875H151.75C151.75 54.4273 145.073 47.75 136.812 47.75V52.75ZM62.1875 52.75H136.812V47.75H62.1875V52.75ZM52.25 62.6875C52.25 57.1887 56.6887 52.75 62.1875 52.75V47.75C53.9273 47.75 47.25 54.4273 47.25 62.6875H52.25ZM52.25 137.312V62.6875H47.25V137.312H52.25ZM62.1875 147.25C56.6887 147.25 52.25 142.811 52.25 137.312H47.25C47.25 145.573 53.9273 152.25 62.1875 152.25V147.25ZM136.812 147.25H62.1875V152.25H136.812V147.25ZM146.75 137.312C146.75 142.811 142.311 147.25 136.812 147.25V152.25C145.073 152.25 151.75 145.573 151.75 137.312H146.75ZM146.75 62.6875V137.312H151.75V62.6875H146.75ZM136.812 60.1875H62.1875V65.1875H136.812V60.1875ZM139.312 137.312V62.6875H134.312V137.312H139.312ZM62.1875 139.812H136.812V134.812H62.1875V139.812ZM59.6875 62.6875V137.312H64.6875V62.6875H59.6875Z" fill="#EE5253"/>
</g>
</g>
</g>
<defs>
<filter id="filter0_d_293_72" x="4.875" y="5.375" width="189.25" height="189.25" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="10"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_293_72"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_293_72" result="shape"/>
</filter>
<filter id="filter1_d_293_72" x="27.25" y="27.75" width="144.5" height="144.5" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="10"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_293_72"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_293_72" result="shape"/>
</filter>
<clipPath id="clip0_293_72">
<rect width="199" height="199" fill="white" transform="translate(0 0.5)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

@ -24,24 +24,22 @@ export default function App(): ReactElement {
};
}, []);
return (
<VirtualRootProvider>
<ZIndexManagerProvider>
<WindowsManagerProvider>
<ModalsManagerProvider>
<SettingsManagerProvider>
<ThemeProvider>
<div className={styles.App}>
<Taskbar/>
<WindowsView/>
<ModalsView/>
<Desktop/>
</div>
</ThemeProvider>
</SettingsManagerProvider>
</ModalsManagerProvider>
</WindowsManagerProvider>
</ZIndexManagerProvider>
</VirtualRootProvider>
);
return <VirtualRootProvider>
<ZIndexManagerProvider>
<WindowsManagerProvider>
<ModalsManagerProvider>
<SettingsManagerProvider>
<ThemeProvider>
<div className={styles.App}>
<Taskbar/>
<WindowsView/>
<ModalsView/>
<Desktop/>
</div>
</ThemeProvider>
</SettingsManagerProvider>
</ModalsManagerProvider>
</WindowsManagerProvider>
</ZIndexManagerProvider>
</VirtualRootProvider>;
};

View file

@ -16,7 +16,7 @@ import WindowsManager from "../../../../features/windows/windowsManager";
export function MarkdownImage({ currentFile, alt, src, modalsManager, windowsManager, app, ...props }) {
const source = useMemo(() => {
if (src.startsWith("public")) {
return src.replace(/^public\//g, `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/`);
return src.replace(/^public\//g, "/");
}
return src;

View file

@ -145,7 +145,7 @@ export const Taskbar = memo(() => {
className={`${styles["Menu-button"]} ${styles["Home-button"]}`}
onClick={() => { updateShowHome(!showHome); }}
>
<ReactSVG src={(process.env as NodeJS.ProcessEnv).PUBLIC_URL + "/assets/logo.svg"}/>
<ReactSVG src={"/assets/logo.svg"}/>
</button>
<HomeMenu active={showHome} setActive={updateShowHome} search={search}/>
</OutsideClickListener>

View file

@ -77,7 +77,7 @@ export const AppButton: FC<AppButtonProps> = memo(({ app, windowsManager, pins,
}}
title={app.name}
>
<ReactSVG src={`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/icons/${app.id}.svg`}/>
<ReactSVG src={`/assets/apps/icons/${app.id}.svg`}/>
</button>
);
});

View file

@ -25,7 +25,7 @@ export const WindowsView: FC = memo(() => {
useEffect(() => {
const resetViewportTitleAndIcon = () => {
setViewportTitle(`${NAME} | ${TAG_LINE}`);
setViewportIcon(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/favicon.ico`);
setViewportIcon(`/favicon.ico`);
};
if (sortedWindows.length === 0 || sortedWindows[sortedWindows.length - 1].minimized)

View file

@ -19,10 +19,10 @@ export const APP_NAMES = {
};
export const APP_ICONS = {
TERMINAL: `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/icons/${APPS.TERMINAL}.svg`,
SETTINGS: `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/icons/${APPS.SETTINGS}.svg`,
MEDIA_VIEWER: `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/icons/${APPS.MEDIA_VIEWER}.svg`,
TEXT_EDITOR: `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/icons/${APPS.TEXT_EDITOR}.svg`,
FILE_EXPLORER: `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/icons/${APPS.FILE_EXPLORER}.svg`,
CALCULATOR: `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/icons/${APPS.CALCULATOR}.svg`,
TERMINAL: `/assets/apps/icons/${APPS.TERMINAL}.svg`,
SETTINGS: `/assets/apps/icons/${APPS.SETTINGS}.svg`,
MEDIA_VIEWER: `/assets/apps/icons/${APPS.MEDIA_VIEWER}.svg`,
TEXT_EDITOR: `/assets/apps/icons/${APPS.TEXT_EDITOR}.svg`,
FILE_EXPLORER: `/assets/apps/icons/${APPS.FILE_EXPLORER}.svg`,
CALCULATOR: `/assets/apps/icons/${APPS.CALCULATOR}.svg`,
};

View file

@ -75,9 +75,9 @@ export default class AppsManager {
*/
static getAppIconUrl(appId: string, iconName?: string): string {
if (iconName == null) {
return `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/icons/${appId}.svg`;
return `/assets/apps/icons/${appId}.svg`;
} else {
return `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/apps/${appId}/icons/${iconName}.svg`;
return `/assets/apps/${appId}/icons/${iconName}.svg`;
}
}
}

View file

@ -7,16 +7,19 @@ let commands: Command[] = [];
*/
const loadCommands = () => {
commands = [];
const context = require.context("./commands", false, /\.ts$/);
context.keys().forEach((key) => {
const commandModule = context(key) as Record<string, Command>;
const commandName = Object.keys(commandModule)[0];
const command = commandModule[commandName];
command.setName(commandName.toLowerCase());
// https://vitejs.dev/guide/features.html#glob-import
const modules = import.meta.glob("./commands/*.ts");
for (const path in modules) {
void modules[path]().then((commandModule: Record<string, Command>) => {
const commandName = Object.keys(commandModule)[0];
commands.push(command);
});
const command = commandModule[commandName];
command.setName(commandName.toLowerCase());
commands.push(command);
});
}
};
loadCommands();

View file

@ -67,6 +67,6 @@ export default class ModalsManager {
}
static getModalIconUrl(name: string): string {
return `${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/modals/icons/${name}.svg`;
return `/assets/modals/icons/${name}.svg`;
}
}

View file

@ -110,7 +110,7 @@ export function loadDefaultData(virtualRoot: VirtualRoot) {
folder.createFolders(["outfit", "roboto-mono"]);
}).createFolder("screenshots", (folder) => {
folder.createFile("screenshot", "png", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/screenshots/screenshot-files-settings-taskbar-desktop.png`);
file.setSource(`/assets/screenshots/screenshot-files-settings-taskbar-desktop.png`);
});
}).createFolder("wallpapers", (folder) => {
folder.setProtected(true);
@ -122,34 +122,34 @@ export function loadDefaultData(virtualRoot: VirtualRoot) {
});
}
}).createFile("banner", "png", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/banner-logo-title.png`);
file.setSource(`/assets/banner-logo-title.png`);
}).createFile("logo", "svg", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/assets/logo.svg`);
file.setSource(`/assets/logo.svg`);
});
}).createFolder("config", (folder) => {
folder.createFile("apps", "xml", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/config/apps.xml`);
file.setSource(`/config/apps.xml`);
}).createFile("desktop", "xml", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/config/desktop.xml`);
file.setSource(`/config/desktop.xml`);
}).createFile("taskbar", "xml", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/config/taskbar.xml`);
file.setSource(`/config/taskbar.xml`);
}).createFile("theme", "xml", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/config/theme.xml`);
file.setSource(`/config/theme.xml`);
});
}).createFolder("documents", (folder) => {
folder.createFile("info", "md", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/documents/info.md`);
file.setSource(`/documents/info.md`);
}).createFile("links", "md", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/documents/links.md`);
file.setSource(`/documents/links.md`);
});
}).createFile("favicon", "ico", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/favicon.ico`);
file.setSource(`/favicon.ico`);
}).createFile("index", "html", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/index.html`);
file.setSource(`/index.html`);
}).createFile("robots", "txt", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/robots.txt`);
file.setSource(`/robots.txt`);
}).createFile("sitemap", "xml", (file) => {
file.setSource(`${(process.env as NodeJS.ProcessEnv).PUBLIC_URL}/sitemap.xml`);
file.setSource(`/sitemap.xml`);
});
});

View file

@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom";

View file

@ -7,12 +7,12 @@
@font-face {
font-family: "Outfit";
src: url("/public/assets/fonts/outfit/Outfit-VariableFont_wght.ttf");
src: url("/assets/fonts/outfit/Outfit-VariableFont_wght.ttf");
font-display: swap;
}
@font-face {
font-family: "Roboto Mono";
src: url("/public/assets/fonts/roboto-mono/RobotoMono-VariableFont_wght.ttf");
src: url("/assets/fonts/roboto-mono/RobotoMono-VariableFont_wght.ttf");
font-display: swap;
}

View file

@ -1,6 +0,0 @@
declare namespace NodeJS {
interface ProcessEnv {
NODE_ENV: "development" | "production" | "test";
PUBLIC_URL: string;
}
}

View file

@ -1,4 +0,0 @@
declare module "*.module.css" {
const classes: { [key: string]: string };
export default classes;
}

1
src/types/vite-env.d.ts vendored Normal file
View file

@ -0,0 +1 @@
/// <reference types="vite/client" />

View file

@ -5,9 +5,9 @@
"jsx": "react-jsx",
/* Modules */
"module": "commonjs",
"moduleResolution": "Node",
"types": ["webpack-env"],
"module": "ESNext",
"moduleResolution": "Bundler",
"types": ["vite/client", "vite-plugin-svgr/client"],
"allowUmdGlobalAccess": true,
"resolveJsonModule": true,
@ -27,7 +27,8 @@
"strict": false,
},
"include": [
"src/**/*"
"src/**/*",
"vite.config.ts"
],
"exclude": [
"./node_modules",

8
vite.config.ts Normal file
View file

@ -0,0 +1,8 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
// https://vitejs.dev/config/
export default defineConfig({
base: "/",
plugins: [react()]
});