Skip to content

Commit

Permalink
docs: update astro example instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Nov 17, 2023
1 parent 3e7f26b commit 080dcc4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
30 changes: 21 additions & 9 deletions examples/astro-project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ cd examples/astro-project
<details open>
<summary><b>Npm</b></summary>

- Install dependencies
- Install the dependencies

```sh
npm --prefix ui i
```

- Run in a development environment - e.g., to enable hot reload in the webview window while
- Run the app in a development environment. E.g., this enables the web-inspector and hot-reload of the webview
window while working on the UI

```sh
v -d dev run .
```

- Run the static build ui
- Build the UI into a static output and run the app

```sh
npm --prefix ui run build
Expand All @@ -41,19 +42,20 @@ cd examples/astro-project
<details>
<summary><b>yarn</b></summary>

- Install dependencies
- Install the dependencies

```sh
yarn --cwd ui
```

- Run in a development environment - e.g., to enable hot reload in the webview window while
- Run the app in a development environment. E.g., this enables the web-inspector and hot-reload of the webview
window while working on the UI

```sh
v -d dev run .
```

- Run the static build ui
- Build the UI into a static output and run the app

```sh
yarn --cwd ui run build
Expand All @@ -67,19 +69,29 @@ cd examples/astro-project
<details>
<summary><b>Pnpm</b></summary>

- Install dependencies
- Update `src/main.v`

https://github.com/ttytm/webview/blob/3e7f26b82df254871ac21f26d370122f9752e969/examples/astro-project/src/main.v#L22-L24

```v
// w.serve_dev(ui_path)!
w.serve_dev(ui_path, pkg_manager: .pnpm)! // <- specify pnpm as package manager.
```

- Install the dependencies

```sh
pnpm --prefix ui i
```

- Run in a development environment - e.g., to enable hot reload in the webview window while
- Run the app in a development environment. E.g., this enables the web-inspector and hot-reload of the webview
window while working on the UI

```sh
v -d dev run .
```

- Run static build ui
- Build the UI into a static output and run the app

```sh
pnpm --prefix ui run build
Expand Down
5 changes: 1 addition & 4 deletions examples/astro-project/src/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ fn main() {
$if dev ? {
w.set_icon(os.join_path(ui_path, 'public', 'favicon.svg'))!
w.serve_dev(ui_path)!
// When switching to another package manager, delete the current package lock file, i.e.
// `package-lock.json` for npm and, if you've already run the package manager's install
// command, the `npm_modules` directory.
// w.serve_dev(ui_path, pkg_manager: .yarn)! // `w.serve_dev(ui_path)!` would work with `yarn` as well.
// w.serve_dev(ui_path, pkg_manager: .yarn)! // `w.serve_dev(ui_path)!` works with `yarn` as well.
// w.serve_dev(ui_path, pkg_manager: .pnpm)!
} $else {
build_path := os.join_path(ui_path, 'dist')
Expand Down

0 comments on commit 080dcc4

Please sign in to comment.