Skip to content

Commit

Permalink
Merge pull request #1247 from xeroxinteractive/next
Browse files Browse the repository at this point in the history
Release dependency updates + Vitest
  • Loading branch information
AndrewLeedham authored Aug 7, 2023
2 parents 4e607f7 + ee96733 commit c8018f5
Show file tree
Hide file tree
Showing 22 changed files with 1,970 additions and 2,356 deletions.
39 changes: 28 additions & 11 deletions .github/scripts/apply-force-publish-labels.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import autoModule from '@auto-it/core';
const Auto = autoModule.Auto;
import { readFile, writeFile } from 'fs/promises';
const LabelExistsError = autoModule.LabelExistsError;
import { writeFile } from 'fs/promises';
import * as url from 'url';

async function applyForcePublishLabels() {
/**
* @type {import('@auto-it/core').Auto}
*/
const auto = new Auto();

await auto.loadConfig();

const packages = [
{ label: 'release: force (cli)', packageName: '@xerox/cli' },
{
Expand All @@ -32,10 +38,14 @@ async function applyForcePublishLabels() {

async function labelExists(label) {
try {
await auto.label({ exists: label });
await auto.label({ exists: label, pr: 1233 });
return true;
} catch (e) {
return false;
if (e instanceof LabelExistsError) {
return false;
} else {
throw e;
}
}
}

Expand All @@ -51,18 +61,25 @@ async function applyForcePublishLabels() {
console.info('No force publish labels found');
return;
}

const lernaPath = url.fileURLToPath(
new URL('../../lerna.json', import.meta.url)
);
const lernaFile = await readFile(lernaPath);
const lerna = JSON.parse(lernaFile.toString());
if (!lerna) {
throw new Error('Could not find lerna.json');
}

lerna.command = lerna.command ?? {};
lerna.command.version = lerna.command.version ?? {};
lerna.command.version.forcePublish = forcedPackages.join(',');
const lerna = {
version: 'independent',
npmClient: 'pnpm',
useWorkspaces: true,
command: {
publish: {
registry: 'https://registry.npmjs.org',
},
},
};

lerna.command.version = {
forcePublish: forcedPackages.join(','),
};

await writeFile(lernaPath, JSON.stringify(lerna, null, 2));

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run audit
- run: pnpm run lint
- run: pnpm run test

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run audit
- run: pnpm run lint
- run: pnpm run test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ typings/
.next

# CLI build folder
packages/xerox-cli/build
packages/xerox-cli/build

# Allows us to generate it on the fly in CI
lerna.json
13 changes: 0 additions & 13 deletions __tests__/audit.test.js

This file was deleted.

4 changes: 2 additions & 2 deletions fixtures/eslint-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "eslint-typescript",
"devDependencies": {
"@types/node": "18.16.18",
"@types/node": "18.17.3",
"@xerox/eslint-config": "workspace:*",
"typescript": "5.1.3"
"typescript": "5.1.6"
},
"private": true
}
6 changes: 3 additions & 3 deletions fixtures/eslint-typescriptreact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"react": "18.1.0"
},
"devDependencies": {
"@types/node": "18.16.18",
"@types/react": "18.2.12",
"@types/node": "18.17.3",
"@types/react": "18.2.18",
"@xerox/eslint-config": "workspace:*",
"typescript": "5.1.3"
"typescript": "5.1.6"
},
"private": true
}
18 changes: 0 additions & 18 deletions jest-esm-resolver.js

This file was deleted.

3 changes: 0 additions & 3 deletions jest.config.js

This file was deleted.

10 changes: 0 additions & 10 deletions lerna.json

This file was deleted.

90 changes: 48 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"lint": "eslint ./packages/**/*.js && prettier ./**/*.json --check --ignore-path .gitignore && pnpm --filter './packages/*' run lint",
"format": "eslint ./packages/**/*.js --format && prettier ./**/*.json --write --ignore-path .gitignore",
"deploy": "auto shipit",
"test": "jest"
"test": "vitest",
"audit": "pnpm audit --prod --audit-level moderate"
},
"eslintConfig": {
"parserOptions": {
Expand All @@ -28,47 +29,52 @@
},
"prettier": "./packages/xerox-prettier-config/index.js",
"devDependencies": {
"@auto-it/core": "10.46.0",
"@auto-it/slack": "10.46.0",
"auto": "10.46.0",
"browserslist": "4.21.9",
"@auto-it/core": "11.0.0",
"@auto-it/slack": "11.0.0",
"auto": "11.0.0",
"browserslist": "4.21.10",
"enhanced-resolve": "5.15.0",
"eslint": "8.42.0",
"jest": "29.5.0",
"jest-package-audit": "5.0.3",
"lerna": "7.0.2",
"prettier": "2.8.8",
"stylelint": "15.7.0"
"eslint": "8.46.0",
"lerna": "7.1.4",
"prettier": "3.0.1",
"stylelint": "15.10.2",
"vitest": "0.34.1"
},
"resolutions": {
"yargs-parser@<13.1.2": "^13.1.2",
"yargs-parser@>=15.0.0 <15.0.1": "^15.0.1",
"yargs-parser@>=18.0.0 <18.1.2": "^18.1.2",
"yargs-parser@>=20.0.0 <20.2.0": "^20.2.0",
"mem@<4.0.0": "^4.0.0",
"y18n@<3.2.2": "^3.2.2",
"y18n@>=4.0.0 <4.0.1": "^4.0.1",
"y18n@>=5.0.0 <5.0.5": "^5.0.5",
"hosted-git-info@<2.8.9": "^2.8.9",
"hosted-git-info@>=3.0.0 <3.0.8": "^3.0.8",
"glob-parent@<5.1.2": "^5.1.2",
"trim-newlines@<3.0.1": "^3.0.1",
"trim-newlines@>=4.0.0 <4.0.1": "^4.0.1",
"trim@<0.0.3": "^0.0.3",
"handlebars@<4.7.7": "^4.7.7",
"normalize-url@<4.5.1": "^4.5.1",
"normalize-url@>=5.0.0 <5.3.1": "^5.3.1",
"normalize-url@>=6.0.0 <6.0.1": "^6.0.1",
"@npmcli/git@<2.0.8": "^2.0.8",
"path-parse@<1.0.7": "^1.0.7",
"tar@<6.1.1": "^6.1.1",
"json-schema@<0.4.0": "^0.4.0",
"@npmcli/arborist@<2.8.2": "^2.8.2",
"node-fetch@<2.6.7": "^2.6.7",
"minimist@<1.2.6": "^1.2.6",
"npm@<8.11.0": "^8.11.0",
"minimatch@<3.0.5": "^3.0.5",
"json5@<1.0.2": "^1.0.2"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"pnpm": {
"overrides": {
"yargs-parser@<13.1.2": "^13.1.2",
"yargs-parser@>=15.0.0 <15.0.1": "^15.0.1",
"yargs-parser@>=18.0.0 <18.1.2": "^18.1.2",
"yargs-parser@>=20.0.0 <20.2.0": "^20.2.0",
"mem@<4.0.0": "^4.0.0",
"y18n@<3.2.2": "^3.2.2",
"y18n@>=4.0.0 <4.0.1": "^4.0.1",
"y18n@>=5.0.0 <5.0.5": "^5.0.5",
"hosted-git-info@<2.8.9": "^2.8.9",
"hosted-git-info@>=3.0.0 <3.0.8": "^3.0.8",
"glob-parent@<5.1.2": "^5.1.2",
"trim-newlines@<3.0.1": "^3.0.1",
"trim-newlines@>=4.0.0 <4.0.1": "^4.0.1",
"trim@<0.0.3": "^0.0.3",
"handlebars@<4.7.7": "^4.7.7",
"normalize-url@<4.5.1": "^4.5.1",
"normalize-url@>=5.0.0 <5.3.1": "^5.3.1",
"normalize-url@>=6.0.0 <6.0.1": "^6.0.1",
"@npmcli/git@<2.0.8": "^2.0.8",
"path-parse@<1.0.7": "^1.0.7",
"tar@<6.1.1": "^6.1.1",
"json-schema@<0.4.0": "^0.4.0",
"@npmcli/arborist@<2.8.2": "^2.8.2",
"node-fetch@<2.6.7": "^2.6.7",
"minimist@<1.2.6": "^1.2.6",
"npm@<8.11.0": "^8.11.0",
"minimatch@<3.0.5": "^3.0.5",
"json5@<1.0.2": "^1.0.2",
"semver@<5.7.2": "^5.7.2",
"semver@>6.3.0 <6.3.1": "^6.3.1",
"semver@>=7.0.0 <7.5.2": "^7.5.2",
"word-wrap@<1.2.4": "^1.2.4"
}
}
}
6 changes: 3 additions & 3 deletions packages/xerox-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
"access": "public"
},
"devDependencies": {
"@types/node": "18.16.18",
"typescript": "5.1.3"
"@types/node": "18.17.3",
"typescript": "5.1.6"
},
"dependencies": {
"chalk": "5.2.0",
"chalk": "5.3.0",
"find-up": "6.3.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { ESLint } = require('eslint');
const { posix } = require('path');
import { test, expect } from 'vitest';
import { ESLint } from 'eslint';
import { posix } from 'path';

test.each(['index.js', 'react.js', 'typescript.js', 'jest.js'])(
'%s config valid',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const glob = require('globby');
const { posix } = require('path');
const { ESLint } = require('eslint');
import { test, expect } from 'vitest';
import glob from 'globby';
import { ESLint } from 'eslint';

const fixtures = glob.sync(
posix.join(__dirname, '../../../fixtures/*/index.*')
new URL('../../../fixtures/*/index.*', import.meta.url).pathname
);

const cli = new ESLint();
Expand Down
14 changes: 7 additions & 7 deletions packages/xerox-eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
"globby": "11.1.0"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"babel-eslint": "^10.1.0",
"eslint-config-prettier": "^8.1.0",
"eslint-import-resolver-typescript": "^3.0.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^27.0.0",
"eslint-plugin-jsdoc": "46.2.6",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jsdoc": "46.4.6",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-testing-library": "^5.0.0",
"globby": "^11.0.1"
},
"peerDependencies": {
"@xerox/prettier-config": "*",
"eslint": ">=7.2.0",
"prettier": ">=2.2.0"
"prettier": ">=3.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/xerox-semantic-release-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "10.0.1",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.0.3",
"@semantic-release/github": "9.0.4",
"@semantic-release/npm": "10.0.4",
"@semantic-release/release-notes-generator": "11.0.3",
"@semantic-release/release-notes-generator": "11.0.4",
"semantic-release-slack-bot": "4.0.2"
},
"peerDependencies": {
Expand Down
14 changes: 0 additions & 14 deletions packages/xerox-stylelint-config/__tests__/configs.test.js

This file was deleted.

14 changes: 14 additions & 0 deletions packages/xerox-stylelint-config/__tests__/configs.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { test, expect } from 'vitest';
import styelint from 'stylelint';

test.each(['index.cjs', 'sass.cjs'])('%s config valid', async (filename) => {
await expect(
styelint.lint({
code: 'a {}',
config: {
extends: `./${filename}`,
},
configBasedir: new URL('../', import.meta.url).pathname,
})
).resolves.toBeTruthy();
});
File renamed without changes.
Loading

0 comments on commit c8018f5

Please sign in to comment.