Skip to content

Commit

Permalink
docs: add detached mode to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
davidenke committed Oct 23, 2024
1 parent d183925 commit fe4b262
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/mocks/node/fs.promises.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export async function readFile() {}
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
}
},
"exclude": ["node_modules", "bin", "dist", "src-tauri"]
}
42 changes: 28 additions & 14 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
},
]
: []),
],
},
}));

0 comments on commit fe4b262

Please sign in to comment.