@adamhl8/configs 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/dist/adamhl8-bunfig/index +21 -9
- package/dist/adamhl8-gitignore/index +11 -2
- package/dist/configs/commitlint.base.d.ts.map +1 -1
- package/dist/configs/justfile.base.just +1 -1
- package/dist/configs/knip.base.d.ts.map +1 -1
- package/dist/configs/oxfmt.base.d.ts.map +1 -1
- package/dist/configs/oxlint.base.d.ts.map +1 -1
- package/dist/configs/oxlint.base.js +2 -2
- package/dist/configs/oxlint.base.js.map +1 -1
- package/dist/configs/release-it.base.d.ts +16 -7
- package/dist/configs/release-it.base.d.ts.map +1 -1
- package/dist/configs/release-it.base.js +14 -8
- package/dist/configs/release-it.base.js.map +1 -1
- package/dist/env/utils.d.ts.map +1 -1
- package/dist/utils.js +17 -0
- package/dist/utils.js.map +1 -0
- package/package.json +8 -5
- package/dist/adamhl8-cliff/index +0 -16
package/README.md
CHANGED
|
@@ -136,17 +136,19 @@ import { releaseItConfig } from "@adamhl8/configs"
|
|
|
136
136
|
export default releaseItConfig({ ... })
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
The release config
|
|
139
|
+
The release config registers the [`release-it-git-cliff`](https://github.com/adamhl8/release-it-git-cliff) plugin with the bundled git-cliff config (`cliff.base.toml`), so there is no per-project `cliff.toml` to write. git-cliff picks the next version from the commits, and the plugin writes `CHANGELOG.md` (formatted with `oxfmt`) and sets the release notes. Tags are named `v${version}`. It publishes with `bun publish`.
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
There is no per-project file to write. The `adamhl8-cliff` bin wraps `git-cliff` with the bundled config (`cliff.base.toml`), so run it in place of `git-cliff`:
|
|
141
|
+
git-cliff must be on `PATH`, and the project needs `release-it-git-cliff` installed directly:
|
|
144
142
|
|
|
145
143
|
```sh
|
|
146
|
-
|
|
144
|
+
bun add -D release-it release-it-git-cliff
|
|
147
145
|
```
|
|
148
146
|
|
|
149
|
-
|
|
147
|
+
#### Notes
|
|
148
|
+
|
|
149
|
+
`release-it-git-cliff` is an optional peer dependency. release-it resolves plugins from its own location or the working directory, so with bun's `isolated` linker it can't find a plugin that's only a dependency of `@adamhl8/configs`.
|
|
150
|
+
|
|
151
|
+
Preview the next version or the unreleased changelog section with `release-it --release-version` or `release-it --changelog`.
|
|
150
152
|
|
|
151
153
|
### lefthook
|
|
152
154
|
|
|
@@ -256,9 +258,9 @@ jobs:
|
|
|
256
258
|
|
|
257
259
|
### Release
|
|
258
260
|
|
|
259
|
-
Manually dispatched. git-cliff
|
|
261
|
+
Manually dispatched. `release-it` uses git-cliff (via `release-it-git-cliff`, see [release-it](#release-it)) to compute the next version from the commits, then bumps `package.json`, regenerates the changelog, commits and tags (both SSH-signed), publishes to npm, and cuts a GitHub release. There is no automatic trigger, so run it when a release is ready (the `release` recipe just does `gh workflow run release.yml`). A dispatch with no releasable commits fails fast because the plugin finds nothing to release.
|
|
260
262
|
|
|
261
|
-
Needs the `NPM_CI_TOKEN` and `CI_SIGNING_KEY` secrets (see [Secrets](#secrets)). The workflow runs the base justfile's `release-run` recipe: `release-it --ci
|
|
263
|
+
Needs the `NPM_CI_TOKEN` and `CI_SIGNING_KEY` secrets (see [Secrets](#secrets)). The workflow installs git-cliff and runs the base justfile's `release-run` recipe: `release-it --ci`.
|
|
262
264
|
|
|
263
265
|
```yaml
|
|
264
266
|
# .github/workflows/release.yml
|
|
@@ -312,4 +314,4 @@ Configure these on each repo that uses the workflows (Settings -> Secrets and va
|
|
|
312
314
|
|
|
313
315
|
The `prepare` script is `"prepare": "just prepare"`, which runs the base justfile's `prepare` recipe (`lefthook install` outside CI, the `.gitignore` sync, and the `bunfig.toml` sync).
|
|
314
316
|
|
|
315
|
-
bun links a dependency's `package.json` bin executables into the local `node_modules/.bin`, but not the bins of the package being developed itself. This repo depends on itself (`"@adamhl8/configs": "file:."`) so that its own bins can be run directly, e.g. `adamhl8-
|
|
317
|
+
bun links a dependency's `package.json` bin executables into the local `node_modules/.bin`, but not the bins of the package being developed itself. This repo depends on itself (`"@adamhl8/configs": "file:."`) so that its own bins can be run directly, e.g. `adamhl8-bunfig` instead of `src/adamhl8-bunfig/index.ts`. That's also why this repo overrides the `prepare` recipe to first run `tsdown`: the bins point at `dist/`, so those builds need to be available.
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import path from "node:path";
|
|
3
2
|
import bun from "bun";
|
|
4
3
|
import { isPlainObject, merge } from "es-toolkit";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
const CONFIG_DIRS = ["./configs/", "../configs/"];
|
|
7
|
+
/** Returns the absolute path of a file in this package's `configs` folder. */
|
|
8
|
+
const configFilePath = (name) => {
|
|
9
|
+
const filePaths = CONFIG_DIRS.map((dir) => fileURLToPath(new URL(`${dir}${name}`, import.meta.url)));
|
|
10
|
+
const filePath = filePaths.find((candidate) => existsSync(candidate));
|
|
11
|
+
if (!filePath) throw new Error(`Couldn't find config file "${name}" in:\n${filePaths.join("\n")}`);
|
|
12
|
+
return filePath;
|
|
13
|
+
};
|
|
14
|
+
const BUNFIG_BASE_PATH = configFilePath("bunfig.base.toml");
|
|
15
|
+
const BUNFIG_PROJECT_PATH = "bunfig.toml";
|
|
16
|
+
/** Parses a TOML file, returning an empty table when the file is missing or isn't a table. */
|
|
17
|
+
const readToml = async (filePath) => {
|
|
18
|
+
const file = bun.file(filePath);
|
|
19
|
+
if (!await file.exists()) return {};
|
|
20
|
+
const parsed = bun.TOML.parse(await file.text());
|
|
21
|
+
return isPlainObject(parsed) ? parsed : {};
|
|
22
|
+
};
|
|
23
|
+
const baseBunfig = await readToml(BUNFIG_BASE_PATH);
|
|
24
|
+
const projectBunfig = await readToml(BUNFIG_PROJECT_PATH);
|
|
13
25
|
const mergedConfig = merge(baseBunfig, projectBunfig);
|
|
14
26
|
const mergedConfigToml = bun.TOML.stringify(mergedConfig) ?? "";
|
|
15
27
|
await bun.write(BUNFIG_PROJECT_PATH, mergedConfigToml);
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import path from "node:path";
|
|
3
2
|
import bun from "bun";
|
|
4
|
-
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
const CONFIG_DIRS = ["./configs/", "../configs/"];
|
|
6
|
+
/** Returns the absolute path of a file in this package's `configs` folder. */
|
|
7
|
+
const configFilePath = (name) => {
|
|
8
|
+
const filePaths = CONFIG_DIRS.map((dir) => fileURLToPath(new URL(`${dir}${name}`, import.meta.url)));
|
|
9
|
+
const filePath = filePaths.find((candidate) => existsSync(candidate));
|
|
10
|
+
if (!filePath) throw new Error(`Couldn't find config file "${name}" in:\n${filePaths.join("\n")}`);
|
|
11
|
+
return filePath;
|
|
12
|
+
};
|
|
13
|
+
const GITIGNORE_BASE_PATH = configFilePath("gitignore.base");
|
|
5
14
|
const END_MARKER = "# The above patterns are managed by @adamhl8/configs. Anything manually added above this line will be replaced.";
|
|
6
15
|
/** Rebuilds the managed region above the marker, keeping what's below it (the whole file when there's no marker). */
|
|
7
16
|
const mergeGitignore = (currentContent, blockBody) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commitlint.base.d.ts","names":[],"sources":["../../src/configs/commitlint.base.ts"],"mappings":";;;qBAkBa,
|
|
1
|
+
{"version":3,"file":"commitlint.base.d.ts","names":["_$_merge_config_merge_config_ts0.OptionalMergeConfigFn"],"sources":["../../src/configs/commitlint.base.ts"],"mappings":";;;qBAkBa,kBAAgBA,sBAAA;;;aAJzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knip.base.d.ts","names":[],"sources":["../../src/configs/knip.base.ts"],"mappings":";;;qBAea,
|
|
1
|
+
{"version":3,"file":"knip.base.d.ts","names":["_$_merge_config_merge_config_ts0.OptionalMergeConfigFn"],"sources":["../../src/configs/knip.base.ts"],"mappings":";;;qBAea,YAAUA,sBAAA;;;;aAJnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxfmt.base.d.ts","names":[],"sources":["../../src/configs/oxfmt.base.ts"],"mappings":";;;qBAqBa,
|
|
1
|
+
{"version":3,"file":"oxfmt.base.d.ts","names":["_$_merge_config_merge_config_ts0.OptionalMergeConfigFn"],"sources":["../../src/configs/oxfmt.base.ts"],"mappings":";;;qBAqBa,aAAWA,sBAAA;WAhBV;;;;aAIV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.base.d.ts","names":[],"sources":["../../src/configs/oxlint.base.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"oxlint.base.d.ts","names":["_$_merge_config_merge_config_ts0.OptionalMergeConfigFn"],"sources":["../../src/configs/oxlint.base.ts"],"mappings":";;;qBAyJa,cAAYA,sBAAA;;aAlJrB;aACA;aACA;;;aAIA;aACA;aACA;aACA;aACA;aACA;aACA;;;;;;;eAkCI;;;;;eAMA;;;;;;;mBAMqD;;;;;;aAMjB;aACG;aACF;;;;eAIe;eAA4B;eAAiB;;;eAClD;;;;iBAItC;iBAAiB;;;;;;aAKN;aACX;aACU;aACC;aACG;aACD;aACE;aACG;aACC;aACX;aACE;aACE;aACD;aACX;aACa;aACR;aACJ;aACC;aACS;aACF;aACF;aACL;aACD;aACF;aACI;aACK;aACV;aACa;aACR;aACW;aAChB;aACW;aACM;aACK;aACD;aACA;aACT;aACE;aACG;aACX;aACD;aACH;aACmB;aACY;aACC;aACC;aACL;aACF;aACE;aACH;aACX;aACI;aACD;aACX;aACmB;aACG;aACN;aACO;aACT;aACJ;aACC;aACP;aACQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolvePackagePath } from "../utils.js";
|
|
3
3
|
//#region src/configs/oxlint.base.ts
|
|
4
4
|
const baseConfig = {
|
|
5
5
|
options: {
|
|
@@ -30,7 +30,7 @@ const baseConfig = {
|
|
|
30
30
|
"promise",
|
|
31
31
|
"node"
|
|
32
32
|
],
|
|
33
|
-
jsPlugins: [
|
|
33
|
+
jsPlugins: [resolvePackagePath("@adamhl8/eslint-plugin-clean-modules")],
|
|
34
34
|
overrides: [
|
|
35
35
|
{
|
|
36
36
|
files: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.base.js","names":[],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"oxlint.base.js","names":[],"sources":["../../src/configs/oxlint.base.ts"],"sourcesContent":["import type { OxlintConfig } from \"oxlint\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { resolvePackagePath } from \"#utils.ts\"\n\nconst baseConfig = {\n options: {\n reportUnusedDisableDirectives: \"error\",\n typeAware: true,\n typeCheck: true,\n },\n\n categories: {\n correctness: \"error\",\n nursery: \"error\",\n pedantic: \"error\",\n perf: \"error\",\n restriction: \"error\",\n style: \"error\",\n suspicious: \"error\",\n },\n\n plugins: [\n \"eslint\",\n \"react\",\n \"unicorn\",\n \"typescript\",\n \"oxc\",\n \"import\",\n \"jsdoc\",\n \"vitest\",\n \"jsx-a11y\",\n \"react-perf\",\n \"promise\",\n \"node\",\n ],\n\n // Resolve to an absolute path so consumers load it from this package's own deps.\n jsPlugins: [resolvePackagePath(\"@adamhl8/eslint-plugin-clean-modules\")],\n\n overrides: [\n {\n files: [\n \".release-it.ts\",\n \"astro.config.ts\",\n \"commitlint.config.ts\",\n \"knip.ts\",\n \"oxfmt.config.ts\",\n \"oxlint.config.ts\",\n \"prisma.config.ts\",\n \"tsdown.config.ts\",\n ],\n rules: {\n \"import/no-default-export\": \"off\",\n },\n },\n {\n files: [\".release-it.ts\"],\n rules: {\n \"no-template-curly-in-string\": \"off\",\n },\n },\n {\n files: [\"**/*.tsx\"],\n rules: {\n \"func-style\": [\"error\", \"expression\", { overrides: { namedExports: \"ignore\" } }],\n },\n },\n ],\n\n rules: {\n \"clean-modules/require-direct-exports\": \"error\",\n \"clean-modules/require-import-extensions\": \"error\",\n \"clean-modules/require-subpath-imports\": \"error\",\n\n curly: [\"error\", \"multi-or-nest\"],\n \"func-style\": [\"error\", \"expression\"],\n \"react/jsx-curly-brace-presence\": [\"error\", { children: \"never\", propElementValues: \"always\", props: \"never\" }],\n \"require-unicode-regexp\": [\"error\", { requireFlag: \"v\" }],\n \"unicorn/filename-case\": [\n \"error\",\n {\n cases: { kebabCase: true, pascalCase: true },\n },\n ],\n \"unicorn/no-useless-undefined\": [\"error\", { checkArguments: false }],\n\n \"capitalized-comments\": \"off\",\n \"id-length\": \"off\",\n \"import/exports-last\": \"off\",\n \"import/group-exports\": \"off\",\n \"import/max-dependencies\": \"off\",\n \"import/no-named-export\": \"off\",\n \"import/no-nodejs-modules\": \"off\",\n \"import/no-unassigned-import\": \"off\",\n \"import/prefer-default-export\": \"off\",\n \"init-declarations\": \"off\",\n \"jsdoc/require-param\": \"off\",\n \"jsdoc/require-returns\": \"off\",\n \"max-classes-per-file\": \"off\",\n \"max-lines\": \"off\",\n \"max-lines-per-function\": \"off\",\n \"max-statements\": \"off\",\n \"no-console\": \"off\",\n \"no-continue\": \"off\",\n \"no-duplicate-imports\": \"off\",\n \"no-inline-comments\": \"off\",\n \"no-magic-numbers\": \"off\",\n \"no-plusplus\": \"off\",\n \"no-ternary\": \"off\",\n \"no-undef\": \"off\",\n \"no-undefined\": \"off\",\n \"no-useless-return\": \"off\",\n \"no-void\": \"off\",\n \"node/callback-return\": \"off\",\n \"node/no-sync\": \"off\",\n \"node/no-top-level-await\": \"off\",\n \"one-var\": \"off\",\n \"oxc/no-async-await\": \"off\",\n \"oxc/no-optional-chaining\": \"off\",\n \"oxc/no-rest-spread-properties\": \"off\",\n \"react/forbid-component-props\": \"off\",\n \"react/jsx-filename-extension\": \"off\",\n \"react/jsx-max-depth\": \"off\",\n \"react/jsx-no-literals\": \"off\",\n \"react/react-in-jsx-scope\": \"off\",\n \"require-await\": \"off\",\n \"sort-imports\": \"off\",\n \"sort-keys\": \"off\",\n \"typescript/consistent-return\": \"off\",\n \"typescript/explicit-function-return-type\": \"off\",\n \"typescript/explicit-module-boundary-types\": \"off\",\n \"typescript/prefer-readonly-parameter-types\": \"off\",\n \"typescript/strict-boolean-expressions\": \"off\",\n \"unicorn/no-array-callback-reference\": \"off\",\n \"unicorn/no-array-method-this-argument\": \"off\",\n \"unicorn/no-await-expression-member\": \"off\",\n \"unicorn/no-process-exit\": \"off\",\n \"unicorn/number-literal-case\": \"off\",\n \"unicorn/switch-case-braces\": \"off\",\n \"vitest/no-hooks\": \"off\",\n \"vitest/no-importing-vitest-globals\": \"off\",\n \"vitest/prefer-describe-function-title\": \"off\",\n \"vitest/prefer-expect-assertions\": \"off\",\n \"vitest/prefer-importing-vitest-globals\": \"off\",\n \"vitest/prefer-lowercase-title\": \"off\",\n \"vitest/prefer-to-be-falsy\": \"off\",\n \"vitest/prefer-to-be-truthy\": \"off\",\n \"vitest/require-hook\": \"off\", // reenable when false positives are fixed?\n \"vitest/require-test-timeout\": \"off\",\n },\n} as const satisfies OxlintConfig\n\nexport const oxlintConfig = createMergeConfigFn<OxlintConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAKA,MAAM,aAAa;CACjB,SAAS;EACP,+BAA+B;EAC/B,WAAW;EACX,WAAW;CACb;CAEA,YAAY;EACV,aAAa;EACb,SAAS;EACT,UAAU;EACV,MAAM;EACN,aAAa;EACb,OAAO;EACP,YAAY;CACd;CAEA,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAGA,WAAW,CAAC,mBAAmB,sCAAsC,CAAC;CAEtE,WAAW;EACT;GACE,OAAO;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,OAAO,EACL,4BAA4B,MAC9B;EACF;EACA;GACE,OAAO,CAAC,gBAAgB;GACxB,OAAO,EACL,+BAA+B,MACjC;EACF;EACA;GACE,OAAO,CAAC,UAAU;GAClB,OAAO,EACL,cAAc;IAAC;IAAS;IAAc,EAAE,WAAW,EAAE,cAAc,SAAS,EAAE;GAAC,EACjF;EACF;CACF;CAEA,OAAO;EACL,wCAAwC;EACxC,2CAA2C;EAC3C,yCAAyC;EAEzC,OAAO,CAAC,SAAS,eAAe;EAChC,cAAc,CAAC,SAAS,YAAY;EACpC,kCAAkC,CAAC,SAAS;GAAE,UAAU;GAAS,mBAAmB;GAAU,OAAO;EAAQ,CAAC;EAC9G,0BAA0B,CAAC,SAAS,EAAE,aAAa,IAAI,CAAC;EACxD,yBAAyB,CACvB,SACA,EACE,OAAO;GAAE,WAAW;GAAM,YAAY;EAAK,EAC7C,CACF;EACA,gCAAgC,CAAC,SAAS,EAAE,gBAAgB,MAAM,CAAC;EAEnE,wBAAwB;EACxB,aAAa;EACb,uBAAuB;EACvB,wBAAwB;EACxB,2BAA2B;EAC3B,0BAA0B;EAC1B,4BAA4B;EAC5B,+BAA+B;EAC/B,gCAAgC;EAChC,qBAAqB;EACrB,uBAAuB;EACvB,yBAAyB;EACzB,wBAAwB;EACxB,aAAa;EACb,0BAA0B;EAC1B,kBAAkB;EAClB,cAAc;EACd,eAAe;EACf,wBAAwB;EACxB,sBAAsB;EACtB,oBAAoB;EACpB,eAAe;EACf,cAAc;EACd,YAAY;EACZ,gBAAgB;EAChB,qBAAqB;EACrB,WAAW;EACX,wBAAwB;EACxB,gBAAgB;EAChB,2BAA2B;EAC3B,WAAW;EACX,sBAAsB;EACtB,4BAA4B;EAC5B,iCAAiC;EACjC,gCAAgC;EAChC,gCAAgC;EAChC,uBAAuB;EACvB,yBAAyB;EACzB,4BAA4B;EAC5B,iBAAiB;EACjB,gBAAgB;EAChB,aAAa;EACb,gCAAgC;EAChC,4CAA4C;EAC5C,6CAA6C;EAC7C,8CAA8C;EAC9C,yCAAyC;EACzC,uCAAuC;EACvC,yCAAyC;EACzC,sCAAsC;EACtC,2BAA2B;EAC3B,+BAA+B;EAC/B,8BAA8B;EAC9B,mBAAmB;EACnB,sCAAsC;EACtC,yCAAyC;EACzC,mCAAmC;EACnC,0CAA0C;EAC1C,iCAAiC;EACjC,6BAA6B;EAC7B,8BAA8B;EAC9B,uBAAuB;EACvB,+BAA+B;CACjC;AACF;AAEA,MAAa,eAAe,oBAAqD,UAAU"}
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { OptionalMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
2
|
import { Config } from "release-it";
|
|
3
3
|
//#region src/configs/release-it.base.d.ts
|
|
4
|
-
|
|
4
|
+
type PluginHooks = Partial<Record<`${"before" | "after"}:${string}`, string | string[]>>;
|
|
5
|
+
type ReleaseItConfig = Config & {
|
|
6
|
+
hooks?: PluginHooks;
|
|
7
|
+
};
|
|
8
|
+
export declare const releaseItConfig: OptionalMergeConfigFn<ReleaseItConfig, {
|
|
5
9
|
readonly hooks: {
|
|
6
10
|
readonly "before:init": "just build";
|
|
7
|
-
readonly "after:
|
|
11
|
+
readonly "after:release-it-git-cliff:beforeRelease": "bun oxfmt CHANGELOG.md";
|
|
12
|
+
};
|
|
13
|
+
readonly plugins: {
|
|
14
|
+
readonly "release-it-git-cliff": {
|
|
15
|
+
readonly config: string;
|
|
16
|
+
readonly output: "CHANGELOG.md";
|
|
17
|
+
};
|
|
8
18
|
};
|
|
9
19
|
readonly git: {
|
|
10
|
-
readonly commitMessage: "release: ${
|
|
11
|
-
readonly tagName: "${version}";
|
|
12
|
-
readonly tagAnnotation: "release ${
|
|
20
|
+
readonly commitMessage: "release: ${tagName}";
|
|
21
|
+
readonly tagName: "v${version}";
|
|
22
|
+
readonly tagAnnotation: "release ${tagName}";
|
|
13
23
|
readonly addUntrackedFiles: true;
|
|
14
24
|
};
|
|
15
25
|
readonly github: {
|
|
16
26
|
readonly release: true;
|
|
17
|
-
readonly releaseName: "${
|
|
18
|
-
readonly releaseNotes: "bun adamhl8-cliff --unreleased --tag ${version}";
|
|
27
|
+
readonly releaseName: "${tagName}";
|
|
19
28
|
};
|
|
20
29
|
readonly npm: {
|
|
21
30
|
readonly publishPackageManager: "bun";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-it.base.d.ts","names":[],"sources":["../../src/configs/release-it.base.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"release-it.base.d.ts","names":["_$_merge_config_merge_config_ts0.OptionalMergeConfigFn"],"sources":["../../src/configs/release-it.base.ts"],"mappings":";;;KAOK,cAAc,QAAQ;KACtB,kBAAkB;EAAW,QAAQ;;qBA+B7B,iBAAeA,sBAAA;;aA3BxB;aACA;;;aAGA;eACE;eACA;;;;aAIF;aAEA;aACA;aACA;;;aAGA;aACA;;;aAGA;aACA;aACA"}
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { createMergeConfigFn } from "../merge-config/merge-config.js";
|
|
2
|
-
|
|
2
|
+
import { configFilePath } from "../utils.js";
|
|
3
|
+
//#region src/configs/release-it.base.ts
|
|
4
|
+
const baseConfig = {
|
|
3
5
|
hooks: {
|
|
4
6
|
"before:init": "just build",
|
|
5
|
-
"after:
|
|
7
|
+
"after:release-it-git-cliff:beforeRelease": "bun oxfmt CHANGELOG.md"
|
|
6
8
|
},
|
|
9
|
+
plugins: { "release-it-git-cliff": {
|
|
10
|
+
config: configFilePath("cliff.base.toml"),
|
|
11
|
+
output: "CHANGELOG.md"
|
|
12
|
+
} },
|
|
7
13
|
git: {
|
|
8
|
-
commitMessage: "release: ${
|
|
9
|
-
tagName: "${version}",
|
|
10
|
-
tagAnnotation: "release ${
|
|
14
|
+
commitMessage: "release: ${tagName}",
|
|
15
|
+
tagName: "v${version}",
|
|
16
|
+
tagAnnotation: "release ${tagName}",
|
|
11
17
|
addUntrackedFiles: true
|
|
12
18
|
},
|
|
13
19
|
github: {
|
|
14
20
|
release: true,
|
|
15
|
-
releaseName: "${
|
|
16
|
-
releaseNotes: "bun adamhl8-cliff --unreleased --tag ${version}"
|
|
21
|
+
releaseName: "${tagName}"
|
|
17
22
|
},
|
|
18
23
|
npm: {
|
|
19
24
|
publishPackageManager: "bun",
|
|
20
25
|
publishPath: "",
|
|
21
26
|
publishArgs: ["--ignore-scripts"]
|
|
22
27
|
}
|
|
23
|
-
}
|
|
28
|
+
};
|
|
29
|
+
const releaseItConfig = createMergeConfigFn(baseConfig);
|
|
24
30
|
//#endregion
|
|
25
31
|
export { releaseItConfig };
|
|
26
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-it.base.js","names":[],"sources":["../../src/configs/release-it.base.ts"],"sourcesContent":["// oxlint-disable no-template-curly-in-string\nimport type { Config } from \"release-it\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\nconst baseConfig = {\n hooks: {\n \"before:init\": \"just build\",\n \"after:
|
|
1
|
+
{"version":3,"file":"release-it.base.js","names":[],"sources":["../../src/configs/release-it.base.ts"],"sourcesContent":["// oxlint-disable no-template-curly-in-string\nimport type { Config } from \"release-it\"\n\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { configFilePath } from \"#utils.ts\"\n\n// release-it's `Hooks` type only lists the hooks of its built-in plugins.\ntype PluginHooks = Partial<Record<`${\"before\" | \"after\"}:${string}`, string | string[]>>\ntype ReleaseItConfig = Config & { hooks?: PluginHooks }\n\nconst baseConfig = {\n hooks: {\n \"before:init\": \"just build\",\n \"after:release-it-git-cliff:beforeRelease\": \"bun oxfmt CHANGELOG.md\",\n },\n plugins: {\n \"release-it-git-cliff\": {\n config: configFilePath(\"cliff.base.toml\"),\n output: \"CHANGELOG.md\",\n },\n },\n git: {\n commitMessage: \"release: ${tagName}\",\n // Set the `v` explicitly because release-it only detects it from an existing tag.\n tagName: \"v${version}\",\n tagAnnotation: \"release ${tagName}\",\n addUntrackedFiles: true,\n },\n github: {\n release: true,\n releaseName: \"${tagName}\",\n },\n npm: {\n publishPackageManager: \"bun\",\n publishPath: \"\",\n publishArgs: [\"--ignore-scripts\"],\n },\n} as const satisfies ReleaseItConfig\n\nexport const releaseItConfig = createMergeConfigFn<ReleaseItConfig, typeof baseConfig>(baseConfig)\n"],"mappings":";;;AAUA,MAAM,aAAa;CACjB,OAAO;EACL,eAAe;EACf,4CAA4C;CAC9C;CACA,SAAS,EACP,wBAAwB;EACtB,QAAQ,eAAe,iBAAiB;EACxC,QAAQ;CACV,EACF;CACA,KAAK;EACH,eAAe;EAEf,SAAS;EACT,eAAe;EACf,mBAAmB;CACrB;CACA,QAAQ;EACN,SAAS;EACT,aAAa;CACf;CACA,KAAK;EACH,uBAAuB;EACvB,aAAa;EACb,aAAa,CAAC,kBAAkB;CAClC;AACF;AAEA,MAAa,kBAAkB,oBAAwD,UAAU"}
|
package/dist/env/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/env/utils.ts"],"mappings":";;;;;;;;wBASgB,kBAAkB,KAChC,eACA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":["arktype"],"sources":["../../src/env/utils.ts"],"mappings":";;;;;;;;wBASgB,kBAAkB,KAChC,eACA,MAAMA,KAAQ,SAAS,OACtB,WAAWA,KAAQ,YAAY;wBAClB,kBAAkB,KAChC,eACA,MAAMA,KAAQ,SAAS,MACvB,UAAUA,KAAQ,MAAM,OACvBA,KAAQ,YAAY"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
//#region src/utils.ts
|
|
4
|
+
const CONFIG_DIRS = ["./configs/", "../configs/"];
|
|
5
|
+
/** Returns the absolute path of a file in this package's `configs` folder. */
|
|
6
|
+
const configFilePath = (name) => {
|
|
7
|
+
const filePaths = CONFIG_DIRS.map((dir) => fileURLToPath(new URL(`${dir}${name}`, import.meta.url)));
|
|
8
|
+
const filePath = filePaths.find((candidate) => existsSync(candidate));
|
|
9
|
+
if (!filePath) throw new Error(`Couldn't find config file "${name}" in:\n${filePaths.join("\n")}`);
|
|
10
|
+
return filePath;
|
|
11
|
+
};
|
|
12
|
+
/** Returns the absolute path of a package's entry file, resolved from this package's dependencies. */
|
|
13
|
+
const resolvePackagePath = (specifier) => fileURLToPath(import.meta.resolve(specifier));
|
|
14
|
+
//#endregion
|
|
15
|
+
export { configFilePath, resolvePackagePath };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { existsSync } from \"node:fs\"\nimport { fileURLToPath } from \"node:url\"\n\n// Check both folders because a bin bundles this file into `<bin>/index`, one level below `configs`.\nconst CONFIG_DIRS = [\"./configs/\", \"../configs/\"] as const\n\n/** Returns the absolute path of a file in this package's `configs` folder. */\nexport const configFilePath = (name: string) => {\n const filePaths = CONFIG_DIRS.map((dir) => fileURLToPath(new URL(`${dir}${name}`, import.meta.url)))\n const filePath = filePaths.find((candidate) => existsSync(candidate))\n if (!filePath) throw new Error(`Couldn't find config file \"${name}\" in:\\n${filePaths.join(\"\\n\")}`)\n return filePath\n}\n\n/** Returns the absolute path of a package's entry file, resolved from this package's dependencies. */\nexport const resolvePackagePath = (specifier: string) => fileURLToPath(import.meta.resolve(specifier))\n"],"mappings":";;;AAIA,MAAM,cAAc,CAAC,cAAc,aAAa;;AAGhD,MAAa,kBAAkB,SAAiB;CAC9C,MAAM,YAAY,YAAY,KAAK,QAAQ,cAAc,IAAI,IAAI,GAAG,MAAM,QAAQ,YAAY,GAAG,CAAC,CAAC;CACnG,MAAM,WAAW,UAAU,MAAM,cAAc,WAAW,SAAS,CAAC;CACpE,IAAI,CAAC,UAAU,MAAM,IAAI,MAAM,8BAA8B,KAAK,SAAS,UAAU,KAAK,IAAI,GAAG;CACjG,OAAO;AACT;;AAGA,MAAa,sBAAsB,cAAsB,cAAc,YAAY,QAAQ,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "My shared configs for TS projects",
|
|
5
5
|
"homepage": "https://github.com/adamhl8/configs",
|
|
6
6
|
"bugs": {
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
20
|
"adamhl8-bunfig": "./dist/adamhl8-bunfig/index",
|
|
21
|
-
"adamhl8-cliff": "./dist/adamhl8-cliff/index",
|
|
22
21
|
"adamhl8-gitignore": "./dist/adamhl8-gitignore/index"
|
|
23
22
|
},
|
|
24
23
|
"files": [
|
|
@@ -53,7 +52,6 @@
|
|
|
53
52
|
"arktype": "^2.2.3",
|
|
54
53
|
"es-toolkit": "^1.52.0",
|
|
55
54
|
"ts-explicit-errors": "^4.1.3",
|
|
56
|
-
"ts-extras": "^1.3.0",
|
|
57
55
|
"type-fest": "^5.10.0"
|
|
58
56
|
},
|
|
59
57
|
"devDependencies": {
|
|
@@ -65,9 +63,10 @@
|
|
|
65
63
|
"markdown-toc": "^1.2.0",
|
|
66
64
|
"oxfmt": "^0.70.0",
|
|
67
65
|
"oxlint": "^1.85.0",
|
|
68
|
-
"oxlint-tsgolint": "^7.0.
|
|
66
|
+
"oxlint-tsgolint": "^7.0.2003",
|
|
69
67
|
"publint": "^0.3.24",
|
|
70
68
|
"release-it": "^21.1.0",
|
|
69
|
+
"release-it-git-cliff": "^0.1.0",
|
|
71
70
|
"tsdown": "^0.23.0",
|
|
72
71
|
"typescript": "^7.0.2"
|
|
73
72
|
},
|
|
@@ -81,7 +80,8 @@
|
|
|
81
80
|
"oxlint": ">=1",
|
|
82
81
|
"oxlint-tsgolint": ">=0.24",
|
|
83
82
|
"publint": ">=0.3",
|
|
84
|
-
"release-it": ">=
|
|
83
|
+
"release-it": ">=21",
|
|
84
|
+
"release-it-git-cliff": ">=0.1",
|
|
85
85
|
"tsdown": ">=0.20",
|
|
86
86
|
"typescript": "^7.0.0"
|
|
87
87
|
},
|
|
@@ -92,6 +92,9 @@
|
|
|
92
92
|
"release-it": {
|
|
93
93
|
"optional": true
|
|
94
94
|
},
|
|
95
|
+
"release-it-git-cliff": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
95
98
|
"tsdown": {
|
|
96
99
|
"optional": true
|
|
97
100
|
}
|
package/dist/adamhl8-cliff/index
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { spawnSync } from "bun";
|
|
4
|
-
const CLIFF_CONFIG_PATH = path.resolve(import.meta.dir, "../configs/cliff.base.toml");
|
|
5
|
-
const result = spawnSync([
|
|
6
|
-
"git-cliff",
|
|
7
|
-
"--config",
|
|
8
|
-
CLIFF_CONFIG_PATH,
|
|
9
|
-
...process.argv.slice(2)
|
|
10
|
-
], { stdio: [
|
|
11
|
-
"inherit",
|
|
12
|
-
"inherit",
|
|
13
|
-
"inherit"
|
|
14
|
-
] });
|
|
15
|
-
process.exitCode = result.exitCode;
|
|
16
|
-
export {};
|