Skip to content

Commit

Permalink
build: Migrate package manager to Yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
lasuillard committed Mar 30, 2024
1 parent a33a8f2 commit a4c5573
Show file tree
Hide file tree
Showing 11 changed files with 2,926 additions and 3,301 deletions.
9 changes: 0 additions & 9 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@
"name": "lasuillard/raindrop-client",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
"features": {
"ghcr.io/devcontainers-contrib/features/pnpm:2": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
"ghcr.io/devcontainers/features/java:1": {}
},
"onCreateCommand": "./.devcontainer/onCreateCommand.sh",
"postAttachCommand": "./.devcontainer/postAttachCommand.sh",
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"customizations": {
"vscode": {
"extensions": [
Expand All @@ -23,11 +20,5 @@
"vivaxy.vscode-conventional-commits"
]
}
},
"containerEnv": {
"PNPM_HOME": "/pnpm"
},
"remoteEnv": {
"PATH": "${containerEnv:PATH}:${containerEnv:PNPM_HOME}"
}
}
3 changes: 0 additions & 3 deletions .devcontainer/postAttachCommand.sh

This file was deleted.

3 changes: 0 additions & 3 deletions .devcontainer/postCreateCommand.sh

This file was deleted.

11 changes: 3 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PNPM
uses: pnpm/action-setup@v3
with:
version: latest

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: pnpm
cache: yarn

- name: Install PNPM deps
run: pnpm install
- name: Install deps
run: yarn install --frozen-lockfile

- uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PNPM
uses: pnpm/action-setup@v3
with:
version: latest

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: pnpm
cache: yarn

- name: Install PNPM deps
run: pnpm install
- name: Install deps
run: yarn install --frozen-lockfile

- name: Build package
run: pnpm run build
run: yarn run build

- name: Generate API docs
run: pnpm run make-docs
run: yarn run make-docs

- name: Upload docs artifact
uses: actions/upload-pages-artifact@v3
Expand Down
16 changes: 5 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up PNPM
uses: pnpm/action-setup@v3
with:
version: latest

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: pnpm
registry-url: https://npm.pkg.github.com
cache: yarn

- name: Install PNPM deps
run: pnpm install
- name: Install deps
run: yarn install --frozen-lockfile

- name: Build app
run: pnpm run build
run: yarn run build

- name: Create release
uses: softprops/action-gh-release@v2
Expand Down Expand Up @@ -63,4 +57,4 @@ jobs:
- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ github.token }}
run: pnpm publish --no-git-checks # BUG: https://github.com/pnpm/pnpm/issues/5894
run: yarn publish
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ repos:
name: Format with Prettier
language: system
types_or: [javascript, ts, json, yaml]
entry: pnpm exec prettier
entry: yarn run prettier
args: [--write]

- id: eslint
name: Lint with ESLint
language: system
types_or: [javascript, ts]
entry: pnpm exec eslint
entry: yarn run eslint
args: [--fix]

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -42,12 +42,12 @@ repos:
language: system
types_or: [javascript, ts]
pass_filenames: false
entry: pnpm exec tsc
entry: yarn run tsc
args: [--noEmit]

- id: vitest
name: Run tests with Vitest
language: system
types_or: [javascript, ts]
pass_filenames: false
entry: pnpm run test
entry: yarn run test
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ help: Makefile ## Show help
# =============================================================================
# Common
# =============================================================================
install: ## Install the app locally
pnpm install
install: ## Install deps and tools
yarn install
pre-commit install --install-hooks
.PHONY: install

init: ## Initialize project repository
update: ## Update deps and tools
yarn upgrade
pre-commit autoupdate
pre-commit install --install-hooks --hook-type pre-commit
.PHONY: init
.PHONY: update


# =============================================================================
Expand All @@ -47,7 +48,7 @@ generate: ## Generate codes from schemas
}

before="$$(sig)"
pnpm run generate
yarn run generate
after="$$(sig)"

if [[ "$$after" != "$$before" ]]; then
Expand All @@ -57,22 +58,22 @@ generate: ## Generate codes from schemas
.PHONY: generate

format: ## Run autoformatters
pnpm exec prettier --list-different --write .
pnpm exec eslint --fix .
yarn run prettier --list-different --write .
yarn run eslint --fix .
.PHONY: format

lint: generate ## Run all linters
pnpm exec prettier --check .
pnpm exec eslint .
pnpm exec tsc --noEmit
yarn run prettier --check .
yarn run eslint .
yarn run tsc --noEmit
.PHONY: lint

test: generate ## Run tests
pnpm run test
yarn run test
.PHONY: test

docs: ## Generate dev documents
pnpm run make-docs
yarn run make-docs
.PHONY: docs


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"preview": "vite preview",
"test": "vitest --coverage --run src tests",
"test:watch": "vitest --silent --coverage --watch --ui src tests",
"make-docs": "pnpm exec typedoc --plugin typedoc-plugin-missing-exports src"
"make-docs": "yarn run typedoc --plugin typedoc-plugin-missing-exports src"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.13.1",
Expand Down
Loading

0 comments on commit a4c5573

Please sign in to comment.