Skip to content

Commit

Permalink
Merge pull request #9 from jcam1/fix/v1
Browse files Browse the repository at this point in the history
`npm` --> `yarn`; Add Root-Level Formatter
  • Loading branch information
SeiyaKobayashi authored Aug 21, 2024
2 parents 100277c + f7fcc7f commit 7e48a20
Show file tree
Hide file tree
Showing 15 changed files with 111 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- Provide a detailed description of the changes -->

-
-

## 📚 References

Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/check-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ on:
- main
- develop
paths:
- "packages/core/**"
- ".github/workflows/check-core.yml"
- 'packages/core/**'

defaults:
run:
Expand All @@ -26,14 +25,14 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Dependencies
run: yarn
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Compile
run: npm run compile
run: yarn run compile
- name: Lint
run: npm run lint:dry-run
run: yarn run lint:dry-run
- name: Format
run: npm run format:dry-run
run: yarn run format:dry-run

test:
runs-on: ubuntu-latest
Expand All @@ -43,7 +42,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Dependencies
run: yarn
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Run tests
run: npm run test
run: yarn run test
34 changes: 34 additions & 0 deletions .github/workflows/check-root.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: static checks for root-level directories & files

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
paths:
- '.github/**'
- 'docs/**'
- 'README.md'
- 'yarnrc.yml'

defaults:
run:
working-directory: ./

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Format
run: yarn run format:dry-run .github docs README.md yarnrc.yml
13 changes: 6 additions & 7 deletions .github/workflows/check-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ on:
- main
- develop
paths:
- "packages/v1/**"
- ".github/workflows/check-v1.yml"
- 'packages/v1/**'

defaults:
run:
Expand All @@ -26,11 +25,11 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Dependencies
run: yarn
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Compile
run: npm run compile:sdk
run: yarn run compile:sdk
- name: Lint
run: npm run lint:dry-run
run: yarn run lint:dry-run
- name: Format
run: npm run format:dry-run
run: yarn run format:dry-run
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"printWidth": 100,
"semi": true,
"singleQuote": true,
"quoteProps": "consistent",
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always"
}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Monorepo for JPYC Node SDKs.

Please refer to `README`s of each SDK for version specific details.

| SDK | `README` |
|----:|:---------|
| SDK | `README` |
| -----: | :----------------------------------------- |
| `core` | [packages/core](./packages/core/README.md) |
| `v1` | [packages/v1](./packages/v1/README.md) |
| `v1` | [packages/v1](./packages/v1/README.md) |

## 🔨 Development

### Git Submodules

