@adamhl8/configs 1.2.1 → 1.4.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.
@@ -4,7 +4,6 @@ import bun from "bun";
4
4
  import { isPlainObject, merge } from "es-toolkit";
5
5
  import { stringify } from "smol-toml";
6
6
  import { objectHasOwn } from "ts-extras";
7
- //#region src/adamhl8-bunfig/index.ts
8
7
  const BUNFIG_BASE_PATH = path.resolve(import.meta.dir, "../configs/bunfig.base.toml");
9
8
  const BUNFIG_PROJECT_PATH = path.resolve("./bunfig.toml");
10
9
  const baseBunfigImport = await import(BUNFIG_BASE_PATH, { with: { type: "toml" } });
@@ -12,5 +11,4 @@ const projectBunfigImport = await bun.file(BUNFIG_PROJECT_PATH).exists() ? await
12
11
  const isTomlImport = (tomlImport) => typeof tomlImport === "object" && objectHasOwn(tomlImport, "default") && isPlainObject(tomlImport.default);
13
12
  const mergedConfigToml = stringify(merge(isTomlImport(baseBunfigImport) ? baseBunfigImport.default : {}, isTomlImport(projectBunfigImport) ? projectBunfigImport.default : {}));
14
13
  await bun.write(BUNFIG_PROJECT_PATH, mergedConfigToml);
15
- //#endregion
16
14
  export {};
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  import path from "node:path";
3
3
  import { spawnSync } from "bun";
