@stacksjs/dtsx 0.2.0 → 0.2.1

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.
Files changed (4) hide show
  1. package/README.md +73 -31
  2. package/dist/cli.js +731 -85513
  3. package/dist/index.js +576 -65057
  4. package/package.json +4 -5
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <p align="center"><img src="https://github.com/stacksjs/dts-generation/blob/main/.github/art/cover.png?raw=true" alt="Social Card of this repo"></p>
1
+ <p align="center"><img src="https://github.com/stacksjs/dtsx/blob/main/.github/art/cover.png?raw=true" alt="Social Card of this repo"></p>
2
2
 
3
3
  [![npm version][npm-version-src]][npm-version-href]
4
4
  [![GitHub Actions][github-actions-src]][github-actions-href]
@@ -10,9 +10,8 @@
10
10
 
11
11
  - Fast .d.ts generation _(via isolatedDeclaration)_
12
12
  - Highly configurable
13
+ - Lightweight library
13
14
  - Cross-platform binary
14
- - Dependency-free
15
- - Bun-powered
16
15
 
17
16
  ## Install
18
17
 
@@ -20,43 +19,48 @@
20
19
  bun install -d @stacksjs/dtsx
21
20
  ```
22
21
 
23
- _@npm.js, please allow us to use the `dtsx` package name 🙏_,
22
+ _@npmjs.com, please allow us to use the `dtsx` package name 🙏_
24
23
 
25
24
  <!-- _Alternatively, you can install:_
26
25
 
27
26
  ```bash
28
- brew install dts-generation # wip
29
- pkgx install dts-generation # wip
27
+ brew install dtsx # wip
28
+ pkgx install dtsx # wip
30
29
  ``` -->
31
30
 
32
31
  ## Get Started
33
32
 
34
- There are two ways of using this dts generation tool: _as a library or as a CLI._
33
+ There are two ways of using this ".d.ts generation" tool: _as a library or as a CLI._
35
34
 
36
- ### Library
35
+ ## Library
37
36
 
38
- Given the npm package is installed:
37
+ Given the npm package is installed, you can use the `generate` function to generate TypeScript declaration files from your project.
39
38
 
40
- ```js
41
- import { generate } from 'dts-generation'
39
+ ### Usage
42
40
 
43
- generate()
44
- ```
45
-
46
- ### CLI
41
+ ```ts
42
+ import type { DtsGenerationOptions } from '@stacksjs/dtsx'
43
+ import { generate } from '@stacksjs/dtsx'
44
+
45
+ const options: DtsGenerationOptions = {
46
+ cwd: './', // default: process.cwd()
47
+ root: './src', // default: './src'
48
+ entrypoints: ['**/*.ts'], // default: ['**/*.ts']
49
+ outdir: './dist', // default: './dist'
50
+ keepComments: true, // default: true
51
+ clean: true, // default: false
52
+ }
47
53
 
48
- ```bash
49
- dts-generation ...
50
- dts-generation --help
51
- dts-generation --version
54
+ await generate(options)
52
55
  ```
53
56
 
54
- ## Configuration
57
+ _Available options:_
55
58
 
56
- The Reverse Proxy can be configured using a `dts.config.ts` _(or `dts.config.js`)_ file and it will be automatically loaded when running the `dts-generation` command.
59
+ Library usage can also be configured using a `dts.config.ts` _(or `dts.config.js`)_ file which is automatically loaded when running the `./dtsx` _(or `bunx dtsx`)_ command. It is also loaded when the `generate` function is called, unless custom options are provided.
57
60
 
58
61
  ```ts
59
62
  // dts.config.ts (or dts.config.js)
63
+
60
64
  export default {
61
65
  cwd: './',
62
66
  root: './src',
@@ -67,13 +71,51 @@ export default {
67
71
  }
68
72
  ```
69
73
 
70
- _Then run:_
74
+ _You may also run:_
75
+
76
+ ```bash
77
+ ./dtsx generate
78
+
79
+ # if the package is installed, you can also run:
80
+ # bunx dtsx generate
81
+ ```
82
+
83
+ ## CLI
84
+
85
+ The `dtsx` CLI provides a simple way to generate TypeScript declaration files from your project. Here's how to use it:
86
+
87
+ ### Usage
88
+
89
+ Generate declaration files using the default options:
71
90
 
72
91
  ```bash
73
- dts-generation generate
92
+ dtsx generate
74
93
  ```
75
94
 
76
- To learn more, head over to the [documentation](https://dts-generation.sh/).
95
+ _Or use custom options:_
96
+
97
+ ```bash
98
+ # Generate declarations for specific entry points:
99
+ dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types
100
+
101
+ # Generate declarations with custom configuration:
102
+ dtsx generate --root ./lib --outdir ./types --clean
103
+
104
+ dtsx --help
105
+ dtsx --version
106
+ ```
107
+
108
+ _Available options:_
109
+
110
+ - `--cwd <path>`: Set the current working directory _(default: current directory)_
111
+ - `--root <path>`: Specify the root directory of the project _(default: './src')_
112
+ - `--entrypoints <files>`: Define entry point files _(comma-separated, default: '**/*.ts')_
113
+ - `--outdir <path>`: Set the output directory for generated .d.ts files _(default: './dist')_
114
+ - `--keep-comments`: Keep comments in generated .d.ts files _(default: true)_
115
+ - `--clean`: Clean output directory before generation _(default: false)_
116
+ - `--tsconfig <path>`: Specify the path to tsconfig.json _(default: 'tsconfig.json')_
117
+
118
+ To learn more, head over to the [documentation](https://dtsx.stacksjs.org/).
77
119
 
78
120
  ## Testing
79
121
 
@@ -119,15 +161,15 @@ We would like to extend our thanks to the following sponsors for funding Stacks
119
161
 
120
162
  ## License
121
163
 
122
- The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
164
+ The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/dtsx/tree/main/LICENSE.md) for more information.
123
165
 
124
166
  Made with 💙
125
167
 
126
168
  <!-- Badges -->
127
- [npm-version-src]: https://img.shields.io/npm/v/@stacksjs/reverse-proxy?style=flat-square
128
- [npm-version-href]: https://npmjs.com/package/@stacksjs/reverse-proxy
129
- [github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/reverse-proxy/ci.yml?style=flat-square&branch=main
130
- [github-actions-href]: https://github.com/stacksjs/reverse-proxy/actions?query=workflow%3Aci
169
+ [npm-version-src]: https://img.shields.io/npm/v/@stacksjs/dtsx?style=flat-square
170
+ [npm-version-href]: https://npmjs.com/package/@stacksjs/dtsx
171
+ [github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/dtsx/ci.yml?style=flat-square&branch=main
172
+ [github-actions-href]: https://github.com/stacksjs/dtsx/actions?query=workflow%3Aci
131
173
 
132
- <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/reverse-proxy/main?style=flat-square
133
- [codecov-href]: https://codecov.io/gh/stacksjs/reverse-proxy -->
174
+ <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/dtsx/main?style=flat-square
175
+ [codecov-href]: https://codecov.io/gh/stacksjs/dtsx -->