@theholocron/tsdown-config 7.14.3 → 7.15.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 +24 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/presets/cli.d.ts +11 -0
- package/dist/presets/cli.js +21 -0
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -8,9 +8,11 @@ Shared [tsdown](https://tsdown.dev) configurations for `@theholocron` packages.
|
|
|
8
8
|
pnpm add -D @theholocron/tsdown-config tsdown
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Presets
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### `library` — published ESM library
|
|
14
|
+
|
|
15
|
+
Single entry point (`src/index.ts`), generates `.d.ts` type declarations, does not bundle `@theholocron/*` peers.
|
|
14
16
|
|
|
15
17
|
```ts
|
|
16
18
|
// tsdown.config.ts
|
|
@@ -27,3 +29,23 @@ export default library({
|
|
|
27
29
|
entry: ["src/index.ts", "src/capabilities/index.ts"],
|
|
28
30
|
});
|
|
29
31
|
```
|
|
32
|
+
|
|
33
|
+
### `cli` — CLI binary
|
|
34
|
+
|
|
35
|
+
Single entry point (`src/cli.ts`), no type declarations (binaries don't need them), sourcemap enabled, injects `#!/usr/bin/env node` shebang so the output is directly executable.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// tsdown.config.ts
|
|
39
|
+
export { default } from "@theholocron/tsdown-config/presets/cli";
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
To customise the entry point or other options, use the `cli()` factory:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// tsdown.config.ts
|
|
46
|
+
import { cli } from "@theholocron/tsdown-config/presets/cli";
|
|
47
|
+
|
|
48
|
+
export default cli({
|
|
49
|
+
entry: ["src/my-cli.ts"],
|
|
50
|
+
});
|
|
51
|
+
```
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UserConfig } from "tsdown";
|
|
2
|
+
//#region presets/cli.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* tsdown preset for a CLI binary.
|
|
5
|
+
* Builds src/cli.ts → dist/cli.mjs with a Node.js shebang banner.
|
|
6
|
+
* No type declarations — binaries don't need them.
|
|
7
|
+
*/
|
|
8
|
+
declare function cli(options?: UserConfig): UserConfig;
|
|
9
|
+
declare const _default: UserConfig;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { cli, _default as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineConfig } from "tsdown";
|
|
2
|
+
//#region presets/cli.ts
|
|
3
|
+
/**
|
|
4
|
+
* tsdown preset for a CLI binary.
|
|
5
|
+
* Builds src/cli.ts → dist/cli.mjs with a Node.js shebang banner.
|
|
6
|
+
* No type declarations — binaries don't need them.
|
|
7
|
+
*/
|
|
8
|
+
function cli(options = {}) {
|
|
9
|
+
return defineConfig({
|
|
10
|
+
entry: ["src/cli.ts"],
|
|
11
|
+
format: "esm",
|
|
12
|
+
dts: false,
|
|
13
|
+
clean: true,
|
|
14
|
+
sourcemap: true,
|
|
15
|
+
banner: { js: "#!/usr/bin/env node" },
|
|
16
|
+
...options
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
var cli_default = cli();
|
|
20
|
+
//#endregion
|
|
21
|
+
export { cli, cli_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/tsdown-config",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.15.0",
|
|
4
4
|
"description": "Shared tsdown configurations for @theholocron packages.",
|
|
5
5
|
"homepage": "https://github.com/theholocron/configs/tree/main/packages/tsdown-config#readme",
|
|
6
6
|
"bugs": "https://github.com/theholocron/configs/issues",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"typescript": "^5.9.3",
|
|
25
25
|
"vitest": "^4.1.10",
|
|
26
26
|
"@vitest/coverage-v8": "^4.1.10",
|
|
27
|
-
"@theholocron/tsconfig": "7.
|
|
28
|
-
"@theholocron/vitest-config": "7.
|
|
27
|
+
"@theholocron/tsconfig": "7.15.0",
|
|
28
|
+
"@theholocron/vitest-config": "7.15.0"
|
|
29
29
|
},
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
@@ -33,6 +33,11 @@
|
|
|
33
33
|
"import": "./dist/index.js",
|
|
34
34
|
"default": "./dist/index.js"
|
|
35
35
|
},
|
|
36
|
+
"./presets/cli": {
|
|
37
|
+
"types": "./dist/presets/cli.d.ts",
|
|
38
|
+
"import": "./dist/presets/cli.js",
|
|
39
|
+
"default": "./dist/presets/cli.js"
|
|
40
|
+
},
|
|
36
41
|
"./presets/library": {
|
|
37
42
|
"types": "./dist/presets/library.d.ts",
|
|
38
43
|
"import": "./dist/presets/library.js",
|