Skip to content

Commit 683ec26

Browse files
authored
Merge pull request #249 from AlexKushnir1/pnpm-migration
Pnpm migration and node bumping
2 parents cf2691a + e17fabe commit 683ec26

23 files changed

+6078
-9457
lines changed

.github/workflows/lint.yml

+14-7
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ jobs:
88
eslint:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
12-
- uses: actions/setup-node@v2
13-
with:
14-
node-version: '16'
15-
cache: 'yarn'
16-
- run: yarn install
17-
- run: yarn lint
11+
- uses: actions/checkout@v3
12+
13+
- name: Setup pnpm
14+
uses: pnpm/[email protected]
15+
with:
16+
version: 9.15.0
17+
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: '20'
21+
cache: 'pnpm'
22+
23+
- run: pnpm install
24+
- run: pnpm lint

.github/workflows/tests-sandbox.yml

+13-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,22 @@ jobs:
99
strategy:
1010
matrix:
1111
platform: [ubuntu-latest, macos-latest]
12-
node-version: [16]
12+
node-version: [20]
1313
runs-on: ${{ matrix.platform }}
1414
steps:
15-
- uses: actions/checkout@v2
16-
- uses: actions/setup-node@v2
15+
- uses: actions/checkout@v3
16+
17+
- name: Setup pnpm
18+
uses: pnpm/[email protected]
19+
with:
20+
version: 9.15.0
21+
22+
- uses: actions/setup-node@v3
1723
with:
1824
node-version: ${{ matrix.node-version }}
25+
1926
- name: Install dependencies
20-
run: yarn
27+
run: pnpm install
28+
2129
- name: Run tests
22-
run: yarn test:sandbox:ci-with-ignore --fail-fast
30+
run: pnpm test:sandbox:ci-with-ignore --fail-fast

.github/workflows/typedoc-generator.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
main
77

88
env:
9-
NODE_VERSION: 18.x.x
9+
NODE_VERSION: 20.x.x
1010
ENTRY_FILE: 'packages'
1111
CONFIG_PATH: 'tsconfig.base.json'
1212
USES_PNPM: 'true'
@@ -20,21 +20,24 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222

23+
- name: Setup pnpm
24+
uses: pnpm/[email protected]
25+
with:
26+
version: 9.15.0
27+
2328
- uses: actions/setup-node@v3
2429
with:
2530
node-version: ${{ env.NODE_VERSION }}
26-
27-
- name: Install yarn
28-
run: npm install -g yarn
31+
cache: 'pnpm'
2932

3033
- name: Install dependencies
31-
run: yarn install
34+
run: pnpm install
3235

3336
- name: Build project
34-
run: yarn build
37+
run: pnpm build
3538

3639
- name: Build documentation
37-
run: yarn docs:generate
40+
run: pnpm docs:generate
3841

3942
- name: Deploy to GitHub pages
4043
uses: JamesIves/github-pages-deploy-action@v4

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ node_modules/
33
.near-credentials/
44
coverage
55
**/dist/tsconfig.tsbuildinfo
6-
lerna-debug.log
7-
yarn-error.log
86
.idea
97
package-lock.json

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn lint && yarn build && git add packages/*/dist
4+
pnpm lint && pnpm build && git add packages/*/dist

.yarnrc

-1
This file was deleted.

__tests__/01.basic-transactions.ava.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* on testnet by using the `test:sandbox` and `test:testnet` scripts in
88
* package.json.
99
*/
10-
import {Worker, NEAR, NearAccount} from 'near-workspaces';
1110
import anyTest, {TestFn} from 'ava';
11+
import {Worker, NEAR, NearAccount} from '../packages/js';
1212

