Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate package manager from Yarn to PNPM #272

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ updates:
schedule:
interval: "weekly"
day: "sunday"
time: "09:00"
commit-message:
prefix: "[Dependencies]"
groups:
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,33 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
- name: Set-up Node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache
key: dependencies-v1-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
cache: 'pnpm'
- name: Set Playwright version
id: playwright-version
run: |
echo "playwright=$(cat package.json | grep @playwright/test | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g')" >> $GITHUB_OUTPUT
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-v1-${{ runner.os }}-${{ hashFiles('.hass/config/.HA_VERSION', '.playwright_docker_version') }}
key: docker-v1-${{ runner.os }}-${{ hashFiles('.hass/config/.HA_VERSION') }}-${{ steps.playwright-version.outputs.playwright }}
- name: Install deps
run: yarn install --frozen-lockfile
run: pnpm install
- name: E2E tests
run: |
touch .env
echo HA_TOKEN=${{ secrets.CYPRESS_HA_TOKEN }} >> .env
yarn test:all
pnpm test:all
- name: Create coverage
run: yarn coverage:report
run: pnpm coverage:report
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/ha-beta-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,25 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache
key: dependencies-v1-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
cache: 'pnpm'
- name: Install
run: yarn install --frozen-lockfile
run: pnpm install
- name: E2E Tests
run: |
touch .env
echo HA_TOKEN=${{ secrets.CYPRESS_HA_TOKEN }} >> .env
TAG=beta yarn test:ci
TAG=beta pnpm test:ci
- name: Create coverage
run: yarn coverage:report
run: pnpm coverage:report
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,33 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache
key: dependencies-v1-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
cache: 'pnpm'
- name: Set Playwright version
id: playwright-version
run: |
echo "playwright=$(cat package.json | grep @playwright/test | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g')" >> $GITHUB_OUTPUT
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-v1-${{ runner.os }}-${{ hashFiles('.hass/config/.HA_VERSION', '.playwright_docker_version') }}
key: docker-v1-${{ runner.os }}-${{ hashFiles('.hass/config/.HA_VERSION') }}-${{ steps.playwright-version.outputs.playwright }}
- name: Install
run: yarn install --frozen-lockfile
run: pnpm install
- name: E2E tests
run: |
touch .env
echo HA_TOKEN=${{ secrets.CYPRESS_HA_TOKEN }} >> .env
yarn test:all
pnpm test:all
- name: Create coverage
run: yarn coverage:report
run: pnpm coverage:report
- uses: actions/upload-artifact@v3
if: always()
with:
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
"scripts": {
"build": "rollup --config rollup.config.js --bundleConfigAsCjs",
"lint": "eslint \"src/**/*.{js,ts}\" \"tests/**/*.ts\"",
"lint:fix": "yarn lint --fix",
"lint:fix": "pnpm lint --fix",
"test:ts": "tsc --noEmit",
"test:run": "dotenv playwright test",
"start:playwright": "docker run --rm --network host --add-host host.docker.internal:host-gateway -v $(pwd):$(pwd) -w $(pwd) -i mcr.microsoft.com/playwright:v$npm_package_devDependencies__playwright_test-jammy sh -c \"yarn test:run && exit\"",
"test:open": "playwright test --ui",
"test:update": "playwright test --update-snapshots",
"test:ci": "yarn demo && yarn start:playwright && yarn stop:ha",
"test:all": "yarn lint && yarn test:ts && yarn test:ci",
"test:ci": "pnpm demo && pnpm start:playwright && pnpm stop:ha",
"test:all": "pnpm lint && pnpm test:ts && pnpm test:ci",
"coverage:report": "nyc report --reporter=lcov --reporter=text-summary",
"start:ha": "docker run --rm -d -p8123:8123 --shm-size=512m -v ${PWD}/.hass/config:/config homeassistant/home-assistant:${TAG:-$(cat .hass/config/.HA_VERSION)}",
"start:ha:win": "docker run --rm -d -p8123:8123 --shm-size=512m -v %cd%/.hass/config:/config homeassistant/home-assistant:${TAG:-$(cat .hass/config/.HA_VERSION)}",
"stop:ha": "docker stop $(docker ps -a -q --filter ancestor=homeassistant/home-assistant:${TAG:-$(cat .hass/config/.HA_VERSION)}) || true",
"reset:ha": "git add .hass/config/.HA_VERSION && git checkout .hass/config",
"demo": "yarn build && yarn start:ha",
"demo:win": "yarn build && yarn start:ha:win",
"prepare": "yarn build",
"prepublishOnly": "yarn test:all",
"demo": "pnpm build && pnpm start:ha",
"demo:win": "pnpm build && pnpm start:ha:win",
"prepare": "pnpm build",
"prepublishOnly": "pnpm test:all",
"version": "git add .",
"postversion": "git push && git push --tags"
},
Expand All @@ -47,6 +47,7 @@
"rollup-plugin-istanbul": "^5.0.0",
"rollup-plugin-ts": "^3.4.5",
"sinon": "^18.0.0",
"tslib": "^2.7.0",
"typescript": "^5.5.4",
"typescript-eslint": "^8.4.0"
}
Expand Down
Loading
Loading