chore: migrate to yarn v3 (#6519)
#### Details Migrates the repo's package manager from yarn v1 to yarn v3 (in non-zero-installs configuration) Some of this was mechanical based on [Yarn's migration guide](https://yarnpkg.com/getting-started/migration). Beyond the steps there, this PR: * Updates assorted CI pipelines/workflows and dev docs to adapt to minor syntax updates * Updates CI workflow's caching strategy to use `actions/setup-node@v3`'s built-in support for yarn berry friendly caching instead of implementing our own with `actions/cache@v3` * Updates license-check-and-add and prettier configs to exclude `.yarn/` * Updates e2e `Dockerfile` to account for new changes * Drops Lerna dependency in favor of plain Yarn workspaces, similar to service and action ##### Motivation * Simplifies some common dev commands. In particular, the command to update report package snapshots changes from `yarn test:report:e2e -- -- -- -u` to just `yarn test:report:e2e -u` * Consistency with other repos * Allows for versioned resolutions (similar to https://github.com/microsoft/accessibility-insights-action/pull/1596) - I left modifying existing resolutions out of scope since this PR was already pretty large without them, will cover them in a different PR * Removes a dependency (Lerna) ##### Context Similar PRs in other repos: * https://github.com/microsoft/accessibility-insights-service/pull/2210 * https://github.com/microsoft/accessibility-insights-action/pull/1559 * https://github.com/microsoft/accessibility-insights-action/pull/1596 * https://github.com/microsoft/axe-sarif-converter/pull/935 * https://github.com/microsoft/accessibility-insights-docs/pull/1577 #### Pull request checklist <!-- If a checklist item is not applicable to this change, write "n/a" in the checkbox --> - [n/a] Addresses an existing issue: #0000 - [x] Ran `yarn fastpass` - [n/a] Added/updated relevant unit test(s) (and ran `yarn test`) - [n/a] Verified code coverage for the changes made. Check coverage report at: `<rootDir>/test-results/unit/coverage` - [x] PR title *AND* final merge commit title both start with a semantic tag (`fix:`, `chore:`, `feat(feature-name):`, `refactor:`). See `CONTRIBUTING.md`. - [n/a] (UI changes only) Added screenshots/GIFs to description above - [n/a] (UI changes only) Verified usability with NVDA/JAWS
This commit is contained in:
Родитель
8f6496bb5f
Коммит
6222eb0972
|
@ -8,3 +8,12 @@ drop/
|
|||
extension/
|
||||
node_modules/
|
||||
test-results/
|
||||
|
||||
# Yarn config for non-zero-installs
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
|
|
@ -27,26 +27,12 @@ jobs:
|
|||
timeout-minutes: 2
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with: { node-version: "${{ env.NODE_VERSION }}" }
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: query yarn cache path
|
||||
id: yarn-cache-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
timeout-minutes: 1
|
||||
|
||||
- name: restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ steps.yarn-cache-path.outputs.dir }}
|
||||
node_modules
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
cache: yarn
|
||||
timeout-minutes: 5
|
||||
|
||||
- run: yarn install --frozen-lockfile --prefer-offline
|
||||
- run: yarn install --immutable
|
||||
timeout-minutes: 10
|
||||
|
||||
# CG and NOTICE generation would go here
|
||||
|
@ -75,26 +61,12 @@ jobs:
|
|||
timeout-minutes: 2
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with: { node-version: "${{ env.NODE_VERSION }}" }
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: query yarn cache path
|
||||
id: yarn-cache-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
timeout-minutes: 1
|
||||
|
||||
- name: restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ steps.yarn-cache-path.outputs.dir }}
|
||||
node_modules
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
cache: yarn
|
||||
timeout-minutes: 5
|
||||
|
||||
- run: yarn install --frozen-lockfile --prefer-offline
|
||||
- run: yarn install --immutable
|
||||
timeout-minutes: 10
|
||||
|
||||
# We set maxWorkers to 2 since GH Action VMs have 2 cores and by default Jest only uses 1.
|
||||
|
@ -137,7 +109,7 @@ jobs:
|
|||
path: unit-tests-2-results
|
||||
timeout-minutes: 2
|
||||
|
||||
- run: yarn publish-code-coverage
|
||||
- run: npx codecov
|
||||
timeout-minutes: 3
|
||||
|
||||
lints:
|
||||
|
@ -148,26 +120,12 @@ jobs:
|
|||
timeout-minutes: 2
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with: { node-version: "${{ env.NODE_VERSION }}" }
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: query yarn cache path
|
||||
id: yarn-cache-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
timeout-minutes: 1
|
||||
|
||||
- name: restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ steps.yarn-cache-path.outputs.dir }}
|
||||
node_modules
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
cache: yarn
|
||||
timeout-minutes: 5
|
||||
|
||||
- run: yarn install --frozen-lockfile --prefer-offline
|
||||
- run: yarn install --immutable
|
||||
timeout-minutes: 10
|
||||
|
||||
- run: yarn copyright:check
|
||||
|
@ -220,16 +178,16 @@ jobs:
|
|||
timeout-minutes: 2
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with: { node-version: "${{ env.NODE_VERSION }}" }
|
||||
with:
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
# Intentionally omitting caching; it would need a separate, larger
|
||||
# cache bucket to account for differences in container image and
|
||||
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD, and that would eat so far into
|
||||
# our 5GB cache quota that we'd run into issues with useful main builds'
|
||||
# caches being evicted anytime dependabot filed a few PRs in a row.
|
||||
timeout-minutes: 2
|
||||
|
||||
# Intentionally omitting caching; it would need a separate, larger
|
||||
# cache bucket to account for differences in container image and
|
||||
# PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD, and that would eat so far into
|
||||
# our 5GB cache quota that we'd run into issues with useful main builds'
|
||||
# caches being evicted anytime dependabot filed a few PRs in a row.
|
||||
|
||||
- run: yarn install --frozen-lockfile --prefer-offline
|
||||
- run: yarn install --immutable
|
||||
timeout-minutes: 10
|
||||
|
||||
- run: yarn build:prod
|
||||
|
@ -283,26 +241,12 @@ jobs:
|
|||
timeout-minutes: 2
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with: { node-version: "${{ env.NODE_VERSION }}" }
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: query yarn cache path
|
||||
id: yarn-cache-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
timeout-minutes: 1
|
||||
|
||||
- name: restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ steps.yarn-cache-path.outputs.dir }}
|
||||
node_modules
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
cache: yarn
|
||||
timeout-minutes: 5
|
||||
|
||||
- run: yarn install --frozen-lockfile --prefer-offline
|
||||
- run: yarn install --immutable
|
||||
timeout-minutes: 10
|
||||
|
||||
- run: yarn build:unified
|
||||
|
@ -337,26 +281,12 @@ jobs:
|
|||
timeout-minutes: 2
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with: { node-version: "${{ env.NODE_VERSION }}" }
|
||||
timeout-minutes: 2
|
||||
|
||||
- name: query yarn cache path
|
||||
id: yarn-cache-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
timeout-minutes: 1
|
||||
|
||||
- name: restore yarn cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
${{ steps.yarn-cache-path.outputs.dir }}
|
||||
node_modules
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-${{ hashFiles('.github/workflows/ci.yml') }}
|
||||
node-version: "${{ env.NODE_VERSION }}"
|
||||
cache: yarn
|
||||
timeout-minutes: 5
|
||||
|
||||
- run: yarn install --frozen-lockfile --prefer-offline
|
||||
- run: yarn install --immutable
|
||||
timeout-minutes: 10
|
||||
|
||||
- run: yarn build:package:report
|
||||
|
|
|
@ -26,3 +26,12 @@ generated-validate-assessment-json.js
|
|||
node_modules/
|
||||
.DS_STORE
|
||||
yarn-error.log
|
||||
|
||||
# Yarn config for non-zero-installs
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
.github/
|
||||
.prettierignore
|
||||
.swcrc
|
||||
.yarnrc
|
||||
.vs/
|
||||
.yarn/
|
||||
AppXManifest.xml
|
||||
copyright-header.txt
|
||||
bin/
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -3,4 +3,12 @@
|
|||
|
||||
# This prevents inconsistent timeouts during yarn install of the large office fabric fonts package
|
||||
# See https://github.com/yarnpkg/yarn/issues/5540#issuecomment-374069461
|
||||
network-timeout 120000
|
||||
httpTimeout: 120000
|
||||
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
||||
spec: '@yarnpkg/plugin-workspace-tools'
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.5.0.cjs
|
12
Dockerfile
12
Dockerfile
|
@ -27,13 +27,17 @@ RUN apt-get update && \
|
|||
apt-get install -y dotnet-sdk-6.0 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN npm install -g yarn@1.22.10
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json yarn.lock /app/
|
||||
COPY .yarn /app/.yarn
|
||||
COPY yarn.lock .yarnrc.yml package.json /app/
|
||||
COPY packages/axe-config/package.json /app/packages/axe-config/
|
||||
COPY packages/report/package.json /app/packages/report/
|
||||
COPY packages/report-e2e-tests/package.json /app/packages/report-e2e-tests/
|
||||
COPY packages/ui/package.json /app/packages/ui/
|
||||
COPY packages/validator/package.json /app/packages/validator/
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
RUN yarn install --immutable
|
||||
|
||||
COPY . /app
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"./.swcrc",
|
||||
"./.vs",
|
||||
"./.vscode",
|
||||
"./.yarn",
|
||||
"./dist",
|
||||
"./docs/art/ada-cat.ansi256.txt",
|
||||
"./docs/LICENSE.txt",
|
||||
|
|
|
@ -85,7 +85,7 @@ We expect almost all code to be covered by unit tests (the main exception to thi
|
|||
yarn test --changedSince main
|
||||
|
||||
# Test only files matching a particular name pattern
|
||||
yarn test -- -- SomeFile.test.tsx
|
||||
yarn test -- SomeFile.test.tsx
|
||||
|
||||
# This runs unit tests continuously as they are updated
|
||||
yarn watch:test
|
||||
|
@ -96,7 +96,7 @@ yarn test
|
|||
# -u updates snapshots
|
||||
yarn test --changedSince main -u
|
||||
yarn test -u
|
||||
yarn test -- -u -- SomeFile.test.tsx
|
||||
yarn test -u -- SomeFile.test.tsx
|
||||
```
|
||||
|
||||
Extra command line arguments and flags are passed along to Jest. See more about Jest options [here](https://jestjs.io/docs/en/cli.html).
|
||||
|
@ -128,9 +128,9 @@ yarn test:report:e2e
|
|||
|
||||
# -u updates snapshots for the report package
|
||||
# Windows:
|
||||
yarn test:report:e2e -- -- -- -u
|
||||
yarn test:report:e2e -u
|
||||
#Linux and Mac:
|
||||
yarn test:report:e2e -- -- -u
|
||||
yarn test:report:e2e -u
|
||||
|
||||
# On occasion you may need to clear the Jest cache before running tests
|
||||
yarn jest --clearCache
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"version": "0.0.0",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"packages": ["packages/*", "."]
|
||||
}
|
16
package.json
16
package.json
|
@ -9,9 +9,9 @@
|
|||
"url": "https://github.com/Microsoft/accessibility-insights-web"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.16.1",
|
||||
"yarn": "^1.22.4"
|
||||
"node": ">=12.16.1"
|
||||
},
|
||||
"packageManager": "yarn@3.5.0",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
|
@ -21,6 +21,7 @@
|
|||
"firefox 87"
|
||||
],
|
||||
"scripts": {
|
||||
"packages": "yarn workspaces foreach --verbose",
|
||||
"ada-cat": "grunt ada-cat",
|
||||
"assessment": "npm-run-all --serial scss:clean fastpass build:all test test:e2e test:unified",
|
||||
"build": "grunt",
|
||||
|
@ -30,8 +31,8 @@
|
|||
"build:unified": "grunt build-unified",
|
||||
"build:unified:all": "grunt build-unified-all",
|
||||
"build:unified:canary": "grunt build-unified-canary",
|
||||
"build:package:report": "lerna --scope accessibility-insights-report run build",
|
||||
"build:package:ui": "lerna --scope accessibility-insights-ui run build",
|
||||
"build:package:report": "yarn packages --include accessibility-insights-report run build",
|
||||
"build:package:ui": "yarn packages --include accessibility-insights-ui run build",
|
||||
"build:prod": "grunt build-prod",
|
||||
"build:package:axe-config": "grunt generate-axe-config",
|
||||
"change-log": "node ./tools/get-change-log-for-release.js",
|
||||
|
@ -47,7 +48,7 @@
|
|||
"format:check": "prettier --config prettier.config.js --check \"**/*\"",
|
||||
"format:fix": "prettier --config prettier.config.js --write \"**/*\"",
|
||||
"lint:check": "eslint \"**/*.{js,ts,tsx}\"",
|
||||
"lint:check:all": "yarn lint:check && yarn lint:scss && lerna run lint:check",
|
||||
"lint:check:all": "yarn lint:check && yarn lint:scss && yarn packages run lint:check",
|
||||
"lint:fix": "eslint \"**/*.{js,ts,tsx}\" --quiet --fix",
|
||||
"lint:scss": "stylelint \"**/*.scss\"",
|
||||
"lint:scss:fix": "stylelint \"**/*.scss\" --fix",
|
||||
|
@ -80,7 +81,7 @@
|
|||
"test:e2e:docker:run:unified": "docker run -t accessibility-insights-unified-e2e sh -c \"yarn test:unified --ci\"",
|
||||
"test:e2e:docker": "npm-run-all --serial test:e2e:docker:build \"test:e2e:docker:run {@}\" --",
|
||||
"test:unified": "cross-env NODE_OPTIONS='--unhandled-rejections=strict' jest --projects src/tests/electron --runInBand --forceExit --detectOpenHandles",
|
||||
"test:report:e2e": "lerna --scope accessibility-insights-report-e2e-tests run test",
|
||||
"test:report:e2e": "yarn packages --include accessibility-insights-report-e2e-tests run test",
|
||||
"tbuild": "yarn build && yarn type:check",
|
||||
"tbuild:all": "yarn build:all && yarn type:check",
|
||||
"type:check": "tsc -noEmit",
|
||||
|
@ -152,7 +153,6 @@
|
|||
"jest-environment-jsdom": "^29.5.0",
|
||||
"jest-junit": "^15.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lerna": "^6.5.1",
|
||||
"license-check-and-add": "^4.0.5",
|
||||
"mini-css-extract-plugin": "2.7.3",
|
||||
"npm-run-all": "^4.1.5",
|
||||
|
@ -205,12 +205,10 @@
|
|||
"resolutions": {
|
||||
"@types/node": "^16.11.7",
|
||||
"ansi-regex": "^5.0.1",
|
||||
"**/compare-func/dot-prop": "^5.2.0",
|
||||
"got": "^11.8.5",
|
||||
"jpeg-js": ">=0.4.4",
|
||||
"kind-of": "^6.0.3",
|
||||
"license-check-and-add/yargs": "^15.3.1",
|
||||
"**/dir-compare/minimatch": "^3.0.5",
|
||||
"minimist": "^1.2.3",
|
||||
"moment": "^2.29.4",
|
||||
"nth-check": ">=2.0.1",
|
||||
|
|
|
@ -8,7 +8,7 @@ Licensed under the MIT License.
|
|||
As of Oct 2020, this repository is an ad-hoc monorepo; `/src` contains code for multiple projects,
|
||||
and does not separate them as cleanly as we would like.
|
||||
|
||||
We plan to gradually convert the repository into a Lerna/Yarn Workspaces based monorepo, similar to
|
||||
We plan to gradually convert the repository into a Yarn Workspaces based monorepo, similar to
|
||||
how [accessibility-insights-service](https://github.com/microsoft/accessibility-insights-service) is
|
||||
structured.
|
||||
|
||||
|
|
|
@ -15,6 +15,5 @@
|
|||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/accessibility-insights-web"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,5 @@
|
|||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/accessibility-insights-web"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,7 @@ steps:
|
|||
timeoutInMinutes: 2
|
||||
retryCountOnTaskFailure: 2
|
||||
|
||||
- script: npm install yarn@1.22.10 -g
|
||||
displayName: install yarn as a global dependency
|
||||
timeoutInMinutes: 1
|
||||
retryCountOnTaskFailure: 2
|
||||
|
||||
- script: yarn install --frozen-lockfile
|
||||
- script: yarn install --immutable
|
||||
displayName: install packages and dependencies
|
||||
timeoutInMinutes: 10
|
||||
retryCountOnTaskFailure: 2
|
||||
|
|
28641
yarn.lock
28641
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче