Skip to content

Commit 821eb6e

Browse files
committed
Use yarn
1 parent c895a9c commit 821eb6e

18 files changed

+1018
-162
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM mcr.microsoft.com/devcontainers/python:1-3.13-bullseye
1+
FROM mcr.microsoft.com/devcontainers/base:bookworm
22

33
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/

.devcontainer/devcontainer.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@
44
"dockerfile": "Dockerfile"
55
},
66
"features": {
7+
"ghcr.io/devcontainers/features/python:1": {
8+
"version": "3.13",
9+
"installTools": false
10+
},
711
"ghcr.io/devcontainers/features/node:1": {
12+
"installYarnUsingApt": false,
813
"version": "22"
9-
}
14+
},
15+
"ghcr.io/nikobockerman/devcontainer-features/yarn-persistent-cache:1": {}
1016
},
1117
"containerEnv": {
18+
"COREPACK_ENABLE_DOWNLOAD_PROMPT": "0",
1219
"UV_CACHE_DIR": "${containerWorkspaceFolder}/.uv/cache",
1320
"UV_TOOL_DIR": "${containerWorkspaceFolder}/.uv/tools",
1421
"PYTHON_HISTORY": "${containerWorkspaceFolder}/.python_history"
1522
},
23+
"onCreateCommand": "yarn && yarn dlx @yarnpkg/sdks vscode",
1624
"updateContentCommand": "uv sync && uv run poe sync",
1725
"portsAttributes": {
1826
"8080": {
@@ -23,6 +31,7 @@
2331
"customizations": {
2432
"vscode": {
2533
"extensions": [
34+
"arcanis.vscode-zipfs",
2635
"charliermarsh.ruff",
2736
"editorconfig.editorconfig",
2837
"esbenp.prettier-vscode",

.github/actions/npm-tools-setup/action.yaml

-13
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: yarn project setup
2+
description: Setup node, yarn and tools for project
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Enable corepack to install yarn
7+
run: corepack enable
8+
shell: bash
9+
- name: Setup node
10+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
11+
with:
12+
node-version: 22
13+
cache: yarn
14+
- name: Install yarn dev tools
15+
run: yarn install --immutable
16+
shell: bash

.github/renovate.json5

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
lockFileMaintenance: {
55
enabled: true,
66
},
7-
postUpdateOptions: ["npmDedupe"],
7+
postUpdateOptions: ["yarnDedupeHighest"],
88
separateMinorPatch: true,
99
packageRules: [
1010
{

.github/workflows/check-github-actions.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- ".github/workflows/**.yaml"
66
- ".github/actions/**"
77
- "package.json"
8-
- "package-lock.json"
8+
- "yarn.lock"
99
workflow_call:
1010
workflow_dispatch:
1111

@@ -17,6 +17,6 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
1919
- name: Setup tools
20-
uses: ./.github/actions/npm-tools-setup
20+
uses: ./.github/actions/yarn-project-setup
2121
- name: Check Github actions
22-
run: npm run check:github-actions
22+
run: yarn run check:github-actions

.github/workflows/check-npm.yaml

-23
This file was deleted.

.github/workflows/check-prettier.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
17-
- name: Setup npm tools
18-
uses: ./.github/actions/npm-tools-setup
17+
- name: Setup yarn tools
18+
uses: ./.github/actions/yarn-project-setup
1919
- name: Check prettier
20-
run: npm run check:prettier
20+
run: yarn run check:prettier

.github/workflows/check-pyright.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
1717
- name: Setup project
1818
uses: ./.github/actions/uv-project-setup
19-
- name: Setup npm tools
20-
uses: ./.github/actions/npm-tools-setup
19+
- name: Setup yarn tools
20+
uses: ./.github/actions/yarn-project-setup
2121
- name: Check pyright
2222
run: uv run poe check:pyright

.github/workflows/check-yarn.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Check - Yarn and dependencies
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- ".github/actions/yarn-project-setup/**"
7+
- ".github/workflows/check-yarn.yaml"
8+
- "package.json"
9+
- "yarn.lock"
10+
workflow_call:
11+
workflow_dispatch:
12+
13+
jobs:
14+
duplicate-dependencies:
15+
name: Check for duplicate dependencies
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
20+
- name: Setup yarn tools
21+
uses: ./.github/actions/yarn-project-setup
22+
- name: Check for duplicate dependencies
23+
run: yarn run check:yarn:dedupe
24+
25+
yarn-install-errors:
26+
name: Validate Yarn install does not contain errors
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
31+
- name: Setup project
32+
uses: ./.github/actions/yarn-project-setup
33+
- name: Yarn install output check
34+
run: |
35+
errors=$(yarn install --json | jq 'select(.displayName != "YN0000")')
36+
error_count=$(echo "$errors" | jq -s 'length')
37+
if [ "$error_count" -gt 0 ]; then
38+
echo "Detected Yarn install errors: $error_count"
39+
echo -e "$errors"
40+
exit 1
41+
fi
42+
43+
peer-requirements:
44+
name: Validate yarn peer requirements
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
49+
- name: Setup project
50+
uses: ./.github/actions/yarn-project-setup
51+
- name: Validate peer requirements are defined
52+
run: |
53+
reqs=$(yarn explain peer-requirements)
54+
echo "$reqs" | grep '✘' || true
55+
echo "$reqs" | grep -q '✘' && exit 1 || exit 0

.github/workflows/ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
uses: ./.github/workflows/check-github-actions.yaml
1515
check-mypy:
1616
uses: ./.github/workflows/check-mypy.yaml
17-
check-npm:
18-
uses: ./.github/workflows/check-npm.yaml
1917
check-prettier:
2018
uses: ./.github/workflows/check-prettier.yaml
2119
check-pyright:
@@ -24,6 +22,8 @@ jobs:
2422
uses: ./.github/workflows/check-renovate-config.yaml
2523
check-ruff:
2624
uses: ./.github/workflows/check-ruff.yaml
25+
check-yarn:
26+
uses: ./.github/workflows/check-yarn.yaml
2727
test-pytest:
2828
uses: ./.github/workflows/test-pytest.yaml
2929
run-all:

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ cython_debug/
164164
#.idea/
165165

166166

167-
/node_modules/
168167
/.ruff_cache/
169168
/.python_history
169+
170+
# Yarn
171+
/.pnp.*
172+
/.yarn/*
173+
!/.yarn/patches
174+
!/.yarn/plugins
175+
!/.yarn/versions

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["arcanis.vscode-zipfs", "esbenp.prettier-vscode"]
3+
}

.vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
23
"files.associations": {
34
"*.txt": "plaintext"
45
},
6+
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
57
"python.testing.unittestEnabled": false,
68
"python.testing.pytestEnabled": true,
9+
"search.exclude": {
10+
"**/.yarn": true,
11+
"**/.pnp.*": true
12+
},
713
"[python]": {
814
"editor.defaultFormatter": "charliermarsh.ruff",
915
"editor.codeActionsOnSave": {

package-lock.json

-102
This file was deleted.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
{
22
"scripts": {
33
"check:github-actions": "git ls-files '.github/**.yaml' | xargs -t -I {} action-validator {}",
4-
"check:npm:dedupe": "npm find-dupes",
4+
"check:yarn:dedupe": "yarn dedupe --check",
55
"check:prettier": "prettier --check .",
66
"check:pyright": "pyright",
77
"check:renovateconfig": "npx --package=renovate -- renovate-config-validator --strict",
88
"fix:prettier": "prettier --write --cache-location .prettiercache ."
99
},
1010
"private": true,
11+
"packageManager": "[email protected]",
1112
"engines": {
1213
"node": "^22.0.0"
1314
},
1415
"devDependencies": {
1516
"@action-validator/cli": "0.6.0",
17+
"@action-validator/core": "0.6.0",
1618
"prettier": "3.4.2",
1719
"pyright": "1.1.391"
1820
}

0 commit comments

Comments
 (0)