4
- //#region src/adamhl8-cliff/index.ts
5
4
  const result = spawnSync([
6
5
  "git-cliff",
7
6
  "--config",
@@ -13,5 +12,4 @@ const result = spawnSync([
13
12
  "inherit"
14
13
  ] });
15
14
  process.exitCode = result.exitCode;
16
- //#endregion
17
15
  export {};
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env bun
2
2
  import path from "node:path";
3
3
  import bun from "bun";
4
- //#region src/adamhl8-gitignore/index.ts
5
4
  const GITIGNORE_BASE_PATH = path.resolve(import.meta.dir, "../configs/gitignore.base");
6
5
  const END_MARKER = "# The above patterns are managed by @adamhl8/configs. Anything manually added above this line will be replaced.";
7
6
  /** Rebuilds the managed region above the marker, keeping what's below it (the whole file when there's no marker). */
@@ -16,5 +15,4 @@ const currentContentFile = bun.file(gitignorePath);
16
15
  const currentContent = await currentContentFile.exists() ? await currentContentFile.text() : "";
17
16
  const merged = mergeGitignore(currentContent, blockBody);
18
17
  if (merged !== currentContent) await bun.write(gitignorePath, merged);
19
- //#endregion
20
18
  export {};
@@ -8,6 +8,9 @@ export PATH := justfile_directory() + "/node_modules/.bin:" + env("PATH")
8
8
  # runs cmd if the condition command succeeds, echoing cmd only when it runs
9
9
  run-when(cmd, condition) := f"if {{condition}}; then echo {{style("command", cmd)}}; {{cmd}}; fi"
10
10
 
11
+ # run if not in CI, the repo has a root module, and the aws profile exists on this machine
12
+ tofu-run-condition := '[ -z "${CI:-}" ] && ls *.tofu >/dev/null 2>&1 && aws configure list-profiles 2>/dev/null | grep -qx adamhl8'
13
+
11
14
  # public recipes are thin wrappers over private _recipes so an override can still call the original
12
15
  # e.g. `prepare: _prepare` + extra lines
13
16
 
@@ -17,6 +20,7 @@ _prepare:
17
20
  adamhl8-gitignore
18
21
  adamhl8-bunfig
19
22
  oxfmt bunfig.toml
23
+ @{{ run-when("tofu init -upgrade", tofu-run-condition) }}
20
24
 
21
25
  bump-deps: _bump-deps
22
26
  _bump-deps:
@@ -27,8 +31,7 @@ _bump-deps:
27
31
 
28
32
  tofu-check: _tofu-check
29
33
  _tofu-check:
30
- @# run if not in CI, the repo has a root module, and the aws profile exists on this machine
31
- @{{ run-when("tofu plan -detailed-exitcode -concise -compact-warnings", '[ -z "${CI:-}" ] && ls *.tofu >/dev/null 2>&1 && aws configure list-profiles 2>/dev/null | grep -qx adamhl8') }}
34
+ @{{ run-when("tofu plan -detailed-exitcode -concise -compact-warnings", tofu-run-condition) }}
32
35
 
33
36
  lint: _lint
34
37
  _lint:
@@ -27,7 +27,30 @@ declare const baseConfig: {
27
27
  readonly publint: true;
28
28
  readonly failOnWarn: true;
29
29
  };
30
+ declare const bundleConfig: {
31
+ readonly entry: ["./src/index.ts"];
32
+ readonly platform: "neutral";
33
+ readonly target: false;
34
+ readonly minify: "dce-only";
35
+ readonly fixedExtension: false;
36
+ readonly hash: false;
37
+ readonly deps: {
38
+ readonly neverBundle: ["bun"];
39
+ };
40
+ readonly failOnWarn: true;
41
+ readonly unbundle: false;
42
+ readonly sourcemap: false;
43
+ readonly dts: false;
44
+ readonly attw: false;
45
+ readonly publint: false;
46
+ readonly inputOptions: {
47
+ readonly experimental: {
48
+ readonly attachDebugInfo: "none";
49
+ };
50
+ };
51
+ };
30
52
  declare const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig>;
53
+ declare const tsdownBundleConfig: MergeConfigFn<StrictUserConfig, typeof bundleConfig>;
31
54
  declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, {
32
55
  readonly target: false;
33
56
  readonly minify: "dce-only";
@@ -36,18 +59,23 @@ declare const tsdownBinConfig: OptionalMergeConfigFn<UserConfig, {
36
59
  readonly deps: {
37
60
  readonly neverBundle: ["bun"];
38
61
  };
39
- readonly publint: true;
40
62
  readonly failOnWarn: true;
41
- readonly entry: [];
42
- readonly platform: "node";
43
63
  readonly unbundle: false;
44
64
  readonly sourcemap: false;
65
+ readonly dts: false;
66
+ readonly attw: false;
67
+ readonly publint: false;
68
+ readonly inputOptions: {
69
+ readonly experimental: {
70
+ readonly attachDebugInfo: "none";
71
+ };
72
+ };
73
+ readonly entry: [];
74
+ readonly platform: "node";
45
75
  readonly outExtensions: () => {
46
76
  readonly js: "";
47
77
  };
48
- readonly dts: false;
49
- readonly attw: false;
50
78
  }>;
51
79
  //#endregion
52
- export { tsdownBinConfig, tsdownConfig };
80
+ export { tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
53
81
  //# sourceMappingURL=tsdown.base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsdown.base.d.ts","names":[],"sources":["../../src/configs/tsdown.base.ts"],"mappings":";;;;KAOK,mBAAmB,YAAY;cAE9B;;;;;;;;;;aAUF;aACA;aACA;;;aAGA;;;aAGA;aACA;;;;;cAkBS,cAAc,cAAc,yBAAyB;cAIrD,iBAAe,sBAAA;;;;;;aA1BxB"}
1
+ {"version":3,"file":"tsdown.base.d.ts","names":[],"sources":["../../src/configs/tsdown.base.ts"],"mappings":";;;;KAOK,mBAAmB,YAAY;cAE9B;;;;;;;;;;aAUF;aACA;aACA;;;aAGA;;;aAGA;aACA;;;;;cAOE;;;;;;;;aAXF;;;;;;;;;aAmBA;eACE;;;;cAcO,cAAc,cAAc,yBAAyB;cAKrD,oBAAoB,cAAc,yBAAyB;cAK3D,iBAAe,sBAAA;;;;;;aA5CxB;;;;;;;;;aAmBA;eACE"}
@@ -22,19 +22,25 @@ const baseConfig = {
22
22
  publint: true,
23
23
  failOnWarn: true
24
24
  };
25
- const binConfig = {
25
+ const bundleConfig = {
26
26
  ...baseConfig,
27
- entry: [],
28
- platform: "node",
29
27
  unbundle: false,
30
28
  sourcemap: false,
31
- outExtensions: () => ({ js: "" }),
32
29
  dts: false,
33
- attw: false
30
+ attw: false,
31
+ publint: false,
32
+ inputOptions: { experimental: { attachDebugInfo: "none" } }
33
+ };
34
+ const binConfig = {
35
+ ...bundleConfig,
36
+ entry: [],
37
+ platform: "node",
38
+ outExtensions: () => ({ js: "" })
34
39
  };
35
40
  const tsdownConfig = createMergeConfigFn(baseConfig);
41
+ const tsdownBundleConfig = createMergeConfigFn(bundleConfig);
36
42
  const tsdownBinConfig = createMergeConfigFn(binConfig);
37
43
  //#endregion
38
- export { tsdownBinConfig, tsdownConfig };
44
+ export { tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
39
45
 
40
46
  //# sourceMappingURL=tsdown.base.js.map
@@ -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 \"#utils.ts\"\nimport { createMergeConfigFn } from \"#utils.ts\"\n\n// Force projects to specify platform\ntype StrictUserConfig = 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 StrictUserConfig\n\nconst binConfig = {\n ...baseConfig,\n entry: [],\n platform: \"node\",\n unbundle: false,\n sourcemap: false,\n outExtensions: () => ({ js: \"\" }) as const,\n dts: false,\n attw: false,\n} as const satisfies UserConfig\n\n// Annotated as the non-optional MergeConfigFn so projects must pass a config (platform is required)\nexport const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig> = createMergeConfigFn<\n StrictUserConfig,\n typeof baseConfig\n>(baseConfig)\nexport const tsdownBinConfig = createMergeConfigFn<UserConfig, typeof binConfig>(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;AACd;AAEA,MAAM,YAAY;CAChB,GAAG;CACH,OAAO,CAAC;CACR,UAAU;CACV,UAAU;CACV,WAAW;CACX,sBAAsB,EAAE,IAAI,GAAG;CAC/B,KAAK;CACL,MAAM;AACR;AAGA,MAAa,eAAmE,oBAG9E,UAAU;AACZ,MAAa,kBAAkB,oBAAkD,SAAS"}
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 \"#utils.ts\"\nimport { createMergeConfigFn } from \"#utils.ts\"\n\n// Force projects to specify platform\ntype StrictUserConfig = 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 StrictUserConfig\n\n// Single-file bundle (not a published library): bundle everything, drop types/lint/sourcemap.\nconst bundleConfig = {\n ...baseConfig,\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 StrictUserConfig\n\n// A bin is a node bundle with no output file extension.\nconst binConfig = {\n ...bundleConfig,\n entry: [],\n platform: \"node\",\n outExtensions: () => ({ js: \"\" }) as const,\n} as const satisfies UserConfig\n\n// Annotated as the non-optional MergeConfigFn so projects must pass a config (platform is required)\nexport const tsdownConfig: MergeConfigFn<StrictUserConfig, typeof baseConfig> = createMergeConfigFn<\n StrictUserConfig,\n typeof baseConfig\n>(baseConfig)\n\nexport const tsdownBundleConfig: MergeConfigFn<StrictUserConfig, typeof bundleConfig> = createMergeConfigFn<\n StrictUserConfig,\n typeof bundleConfig\n>(bundleConfig)\n\nexport const tsdownBinConfig = createMergeConfigFn<UserConfig, typeof binConfig>(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;AACd;AAGA,MAAM,eAAe;CACnB,GAAG;CACH,UAAU;CACV,WAAW;CACX,KAAK;CACL,MAAM;CACN,SAAS;CACT,cAAc,EACZ,cAAc,EACZ,iBAAiB,OACnB,EACF;AACF;AAGA,MAAM,YAAY;CAChB,GAAG;CACH,OAAO,CAAC;CACR,UAAU;CACV,sBAAsB,EAAE,IAAI,GAAG;AACjC;AAGA,MAAa,eAAmE,oBAG9E,UAAU;AAEZ,MAAa,qBAA2E,oBAGtF,YAAY;AAEd,MAAa,kBAAkB,oBAAkD,SAAS"}
package/dist/index.d.ts CHANGED
@@ -3,5 +3,5 @@ import { knipConfig } from "./configs/knip.base.js";
3
3
  import { oxfmtConfig } from "./configs/oxfmt.base.js";
4
4
  import { oxlintConfig } from "./configs/oxlint.base.js";
5
5
  import { releaseItConfig } from "./configs/release-it.base.js";
6
- import { tsdownBinConfig, tsdownConfig } from "./configs/tsdown.base.js";
7
- export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownConfig };
6
+ import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./configs/tsdown.base.js";
7
+ export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
package/dist/index.js CHANGED
@@ -3,5 +3,5 @@ import { knipConfig } from "./configs/knip.base.js";
3
3
  import { oxfmtConfig } from "./configs/oxfmt.base.js";
4
4
  import { oxlintConfig } from "./configs/oxlint.base.js";
5
5
  import { releaseItConfig } from "./configs/release-it.base.js";
6
- import { tsdownBinConfig, tsdownConfig } from "./configs/tsdown.base.js";
7
- export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownConfig };
6
+ import { tsdownBinConfig, tsdownBundleConfig, tsdownConfig } from "./configs/tsdown.base.js";
7
+ export { commitlintConfig, knipConfig, oxfmtConfig, oxlintConfig, releaseItConfig, tsdownBinConfig, tsdownBundleConfig, tsdownConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamhl8/configs",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "My shared configs for TS projects",
5
5
  "homepage": "https://github.com/adamhl8/configs",
6
6
  "bugs": {