Skip to content

Commit

Permalink
chore: use nx release (#8194)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed Jan 6, 2024
1 parent 3d72930 commit d0977ab
Show file tree
Hide file tree
Showing 46 changed files with 398 additions and 2,336 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,19 +279,25 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # we need the tags to be available

- name: Install
uses: ./.github/actions/prepare-install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'

- name: Build
uses: ./.github/actions/prepare-build

# Fetch all history for all tags and branches in this job because lerna needs it
- run: |
git fetch --prune --unshallow
- name: Figure out and apply the next canary version
run: npx nx run repo-tools:apply-canary-version

- name: Publish all packages to npm
run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes
- name: Publish all packages to npm with the canary tag
# NOTE: this needs to be npx, rather than yarn, to make sure the authenticated npm registry is used
run: npx nx release publish --tag canary
env:
NX_CLOUD_DISTRIBUTED_EXECUTION: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
5 changes: 0 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)


Expand Down
2 changes: 1 addition & 1 deletion docs/Packages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Packages
---

The `@typescript-eslint/*` packages are all stored in [our GitHub monorepo](https://github.com/typescript-eslint/typescript-eslint).
The monorepo is built with [Lerna](https://lerna.js.org) and [Nx](https://nx.dev).
The monorepo is built and released with [Nx](https://nx.dev).

Each page in this section corresponds to a package we intentionally expose to users.
They are:
Expand Down
2 changes: 2 additions & 0 deletions docs/maintenance/Releases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ id: releases
title: Releases
---

{/* TODO: update references to lerna to be `nx release instead` */}

[Users > Releases](../users/Releases.mdx) describes how our automatic releases are done.
There is generally no maintenance activity we need to take for the weekly releases.

Expand Down
11 changes: 0 additions & 11 deletions lerna.json

This file was deleted.

21 changes: 21 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"nxCloudAccessToken": "YjIzMmMxMWItMjhiMS00NWY2LTk1NWYtYWU3YWQ0YjE4YjBlfHJlYWQ=",
"release": {
"changelog": {
"git": {
"commit": true,
"tag": true
},
"workspaceChangelog": {
"createRelease": "github",
"renderer": "tools/release/changelog-renderer"
},
"projectChangelogs": {
"renderer": "tools/release/changelog-renderer"
}
},
"version": {
"generatorOptions": {
"currentVersionResolver": "git-tag",
"specifierSource": "conventional-commits"
}
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"check-docs": "npx nx run-many --target=check-docs --parallel",
"check-format": "prettier --check .",
"check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\" --no-progress --show-context --show-suggestions",
"clean": "lerna clean -y && nx run-many --target=clean",
"clean": "nx run-many --target=clean",
"format": "prettier --write .",
"generate-breaking-changes": "npx nx run eslint-plugin:generate-breaking-changes",
"generate-configs": "npx nx run eslint-plugin:generate:configs",
Expand All @@ -43,6 +43,7 @@
"lint": "npx nx run-many --target=lint --parallel",
"postinstall": "npx nx run repo-tools:postinstall-script",
"pre-commit": "yarn lint-staged",
"release": "tsx tools/release/release.ts",
"start": "npx nx run website:start",
"test": "npx nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint",
"test-integration": "npx nx run integration-tests:test",
Expand All @@ -59,9 +60,9 @@
"@babel/eslint-parser": "^7.23.3",
"@babel/parser": "^7.23.3",
"@babel/types": "^7.23.3",
"@nx/eslint": "17.1.2",
"@nx/jest": "17.1.2",
"@nx/workspace": "17.1.2",
"@nx/eslint": "17.2.8",
"@nx/jest": "17.2.8",
"@nx/workspace": "17.2.8",
"@prettier/sync": "^0.3.0",
"@swc/core": "^1.3.68",
"@swc/jest": "^0.2.26",
Expand Down Expand Up @@ -99,13 +100,12 @@
"jest-diff": "^29.6.2",
"jest-snapshot": "^29.6.2",
"jest-specific-snapshot": "^8.0.0",
"lerna": "7.4.2",
"lint-staged": "^15.0.0",
"make-dir": "^4.0.0",
"markdownlint-cli": "^0.37.0",
"ncp": "^2.0.0",
"netlify": "^13.1.9",
"nx": "17.1.2",
"nx": "17.2.8",
"prettier": "3.1.0",
"pretty-format": "^29.6.2",
"raw-loader": "^4.0.2",
Expand All @@ -114,7 +114,8 @@
"ts-node": "10.7.0",
"tslint": "^6.1.3",
"tsx": "^4.6.2",
"typescript": ">=4.3.5 <5.4.0"
"typescript": ">=4.3.5 <5.4.0",
"yargs": "17.7.1"
},
"resolutions": {
"@jest/create-cache-key-function": "^29",
Expand Down
5 changes: 0 additions & 5 deletions packages/ast-spec/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/ast-spec
Expand Down
1 change: 0 additions & 1 deletion packages/ast-spec/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/ast-spec/**/*.{mts,cts,ts,tsx}"],
"ignorePath": ".eslintignore"
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/eslint-plugin-internal/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal
Expand Down
3 changes: 0 additions & 3 deletions packages/eslint-plugin-internal/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/eslint-plugin-internal/**/*.{mts,cts,ts,tsx}"
],
"ignorePath": ".eslintignore"
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/eslint-plugin-tslint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint
Expand Down
3 changes: 0 additions & 3 deletions packages/eslint-plugin-tslint/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/eslint-plugin-tslint/**/*.{mts,cts,ts,tsx}"
],
"ignorePath": ".eslintignore"
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/eslint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)


Expand Down
1 change: 0 additions & 1 deletion packages/eslint-plugin/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/eslint-plugin/**/*.{mts,cts,ts,tsx}"],
"ignorePath": ".eslintignore"
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/integration-tests/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/integration-tests
Expand Down
3 changes: 0 additions & 3 deletions packages/integration-tests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/integration-tests/**/*.{mts,cts,ts,tsx}"
],
"ignorePath": ".eslintignore"
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/parser
Expand Down
1 change: 0 additions & 1 deletion packages/parser/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/parser/**/*.{mts,cts,ts,tsx}"],
"ignorePath": ".eslintignore"
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/repo-tools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/repo-tools
Expand Down
2 changes: 2 additions & 0 deletions packages/repo-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"scripts": {
"//": "NOTE: intentionally no build step in this package",
"apply-canary-version": "tsx ./src/apply-canary-version.mts",
"format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore",
"generate-contributors": "tsx ./src/generate-contributors.ts",
"generate-sponsors": "tsx ./src/generate-sponsors.ts",
Expand All @@ -20,6 +21,7 @@
"execa": "*",
"prettier": "^3.0.3",
"rimraf": "*",
"semver": "7.5.4",
"tmp": "*",
"typescript": "*"
}
Expand Down
1 change: 0 additions & 1 deletion packages/repo-tools/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/repo-tools/**/*.{mts,cts,ts,tsx}"],
"ignorePath": ".eslintignore"
}
}
Expand Down
64 changes: 64 additions & 0 deletions packages/repo-tools/src/apply-canary-version.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { execaSync } from 'execa';
import semver from 'semver';

