Skip to content

Commit

Permalink
remove yarn from contract folder (#877)
Browse files Browse the repository at this point in the history
* remove yarn from contract folder

* update image to use pnpm instead of yarn

* update /ts and hello-world to use pnpm
  • Loading branch information
aalu1418 authored Oct 2, 2024
1 parent 3ff8c1b commit c8e4c1f
Show file tree
Hide file tree
Showing 16 changed files with 6,722 additions and 6,777 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: contracts/docker-build.tar
key: ${{ runner.os }}-docker-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }}'
key: ${{ runner.os }}-docker-pnpm-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }}
- name: build & save image
if: steps.cache-image.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: contracts/docker-build.tar
key: ${{ runner.os }}-docker-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }}'
key: ${{ runner.os }}-docker-pnpm-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }}
- name: load cached image
run: |
docker load --input docker-build.tar
Expand All @@ -74,14 +74,14 @@ jobs:
cd /repo/contracts &&\
solana-keygen new -o id.json --no-bip39-passphrase &&\
cd /repo/ts &&\
yarn install --frozen-lockfile &&\
yarn build &&\
pnpm install --frozen-lockfile &&\
pnpm build &&\
cd /repo/contracts &&\
yarn install --frozen-lockfile &&\
pnpm install --frozen-lockfile &&\
anchor test &&\
chmod -R 755 ./target &&\
cd /repo/contracts/examples/hello-world &&\
yarn install --frozen-lockfile &&\
pnpm install --frozen-lockfile &&\
anchor test &&\
chmod -R 755 ./target"
Expand All @@ -101,13 +101,14 @@ jobs:
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: contracts/docker-build.tar
key: ${{ runner.os }}-docker-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }}'
key: ${{ runner.os }}-docker-pnpm-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }}
- name: load cached image
run: |
docker load --input docker-build.tar
- name: format contracts + artifacts
run: |
yarn install --frozen-lockfile
npm install -g pnpm
pnpm install --frozen-lockfile
cd ../ # back to root
make format-contracts
echo "run 'make format-contracts' if this fails"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ upgrade-e2e-core-deps:

.PHONY: format-contracts
format-contracts:
cd ./contracts && cargo fmt && go fmt ./... && yarn format
cd ./contracts && cargo fmt && go fmt ./... && pnpm format
1 change: 1 addition & 0 deletions contracts/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion contracts/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cluster = "localnet"
wallet = "id.json"

[scripts]
test = "yarn run test"
test = "pnpm run test"

# [programs.mainnet]
# TODO: add pubkeys
Expand Down
4 changes: 4 additions & 0 deletions contracts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ RUN cd /contracts && anchor build

# only keep downloaded artifacts in /root/.cargo cached
RUN rm -rf /contracts

# remove yarn dependency, use pnpm
RUN npm uninstall -g yarn
RUN npm install -g pnpm
2 changes: 1 addition & 1 deletion contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Available networks with declared IDs:

## Test

Make sure to run `yarn install` to fetch mocha and other test dependencies.
Make sure to run `pnpm i` to fetch mocha and other test dependencies.

Start a dockerized shell that contains Solana and Anchor:

Expand Down
2 changes: 1 addition & 1 deletion contracts/examples/hello-world/Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cluster = "localnet"
wallet = "../../id.json"

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "pnpm run test"

# TODO: clone from devnet once available
[[test.genesis]]
Expand Down
3 changes: 3 additions & 0 deletions contracts/examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"mocha": "^9.0.3",
"ts-mocha": "^10.0.0",
"typescript": "^4.3.5"
},
"scripts": {
"test": "ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
}
}
Loading

0 comments on commit c8e4c1f

Please sign in to comment.