Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Avoid global pnpm store (paritytech#921)
Browse files Browse the repository at this point in the history
* Use local pnpm store

* Fix rustfmt toolchain version

* Add troubleshooting note about pnpm store

* Remove old nvmrc

* Build contracts before relayer

The relayer requires the current contracts' compile artifacts to
generate bindings. Without this, changes to the contracts aren't picked
up properly:

For fresh dev environments, the relayer build fails unless we first
compile the contracts. For existing environments, we must manually
ensure that contracts are built before running start-services, or
relayer contract bindings will be out of date.

* Format files with pre-commit hook

* Add postcheckout hook to keep submodules updated

* Revert "Format files with pre-commit hook"

This reverts commit e9b184cdfcd67a1afc551c919b7d28fe855380ea.

* Revert "Fix rustfmt toolchain version"

This reverts commit c603e5451d5e5f99fd36b9ac02b92163cef11cf9.
  • Loading branch information
doubledup authored Aug 7, 2023
1 parent b2b2e9c commit aa1d4b6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ Check untracked files & directories:
```sh
git clean -ndx | awk '{print $3}'
```
After removing `node_modules` directories (eg. with `git clean above`), clear the pnpm cache:
```sh
pnpm store prune
```

Check Nix config in `~/.config/nix/nix.conf`.

Expand Down
5 changes: 5 additions & 0 deletions hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

set -e

git submodule update
3 changes: 2 additions & 1 deletion web/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.turbo
.deps
.pnpm-store
.turbo
1 change: 1 addition & 0 deletions web/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
store-dir=.pnpm-store/
1 change: 0 additions & 1 deletion web/.nvmrc

This file was deleted.

25 changes: 17 additions & 8 deletions web/packages/test/scripts/build-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ build_cumulus() {
mkdir -p $output_bin_dir && cp "$cumulus_bin" "$output_bin_dir"/polkadot-parachain
}

build_relaychain() {
if [ ! -f "$relaychain_bin" ]; then
echo "Building polkadot binary as $relaychain_bin"
rebuild_relaychain
fi
mkdir -p $output_bin_dir && cp "$relaychain_bin" "$output_bin_dir"/polkadot
}

rebuild_cumulus(){
pushd $root_dir/parachain
mkdir -p $cumulus_dir
Expand All @@ -41,6 +33,14 @@ build_cumulus_from_source(){
popd
}

build_relaychain() {
if [ ! -f "$relaychain_bin" ]; then
echo "Building polkadot binary as $relaychain_bin"
rebuild_relaychain
fi
mkdir -p $output_bin_dir && cp "$relaychain_bin" "$output_bin_dir"/polkadot
}

rebuild_relaychain(){
pushd $root_dir/parachain
mkdir -p $relaychain_dir
Expand All @@ -52,6 +52,14 @@ rebuild_relaychain(){
popd
}

build_contracts()
{
echo "Building contracts"
pushd $root_dir/contracts
forge build
popd
}

build_relayer()
{
echo "Building relayer"
Expand All @@ -64,6 +72,7 @@ install_binary() {
mkdir -p $output_bin_dir
build_cumulus_from_source
build_relaychain
build_contracts
build_relayer
}

Expand Down

0 comments on commit aa1d4b6

Please sign in to comment.