mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-17 06:14:21 +01:00
Merge pull request #35 from MutinyWallet/link-instructions
add instructions for linking
This commit is contained in:
42
README.md
42
README.md
@@ -1,30 +1,32 @@
|
||||
# SolidStart
|
||||
### Running Mutiny Web
|
||||
|
||||
Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);
|
||||
|
||||
## Creating a project
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm init solid@latest
|
||||
|
||||
# create a new project in my-app
|
||||
npm init solid@latest my-app
|
||||
```
|
||||
pnpm install
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
## Developing
|
||||
### Local
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
To make local development easier with a latest local version of [the node manager](https://github.com/MutinyWallet/mutiny-node), you may want to `pnpm link` it.
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
Due to how [Vite's dev server works](https://vitejs.dev/config/server-options.html#server-fs-allow), the linked `mutiny-node` project folder should be a sibling of this `mutiny-web` folder. Alternatively you can change the allow path in `vite.config.ts`.
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
In your `mutiny-node` local repo:
|
||||
|
||||
```
|
||||
just link
|
||||
```
|
||||
|
||||
## Building
|
||||
(on a Mac you might need to prefix `just link` with these flags: `AR=/opt/homebrew/opt/llvm/bin/llvm-ar CC=/opt/homebrew/opt/llvm/bin/clang`)
|
||||
|
||||
Solid apps are built with _adapters_, which optimise your project for deployment to different environments.
|
||||
Now in this repo, link them.
|
||||
|
||||
By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different adapter, add it to the `devDependencies` in `package.json` and specify in your `vite.config.js`.
|
||||
```
|
||||
just local
|
||||
```
|
||||
|
||||
To revert back and use the remote version of mutiny-wasm:
|
||||
|
||||
```
|
||||
just remote
|
||||
```
|
||||
|
||||
10
justfile
Normal file
10
justfile
Normal file
@@ -0,0 +1,10 @@
|
||||
set dotenv-load := false
|
||||
|
||||
dev:
|
||||
pnpm run dev
|
||||
|
||||
local:
|
||||
pnpm link --global "@mutinywallet/mutiny-wasm"
|
||||
|
||||
remote:
|
||||
pnpm unlink "@mutinywallet/mutiny-wasm" && pnpm install
|
||||
@@ -21,6 +21,7 @@ export default function BalanceBox() {
|
||||
|
||||
const fetchOnchainBalance = async () => {
|
||||
console.log("Refetching onchain balance");
|
||||
await state.node_manager?.sync();
|
||||
const balance = await state.node_manager?.get_balance();
|
||||
return balance
|
||||
};
|
||||
|
||||
@@ -41,6 +41,10 @@ const pwaOptions: Partial<VitePWAOptions> = {
|
||||
export default defineConfig({
|
||||
server: {
|
||||
port: 3420,
|
||||
fs: {
|
||||
// Allow serving files from one level up (so that if mutiny-node is a sibling folder we can use it locally)
|
||||
allow: [".."]
|
||||
}
|
||||
},
|
||||
plugins: [wasm(), solid({ ssr: false }), VitePWA(pwaOptions)],
|
||||
resolve: {
|
||||
@@ -50,4 +54,5 @@ export default defineConfig({
|
||||
// This is necessary because otherwise `vite dev` can't find the wasm
|
||||
exclude: ["@mutinywallet/mutiny-wasm", "@mutinywallet/waila-wasm"],
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user