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

chore: migrate to yarn v3 #935

Merged
merged 8 commits into from
Mar 29, 2023
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,12 @@ typings/
/dist/
/src/test-resources/generator/*.js
/test-results/

# yarn non-zero-installs setup
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
.github/
.yarn/
.prettierignore
**/*.gitattributes
**/*.gitignore
Expand Down
873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.5.0.cjs
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,23 @@ change, so we're waiting to change this until we would need to make a breaking c

To update the package and test cases to account for a new axe-core version:

1. Update the version of axe-core in `yarn.lock` (_not_ `package.json`); usually dependabot will cover this. If updating to the latest version, this can be accomplished using `yarn upgrade axe-core`.
1. In `package.json`, update the version numbers of the following components:

- `devDependencies` entries for `@axe-core/cli` and `@axe-core/puppeteer`
- `resolutions` entries for `axe-core` and `@axe-core/cli/chromedriver`
- **NOT** the `dependencies` entry for `@axe-core`!

1. Build the repo with:

```
yarn install
yarn build
```
1. Update the versions of @axe-core/cli, @axe-core/puppeteer, and axe-core in `src/test-resources/generator/package.json`

1. Generate test resource files for the new version with:

```
cd src/test-resources/generator
yarn install
yarn generate
yarn generate-test-resources
```

1. Manually compare the diff of `/src/test-resources/basic-axe-vPREVIOUS.sarif` and `/src/test-resources/basic-axe-vNEW.sarif`; the only differences should be the version numbers.
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
versionSpec: '14.18.3'
displayName: use node 14.18.3

- script: yarn install --frozen-lockfile
- script: yarn install --immutable
displayName: yarn install

- script: yarn lint
Expand All @@ -33,7 +33,7 @@ jobs:
- script: yarn build
displayName: yarn build

- script: yarn test -- --ci
- script: yarn test --ci
displayName: yarn test

- task: PublishTestResults@2
Expand Down
1 change: 1 addition & 0 deletions copyright-header.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
".gitattributes",
".gitignore",
".prettierignore",
".yarn/",
"src/test-resources/",
"test-results/",
"yarn.lock",
Expand Down
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@
"types": "dist/index.d.js",
"files": [
"dist/",
"!dist/test-resources/",
"LICENSE",
"README.md"
],
"engines": {
"node": ">= 8"
},
"packageManager": "[email protected]",
"dependencies": {
"@types/sarif": ">=2.1.1 <=2.1.4",
"axe-core": "^3.2.2 || ^4.0.0",
"yargs": "^17.0.0"
},
"devDependencies": {
"@axe-core/cli": "^4.6.0",
"@axe-core/puppeteer": "^4.6.0",
"@types/jest": "^27.4.0",
"@types/lodash": "^4.14.136",
"@types/node": "^14.0.1",
"@types/node": "^14.18.38",
"@types/yargs": "^17.0.8",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
Expand All @@ -32,14 +36,17 @@
"license-check-and-add": "^4.0.1",
"lodash": "^4.17.15",
"prettier": "^2.0.1",
"puppeteer": "^13.7.0",
"rimraf": "^4.0.4",
"semantic-release": "^19.0.2",
"ts-jest": "^27.0.2",
"typemoq": "^2.1.0",
"typescript": "^4.0.2"
},
"resolutions": {
"ansi-regex": "^5.0.1"
"@axe-core/cli/chromedriver@^109.0.0": "^111.0.0",
"ansi-regex@^4.1.0": "^5.0.1",
"axe-core": "4.6.3"
},
"scripts": {
"prebuild": "yarn clean",
Expand All @@ -53,7 +60,10 @@
"precheckin": "yarn format-check && yarn lint && yarn build && yarn test && yarn copyrightheaders",
"watch:build": "tsc -p . --watch",
"watch:test": "jest --watch --coverage false --colors",
"semantic-release": "semantic-release"
"semantic-release": "semantic-release",
"generate-test-resources": "yarn generate-axe-core-resources && yarn generate-axe-cli-resources",
"generate-axe-cli-resources": "node dist/test-resources/generator/generate-axe-cli-resources.js",
"generate-axe-core-resources": "node dist/test-resources/generator/generate-axe-core-resources.js"
},
"repository": {
"type": "git",
Expand Down
12 changes: 6 additions & 6 deletions src/test-resources/generator/generate-axe-cli-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import * as url from 'url';

const axeCoreVersion = (axe as any).version;
const axeSourcePath = require.resolve('axe-core/axe.min.js');
const testResourcesDir = path.join(__dirname, '../');
const axeCliBin = `${__dirname}/node_modules/.bin/axe`;
const rootDir = path.join(__dirname, '..', '..', '..');
const testResourcesDir = path.join(rootDir, 'src', 'test-resources');

const testUrls: Record<string, string> = {
'w3citylights': 'https://www.w3.org/WAI/demos/bad/before/home.html',
Expand All @@ -18,16 +18,16 @@ const testUrls: Record<string, string> = {
function generateResources() {
for (const testUrlIdentifier of Object.keys(testUrls)) {
const testUrl = testUrls[testUrlIdentifier];
const axeCliVersion = child_process.execSync(`${axeCliBin} --version`).toString().trim();
const axeCliVersion = child_process.execSync(`yarn run axe --version`).toString().trim();
const axeCliOutputFile = path.join(testResourcesDir, `${testUrlIdentifier}-axe-v${axeCoreVersion}.axe-cli-v${axeCliVersion}.json`);
console.log(`Writing test resource: ${axeCliOutputFile}`);

const axeCliOutputFileRelativePath = path.relative(__dirname, axeCliOutputFile);
let axeCliCommand = `${axeCliBin} ${testUrl} --show-errors --save ${axeCliOutputFileRelativePath} --axe-source ${axeSourcePath}`;
const axeCliOutputFileRelativeToRoot = path.relative(rootDir, axeCliOutputFile);
let axeCliCommand = `yarn run axe ${testUrl} --show-errors --save ${axeCliOutputFileRelativeToRoot} --axe-source ${axeSourcePath}`;
if (testUrlIdentifier === 'basic') {
axeCliCommand += ' --rules document-title';
}
console.log(`Invoking @axe-core/cli v${axeCliVersion} with: ${axeCliCommand}`);
console.log(`Invoking @axe-core/cli v${axeCliVersion} with: ${axeCliCommand}`, { cwd: rootDir });

child_process.execSync(axeCliCommand);
}
Expand Down
8 changes: 4 additions & 4 deletions src/test-resources/generator/generate-axe-core-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import * as fs from 'fs';
import * as path from 'path';
import * as Puppeteer from 'puppeteer';
import * as url from 'url';
import { convertAxeToSarif } from '../../../dist/index';
import { testResourceTimestampPlaceholder } from '../../../dist/test-resource-constants';
import { convertAxeToSarif } from '../../index';
import { testResourceTimestampPlaceholder } from '../../test-resource-constants';

const axeVersion: string = (axe as any).version;
const axeSource: string = axe.source

const testResourcesDir = path.join(__dirname, '../');
const rootDir = path.join(__dirname, '..', '..', '..');
const testResourcesDir = path.join(rootDir, 'src', 'test-resources');

const axeReporters: string[] = ['v1', 'v2', 'raw'];
const testUrls: Record<string, string> = {
Expand Down
22 changes: 0 additions & 22 deletions src/test-resources/generator/package.json

This file was deleted.

Loading