Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
47 changes: 34 additions & 13 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
Expand All @@ -21,18 +21,39 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: yarn
run: yarn --network-concurrency 1
- name: linter checks
run: yarn lint
- name: prettify diff
run: yarn prettify:diff
- name: tests
run: yarn test
- name: Set up Bun
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 #v2.1.2
with:
bun-version: 1.3.x

- name: Install dependencies
run: bun install

- name: Postinstall - electron app deps
run: node node_modules/electron-builder/cli.js install-app-deps

- name: Postinstall - rebuild dexc
run: bun run rebuild-dexc

- name: Postinstall - rebuild pi-ui
run: bun run rebuild-pi-ui

- name: Postinstall - rebuild sbffi
run: bun run rebuild-sbffi

- name: Linter checks
run: bun run lint

- name: Prettify diff
run: bun run prettify:diff

- name: Tests
run: bun run test
env:
CI: true
- name: build
run: yarn build
- name: check i18n dupes
run: yarn i18n-check-dupes

- name: Build
run: bun run build

- name: Check i18n dupes
run: bun run i18n-check-dupes
111 changes: 87 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ This will start dcrd and dcrwallet for you.
On macOS, double-click the .dmg file, drag the .app to your
Applications folder. Double click on Decrediton.app to start.

You can also install via [brew cask](https://caskroom.github.io):
You can also install via [brew cask](https://formulae.brew.sh/cask/decrediton):
```bash
brew cask install decrediton
brew install --cask decrediton
```

From there follow the on screen instructions to setup your wallet.
Expand Down Expand Up @@ -77,11 +77,13 @@ production.

The current recommended versions for the main tools are:

- Node: 18.20+
- Node: 20.20+
- Npm: 10.8+
- Yarn: 1.22+
- Bun: 1.3+

To ease node version management, install all top-level tools (node/npm/yarn) using [nvm](https://github.com/nvm-sh/nvm).
To ease node version management, install bun from [bun.sh](https://bun.sh), and all other top-level tools (node/npm) using [nvm](https://github.com/nvm-sh/nvm). Yarn is only required on older hardware where bun might not work.

If you use [Nix](https://nixos.org/) and [direnv](https://direnv.net/), this repository includes a `flake.nix` that automatically provides all required dependencies. Simply run `direnv allow` in the project directory to activate the dev environment.

### Electron extensions

Expand Down Expand Up @@ -115,17 +117,21 @@ git clone https://github.com/decred/decrediton.git
cd decrediton
mkdir bin/
cp $GOPATH/bin/dcr* bin/
yarn
# TODO ? prob these just go in some package file
npm install -g prebuild
npm install -g cmake-js
yarn build-trezor
yarn dev
bun install
bun run build-trezor
bun run rebuild-natives
bun run dev
```

Note: The `bun run rebuild-natives` step is only required for the dev server, not for building release packages.

### Managing Dependencies

This project uses **yarn.lock** as the single source of truth for dependency versions. Bun automatically migrates from yarn.lock on first install, generating a bun.lock.

### Requirements for DEX Development Usage

The building of the dex module requires Go to be installed.
Building the dex module requires Go to be installed.

### Keeping up with dcrd/dcrwallet changes

Expand Down Expand Up @@ -179,7 +185,7 @@ Once you restart decrediton, you should be presented with a screen to specify
the node parameters. Note that all of them are present in the command you used
to start the node for your respective system.

CLI options (including ```--advanced```) when running `yarn dev` are currently not supported.
CLI options (including ```--advanced```) when running `bun run dev` are currently not supported.

When generating the TLS keypairs for the rpc endpoint you should use the P-256 curve by starting the daemon with `--tlscurve=P-256`. Note that the rpccert/rpckey files need to be deleted before this.

Expand Down Expand Up @@ -220,8 +226,8 @@ After installing windows-build-tools, open a *non-administrative* prompt
(cmd.exe) and then try recompiling the native modules:

```bash
yarn
yarn rebuild-natives
bun install
bun run rebuild-natives
```

If you have multiple versions of VS Build Tools installed, you may need to
Expand All @@ -246,8 +252,8 @@ The end result for module compilation should be the following files:
- `app/node_modules/dcrwin32ipc/build/Release/dcrwin32ipc.node`
- `app/node_modules/grpc/src/node/extension_binary/electron-v3.0-win32-x64/grpc_node.node`

*Note*: `yarn start` does _not_ currently correctly load the dcrwin32ipc module, so
testing with yarn build/start will fail to correctly unload dcrd/dcrwallet when
*Note*: `bun run start` does _not_ currently correctly load the dcrwin32ipc module, so
testing with bun run build/start will fail to correctly unload dcrd/dcrwallet when
closing.

When using git bash, `cmd.exe` or Powershell, you might need to install [MingW-w64](https://www.mingw-w64.org/) to get access to gcc and be able to compile libdex. After installing it, ensure `gcc` and `python` are accessible in console (add the appropriate binary paths to the `%PATH%` environment variable).
Expand All @@ -264,7 +270,7 @@ might need to tweak stuff (in particular, you'll need to disable hardware
acceleration and ui animations) to run decrediton on it.

```bash
yarn rebuild-natives
bun run rebuild-natives
```


Expand All @@ -277,31 +283,88 @@ You can test the production version (without most of the debugging info and with
compiled and minified code) by using:

```bash
yarn build
yarn start
bun run build
bun run start
```

And finally, a packaged version (including the final standalone electron
binaries) for the current platform can be built with:

```bash
yarn package
bun run package
```

### Linux

You need to make sure you have the rpm-build package installed for the building to work.

```bash
yarn package-linux
bun run package-linux
```

After it is finished it will have the built rpm, deb and tar.gz in the release/ directory.
After it is finished it will have the built AppImage and tar.gz in the release/ directory.

If you're only interested in a tar.gz, you can alternatively use:

```bash
yarn package-dev-linux
bun run package-dev-linux
```

### Building on Older Hardware

If you encounter an "illegal hardware instruction" error when running `bun install`, your CPU likely doesn't support the instruction set that bun was compiled with (e.g., AVX2). This is common on older processors. Use yarn instead of bun.

**Important:** The `yarn.lock` file is the source of truth for dependency versions. Use `--frozen-lockfile` to ensure yarn uses the committed lock file without modifying it.

**Step 1: Install dependencies**

```bash
yarn install --frozen-lockfile --ignore-scripts
```

**Step 2: Run postinstall steps manually**

The postinstall script uses bun internally, so run these equivalent commands:

```bash
# Download the electron binary
node node_modules/electron/install.js

# Install electron app dependencies
yarn electron-builder install-app-deps

# Install dex module dependencies (has its own package-lock.json)
cd modules/dex && yarn install --ignore-scripts && cd ../..

# Compile sbffi native module and copy to both locations
CMAKE_POLICY_VERSION_MINIMUM=3.5 npx cmake-js compile --directory node_modules/sbffi --CDnapi_build_version=5
cp -r node_modules/sbffi/build modules/dex/node_modules/sbffi/

# Install pi-ui dependencies (has its own yarn.lock, skip scripts since dist is pre-built)
cd node_modules/pi-ui && yarn install --ignore-scripts && rm -rf node_modules/react node_modules/react-dom && cd ../..
```

**Step 3: Build and run**

```bash
# Build trezor module and rebuild native modules
yarn build-trezor
yarn rebuild-natives

# Run development server
yarn hot-server -- --start-hot

# Or build for production (run each step since compound 'build' script uses bun)
yarn build-trezor
yarn build-preload
yarn build-main
yarn build-renderer

# Run the production build
yarn start

# Package for distribution
yarn electron-builder build --publish never
```

## Contact
Expand Down
13 changes: 13 additions & 0 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/yarn.lock

This file was deleted.

Loading
Loading