Skip to content

Commit

Permalink
Migrate to pnpm (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
elchininet authored Mar 24, 2024
1 parent a7cddb4 commit 0d20fad
Show file tree
Hide file tree
Showing 7 changed files with 2,497 additions and 2,343 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,26 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
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: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: dependencies-v1-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
cache: 'pnpm'
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-v1-${{ runner.os }}-${{ hashFiles('.hass/config/.HA_VERSION', '.playwright_docker_version') }}
- name: Install deps
run: yarn install --frozen-lockfile
run: pnpm install
- name: E2E tests
run: yarn test:all
run: pnpm test:all
- name: Create coverage
run: yarn coverage:report
run: pnpm coverage:report
- name: Coveralls
uses: coverallsapp/github-action@master
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,23 +11,22 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
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: TAG=beta yarn test:ci
run: TAG=beta pnpm test:ci
- name: Create coverage
run: yarn coverage:report
run: pnpm coverage:report
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,26 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 8
run_install: false
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: dependencies-v1-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
cache: 'pnpm'
- name: Cache Docker images
uses: ScribeMD/[email protected]
with:
key: docker-v1-${{ runner.os }}-${{ hashFiles('.hass/config/.HA_VERSION', '.playwright_docker_version') }}
- name: Install
run: yarn install --frozen-lockfile
run: pnpm install
- name: E2E tests
run: yarn test:all
run: pnpm test:all
- name: Create coverage
run: yarn coverage:report
run: pnpm coverage:report
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand Down
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,32 @@
"license": "Apache-2.0",
"private": false,
"scripts": {
"build": "yarn clean && rollup --config rollup.config.js --bundleConfigAsCjs",
"build": "pnpm clean && rollup --config rollup.config.js --bundleConfigAsCjs",
"clean": "rm -rf dist || true",
"test:lint": "eslint \"src/**/*.{js,ts}\" \"tests/**/*.ts\"",
"test:clean": "rm -rf dist .nyc_output coverage || true",
"test:all": "yarn test:ts && yarn test:lint && yarn test:ci",
"test:ci": "yarn test:clean && yarn demo && yarn start:playwright && yarn stop:ha",
"test:all": "pnpm test:ts && pnpm test:lint && pnpm test:ci",
"test:ci": "pnpm test:clean && pnpm demo && pnpm start:playwright && pnpm stop:ha",
"test:run": "playwright test",
"test:open": "playwright test --ui",
"test:ts": "tsc --noEmit",
"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)}",
"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": "pnpm build && pnpm start:ha",
"start:playwright": "docker run --rm --network host --add-host host.docker.internal:host-gateway -v $(pwd):/$(pwd)/ -w $(pwd) -i mcr.microsoft.com/playwright:$(cat .playwright_docker_version) sh -c \"yarn test:run && exit\"",
"coverage:report": "nyc report --reporter=lcov --reporter=text-summary",
"prepare": "yarn build",
"prepublishOnly": "yarn test:all",
"preinstall": "npx -y only-allow pnpm",
"prepare": "pnpm build",
"prepublishOnly": "pnpm test:all",
"version": "git add .",
"postversion": "git push && git push --tags"
},
"devDependencies": {
"@playwright/test": "^1.42.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@stylistic/eslint-plugin-js": "^1.7.0",
"@types/node": "^20.11.30",
"@typescript-eslint/eslint-plugin": "^7.3.1",
Expand All @@ -41,8 +43,8 @@
"playwright-test-coverage": "^1.2.12",
"rollup": "^4.13.0",
"rollup-plugin-istanbul": "^5.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-ts": "^3.4.5",
"tslib": "^2.6.2",
"typescript": "^5.4.3"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 0d20fad

Please sign in to comment.