Skip to content

Commit

Permalink
Merge pull request #141 from nikobockerman/use-yarn-and-small-fixes
Browse files Browse the repository at this point in the history
Use yarn and small fixes
  • Loading branch information
nikobockerman authored Dec 23, 2024
2 parents 26e08f0 + 821eb6e commit d7bfd66
Show file tree
Hide file tree
Showing 18 changed files with 1,024 additions and 160 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM mcr.microsoft.com/devcontainers/python:1-3.13-bullseye
FROM mcr.microsoft.com/devcontainers/base:bookworm

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
12 changes: 11 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/python:1": {
"version": "3.13",
"installTools": false
},
"ghcr.io/devcontainers/features/node:1": {
"installYarnUsingApt": false,
"version": "22"
}
},
"ghcr.io/nikobockerman/devcontainer-features/yarn-persistent-cache:1": {}
},
"containerEnv": {
"COREPACK_ENABLE_DOWNLOAD_PROMPT": "0",
"UV_CACHE_DIR": "${containerWorkspaceFolder}/.uv/cache",
"UV_TOOL_DIR": "${containerWorkspaceFolder}/.uv/tools",
"PYTHON_HISTORY": "${containerWorkspaceFolder}/.python_history"
},
"onCreateCommand": "yarn && yarn dlx @yarnpkg/sdks vscode",
"updateContentCommand": "uv sync && uv run poe sync",
"portsAttributes": {
"8080": {
Expand All @@ -23,8 +31,10 @@
"customizations": {
"vscode": {
"extensions": [
"arcanis.vscode-zipfs",
"charliermarsh.ruff",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"github.vscode-github-actions",
"mrmlnc.vscode-json5",
"ms-azuretools.vscode-docker",
Expand Down
13 changes: 0 additions & 13 deletions .github/actions/npm-tools-setup/action.yaml

This file was deleted.

16 changes: 16 additions & 0 deletions .github/actions/yarn-project-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: yarn project setup
description: Setup node, yarn and tools for project
runs:
using: composite
steps:
- name: Enable corepack to install yarn
run: corepack enable
shell: bash
- name: Setup node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: 22
cache: yarn
- name: Install yarn dev tools
run: yarn install --immutable
shell: bash
1 change: 1 addition & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
lockFileMaintenance: {
enabled: true,
},
postUpdateOptions: ["yarnDedupeHighest"],
separateMinorPatch: true,
packageRules: [
{
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-github-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- ".github/workflows/**.yaml"
- ".github/actions/**"
- "package.json"
- "package-lock.json"
- "yarn.lock"
workflow_call:
workflow_dispatch:

Expand All @@ -17,6 +17,6 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup tools
uses: ./.github/actions/npm-tools-setup
uses: ./.github/actions/yarn-project-setup
- name: Check Github actions
run: npm run check:github-actions
run: yarn run check:github-actions
23 changes: 0 additions & 23 deletions .github/workflows/check-npm.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/check-prettier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup npm tools
uses: ./.github/actions/npm-tools-setup
- name: Setup yarn tools
uses: ./.github/actions/yarn-project-setup
- name: Check prettier
run: npm run check:prettier
run: yarn run check:prettier
4 changes: 2 additions & 2 deletions .github/workflows/check-pyright.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup project
uses: ./.github/actions/uv-project-setup
- name: Setup npm tools
uses: ./.github/actions/npm-tools-setup
- name: Setup yarn tools
uses: ./.github/actions/yarn-project-setup
- name: Check pyright
run: uv run poe check:pyright
55 changes: 55 additions & 0 deletions .github/workflows/check-yarn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Check - Yarn and dependencies

on:
pull_request:
paths:
- ".github/actions/yarn-project-setup/**"
- ".github/workflows/check-yarn.yaml"
- "package.json"
- "yarn.lock"
workflow_call:
workflow_dispatch:

jobs:
duplicate-dependencies:
name: Check for duplicate dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup yarn tools
uses: ./.github/actions/yarn-project-setup
- name: Check for duplicate dependencies
run: yarn run check:yarn:dedupe

yarn-install-errors:
name: Validate Yarn install does not contain errors
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup project
uses: ./.github/actions/yarn-project-setup
- name: Yarn install output check
run: |
errors=$(yarn install --json | jq 'select(.displayName != "YN0000")')
error_count=$(echo "$errors" | jq -s 'length')
if [ "$error_count" -gt 0 ]; then
echo "Detected Yarn install errors: $error_count"
echo -e "$errors"
exit 1
fi
peer-requirements:
name: Validate yarn peer requirements
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup project
uses: ./.github/actions/yarn-project-setup
- name: Validate peer requirements are defined
run: |
reqs=$(yarn explain peer-requirements)
echo "$reqs" | grep '✘' || true
echo "$reqs" | grep -q '✘' && exit 1 || exit 0
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ on:
workflow_dispatch:

jobs:
check-github-actions:
uses: ./.github/workflows/check-github-actions.yaml
check-mypy:
uses: ./.github/workflows/check-mypy.yaml
check-prettier:
uses: ./.github/workflows/check-prettier.yaml
check-pyright:
uses: ./.github/workflows/check-pyright.yaml
check-renovate-config:
uses: ./.github/workflows/check-renovate-config.yaml
check-ruff:
uses: ./.github/workflows/check-ruff.yaml
check-yarn:
uses: ./.github/workflows/check-yarn.yaml
test-pytest:
uses: ./.github/workflows/test-pytest.yaml
run-all:
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ cython_debug/
#.idea/


/node_modules/
/.ruff_cache/
/.python_history

# Yarn
/.pnp.*
/.yarn/*
!/.yarn/patches
!/.yarn/plugins
!/.yarn/versions
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["arcanis.vscode-zipfs", "esbenp.prettier-vscode"]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.associations": {
"*.txt": "plaintext"
},
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
Expand Down
102 changes: 0 additions & 102 deletions package-lock.json

This file was deleted.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"scripts": {
"check:github-actions": "git ls-files '.github/**.yaml' | xargs -t -I {} action-validator {}",
"check:npm:dedupe": "npm find-dupes",
"check:yarn:dedupe": "yarn dedupe --check",
"check:prettier": "prettier --check .",
"check:pyright": "pyright",
"check:renovateconfig": "npx --package=renovate -- renovate-config-validator --strict",
"fix:prettier": "prettier --write ."
"fix:prettier": "prettier --write --cache-location .prettiercache ."
},
"private": true,
"packageManager": "[email protected]",
"engines": {
"node": "^22.0.0"
},
"devDependencies": {
"@action-validator/cli": "0.6.0",
"@action-validator/core": "0.6.0",
"prettier": "3.4.2",
"pyright": "1.1.391"
}
Expand Down
Loading

0 comments on commit d7bfd66

Please sign in to comment.