Skip to content

Commit

Permalink
feat: pnpm (#581)
Browse files Browse the repository at this point in the history
* added pnpm

* pnpm package refrences

* pnpm in gh action

* contributing and maintainers pnpm

* action updates

* uses checkout@v4

* prettier
  • Loading branch information
heyAyushh authored Oct 22, 2024
1 parent 0e3a814 commit d9a1b98
Show file tree
Hide file tree
Showing 11 changed files with 8,299 additions and 4,690 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/contentlayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm -g i yarn
- run: yarn install
- run: yarn contentlayer:build
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Build contentlayer
run: pnpm contentlayer:build
14 changes: 9 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ jobs:
deploy-production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Vercel CLI and Yarn
run: npm install --global vercel@latest yarn
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Vercel CLI and pnpm
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run:
vercel pull --yes --environment=production
--token=${{secrets.VERCEL_TOKEN }}
- name: Install dependencies via yarn
run: yarn install
- name: Install dependencies via pnpm
run: pnpm install
# todo: if not content files changed, skip uploading
# todo: only upload the changed files
- name: Upload latest content to crowdin
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@ jobs:
Format:
name: Test formatting via prettier/lint...
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Use Node.js node
uses: actions/setup-node@v2
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
node-version: "18"
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: before_install
run:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
&& sudo sysctl -p

- name: installing yarn
run: yarn install
- name: Install dependencies
run: pnpm install
- name: prettier:check
run: yarn prettier
run: pnpm prettier
- name: lint
run: yarn lint
run: pnpm lint
24 changes: 17 additions & 7 deletions .github/workflows/label-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
if: contains(github.event.pull_request.labels.*.name, 'prettier')
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20]

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
Expand All @@ -33,21 +37,27 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Use Node.js node
uses: actions/setup-node@v2
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: "18"
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- name: before_install
run:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
&& sudo sysctl -p

# perform steps to modify as desired
- name: yarn install
run: yarn install
- name: yarn prettier:fix
run: yarn prettier:fix
- name: pnpm install
run: pnpm install
- name: pnpm prettier:fix
run: pnpm prettier:fix

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ If your editor is not configured to auto-format on save using prettier, then you
can run the following command to auto-format all files in your local repo/PR:

```shell
yarn prettier:fix
pnpm prettier:fix
```

You can also run the prettier check command to see which files do not follow the
prettier formatting guidelines.

```shell
yarn prettier
pnpm prettier
```

#### Rust & Anchor
Expand Down Expand Up @@ -999,16 +999,16 @@ git clone https://github.com/solana-foundation/developer-content.git
cd developer-content
```

2. Install the dependencies via `yarn`:
2. Install the dependencies via `pnpm`:

```shell
yarn install
pnpm install
```

3. Run the developer content API locally:

```shell
yarn dev
pnpm dev
```

> Note: The developer content API normally runs locally on port `3001`
10 changes: 5 additions & 5 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ operations.
Push all the English based content to the Crowdin platform to

```shell
yarn crowdin:upload
pnpm crowdin:upload
```

### Download the current translations

You can download the latest translations using the crowdin cli:

```shell
yarn crowdin:download
pnpm crowdin:download
```

This will store all the translated content files inside the `i18n` directory,
Expand Down Expand Up @@ -67,21 +67,21 @@ the translation path (`-t` flag). Be sure to include the `%locale%` wildcard in
the translation path:

```shell
yarn crowdin upload -s docs/intro/installation.md -t i18n/%locale%/docs/intro/installation.md
pnpm crowdin upload -s docs/intro/installation.md -t i18n/%locale%/docs/intro/installation.md
```

To download the Crowdin formatted content, download the entire locale using the
`-l` flag and passing the locale short code. For example, downloading only the
German (DE) translated content:

```shell
yarn crowdin download -l de
pnpm crowdin download -l de
```

It may be helpful to also run the prettier formatter on the translation files,
since this is normally performed by a GitHub action on deployment to catch and
fix many formatting issues that Crowdin causes due to altering content:

```shell
yarn prettier:i18n
pnpm prettier:i18n
```
4 changes: 2 additions & 2 deletions content/guides/getstarted/local-rust-hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ library.
### Install Node.js

To use node in WSL2 on Windows, please follow this
[guide to installing node in WSL2](https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl)
to install node.
[guide to installing node in WSL2](https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl) to
install node.

```shell
sudo apt-get install curl
Expand Down
3 changes: 2 additions & 1 deletion docs/programs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ with README files that explain you how to run the different examples. Most
examples are self-contained and are available in native Rust (ie, with no
framework) and [Anchor](https://www.anchor-lang.com/docs/installation). It also
contains a list of examples that we would love to
[see as contributions](https://github.com/solana-developers/program-examples?tab=readme-ov-file#examples-wed-love-to-see).
[see as contributions](https://github.com/solana-developers/program-examples?tab=readme-ov-file#examples-wed-love-to-see).

Within the repo you will find the following subfolder, each with assorted
example programs within them:

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
"runner": "npx ts-node -r tsconfig-paths/register",
"contentlayer:build": "npx contentlayer2 build --clearCache",
"code-import": "npx esrun coder.ts",
"dev": "yarn code-import && yarn contentlayer:build && concurrently -p \"[{name}]\" -n \"code import,next dev\" -c \"bgBlue.bold,bgGreen.bold\" \"yarn code-import --watch\" \"next dev -p 3001\"",
"build": "yarn code-import && yarn prettier:i18n && yarn contentlayer:build && next build",
"dev": "pnpm code-import && pnpm contentlayer:build && concurrently -p \"[{name}]\" -n \"code import,next dev\" -c \"bgBlue.bold,bgGreen.bold\" \"pnpm code-import --watch\" \"next dev -p 3001\"",
"build": "pnpm code-import && pnpm prettier:i18n && pnpm contentlayer:build && next build",
"start": "next start -p 3001",
"test": "yarn code-import && yarn prettier && && yarn contentlayer:build",
"test": "pnpm code-import && pnpm prettier && pnpm contentlayer:build",
"lint": "next lint",
"prettier:i18n": "prettier -cw \"i18n/**/*.{js,jsx,ts,tsx,md,css,md,mdx}\" --ignore-path \"[]\"",
"prettier": "prettier -c \"./**/*.{js,jsx,ts,tsx,md,css,md,mdx}\"",
"prettier:fix": "prettier -cw \"**/*.{js,jsx,ts,tsx,md,css,md,mdx}\"",
"crowdin:download": "crowdin download && npm run prettier:i18n",
"crowdin:upload": "crowdin upload sources",
"browser-sync": "browser-sync start --proxy \"localhost:3000\" --files \"**/*.md\"",
"prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install",
"dev:sync": "yarn dev & (sleep 5 && yarn browser-sync)"
"prepare": "husky",
"dev:sync": "pnpm dev & (sleep 5 && pnpm browser-sync)"
},
"dependencies": {
"@crowdin/cli": "^3.18.0",
Expand Down Expand Up @@ -61,6 +61,6 @@
"vfile": "^6.0.2"
},
"lint-staged": {
"*.{js,jsx,json,ts,tsx,md,css,md,mdx,yml,yaml}": "yarn prettier:fix"
"*.{js,jsx,json,ts,tsx,md,css,md,mdx,yml,yaml}": "pnpm prettier:fix"
}
}
Loading

0 comments on commit d9a1b98

Please sign in to comment.