-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
69 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<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> | ||
<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> | ||
|
||
[![npm version][npm-version-src]][npm-version-href] | ||
[![GitHub Actions][github-actions-src]][github-actions-href] | ||
|
@@ -11,8 +11,7 @@ | |
- Fast .d.ts generation _(via isolatedDeclaration)_ | ||
- Highly configurable | ||
- Cross-platform binary | ||
- Dependency-free | ||
- Bun-powered | ||
- Lightweight & dependency-free library | ||
|
||
## Install | ||
|
||
|
@@ -25,35 +24,39 @@ [email protected], please allow us to use the `dtsx` package name 🙏_, | |
<!-- _Alternatively, you can install:_ | ||
```bash | ||
brew install dts-generation # wip | ||
pkgx install dts-generation # wip | ||
brew install dtsx # wip | ||
pkgx install dtsx # wip | ||
``` --> | ||
|
||
## Get Started | ||
|
||
There are two ways of using this dts generation tool: _as a library or as a CLI._ | ||
There are two ways of using this ".d.ts generation" tool: _as a library or as a CLI._ | ||
|
||
### Library | ||
|
||
Given the npm package is installed: | ||
Given the npm package is installed, you can use the `generate` function to generate TypeScript declaration files from your project. | ||
|
||
```js | ||
import { generate } from 'dts-generation' | ||
#### Usage | ||
|
||
generate() | ||
``` | ||
|
||
### CLI | ||
```ts | ||
import { generate } from '@stacksjs/dtsx' | ||
|
||
interface Options { | ||
cwd?: string // default: process.cwd() | ||
root?: string // default: './src' | ||
entrypoints?: string[] // default: ['**/*.ts'] | ||
outdir?: string // default: './dist' | ||
keepComments?: boolean // default: true | ||
clean?: boolean // default: false | ||
tsconfigPath?: string // default: './tsconfig.json' | ||
} | ||
|
||
```bash | ||
dts-generation ... | ||
dts-generation --help | ||
dts-generation --version | ||
await generate(options?: Options) | ||
``` | ||
|
||
## Configuration | ||
_Available options:_ | ||
|
||
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. | ||
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. | ||
|
||
```ts | ||
// dts.config.ts (or dts.config.js) | ||
|
@@ -70,10 +73,48 @@ export default { | |
_Then run:_ | ||
|
||
```bash | ||
dts-generation generate | ||
./dtsx generate | ||
|
||
# or, you may use | ||
# bunx dtsx generate | ||
``` | ||
|
||
To learn more, head over to the [documentation](https://dts-generation.sh/). | ||
### CLI | ||
|
||
The `dtsx` CLI provides a simple way to generate TypeScript declaration files from your project. Here's how to use it: | ||
|
||
#### Usage | ||
|
||
Generate declaration files using the default options: | ||
|
||
```bash | ||
dtsx generate | ||
``` | ||
|
||
_Or use custom options:_ | ||
|
||
```bash | ||
# Generate declarations for specific entry points: | ||
dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types | ||
|
||
# Generate declarations with custom configuration: | ||
dtsx generate --root ./lib --outdir ./types --clean | ||
|
||
dtsx --help | ||
dtsx --version | ||
``` | ||
|
||
_Available options:_ | ||
|
||
- `--cwd <path>`: Set the current working directory _(default: current directory)_ | ||
- `--root <path>`: Specify the root directory of the project _(default: './src')_ | ||
- `--entrypoints <files>`: Define entry point files _(comma-separated, default: '**/*.ts')_ | ||
- `--outdir <path>`: Set the output directory for generated .d.ts files _(default: './dist')_ | ||
- `--keep-comments`: Keep comments in generated .d.ts files _(default: true)_ | ||
- `--clean`: Clean output directory before generation _(default: false)_ | ||
- `--tsconfig <path>`: Specify the path to tsconfig.json _(default: 'tsconfig.json')_ | ||
|
||
To learn more, head over to the [documentation](https://dtsx.stacksjs.org/). | ||
|
||
## Testing | ||
|
||
|
@@ -119,15 +160,15 @@ We would like to extend our thanks to the following sponsors for funding Stacks | |
|
||
## License | ||
|
||
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information. | ||
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/dtsx/tree/main/LICENSE.md) for more information. | ||
|
||
Made with 💙 | ||
|
||
<!-- Badges --> | ||
[npm-version-src]: https://img.shields.io/npm/v/@stacksjs/reverse-proxy?style=flat-square | ||
[npm-version-href]: https://npmjs.com/package/@stacksjs/reverse-proxy | ||
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/reverse-proxy/ci.yml?style=flat-square&branch=main | ||
[github-actions-href]: https://github.com/stacksjs/reverse-proxy/actions?query=workflow%3Aci | ||
[npm-version-src]: https://img.shields.io/npm/v/@stacksjs/dtsx?style=flat-square | ||
[npm-version-href]: https://npmjs.com/package/@stacksjs/dtsx | ||
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/dtsx/ci.yml?style=flat-square&branch=main | ||
[github-actions-href]: https://github.com/stacksjs/dtsx/actions?query=workflow%3Aci | ||
|
||
<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/reverse-proxy/main?style=flat-square | ||
[codecov-href]: https://codecov.io/gh/stacksjs/reverse-proxy --> | ||
<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/dtsx/main?style=flat-square | ||
[codecov-href]: https://codecov.io/gh/stacksjs/dtsx --> |