Skip to content

Commit aa6c02a

Browse files
committed
chore: improve the readme
chore: wip chore: wip
1 parent 6ba94b5 commit aa6c02a

File tree

1 file changed

+69
-28
lines changed

1 file changed

+69
-28
lines changed

README.md

+69-28
Original file line numberDiff line numberDiff line change
@@ -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>
22

33
[![npm version][npm-version-src]][npm-version-href]
44
[![GitHub Actions][github-actions-src]][github-actions-href]
@@ -11,8 +11,7 @@
1111
- Fast .d.ts generation _(via isolatedDeclaration)_
1212
- Highly configurable
1313
- Cross-platform binary
14-
- Dependency-free
15-
- Bun-powered
14+
- Lightweight & dependency-free library
1615

1716
## Install
1817

@@ -25,35 +24,39 @@ [email protected], please allow us to use the `dtsx` package name 🙏_,
2524
<!-- _Alternatively, you can install:_
2625
2726
```bash
28-
brew install dts-generation # wip
29-
pkgx install dts-generation # wip
27+
brew install dtsx # wip
28+
pkgx install dtsx # wip
3029
``` -->
3130

3231
## Get Started
3332

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._
3534

3635
### Library
3736

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.
3938

40-
```js
41-
import { generate } from 'dts-generation'
39+
#### Usage
4240

43-
generate()
44-
```
45-
46-
### CLI
41+
```ts
42+
import { generate } from '@stacksjs/dtsx'
43+
44+
interface Options {
45+
cwd?: string // default: process.cwd()
46+
root?: string // default: './src'
47+
entrypoints?: string[] // default: ['**/*.ts']
48+
outdir?: string // default: './dist'
49+
keepComments?: boolean // default: true
50+
clean?: boolean // default: false
51+
tsconfigPath?: string // default: './tsconfig.json'
52+
}
4753

48-
```bash
49-
dts-generation ...
50-
dts-generation --help
51-
dts-generation --version
54+
await generate(options?: Options)
5255
```
5356

54-
## Configuration
57+
_Available options:_
5558

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+
The library can configured using a `dts.config.ts` _(or `dts.config.js`)_ file and it will be automatically loaded when running the `./dtsx` _(or `bunx dtsx`)_ command.
5760

5861
```ts
5962
// dts.config.ts (or dts.config.js)
@@ -70,10 +73,48 @@ export default {
7073
_Then run:_
7174

7275
```bash
73-
dts-generation generate
76+
./dtsx generate
77+
78+
# or, you may use
79+
# bunx dtsx generate
7480
```
7581

76-
To learn more, head over to the [documentation](https://dts-generation.sh/).
82+
### CLI
83+
84+
The `dtsx` CLI provides a simple way to generate TypeScript declaration files from your project. Here's how to use it:
85+
86+
#### Usage
87+
88+
Generate declaration files using the default options:
89+
90+
```bash
91+
dtsx generate
92+
```
93+
94+
_Or use custom options:_
95+
96+
```bash
97+
# Generate declarations for specific entry points:
98+
dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types
99+
100+
# Generate declarations with custom configuration:
101+
dtsx generate --root ./lib --outdir ./types --clean
102+
103+
dtsx --help
104+
dtsx --version
105+
```
106+
107+
_Available options:_
108+
109+
- `--cwd <path>`: Set the current working directory _(default: current directory)_
110+
- `--root <path>`: Specify the root directory of the project _(default: './src')_
111+
- `--entrypoints <files>`: Define entry point files _(comma-separated, default: '**/*.ts')_
112+
- `--outdir <path>`: Set the output directory for generated .d.ts files _(default: './dist')_
113+
- `--keep-comments`: Keep comments in generated .d.ts files _(default: true)_
114+
- `--clean`: Clean output directory before generation _(default: false)_
115+
- `--tsconfig <path>`: Specify the path to tsconfig.json _(default: 'tsconfig.json')_
116+
117+
To learn more, head over to the [documentation](https://dtsx.stacksjs.org/).
77118

78119
## Testing
79120

@@ -119,15 +160,15 @@ We would like to extend our thanks to the following sponsors for funding Stacks
119160

120161
## License
121162

122-
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
163+
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/dtsx/tree/main/LICENSE.md) for more information.
123164

124165
Made with 💙
125166

126167
<!-- 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
168+
[npm-version-src]: https://img.shields.io/npm/v/@stacksjs/dtsx?style=flat-square
169+
[npm-version-href]: https://npmjs.com/package/@stacksjs/dtsx
170+
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/dtsx/ci.yml?style=flat-square&branch=main
171+
[github-actions-href]: https://github.com/stacksjs/dtsx/actions?query=workflow%3Aci
131172

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 -->
173+
<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/dtsx/main?style=flat-square
174+
[codecov-href]: https://codecov.io/gh/stacksjs/dtsx -->

0 commit comments

Comments
 (0)