@adamhl8/configs 2.2.0 → 2.2.2
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 +20 -2
- package/dist/configs/oxfmt.base.d.ts.map +1 -1
- package/dist/configs/oxlint.base.d.ts.map +1 -1
- package/dist/configs/tsdown.base.d.ts +3 -0
- package/dist/configs/tsdown.base.d.ts.map +1 -1
- package/dist/configs/tsdown.base.js +2 -1
- package/dist/configs/tsdown.base.js.map +1 -1
- package/dist/tofu/github/actions_secrets.tofu +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ Scripts live in a shared [`just`](https://github.com/casey/just) base justfile i
|
|
|
35
35
|
import "node_modules/@adamhl8/configs/dist/configs/justfile.base.just"
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
It provides `lint`, `build`, `test`, `bump-deps`, `release`, `release-run`, and `prepare`. Run `just` to list them. `build` only runs `tsdown` if the project has a `tsdown.config.ts`,
|
|
38
|
+
It provides `lint`, `build`, `test`, `bump-deps`, `release`, `release-run`, `tofu-check`, and `prepare`. Run `just` to list them. The recipes degrade gracefully so projects can use them as-is: `build` only runs `tsdown` if the project has a `tsdown.config.ts`, `test` (`bun test`) passes when there are no tests, and `tofu-check` (a `tofu plan` drift check, which `build` also runs) skips itself unless run locally in a project with `.tofu` files.
|
|
39
39
|
|
|
40
40
|
To customize a recipe, redefine it in your `justfile`. Each public recipe is a thin wrapper over a private `_recipe` that holds the actual body, so an override can still run the original instead of copying it:
|
|
41
41
|
|
|
@@ -109,7 +109,7 @@ const config = tsdownConfig({ ... })
|
|
|
109
109
|
export default defineConfig(config)
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
`
|
|
112
|
+
`tsdownBundleConfig` is also exported for single-file bundles that aren't published libraries: everything is bundled, with no type declarations or publish checks. `tsdownBinConfig` builds `package.json` bin executables: the same bundle for node, with an extensionless output file.
|
|
113
113
|
|
|
114
114
|
### commitlint
|
|
115
115
|
|
|
@@ -174,6 +174,24 @@ dist/
|
|
|
174
174
|
|
|
175
175
|
Everything below the marker is left untouched. The sync can also be run manually by running `adamhl8-gitignore`.
|
|
176
176
|
|
|
177
|
+
### env
|
|
178
|
+
|
|
179
|
+
Utilities for validated environment variables, exported from the `/env` subpath:
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
import { parseEnv, requireWhen } from "@adamhl8/configs/env"
|
|
183
|
+
|
|
184
|
+
const isProd = process.env["NODE_ENV"] === "production"
|
|
185
|
+
|
|
186
|
+
export const env = parseEnv({
|
|
187
|
+
API_URL: "string.url",
|
|
188
|
+
// required in production, optional otherwise
|
|
189
|
+
SENTRY_DSN: requireWhen(isProd, "string.url"),
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`parseEnv` is `arkenv` with friendlier failures: invalid env prints the validation message and exits instead of throwing. `requireWhen` makes a var required while its condition is true and optional otherwise. An optional third argument supplies a fallback for when the var is unset (the fallback is exempt from validation, a set value never is).
|
|
194
|
+
|
|
177
195
|
## GitHub Actions
|
|
178
196
|
|
|
179
197
|
This repo hosts three reusable workflows you can call from other projects instead of copy/pasting them. The calling project must use `bun`, have a `justfile` that imports the base justfile (see [just](#just)), and have a commitlint config (e.g. via these configs). The workflows set up bun and install just and lefthook themselves.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxfmt.base.d.ts","names":[],"sources":["../../src/configs/oxfmt.base.ts"],"mappings":";;;cAqBa,aAAW,sBAAA
|
|
1
|
+
{"version":3,"file":"oxfmt.base.d.ts","names":[],"sources":["../../src/configs/oxfmt.base.ts"],"mappings":";;;cAqBa,aAAW,sBAAA;WAhBV;;;;aAIV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxlint.base.d.ts","names":[],"sources":["../../src/configs/oxlint.base.ts"],"mappings":";;;cAkJa,cAAY,sBAAA;;aA1IrB;aACA;aACA;;;aAIA;aACA;aACA;aACA;aACA;aACA;aACA;;;;;;;eAkCI;;;;;eAMA
|
|
1
|
+
{"version":3,"file":"oxlint.base.d.ts","names":[],"sources":["../../src/configs/oxlint.base.ts"],"mappings":";;;cAkJa,cAAY,sBAAA;;aA1IrB;aACA;aACA;;;aAIA;aACA;aACA;aACA;aACA;aACA;aACA;;;;;;;eAkCI;;;;;eAMA;;;;aAMoC;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;aACM;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"}
|
|
@@ -26,6 +26,7 @@ declare const baseConfig: {
|
|
|
26
26
|
};
|
|
27
27
|
readonly publint: true;
|
|
28
28
|
readonly failOnWarn: true;
|
|
29
|
+
readonly suppressWarnings: ["does not yet have a stable API"];
|
|
29
30
|
};
|
|
30
31
|
type StrictBundleConfig = SetRequired<UserConfig, "platform" | "entry">;
|
|
31
32
|
declare const bundleConfig: {
|
|
@@ -38,6 +39,7 @@ declare const bundleConfig: {
|
|
|
38
39
|
readonly neverBundle: ["bun"];
|
|
39
40
|
};
|
|
40
41
|
readonly failOnWarn: true;
|
|
42
|
+
readonly suppressWarnings: ["does not yet have a stable API"];
|
|
41
43
|
readonly entry: [];
|
|
42
44
|
readonly unbundle: false;
|
|
43
45
|
readonly sourcemap: false;
|
|
@@ -60,6 +62,7 @@ declare const binConfig: {
|
|
|
60
62
|
readonly neverBundle: ["bun"];
|
|
61
63
|
};
|
|
62
64
|
readonly failOnWarn: true;
|
|
65
|
+
readonly suppressWarnings: ["does not yet have a stable API"];
|
|
63
66
|
readonly entry: [];
|
|
64
67
|
readonly unbundle: false;
|
|
65
68
|
readonly sourcemap: false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.base.d.ts","names":[],"sources":["../../src/configs/tsdown.base.ts"],"mappings":";;;;KAOK,eAAe,YAAY;cAE1B
|
|
1
|
+
{"version":3,"file":"tsdown.base.d.ts","names":[],"sources":["../../src/configs/tsdown.base.ts"],"mappings":";;;;KAOK,eAAe,YAAY;cAE1B;;WAEM;;;;WAIF;;;;aAIN;aACA;aACA;;;aAGA;;;aAGA;aACA;;;;;;KAQC,qBAAqB,YAAY;cAGhC;WA5BM;;WAIF;;;;aASN;;;;;;;;;;;aAwBA;eACE;;;;KAMD,kBAAkB,YAAY;cAG7B;;WA3CI;;;;aASN;;;;;;;;;;;aAwBA;eACE;;;WAWM;;aACkB;;;cAKjB,cAAc,cAAc,qBAAqB;cAKjD,oBAAoB,cAAc,2BAA2B;cAK7D,iBAAiB,cAAc,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdown.base.js","names":[],"sources":["../../src/configs/tsdown.base.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\n// Force projects to specify platform\ntype StrictConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n platform: \"neutral\",\n target: false,\n unbundle: true,\n sourcemap: true,\n minify: \"dce-only\",\n fixedExtension: false,\n hash: false,\n dts: {\n newContext: true,\n tsgo: true,\n sourcemap: true,\n },\n deps: {\n neverBundle: [\"bun\"],\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n publint: true,\n failOnWarn: true,\n} as const satisfies StrictConfig\n\n// Force projects to specify platform and entry\ntype StrictBundleConfig = SetRequired<UserConfig, \"platform\" | \"entry\">\n\n// Single-file bundle (not a published library): bundle everything, drop types/lint/sourcemap.\nconst bundleConfig = {\n ...baseConfig,\n entry: [],\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n inputOptions: {\n experimental: {\n attachDebugInfo: \"none\", // remove region comments from bundled output\n },\n },\n} as const satisfies StrictBundleConfig\n\n// Force projects to specify platform and entry\ntype StrictBinConfig = SetRequired<UserConfig, \"entry\">\n\n// A bin is a node bundle with no output file extension.\nconst binConfig = {\n ...bundleConfig,\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }) as const,\n} as const satisfies StrictBinConfig\n\n// The export annotations forbid the no-arg call (platform/entry must be provided) and are load-bearing for\n// declaration emit: without one, tsgo synthesizes the type and fails with TS2883 on tsdown's non-exported internals.\nexport const tsdownConfig: MergeConfigFn<StrictConfig, typeof baseConfig> = createMergeConfigFn<\n StrictConfig,\n typeof baseConfig\n>(baseConfig)\n\nexport const tsdownBundleConfig: MergeConfigFn<StrictBundleConfig, typeof bundleConfig> = createMergeConfigFn<\n StrictBundleConfig,\n typeof bundleConfig\n>(bundleConfig)\n\nexport const tsdownBinConfig: MergeConfigFn<StrictBinConfig, typeof binConfig> = createMergeConfigFn<\n StrictBinConfig,\n typeof binConfig\n>(binConfig)\n"],"mappings":";;AASA,MAAM,aAAa;CACjB,OAAO,CAAC,gBAAgB;CACxB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,WAAW;CACX,QAAQ;CACR,gBAAgB;CAChB,MAAM;CACN,KAAK;EACH,YAAY;EACZ,MAAM;EACN,WAAW;CACb;CACA,MAAM,EACJ,aAAa,CAAC,KAAK,EACrB;CACA,MAAM;EACJ,OAAO;EACP,SAAS;CACX;CACA,SAAS;CACT,YAAY;
|
|
1
|
+
{"version":3,"file":"tsdown.base.js","names":[],"sources":["../../src/configs/tsdown.base.ts"],"sourcesContent":["import type { UserConfig } from \"tsdown\"\nimport type { SetRequired } from \"type-fest\"\n\nimport type { MergeConfigFn } from \"#merge-config/merge-config.ts\"\nimport { createMergeConfigFn } from \"#merge-config/merge-config.ts\"\n\n// Force projects to specify platform\ntype StrictConfig = SetRequired<UserConfig, \"platform\">\n\nconst baseConfig = {\n entry: [\"./src/index.ts\"],\n platform: \"neutral\",\n target: false,\n unbundle: true,\n sourcemap: true,\n minify: \"dce-only\",\n fixedExtension: false,\n hash: false,\n dts: {\n newContext: true,\n tsgo: true,\n sourcemap: true,\n },\n deps: {\n neverBundle: [\"bun\"],\n },\n attw: {\n level: \"error\",\n profile: \"esm-only\",\n },\n publint: true,\n failOnWarn: true,\n suppressWarnings: [\"does not yet have a stable API\"],\n} as const satisfies StrictConfig\n\n// Force projects to specify platform and entry\ntype StrictBundleConfig = SetRequired<UserConfig, \"platform\" | \"entry\">\n\n// Single-file bundle (not a published library): bundle everything, drop types/lint/sourcemap.\nconst bundleConfig = {\n ...baseConfig,\n entry: [],\n unbundle: false,\n sourcemap: false,\n dts: false,\n attw: false,\n publint: false,\n inputOptions: {\n experimental: {\n attachDebugInfo: \"none\", // remove region comments from bundled output\n },\n },\n} as const satisfies StrictBundleConfig\n\n// Force projects to specify platform and entry\ntype StrictBinConfig = SetRequired<UserConfig, \"entry\">\n\n// A bin is a node bundle with no output file extension.\nconst binConfig = {\n ...bundleConfig,\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }) as const,\n} as const satisfies StrictBinConfig\n\n// The export annotations forbid the no-arg call (platform/entry must be provided) and are load-bearing for\n// declaration emit: without one, tsgo synthesizes the type and fails with TS2883 on tsdown's non-exported internals.\nexport const tsdownConfig: MergeConfigFn<StrictConfig, typeof baseConfig> = createMergeConfigFn<\n StrictConfig,\n typeof baseConfig\n>(baseConfig)\n\nexport const tsdownBundleConfig: MergeConfigFn<StrictBundleConfig, typeof bundleConfig> = createMergeConfigFn<\n StrictBundleConfig,\n typeof bundleConfig\n>(bundleConfig)\n\nexport const tsdownBinConfig: MergeConfigFn<StrictBinConfig, typeof binConfig> = createMergeConfigFn<\n StrictBinConfig,\n typeof binConfig\n>(binConfig)\n"],"mappings":";;AASA,MAAM,aAAa;CACjB,OAAO,CAAC,gBAAgB;CACxB,UAAU;CACV,QAAQ;CACR,UAAU;CACV,WAAW;CACX,QAAQ;CACR,gBAAgB;CAChB,MAAM;CACN,KAAK;EACH,YAAY;EACZ,MAAM;EACN,WAAW;CACb;CACA,MAAM,EACJ,aAAa,CAAC,KAAK,EACrB;CACA,MAAM;EACJ,OAAO;EACP,SAAS;CACX;CACA,SAAS;CACT,YAAY;CACZ,kBAAkB,CAAC,gCAAgC;AACrD;AAMA,MAAM,eAAe;CACnB,GAAG;CACH,OAAO,CAAC;CACR,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACT,cAAc,EACZ,cAAc,EACZ,iBAAiB,OACnB,EACF;AACF;AAMA,MAAM,YAAY;CAChB,GAAG;CACH,UAAU;CACV,sBAAsB,EAAE,IAAI,GAAG;AACjC;AAIA,MAAa,eAA+D,oBAG1E,UAAU;AAEZ,MAAa,qBAA6E,oBAGxF,YAAY;AAEd,MAAa,kBAAoE,oBAG/E,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamhl8/configs",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "My shared configs for TS projects",
|
|
5
5
|
"homepage": "https://github.com/adamhl8/configs",
|
|
6
6
|
"bugs": {
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"prepare": "just prepare"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@adamhl8/eslint-plugin-clean-modules": "^0.1.
|
|
49
|
+
"@adamhl8/eslint-plugin-clean-modules": "^0.1.5",
|
|
50
50
|
"@commitlint/config-conventional": "^21.2.0",
|
|
51
51
|
"@commitlint/types": "^21.2.0",
|
|
52
|
-
"arkenv": "^0.12.
|
|
52
|
+
"arkenv": "^0.12.3",
|
|
53
53
|
"arktype": "^2.2.3",
|
|
54
54
|
"es-toolkit": "^1.49.0",
|
|
55
55
|
"smol-toml": "^1.7.0",
|
|
56
|
-
"ts-explicit-errors": "^4.1.
|
|
57
|
-
"ts-extras": "^1.
|
|
56
|
+
"ts-explicit-errors": "^4.1.3",
|
|
57
|
+
"ts-extras": "^1.3.0",
|
|
58
58
|
"type-fest": "^5.8.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
"@arethetypeswrong/core": "^0.18.5",
|
|
63
63
|
"@commitlint/cli": "^21.2.1",
|
|
64
64
|
"@types/bun": "^1.3.14",
|
|
65
|
-
"knip": "^6.
|
|
65
|
+
"knip": "^6.27.0",
|
|
66
66
|
"markdown-toc": "^1.2.0",
|
|
67
|
-
"oxfmt": "^0.
|
|
68
|
-
"oxlint": "^1.
|
|
69
|
-
"oxlint-tsgolint": "^0.
|
|
67
|
+
"oxfmt": "^0.59.0",
|
|
68
|
+
"oxlint": "^1.74.0",
|
|
69
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
70
70
|
"publint": "^0.3.21",
|
|
71
71
|
"release-it": "^20.2.1",
|
|
72
|
-
"tsdown": "^0.22.
|
|
72
|
+
"tsdown": "^0.22.13",
|
|
73
73
|
"typescript": "^7.0.2"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|