diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 821626cb..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Release - -on: - schedule: - - cron: '0 9 * * 1' # Every Monday at 9:00 AM UTC - workflow_dispatch: - branches: - - master - -permissions: - contents: write - id-token: write - packages: write - -jobs: - release: - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/master' - - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - token: ${{ secrets.RELEASE_TOKEN }} - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: '.nvmrc' - check-latest: true - registry-url: 'https://registry.npmjs.org' - - - name: Configure git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Install dependencies - run: npm ci - - - name: Build - run: npm run build - - - name: Release - run: npm run release - env: - CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index b5f67298..00000000 --- a/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -Renovate Bot -Tane Morgan <464864+tanem@users.noreply.github.com> -dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> -github-actions[bot] -renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 19267240..c2fccd24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +This file is frozen history: it covers releases up to and including v8.0.8, and +is not regenerated any more. This package is deprecated and nothing is released +from here any more — see the [README](README.md) for the replacement. + ## [v8.0.8](https://github.com/tanem/tanem-scripts/tree/v8.0.8) (2026-08-03) [Full Changelog](https://github.com/tanem/tanem-scripts/compare/v8.0.7...v8.0.8) diff --git a/README.md b/README.md index 79074a51..20759d40 100644 --- a/README.md +++ b/README.md @@ -1,115 +1,22 @@ # tanem-scripts -[![npm version](https://img.shields.io/npm/v/tanem-scripts.svg?style=flat-square)](https://www.npmjs.com/package/tanem-scripts) -[![build status](https://img.shields.io/github/actions/workflow/status/tanem/tanem-scripts/ci.yml?branch=master&style=flat-square)](https://github.com/tanem/tanem-scripts/actions/workflows/ci.yml) -[![coverage status](https://img.shields.io/codecov/c/github/tanem/tanem-scripts.svg?style=flat-square)](https://codecov.io/gh/tanem/tanem-scripts) -[![npm downloads](https://img.shields.io/npm/dm/tanem-scripts.svg?style=flat-square)](https://www.npmjs.com/package/tanem-scripts) - -> Common scripts for my projects. - -## Usage - -``` -Usage: tanem-scripts [options] [command] - -Common scripts for my projects. - -Options: - -V, --version output the version number - -h, --help output usage information - -Commands: - authors generates a list of authors in a format suitable for inclusion in an AUTHORS file - changelog [options] generates a changelog using GitHub tags and pull requests - release runs npm-version with a valid semver.inc argument -``` - -## API - -### authors() - -Returns a `Promise` that will be resolved with a list of authors sorted alphabetically by author name. If an error occurs during execution, the `Promise` is rejected with an `Error` object. - -**Example** - -```ts -// Note: The `fs.promises` API was added in Node.js v10.0.0. -import { promises as fs } from 'fs'; -import path from 'path'; -import { authors } from 'tanem-scripts'; - -(async () => { - try { - const result = await authors(); - await fs.writeFile(path.join(__dirname, 'AUTHORS'), result, 'utf-8'); - } catch (error) { - console.error(error); - } -})(); -``` - ---- - -### changelog([options]) - -Returns a `Promise` that will be resolved with the changelog. If an error occurs during execution, the `Promise` is rejected with an `Error` object. - -**Arguments** - -- `options` - _Optional_ An object containing the optional arguments defined below. Defaults to `{}`. - - `futureRelease` - _Optional_ Tag to use for PRs merged since the last published tag. If unspecified, those PRs will be excluded. - -**Example** - -```ts -// Note: The `fs.promises` API was added in Node.js v10.0.0. -import { promises as fs } from 'fs'; -import path from 'path'; -import { changelog } from 'tanem-scripts'; - -(async () => { - try { - const result = await changelog({ - futureRelease: 'v2.0.0', - }); - await fs.writeFile(path.join(__dirname, 'CHANGELOG.md'), result, 'utf-8'); - } catch (error) { - console.error(error); - } -})(); -``` - ---- - -### release() - -Returns a `Promise` that resolves with `'released'` once the release script completes, or `'nothing-to-release'` if no pull requests have merged since the last published tag. If an error occurs during execution, the `Promise` is rejected with an `Error` object. - -**Example** - -```ts -import { release } from 'tanem-scripts'; - -(async () => { - try { - await release(); - } catch (error) { - console.error(error); - } -})(); -``` - -## Installation - -``` -$ npm install tanem-scripts --save-dev -``` - -You'll also need to generate a new [GitHub personal access token](https://github.com/settings/tokens), then set an environment variable by running the following command at the prompt or by adding it to your shell profile: - -```sh -export CHANGELOG_GITHUB_TOKEN= -``` +> **Deprecated.** Use [`tanem/release-action`](https://github.com/tanem/release-action) instead. + +This package automated label-driven releases for my open-source repos: it +derived a semver bump from the labels on the week's merged pull requests, +versioned and tagged the repo, regenerated CHANGELOG.md, and published to npm. + +That job now belongs to +[`tanem/release-action`](https://github.com/tanem/release-action), a composite +GitHub Action doing the same work with no npm dependency to install and no +personal access token to hold. Release notes there are published to GitHub +Releases rather than a regenerated CHANGELOG.md, and the `authors` command has +no successor — it was dropped rather than ported. + +Every repo that used this package is off it, and nothing is released from here +any more: the weekly release cron is gone, so no release can fire. +[CHANGELOG.md](CHANGELOG.md) is frozen at v8.0.8, and this repo's history stays +readable. ## License diff --git a/package.json b/package.json index 17d90513..e03db08c 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "url": "git+https://github.com/tanem/tanem-scripts.git" }, "keywords": [ - "authors", "changelog", "changelog-generator", "cli", @@ -28,7 +27,6 @@ "node", "script", "scripts", - "shortlog", "typescript" ], "license": "MIT", @@ -73,7 +71,6 @@ "compile": "tsc -p tsconfig.base.json", "format": "prettier --write \"**/*.{js,ts}\"", "lint": "eslint . --ext .js,.ts", - "release": "node dist/cli release", "test": "run-s check:* lint build test:*", "test:cjs": "jest --config ./scripts/jest/config.cjs.js", "test:src": "jest --config ./scripts/jest/config.src.js" diff --git a/scripts/jest/config.cjs.js b/scripts/jest/config.cjs.js index 3e19a391..421e9663 100644 --- a/scripts/jest/config.cjs.js +++ b/scripts/jest/config.cjs.js @@ -6,6 +6,5 @@ module.exports = Object.assign({}, srcConfig, { '^../src$': '/dist/index.js', '^../src/data$': '/dist/data.js', '^../src/changelog$': '/dist/changelog.js', - '^../src/authors$': '/dist/authors.js', }, }); diff --git a/src/authors.ts b/src/authors.ts deleted file mode 100644 index fa58d16d..00000000 --- a/src/authors.ts +++ /dev/null @@ -1,27 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck - -import execa from 'execa'; -import { get as getData } from './data'; - -const authors = async (): Promise => { - const { commits } = await getData(); - - const authors = commits - .map((commit) => { - let author = `${commit.commit.author.name} <${commit.commit.author.email}>`; - ({ stdout: author } = execa.sync('git', ['check-mailmap', author])); - return author; - }) - .reduce( - (result, author) => - result.includes(author) ? result : [...result, author], - [] as string[], - ); - - authors.sort(); - - return authors.join('\n'); -}; - -export default authors; diff --git a/src/cli.ts b/src/cli.ts index 9c8e26d1..4239ac95 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,7 +1,6 @@ #!/usr/bin/env node import { Command } from 'commander'; -import authors from './authors'; import changelog from './changelog'; import release from './release'; @@ -20,26 +19,6 @@ program.on('command:*', function () { process.exit(1); }); -program - .command('authors') - .description( - 'generates an alphabetised list of authors in a format suitable for inclusion in an AUTHORS file', - ) - .action(async () => { - try { - const result = await authors(); - process.stdout.write(result); - } catch (error) { - console.error(error); - process.exit(1); - } - }) - .on('--help', () => { - console.log(` -Examples: - $ authors`); - }); - program .command('changelog') .description('generates a changelog using GitHub tags and pull requests') diff --git a/src/index.ts b/src/index.ts index 9fa1c1e9..bc15eb96 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,2 @@ -export { default as authors } from './authors'; export { default as changelog } from './changelog'; export { default as release } from './release'; diff --git a/src/release.ts b/src/release.ts index 12eee00a..414741c9 100755 --- a/src/release.ts +++ b/src/release.ts @@ -6,7 +6,6 @@ import execa from 'execa'; import fs from 'fs-extra'; import path from 'path'; import semver from 'semver'; -import authors from './authors'; import changelog from './changelog'; import { get as getData } from './data'; @@ -71,9 +70,6 @@ const release = async (): Promise<'released' | 'nothing-to-release'> => { changelogContent, ); - const authorsContent = await authors(); - await fs.outputFile(path.join(process.cwd(), 'AUTHORS'), authorsContent); - await fs.writeJSON( packagePath, { ...packageObj, version: newVersion }, diff --git a/test/cli.test.ts b/test/cli.test.ts index 2cbce524..00058671 100644 --- a/test/cli.test.ts +++ b/test/cli.test.ts @@ -11,20 +11,6 @@ describe('CLI integration tests', () => { } }); - test('authors command produces valid output', () => { - const output = execSync(`${CLI_PATH} authors`, { - encoding: 'utf-8', - env: process.env, - }); - - // Should contain valid author entries - expect(output).toMatch(/[\w\s<>@\[\].-]+/); - expect(output.split('\n').length).toBeGreaterThan(0); - - // Should contain at least one email address - expect(output).toMatch(/<[^>]+>/); - }); - test('changelog command produces valid markdown', () => { const output = execSync(`${CLI_PATH} changelog`, { encoding: 'utf-8', diff --git a/test/release.test.ts b/test/release.test.ts index ec5ce71c..1b2cc945 100644 --- a/test/release.test.ts +++ b/test/release.test.ts @@ -1,9 +1,7 @@ jest.mock('../src/changelog'); -jest.mock('../src/authors'); import { release } from '../src'; import changelog from '../src/changelog'; -import authors from '../src/authors'; import * as data from '../src/data'; const mockDataWithLabels = { @@ -50,9 +48,6 @@ describe('release validation', () => { (changelog as jest.MockedFunction).mockResolvedValue( '# Changelog', ); - (authors as jest.MockedFunction).mockResolvedValue( - 'Author1', - ); }); afterEach(() => {