Skip to content

Commit

Permalink
docs: Add guide to speed up build process on Windows
Browse files Browse the repository at this point in the history
Remove outdated description about gulp
  • Loading branch information
starliiit authored and andelf committed Aug 26, 2022
1 parent 5f9f090 commit a5bdaa7
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions docs/develop-logseq-on-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This is a guide on creating Logseq development environment on Windows with `Powe
* Node.js 16.x
* Clojure (follow this [Guidance](https://clojure.org/guides/getting_started#_installation_on_windows))
* JRE 8 (required for Clojure)
* Visual Studio (required for desktop app)

(updated 20220218. May confirm via JAVA_VERSION and NODE_VERSION in [THIS FILE](https://github.com/logseq/logseq/blob/master/.github/workflows/build.yml))

Expand All @@ -28,32 +29,53 @@ This is a guide on creating Logseq development environment on Windows with `Powe
Congrats! The pre-requisites are ready.

## Set-up development environment (web app)

The basic idea is replacing the `clojure` commands in [package.json](https://github.com/logseq/logseq/blob/master/package.json) to `clj`.
Go to your cloned Logseq repo. Then install dependencies, execute the `clj` equivalent of `yarn watch` via doing the `gulp`'s job manually (as it's not available on Windows). Refer [THIS](#an-example-of-setting-up-proxy-in-powershell) if you want to setup proxy in `PowerShell`.
* copy files in `resources` to `static`
* ```
yarn
clj -M:cljs watch app electron
Go to your cloned Logseq repo. Then install dependencies, execute the `clj` equivalent of `yarn watch`. Refer [THIS](#an-example-of-setting-up-proxy-in-powershell) if you want to setup proxy in `PowerShell`.

* Copy files in `resources` to `static`

* Compile static assets(css, icons...)
```
* ```
yarn css:watch
yarn add --dev gulp
yarn
yarn gulp:watch
```

* Open another powershell window, and run `yarn cljs:watch`. Clojure CLI will pull dependencies from Maven and Clojars, build the app and start the development server. Refer [THIS](#set-up-clojure-cli-repository-mirror) if your network access to Maven and Clojars is unstable.

Now you can access the app via `http://localhost:3001` and all changes to the code will be watched.

## Set-up development environment (desktop)
To run the desktop app in development mode, after setting up web app development environment, run following commands which are equivalent to `yarn dev-electron-app`:
* ```
cd static
yarn
yarn electron:dev
```

```
cd static
yarn
yarn electron:dev
```

The desktop app should pop-up on your screen.

During the build process `node-gyp` may complain that it cannot find Visual Studio. Try building the app in Developer Powershell for VS(shipped with Visual Studio). If this does not work for you, [This issue](https://github.com/nodejs/node-gyp/issues/2203) may be helpful.

## An example of setting up proxy in PowerShell
```
$env:GLOBAL_AGENT_HTTPS_PROXY='http://<proxy-host>:<proxy-port>'
$env:ELECTRON_GET_USE_PROXY='true'
$env:HTTPS_PROXY='http://<proxy-host>:<proxy-port>'
$env:HTTP_PROXY='http://<proxy-host>:<proxy-port>'
```
```

## Set up Clojure CLI repository mirror

add the following pair to `deps.edn`:

```
:mvn/repos {
"central" {:url "https://maven.aliyun.com/repository/public"}
"clojars" {:url "https://mirrors.tuna.tsinghua.edu.cn/clojars"}
}
```

The mirrors above are friendly to Chinese developers(with bad network), developers with self-hosted repositories can use their own services.

0 comments on commit a5bdaa7

Please sign in to comment.