1313
const test = anyTest as TestFn<{
1414
worker: Worker;

__tests__/03.single-use-access-keys-with-linkdrop.ava.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
*
1212
* You can see this functionality in action below using `signWithKey`.
1313
*/
14-
import {Worker, createKeyPair, NEAR, NearAccount} from 'near-workspaces';
1514
import anyTest, {TestFn} from 'ava';
15+
import {Worker, createKeyPair, NEAR, NearAccount} from '../packages/js';
1616

1717
/* Contract API for reference
1818
impl Linkdrop {

__tests__/04.cross-contract-calls-with-fungible-token.ava.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* tests below initiate chains of transactions using near-workspaces's transaction
1414
* builder. Search for `batch` below.
1515
*/
16-
import {Worker, NearAccount, captureError, BN, NEAR} from 'near-workspaces';
1716
import anyTest, {TestFn} from 'ava';
17+
import {Worker, NearAccount, captureError, BN, NEAR} from '../packages/js';
1818

1919
const STORAGE_BYTE_COST = '1.5 mN';
2020

__tests__/05.spoon-contract-to-sandbox.ava.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
* contracts can give you a huge confidence boost that your contracts will work
1919
* as expected once actually deployed.
2020
*/
21-
import {Gas, NEAR, NearAccount, Worker, captureError} from 'near-workspaces';
2221
import anyTest, {TestFn} from 'ava';
22+
import {Gas, NEAR, NearAccount, Worker, captureError} from '../packages/js';
2323

2424
const REF_FINANCE_ACCOUNT = 'v2.ref-finance.near';
2525

__tests__/06.init-config.ava.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {getNetworkFromEnv, NearAccount, Worker} from 'near-workspaces';
21
import anyTest, {TestFn} from 'ava';
2+
import {getNetworkFromEnv, NearAccount, Worker} from '../packages/js';
33

44
if (getNetworkFromEnv() === 'testnet') {
55
const test = anyTest as TestFn<{

__tests__/07.resue-worker.ava.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* Keep in mind that tests are executed in parallel.
66
* It means that they should not depend on each other.
77
*/
8-
import {Worker, NEAR, NearAccount} from 'near-workspaces';
98
import anyTest, {TestFn} from 'ava';
9+
import {Worker, NEAR, NearAccount} from '../packages/js';
1010

1111
const test = anyTest as TestFn<{
1212
worker: Worker;

__tests__/08.custom-network.ava.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import process from 'process';
2-
import {Worker, getNetworkFromEnv} from 'near-workspaces';
32
import anyTest, {TestFn} from 'ava';
3+
import {Worker, getNetworkFromEnv} from '../packages/js';
44

55
// To run this test, you need to set the NEAR_RPC_API_KEY environment variable tied the Pagoda testnet network.
66
// And the NEAR_WORKSPACES_NETWORK environment variable to 'custom'.
77
//
8-
// Sample: NEAR_WORKSPACES_NETWORK=custom NEAR_RPC_API_KEY="xxx" yarn test...
8+
// Sample: NEAR_WORKSPACES_NETWORK=custom NEAR_RPC_API_KEY="xxx" pnpm test...
99
if (getNetworkFromEnv() === 'custom' && process.env.NEAR_RPC_API_KEY !== '') {
1010
const test = anyTest as TestFn<{
1111
worker: Worker;

__tests__/09.fast-forward.ava.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import {NearAccount, getNetworkFromEnv} from 'near-workspaces';
21
import anyTest, {TestFn} from 'ava';
3-
import {Worker} from 'near-workspaces/dist/worker';
2+
import {NearAccount, Worker, getNetworkFromEnv} from '../packages/js';
43

54
// The contract provided contains only one view call, returning the
65
// block_timestamp and epoch_height of the current block as a tuple.

__tests__/ci-ignore-02.patch-state.ava.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
*/
1313

1414
/* eslint-disable @typescript-eslint/no-extraneous-class, @typescript-eslint/no-unsafe-member-access */
15-
import * as borsh from 'borsh';
16-
import {Worker, getNetworkFromEnv, NearAccount} from 'near-workspaces';
17-
import {NEAR} from 'near-units';
1815
import anyTest, {TestFn} from 'ava';
16+
import * as borsh from '../packages/js/node_modules/borsh';
17+
import {Worker, getNetworkFromEnv, NearAccount} from '../packages/js';
18+
import {NEAR} from '../packages/js/node_modules/near-units';
1919

2020
if (getNetworkFromEnv() === 'sandbox') {
2121
const test = anyTest as TestFn<{

examples/simple-project/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ This is the simplest project setup example with workspaces-js. You can copy it a
44

55
## Usage
66
```
7-
yarn
8-
yarn test
7+
pnpm install
8+
pnpm test
99
```
1010

1111
## Setup your project
1212

1313
Assume you have written your smart contract. Setup and write workspaces-js test as this project is easy:
1414

1515
1. Build the contract to `.wasm` as place it in `contracts/`.
16-
2. Install the `near-workspaces` and `ava` with `npm` or `yarn`.
16+
2. Install the `near-workspaces` and `ava` with `pnpm` or you package manager.
1717
3. Copy the ava.config.cjs to you project root directory.
1818
4. Write test, place in `__tests__/`, end with `.ava.js`. You can refer to `__tests__/test-status-message.ava.js` as an example.
19-
5. We're done! Run test with `yarn test` and continue adding more tests!
19+
5. We're done! Run test with `pnpm test` and continue adding more tests!

0 commit comments

Comments
 (0)