From 786fa0b16067c06bfaac9de43059a4caab730f63 Mon Sep 17 00:00:00 2001 From: Werner Robitza Date: Tue, 27 Aug 2024 10:16:49 +0200 Subject: [PATCH] Added examples to README, see #258 --- README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 23de2ac..6c4ad8c 100644 --- a/README.md +++ b/README.md @@ -116,20 +116,34 @@ Options: --version Show version number [boolean] ``` -Examples: +### Examples + +To generate a dts bundle for a single entry file: ```bash ./node_modules/.bin/dts-bundle-generator -o my.d.ts path/to/your/entry-file.ts ``` +To generate a dts bundle for multiple entry files: + ```bash ./node_modules/.bin/dts-bundle-generator path/to/your/entry-file.ts path/to/your/entry-file-2.ts ``` +To generate a dts bundle for a single entry file with external inlines and imports: + ```bash -./node_modules/.bin/dts-bundle-generator --external-inlines=@mycompany/internal-project --external-imports=@angular/core rxjs path/to/your/entry-file.ts +./node_modules/.bin/dts-bundle-generator \ + --external-inlines=@mycompany/internal-project \ + --external-imports=@angular/core rxjs \ + -- path/to/your/entry-file.ts ``` +> [!NOTE] +> Note that, as in the above example, the arguments accepting arrays (like `--external-inlines` or `--external-imports`) accept multiple values separated by spaces. Since the input file(s) are positional arguments, you need to put the `--` separator before it when it is preceded by an argument that accepts multiple values. Otherwise you will get an error (`Error: No input files specified`). + +To generate a dts bundle for a single entry file with external types: + ```bash ./node_modules/.bin/dts-bundle-generator --external-types=jquery path/to/your/entry-file.ts ```