Skip to content

Commit 3ea7824

Browse files
committed
chore: migrate to pnpm (#245)
migrate to release-please reduce complexity of generateScreenshotPath reduce complexity of getConfig fn prepare directory structure for more examples prepare codeclimate configuration for monorepo
1 parent fc5624b commit 3ea7824

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+10948
-21332
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
parser: "@typescript-eslint/parser",
1919
parserOptions: {
2020
sourceType: "module",
21-
project: ["./tsconfig.json", "./example/tsconfig.json"],
21+
project: ["./packages/cypress-plugin-visual-regression-diff/tsconfig.json", "./examples/webpack/tsconfig.json"],
2222
tsconfigRootDir: __dirname,
2323
warnOnUnsupportedTypeScriptVersion: false,
2424
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,

.github/workflows/ci.yml

+47-112
Original file line numberDiff line numberDiff line change
@@ -11,176 +11,111 @@ jobs:
1111
cache:
1212
name: CI cache
1313
runs-on: ubuntu-latest
14-
outputs:
15-
yarn-cache-key: ${{ steps.yarn-cache-key.outputs.key }}
1614
steps:
1715
- uses: actions/checkout@v3
16+
- uses: pnpm/[email protected]
1817
- uses: actions/setup-node@v3
1918
with:
2019
node-version: "18.x"
21-
- name: Remove git auth
22-
run: git config --unset http.https://github.com/.extraheader
23-
- name: Generate yarn cache-key
24-
id: yarn-cache-key
25-
run: echo "::set-output name=key::${{ runner.os }}-yarn-ci-cache-v3-${{ hashFiles('./yarn.lock') }}-${{ hashFiles('**/yarn.lock') }}"
26-
- name: Configure Yarn cache
27-
uses: actions/cache@v3
28-
with:
29-
key: ${{ steps.yarn-cache-key.outputs.key }}
30-
path: |
31-
~/.cache/Cypress
32-
.yarn
33-
node_modules
34-
example/node_modules
35-
- name: Install dependencies
36-
if: ${{ github.actor != 'dependabot[bot]' || github.ref == 'refs/heads/main' }}
37-
run: yarn --immutable
38-
- name: Reset yarn.lock (due to dependabot incompatibility with yarn 3)
39-
if: ${{ github.actor == 'dependabot[bot]' && github.ref != 'refs/heads/main' }}
40-
run: "git checkout HEAD~1 yarn.lock"
41-
- name: Install dependencies & update yarn.lock (dependabot)
42-
if: ${{ github.actor == 'dependabot[bot]' && github.ref != 'refs/heads/main' }}
43-
run: "yarn install && git stage yarn.lock && git commit -m 'chore: update yarn.lock' && git push"
44-
env:
45-
YARN_ENABLE_IMMUTABLE_INSTALLS: false
20+
cache: 'pnpm'
21+
- run: pnpm install
4622

4723
lint:
4824
name: lint
4925
runs-on: ubuntu-latest
5026
needs: cache
5127
steps:
5228
- uses: actions/checkout@v3
29+
- uses: pnpm/[email protected]
5330
- uses: actions/setup-node@v3
5431
with:
5532
node-version: "18.x"
56-
- name: remove git auth
57-
run: git config --unset http.https://github.com/.extraheader
58-
- name: Configure Yarn cache
59-
uses: actions/cache@v3
60-
with:
61-
key: ${{ needs.cache.outputs.yarn-cache-key }}
62-
path: |
63-
~/.cache/Cypress
64-
.yarn
65-
node_modules
66-
example/node_modules
67-
- name: Install dependencies
68-
run: yarn --immutable
69-
- name: Lint
70-
run: yarn lint:ci
71-
- name: Prettify
72-
run: yarn prettify:ci
33+
cache: 'pnpm'
34+
- run: pnpm install
35+
- run: pnpm lint:ci
36+
- run: pnpm format:ci
7337

7438
test:
7539
name: test
7640
runs-on: ubuntu-latest
7741
needs: cache
7842
steps:
7943
- uses: actions/checkout@v3
44+
- uses: pnpm/[email protected]
8045
- uses: actions/setup-node@v3
8146
with:
8247
node-version: "18.x"
83-
- name: remove git auth
84-
run: git config --unset http.https://github.com/.extraheader
85-
- name: Configure Yarn cache
86-
uses: actions/cache@v3
87-
with:
88-
key: ${{ needs.cache.outputs.yarn-cache-key }}
89-
path: |
90-
~/.cache/Cypress
91-
.yarn
92-
node_modules
93-
example/node_modules
94-
- name: Install dependencies
95-
run: yarn --immutable
96-
- name: Build plugin
97-
run: yarn build
98-
- name: Install example dependencies
99-
run: cd example && yarn --immutable
48+
cache: 'pnpm'
49+
- run: pnpm install && cd ./examples/webpack && pnpm cypress install
50+
- run: pnpm --filter cypress-plugin-visual-regression-diff -r build
10051
- name: Test e2e
101-
run: yarn test:e2e:ci
52+
run: pnpm test:e2e:ci
10253
- name: Test component-testing
103-
run: yarn test:ct:ci
54+
run: pnpm test:ct:ci
10455

10556
test-integration-coverage:
10657
name: test-integration-coverage
10758
runs-on: ubuntu-latest
10859
needs: cache
10960
steps:
11061
- uses: actions/checkout@v3
62+
- uses: pnpm/[email protected]
11163
- uses: actions/setup-node@v3
11264
with:
11365
node-version: "18.x"
114-
- name: remove git auth
115-
run: git config --unset http.https://github.com/.extraheader
116-
- name: Configure Yarn cache
117-
uses: actions/cache@v3
118-
with:
119-
key: ${{ needs.cache.outputs.yarn-cache-key }}
120-
path: |
121-
~/.cache/Cypress
122-
.yarn
123-
node_modules
124-
example/node_modules
125-
- name: Install dependencies
126-
run: yarn --immutable
66+
cache: 'pnpm'
67+
- run: pnpm install
12768
- name: Test integration (with coverage) and upload to CodeClimate
12869
if: ${{ github.ref == 'refs/heads/main' }}
12970
uses: paambaati/[email protected]
13071
env:
13172
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
13273
with:
13374
debug: true
134-
coverageCommand: yarn test:integration:ci
75+
coverageCommand: pnpm test:integration:ci
13576
coverageLocations: |
136-
${{github.workspace}}/coverage/lcov.info:lcov
77+
${{github.workspace}}/packages/*/coverage/lcov.info:lcov
13778
- name: Test integration (with coverage)
13879
if: ${{ github.ref != 'refs/heads/main' }}
139-
run: yarn test:integration:ci
80+
run: pnpm test:integration:ci
14081

141-
build-and-release:
142-
name: build and release
82+
prepare-release:
83+
name: detect changes, bump package versions, generate changelog and commit it to main branch
14384
runs-on: ubuntu-latest
14485
needs: [cache, lint, test, test-integration-coverage]
14586
if: ${{ github.actor != 'dependabot[bot]' && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
87+
permissions:
88+
contents: write
89+
pull-requests: write
90+
outputs:
91+
releases_created: ${{ steps.release.outputs.releases_created }}
14692
steps:
147-
- uses: actions/checkout@v3
93+
- uses: google-github-actions/[email protected]
94+
id: release
14895
with:
149-
# pulls all commits (needed for lerna / semantic release to correctly version)
150-
fetch-depth: "0"
151-
- name: Setup git user
152-
run: |
153-
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
154-
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
96+
command: manifest
97+
default-branch: main
98+
99+
build-and-release:
100+
name: build and release
101+
runs-on: ubuntu-latest
102+
needs: prepare-release
103+
if: needs.prepare-release.outputs.releases_created
104+
steps:
105+
- uses: actions/checkout@v3
106+
- uses: pnpm/[email protected]
155107
- uses: actions/setup-node@v3
156108
with:
157109
node-version: "18.x"
158-
- name: remove git auth
159-
run: git config --unset http.https://github.com/.extraheader
160-
- name: Configure Yarn cache
161-
uses: actions/cache@v3
162-
with:
163-
key: ${{ needs.cache.outputs.yarn-cache-key }}
164-
path: |
165-
~/.cache/Cypress
166-
.yarn
167-
node_modules
168-
example/node_modules
169-
- name: Install dependencies
170-
run: yarn --immutable
171-
- name: Authenticate with Registry
172-
run: |
173-
yarn npm logout
174-
echo "registry=http://registry.npmjs.org/" >> .npmrc
175-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
176-
npm whoami
177-
env:
110+
cache: 'pnpm'
111+
registry-url: 'https://registry.npmjs.org'
178112
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
179-
- name: release package
180-
if: ${{ success() }}
181-
run: yarn release:ci
113+
- run: pnpm install
114+
- name: Build packages to get cross-references working 🔧
115+
run: pnpm build
116+
- name: Release package
117+
run: pnpm release:ci
182118
env:
183119
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
184-
NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
185120
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
186121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"packages/cypress-plugin-visual-regression-diff": "3.3.9"
3+
}

.yarn/releases/yarn-3.2.4.cjs

-801
This file was deleted.

.yarnrc.yml

-3
This file was deleted.

CONTRIBUTING.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Don’t hesitate to ask a question directly on the [discussions board](https://g
2222

2323
- Checkout the master branch and (after you do your work) file a PR against it
2424

25-
- Read through the [development setup](#development-setup) to learn how to work with this project. Always make sure that `yarn lint`, `yarn build` and `yarn test` pass
25+
- Read through the [development setup](#development-setup) to learn how to work with this project. Always make sure that `pnpm lint`, `pnpm build` and `pnpm test` pass
2626

2727
- Please use [conventional commits v1.0.0 style guide](https://www.conventionalcommits.org/en/v1.0.0/) for commits and PR names
2828

@@ -42,15 +42,15 @@ Don’t hesitate to ask a question directly on the [discussions board](https://g
4242

4343
<!-- textlint-disable spelling -->
4444

45-
You will need [Node.js](https://nodejs.org/en/) **version 16+** and [yarn](https://yarnpkg.com/getting-started/install).
45+
You will need [Node.js](https://nodejs.org/en/) **version 16+** and [pnpm](https://pnpm.io/installation).
4646

4747
<!-- textlint-enable -->
4848

4949
After cloning the repository, run:
5050

5151
```bash
52-
yarn i # installs the project dependencies
53-
cd example && yarn i # install dependencies for example project (useful for testing)
52+
pnpm i # installs the project dependencies
53+
cd examples/webpack && pnpm i # install dependencies for example project (useful for testing)
5454
```
5555

5656
### Committing Changes
@@ -63,30 +63,30 @@ When fired in the project root they will run corresponding actions in every nest
6363

6464
```bash
6565
# build the project for NPM and example usage
66-
$ yarn build
66+
$ pnpm build
6767

6868
# run tests once
69-
$ yarn test
69+
$ pnpm test
7070

7171
# open cypress component runner from example directory
72-
# requires plugin to be built first via `yarn build`
73-
$ yarn test:ct
72+
# requires plugin to be built first via `pnpm build`
73+
$ pnpm test:ct
7474

7575
# open cypress e2e runner from example directory
76-
# requires plugin to be built first via `yarn build`
77-
$ yarn test:e2e
76+
# requires plugin to be built first via `pnpm build`
77+
$ pnpm test:e2e
7878

7979
# run integration tests once and collect coverage
80-
$ yarn test:integration:coverage
80+
$ pnpm test:integration:coverage
8181

8282
# run integration tests in watch mode
83-
$ yarn test:integration:watch
83+
$ pnpm test:integration:watch
8484

8585
# lint & try to autofix linting errors
86-
$ yarn fix:lint && yarn prettify
86+
$ pnpm fix:lint && pnpm format
8787

8888
# lint files
89-
$ yarn lint && yarn prettify:ci
89+
$ pnpm lint && pnpm format:ci
9090
```
9191

9292
There are some other scripts available in the `scripts` section of the `package.json` file.

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,14 @@
6161
You can install this library using your favorite package manager:
6262

6363
```bash
64+
# npm
65+
npm install --save-dev @frsource/cypress-plugin-visual-regression-diff
66+
6467
# yarn
6568
yarn add -D @frsource/cypress-plugin-visual-regression-diff
6669

67-
# npm
68-
npm install --save-dev @frsource/cypress-plugin-visual-regression-diff
70+
# pnpm
71+
pnpm add -D @frsource/cypress-plugin-visual-regression-diff
6972
```
7073

7174
Next, you need to import the library:
@@ -150,7 +153,7 @@ cy.matchImage();
150153

151154
## Example
152155

153-
Still got troubles with installation? Have a look at [example directory of this repo](./example) to see how this plugin can be used in e2e or component-testing Cypress environment within your project.
156+
Still got troubles with installation? Have a look at [examples directory of this repo](./examples) to see how this plugin can be used in e2e or component-testing Cypress environment within your project.
154157

155158
## Automatic clean up of unused images
156159

example/.yarnrc.yml

-3
This file was deleted.

0 commit comments

Comments
 (0)