This repo uses [Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to be in sync with [JPYCv2](https://github.com/jcam1/JPYCv2/tree/main) repo.
This repo uses [Git Submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) to be in sync with [JPYCv2](https://github.com/jcam1/JPYCv2/tree/main) repo.

To include submodules when cloning the repo, add `--recursive` option like below.
To include submodules when cloning the repo, add `--recursive` option like below.

```sh
$ git clone --recursive https://github.com/jcam1/sdks.git
Expand All @@ -36,17 +36,17 @@ $ cd sdks
$ yarn
```

### NPM Scripts
### Yarn Scripts

To run npm scripts defined in workspaces, run the following.
To run yarn scripts defined in workspaces, run the following.

```sh
$ npm run -w <workspace name> <command name>
$ yarn workspace <workspace name> run <command name>
```

### Dependencies

To add dependencies, run one of the following. To prevent unexpected behaviors, always pin the exact versions of the dependencies to be installed.
To add dependencies, run one of the following. To prevent unexpected behaviors, always pin the exact versions of the dependencies to be installed.

```sh
# Add dependencies to the specified workspace
Expand Down
30 changes: 22 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,38 @@
"packages/*"
],
"scripts": {
"prepare": "husky"
"prepare": "husky",
"format": "prettier --write",
"format:dry-run": "prettier --check"
},
"devDependencies": {
"husky": "9.0.11",
"lint-staged": "15.2.9"
"lint-staged": "15.2.9",
"prettier": "3.3.3"
},
"lint-staged": {
"*.{md,json,yml}": [
"yarn run format README.md yarnrc.yml"
],
".github/**/*.{md,json,yml}": [
"yarn run format .github"
],
".docs/**/*.{md,json,yml}": [
"yarn run format docs"
],
"packages/core/**/*.{ts,js}": [
"npm run -w @jpyc/sdk-core lint"
"yarn workspace @jpyc/sdk-core run lint",
"yarn workspace @jpyc/sdk-core run format"
],
"packages/core/**/*.{ts,js,md,json}": [
"npm run -w @jpyc/sdk-core format"
"packages/core/**/*.{md,json}": [
"yarn workspace @jpyc/sdk-core run format"
],
"packages/v1/**/*.{ts,js}": [
"npm run -w @jpyc/sdk-v1 lint"
"yarn workspace @jpyc/sdk-v1 run lint",
"yarn workspace @jpyc/sdk-v1 run format"
],
"packages/v1/**/*.{ts,js,md,json}": [
"npm run -w @jpyc/sdk-v1 format"
"packages/v1/**/*.{md,json}": [
"yarn workspace @jpyc/sdk-v1 run format"
]
}
}
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ JPYC core SDK implements a set of constants, types and functions, commonly used

## 🤖 Available Commands

The following commands are available as npm scripts for local development & testing.
The following commands are available as yarn scripts for local development & testing.

| Command | Description |
| ---------------: | :----------------------------------- |
Expand Down
3 changes: 3 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"repository": "https://github.com/jcam1/sdks.git",
"license": "MIT",
"version": "1.0.0",
"publishConfig": {
"access": "public"
},
"engines": {
"node": "^20.12.0",
"yarn": "^1.22.22"
Expand Down
4 changes: 2 additions & 2 deletions packages/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Please follow the following steps to configure our SDK.

#### 1. Install Packages

Install npm packages.
Install packages.

```sh
# yarn
Expand Down Expand Up @@ -78,7 +78,7 @@ For your reference, we provide code examples in `examples` directory. Please fol

## 🤖 Available Commands

The following commands are available as npm scripts for local development & testing.
The following commands are available as yarn scripts for local development & testing.

| Command | Description |
| ----------------------------: | :------------------------------------------------------ |
Expand Down
8 changes: 4 additions & 4 deletions packages/v1/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ We provide code examples that use JPYC V1 SDK as an interface to locally-deploye
Run the following command to start running local Hardhat network and its accompanying node.

```sh
$ npm run node
$ yarn run node
```

### 2. Deploy Contracts

**Open a different window** and run the following command to deploy JPYCv2 contracts to the local network. Once successfully deployed, a new directory will be created, and you can find deployed contract addresses at `/packages/v1/ignition/deployments/chain-31337/deployed_addresses.json`.

```sh
$ npm run deploy
$ yarn run deploy
```

### 3. Set Environment Variables
Expand All @@ -26,7 +26,7 @@ Run the following commands, and edit the generated `.env` file accordingly. Set
# cd into this directory
$ cd /packages/v1
# copy `.env.example` to `.env`
$ npm run env
$ yarn run env
```

### 4. Run Code Examples
Expand All @@ -48,5 +48,5 @@ Run the following commands to execute our code examples.
For example, to mint JPYC tokens on local network, run the following.

```sh
$ npm run mint
$ yarn run mint
```
3 changes: 3 additions & 0 deletions packages/v1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"repository": "https://github.com/jcam1/sdks.git",
"license": "MIT",
"version": "1.0.0",
"publishConfig": {
"access": "public"
},
"engines": {
"node": "^20.12.0",
"yarn": "^1.22.22"
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5252,6 +5252,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.2.tgz#03ff86dc7c835f2d2559ee76876a3914cec4a90a"
integrity sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==

[email protected]:
version "3.3.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105"
integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==

pretty-format@^29.0.0, pretty-format@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812"
Expand Down
3 changes: 3 additions & 0 deletions yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
npmAlwaysAuth: true
npmAuthToken: '${NODE_AUTH_TOKEN}'
npmPublishRegistry: 'https://registry.npmjs.org'

0 comments on commit 7e48a20

Please sign in to comment.