diff --git a/README.md b/README.md index 7bceebf..05ad7c7 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,12 @@ Each stepper serves a different purpose: Assuming you have [Rust], [nvm][nvm-nix] and [pnpm] installed, you can run the application with the following commands: ```bash +# install dependencies nvm use && pnpm i +# start app locally with dev servers pnpm dev +# start frontend detached +pnpm dev:detached ``` ### Prerequisites diff --git a/src/mocks/node/fs.promises.ts b/src/mocks/node/fs.promises.ts new file mode 100644 index 0000000..4ed866c --- /dev/null +++ b/src/mocks/node/fs.promises.ts @@ -0,0 +1 @@ +export async function readFile() {} diff --git a/tsconfig.json b/tsconfig.json index 48a41d4..2f2f03c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,5 +22,6 @@ "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true - } + }, + "exclude": ["node_modules", "bin", "dist", "src-tauri"] } diff --git a/vite.config.ts b/vite.config.ts index ff5eb0b..ca998e5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -58,23 +58,37 @@ export default defineConfig(async config => ({ import: { meta: { url: 'http://localhost' } }, }, resolve: { - alias: { + alias: [ // node - buffer: resolve(import.meta.dirname, 'src/mocks/node/buffer.ts'), - http2: resolve(import.meta.dirname, 'src/mocks/node/http2.ts'), - module: resolve(import.meta.dirname, 'src/mocks/node/module.ts'), - url: resolve(import.meta.dirname, 'src/mocks/node/url.ts'), - zlib: resolve(import.meta.dirname, 'src/mocks/node/zlib.ts'), + { find: 'buffer', replacement: resolve(import.meta.dirname, 'src/mocks/node/buffer.ts') }, + { find: /^fs$/, replacement: resolve(import.meta.dirname, 'src/mocks/node/fs.ts') }, + { find: 'fs/promises', replacement: resolve(import.meta.dirname, 'src/mocks/node/fs.promises.ts') }, + { find: 'http2', replacement: resolve(import.meta.dirname, 'src/mocks/node/http2.ts') }, + { find: 'module', replacement: resolve(import.meta.dirname, 'src/mocks/node/module.ts') }, + { find: 'url', replacement: resolve(import.meta.dirname, 'src/mocks/node/url.ts') }, + { find: 'zlib', replacement: resolve(import.meta.dirname, 'src/mocks/node/zlib.ts') }, // tauri ...(config.mode === 'detached' - ? { - '@tauri-apps/api/window': resolve(import.meta.dirname, 'src/mocks/tauri/api.window.ts'), - '@tauri-apps/api/event': resolve(import.meta.dirname, 'src/mocks/tauri/api.event.ts'), - '@tauri-apps/plugin-dialog': resolve(import.meta.dirname, 'src/mocks/tauri/plugin-dialog.ts'), - '@tauri-apps/plugin-fs': resolve(import.meta.dirname, 'src/mocks/tauri/plugin-fs.ts'), - } - : {}), - }, + ? [ + { + find: '@tauri-apps/api/window', + replacement: resolve(import.meta.dirname, 'src/mocks/tauri/api.window.ts'), + }, + { + find: '@tauri-apps/api/event', + replacement: resolve(import.meta.dirname, 'src/mocks/tauri/api.event.ts'), + }, + { + find: '@tauri-apps/plugin-dialog', + replacement: resolve(import.meta.dirname, 'src/mocks/tauri/plugin-dialog.ts'), + }, + { + find: '@tauri-apps/plugin-fs', + replacement: resolve(import.meta.dirname, 'src/mocks/tauri/plugin-fs.ts'), + }, + ] + : []), + ], }, }));