const preid = 'alpha';
const distTag = 'canary';

const currentLatestVersion = execaSync('npm', [
'view',
'@typescript-eslint/eslint-plugin@latest',
'version',
]).stdout.trim();

const currentCanaryVersion = execaSync('npm', [
'view',
`@typescript-eslint/eslint-plugin@${distTag}`,
'version',
]).stdout.trim();

console.log('\nResolved current versions: ', {
currentLatestVersion,
currentCanaryVersion,
});

let nextCanaryVersion: string | null;

if (semver.gte(currentLatestVersion, currentCanaryVersion)) {
console.log(
'\nLatest version is greater than or equal to the current canary version, starting new prerelease base...',
);
// Determine next minor version above the currentLatestVersion
nextCanaryVersion = semver.inc(
currentLatestVersion,
'prerelease',
undefined,
preid,
);
} else {
console.log(
'\nLatest version is less than the current canary version, incrementing the existing prerelease base...',
);
// Determine next prerelease version above the currentCanaryVersion
nextCanaryVersion = semver.inc(
currentCanaryVersion,
'prerelease',
undefined,
preid,
);
}

if (!nextCanaryVersion) {
console.log(`Error: Unable to determine next canary version`);
// eslint-disable-next-line no-process-exit
process.exit(1);
}

console.log(`\nApplying next canary version with Nx`);

const command = `nx release version ${nextCanaryVersion}`;

console.log(`\n> ${command}\n`);

execaSync('npx', command.split(' '), {
stdio: 'inherit',
});
5 changes: 0 additions & 5 deletions packages/rule-schema-to-typescript-types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/rule-schema-to-typescript-types
Expand Down
3 changes: 0 additions & 3 deletions packages/rule-schema-to-typescript-types/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"packages/rule-schema-to-typescript-types/**/*.{mts,cts,ts,tsx}"
],
"ignorePath": ".eslintignore"
}
}
Expand Down
5 changes: 0 additions & 5 deletions packages/rule-tester/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [6.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v6.16.0...v6.17.0) (2024-01-01)

**Note:** Version bump only for package @typescript-eslint/rule-tester
Expand Down
5 changes: 1 addition & 4 deletions packages/rule-tester/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/rule-tester/**/*.ts"]
}
"outputs": ["{options.outputFile}"]
}
}
}
Loading

0 comments on commit d0977ab

Please sign in to comment.