From db0dc109cf86e8215c1a39ee3a2ee493dceda3ea Mon Sep 17 00:00:00 2001 From: Kexy Biscuit Date: Fri, 3 Jan 2025 18:20:11 +0800 Subject: [PATCH] feat: bootstrap release please (#13) --- .github/workflows/release-please.yml | 67 +++++++++++++++++++ .release-please-manifest.json | 5 ++ eslint.config.ts | 2 +- package.json | 4 +- packages/eslint-config/package.json | 4 +- .../src/utils/get-flat-config-name.ts | 14 ++-- packages/eslint-parser-plain/README.md | 10 +-- packages/eslint-parser-plain/package.json | 2 +- .../eslint-parser-plain/tests/index.spec.ts | 2 +- packages/eslint-plugin-format/README.md | 2 +- packages/eslint-plugin-format/package.json | 4 +- packages/eslint-plugin-format/src/index.ts | 2 +- .../tests/rules/prettier.spec.ts | 2 +- pnpm-lock.yaml | 4 +- release-please-config.json | 20 ++++++ scripts/typegen.ts | 2 +- 16 files changed, 119 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..2156e6a --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,67 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + command: manifest-release + token: ${{secrets.GITHUB_TOKEN}} + + # The logic below handles the npm publication: + - uses: actions/checkout@v4 + # these if statements ensure that a publication only occurs when + # a new release is created: + if: ${{steps.release.outputs['packages/eslint-config--release_created'] || steps.release.outputs['packages/eslint-parser-plain--release_created'] || steps.release.outputs['packages/eslint-plugin-format--release_created']}} + + - name: Setup target Node.js to enable Corepack + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + if: ${{steps.release.outputs['packages/eslint-config--release_created'] || steps.release.outputs['packages/eslint-parser-plain--release_created'] || steps.release.outputs['packages/eslint-plugin-format--release_created']}} + + - name: Enable Corepack + run: corepack enable + if: ${{steps.release.outputs['packages/eslint-config--release_created'] || steps.release.outputs['packages/eslint-parser-plain--release_created'] || steps.release.outputs['packages/eslint-plugin-format--release_created']}} + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: pnpm + registry-url: 'https://registry.npmjs.org' + if: ${{steps.release.outputs['packages/eslint-config--release_created'] || steps.release.outputs['packages/eslint-parser-plain--release_created'] || steps.release.outputs['packages/eslint-plugin-format--release_created']}} + + - run: pnpm install --frozen-lockfile + if: ${{steps.release.outputs['packages/eslint-config--release_created'] || steps.release.outputs['packages/eslint-parser-plain--release_created'] || steps.release.outputs['packages/eslint-plugin-format--release_created']}} + + - run: pnpm typegen + if: ${{steps.release.outputs['packages/eslint-config--release_created'] || steps.release.outputs['packages/eslint-parser-plain--release_created'] || steps.release.outputs['packages/eslint-plugin-format--release_created']}} + + - run: pnpm build + if: ${{steps.release.outputs['packages/eslint-config--release_created'] || steps.release.outputs['packages/eslint-parser-plain--release_created'] || steps.release.outputs['packages/eslint-plugin-format--release_created']}} + + - run: pnpm exec jiek publish --no-bumper --filter @biscuittin/eslint-config + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{steps.release.outputs['packages/eslint-config--release_created']}} + + - run: pnpm exec jiek publish --no-bumper --filter @biscuittin/eslint-parser-plain + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{steps.release.outputs['packages/eslint-parser-plain--release_created']}} + + - run: pnpm exec jiek publish --no-bumper --filter @biscuittin/eslint-plugin-format + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + if: ${{steps.release.outputs['packages/eslint-plugin-format--release_created']}} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..6fdb463 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,5 @@ +{ + "packages/eslint-config": "0.0.1", + "packages/eslint-parser-plain": "0.0.1", + "packages/eslint-plugin-format": "0.0.1" +} diff --git a/eslint.config.ts b/eslint.config.ts index dd60796..555a8d5 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -1,4 +1,4 @@ -import config from '@bttin/eslint-config' +import config from '@biscuittin/eslint-config' export default config( { diff --git a/package.json b/package.json index c57c7b5..8b1bc4a 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "yarn": ">=999.0.0" }, "scripts": { - "build": "jiek build --noMin --filter @bttin/*", + "build": "jiek build --noMin --filter @biscuittin/*", "test": "vitest --run --logHeapUsage", "coverage": "vitest run --coverage", "typegen": "tsx scripts/typegen.ts", @@ -25,7 +25,7 @@ "prepare": "husky" }, "devDependencies": { - "@bttin/eslint-config": "workspace:^", + "@biscuittin/eslint-config": "workspace:^", "@commitlint/cli": "^19.6.1", "@commitlint/config-conventional": "^19.6.0", "@commitlint/types": "^19.5.0", diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 325f24c..694aa32 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -1,7 +1,7 @@ { - "name": "@bttin/eslint-config", + "name": "@biscuittin/eslint-config", "type": "module", - "version": "0.1.0", + "version": "0.0.1", "description": "A collection of ESLint configurations for Biscuit Tin projects.", "author": "Biscuit Tin ", "license": "MIT", diff --git a/packages/eslint-config/src/utils/get-flat-config-name.ts b/packages/eslint-config/src/utils/get-flat-config-name.ts index 6ffd2f4..3a6333d 100644 --- a/packages/eslint-config/src/utils/get-flat-config-name.ts +++ b/packages/eslint-config/src/utils/get-flat-config-name.ts @@ -1,11 +1,11 @@ export function getFlatConfigName(module: T) { return { - base: `@bttin/eslint-config/${module}`, - setup: `@bttin/eslint-config/${module}/setup`, - rules: `@bttin/eslint-config/${module}/rules`, - stylistic: `@bttin/eslint-config/${module}/stylistic`, - commonjs: `@bttin/eslint-config/${module}/commonjs`, - module: `@bttin/eslint-config/${module}/module`, - script: `@bttin/eslint-config/${module}/script`, + base: `@biscuittin/eslint-config/${module}`, + setup: `@biscuittin/eslint-config/${module}/setup`, + rules: `@biscuittin/eslint-config/${module}/rules`, + stylistic: `@biscuittin/eslint-config/${module}/stylistic`, + commonjs: `@biscuittin/eslint-config/${module}/commonjs`, + module: `@biscuittin/eslint-config/${module}/module`, + script: `@biscuittin/eslint-config/${module}/script`, } as const } diff --git a/packages/eslint-parser-plain/README.md b/packages/eslint-parser-plain/README.md index 65a7f24..b87208a 100644 --- a/packages/eslint-parser-plain/README.md +++ b/packages/eslint-parser-plain/README.md @@ -1,4 +1,4 @@ -# @bttin/eslint-parser-plain +# @biscuittin/eslint-parser-plain Allow you to parse various types of files with ESLint, a fork of [Ray's](https://github.com/so1ve/eslint-parser-plain) ([@so1ve](https://github.com/so1ve)). @@ -7,15 +7,15 @@ Allow you to parse various types of files with ESLint, a fork of [Ray's](https:/ ### Install ```bash -npm install -D @bttin/eslint-parser-plain +npm install -D @biscuittin/eslint-parser-plain ``` ```bash -yarn add -D @bttin/eslint-parser-plain +yarn add -D @biscuittin/eslint-parser-plain ``` ```bash -pnpm add -D @bttin/eslint-parser-plain +pnpm add -D @biscuittin/eslint-parser-plain ``` ### Configure @@ -23,7 +23,7 @@ pnpm add -D @bttin/eslint-parser-plain We recommend using [ESLint's Flat Config format](https://eslint.org/docs/latest/use/configure/configuration-files-new). ```typescript -import parserPlain from "@bttin/eslint-parser-plain" +import parserPlain from "@biscuittin/eslint-parser-plain" export default [ { diff --git a/packages/eslint-parser-plain/package.json b/packages/eslint-parser-plain/package.json index 1d53381..9abf611 100644 --- a/packages/eslint-parser-plain/package.json +++ b/packages/eslint-parser-plain/package.json @@ -1,5 +1,5 @@ { - "name": "@bttin/eslint-parser-plain", + "name": "@biscuittin/eslint-parser-plain", "type": "module", "version": "0.0.1", "description": "Parse various types of files with ESLint, a fork of Ray's (@so1ve).", diff --git a/packages/eslint-parser-plain/tests/index.spec.ts b/packages/eslint-parser-plain/tests/index.spec.ts index b741399..733d2e5 100644 --- a/packages/eslint-parser-plain/tests/index.spec.ts +++ b/packages/eslint-parser-plain/tests/index.spec.ts @@ -1,4 +1,4 @@ -import { parseForESLint } from '@bttin/eslint-parser-plain' +import { parseForESLint } from '@biscuittin/eslint-parser-plain' import { describe, expect, it } from 'vitest' describe('should', () => { diff --git a/packages/eslint-plugin-format/README.md b/packages/eslint-plugin-format/README.md index e4ce1dd..9404023 100644 --- a/packages/eslint-plugin-format/README.md +++ b/packages/eslint-plugin-format/README.md @@ -1,4 +1,4 @@ -# @bttin/eslint-plugin-format +# @biscuittin/eslint-plugin-format Format various languages with formatters in ESLint. Supports [Prettier](https://prettier.io/) and [dprint](https://dprint.dev/). diff --git a/packages/eslint-plugin-format/package.json b/packages/eslint-plugin-format/package.json index cbc629f..05d9b68 100644 --- a/packages/eslint-plugin-format/package.json +++ b/packages/eslint-plugin-format/package.json @@ -1,5 +1,5 @@ { - "name": "@bttin/eslint-plugin-format", + "name": "@biscuittin/eslint-plugin-format", "type": "module", "version": "0.0.1", "description": "Format various languages with formatters in ESLint, a fork of Antfu's, with support for configuration files.", @@ -48,7 +48,7 @@ } }, "dependencies": { - "@bttin/eslint-parser-plain": "workspace:^", + "@biscuittin/eslint-parser-plain": "workspace:^", "eslint-formatting-reporter": "^0.0.0", "find-up-simple": "^1.0.0", "micro-memoize": "^4.1.2", diff --git a/packages/eslint-plugin-format/src/index.ts b/packages/eslint-plugin-format/src/index.ts index 9ab95ce..9c9c133 100644 --- a/packages/eslint-plugin-format/src/index.ts +++ b/packages/eslint-plugin-format/src/index.ts @@ -1,6 +1,6 @@ import type { ESLint, Linter } from 'eslint' -import parserPlain from '@bttin/eslint-parser-plain' +import parserPlain from '@biscuittin/eslint-parser-plain' import packagePlugin from '../package.json' import dprint from './rules/dprint.js' diff --git a/packages/eslint-plugin-format/tests/rules/prettier.spec.ts b/packages/eslint-plugin-format/tests/rules/prettier.spec.ts index 92af05a..4b0ea7b 100644 --- a/packages/eslint-plugin-format/tests/rules/prettier.spec.ts +++ b/packages/eslint-plugin-format/tests/rules/prettier.spec.ts @@ -1,4 +1,4 @@ -import pluginFormat from '@bttin/eslint-plugin-format' +import pluginFormat from '@biscuittin/eslint-plugin-format' import { fileURLToPath } from 'node:url' import { ruleTester } from '../../../../tools/eslint-rule-tester.js' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 23df4ff..f2e2752 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,7 +15,7 @@ importers: .: devDependencies: - '@bttin/eslint-config': + '@biscuittin/eslint-config': specifier: workspace:^ version: link:packages/eslint-config '@commitlint/cli': @@ -193,7 +193,7 @@ importers: packages/eslint-plugin-format: dependencies: - '@bttin/eslint-parser-plain': + '@biscuittin/eslint-parser-plain': specifier: workspace:^ version: link:../eslint-parser-plain eslint-formatting-reporter: diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..c9acb3a --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,20 @@ +{ + "release-type": "node", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "draft": false, + "prerelease": true, + "separate-pull-requests": true, + "packages": { + "packages/eslint-config": { + "changelog-path": "CHANGELOG.md" + }, + "packages/eslint-parser-plain": { + "changelog-path": "CHANGELOG.md" + }, + "packages/eslint-plugin-format": { + "changelog-path": "CHANGELOG.md" + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} diff --git a/scripts/typegen.ts b/scripts/typegen.ts index c319ae4..6c2b1f5 100644 --- a/scripts/typegen.ts +++ b/scripts/typegen.ts @@ -23,7 +23,7 @@ import { tailwindcss, typescript, unicorn, -} from '@bttin/eslint-config' +} from '@biscuittin/eslint-config' import { flatConfigsToRulesDTS } from 'eslint-typegen/core' import { builtinRules } from 'eslint/use-at-your-own-risk' import fs from 'node:fs/promises'