@goodie-ts/cli 0.1.1 → 0.3.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/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js.map +1 -1
- package/package.json +9 -9
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 GOOD Code ApS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @goodie-ts/cli
|
|
2
|
+
|
|
3
|
+
CLI for [goodie-ts](https://github.com/GOOD-Code-ApS/goodie) compile-time dependency injection.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @goodie-ts/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Requires Node.js >= 22.13** (for recursive `fs.watch` on Linux).
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Runs the goodie-ts transformer from the command line. Use it as a standalone code generation step, or with `--watch` for continuous rebuilds during development. This is the recommended way to integrate goodie-ts into non-Vite projects.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# One-shot generation (defaults: tsconfig.json -> src/AppContext.generated.ts)
|
|
21
|
+
goodie generate
|
|
22
|
+
|
|
23
|
+
# Custom paths
|
|
24
|
+
goodie generate --tsconfig tsconfig.app.json --output src/generated/Context.ts
|
|
25
|
+
|
|
26
|
+
# Watch mode — rebuild on .ts changes
|
|
27
|
+
goodie generate --watch
|
|
28
|
+
|
|
29
|
+
# Watch a specific directory
|
|
30
|
+
goodie generate --watch --watch-dir src
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
| Flag | Default | Description |
|
|
36
|
+
|------|---------|-------------|
|
|
37
|
+
| `--tsconfig` | `tsconfig.json` | Path to tsconfig.json |
|
|
38
|
+
| `--output` | `src/AppContext.generated.ts` | Output file path |
|
|
39
|
+
| `--watch` | `false` | Watch for changes and rebuild |
|
|
40
|
+
| `--watch-dir` | `.` (cwd) | Directory to watch (recursive) |
|
|
41
|
+
|
|
42
|
+
## Programmatic API
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { runTransform, logOutcome, watchAndRebuild } from '@goodie-ts/cli';
|
|
46
|
+
|
|
47
|
+
// One-shot
|
|
48
|
+
const outcome = runTransform({
|
|
49
|
+
tsConfigPath: './tsconfig.json',
|
|
50
|
+
outputPath: './src/AppContext.generated.ts',
|
|
51
|
+
});
|
|
52
|
+
logOutcome(outcome);
|
|
53
|
+
|
|
54
|
+
// Watch
|
|
55
|
+
const handle = watchAndRebuild({
|
|
56
|
+
tsConfigPath: './tsconfig.json',
|
|
57
|
+
outputPath: './src/AppContext.generated.ts',
|
|
58
|
+
watchDir: './src',
|
|
59
|
+
});
|
|
60
|
+
// handle.close() to stop
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## package.json integration
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"scripts": {
|
|
68
|
+
"generate": "goodie generate",
|
|
69
|
+
"generate:watch": "goodie generate --watch"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
[MIT](https://github.com/GOOD-Code-ApS/goodie/blob/main/LICENSE)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;EAsDnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC;IACpC,IAAI,EAAE;QACJ,WAAW,EAAE,4CAA4C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MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;gBAChC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;gBACtC,CAAC,CAAC,GAAG,CAAC;YACR,OAAO,CAAC,GAAG,CACT,qBAAqB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,GAAG,iBAAiB,CAC1E,CAAC;YACF,eAAe,CAAC;gBACd,YAAY;gBACZ,UAAU;gBACV,QAAQ;aACT,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodie-ts/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "CLI for goodie-ts compile-time dependency injection",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"import": "./dist/index.js"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "tsc",
|
|
31
|
-
"clean": "rm -rf dist *.tsbuildinfo"
|
|
32
|
-
},
|
|
33
29
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
30
|
+
"citty": "^0.1.6",
|
|
31
|
+
"@goodie-ts/transformer": "0.3.0"
|
|
36
32
|
},
|
|
37
33
|
"devDependencies": {
|
|
38
34
|
"@types/node": "^22.0.0"
|
|
39
35
|
},
|
|
40
36
|
"files": [
|
|
41
37
|
"dist"
|
|
42
|
-
]
|
|
43
|
-
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
42
|
+
}
|
|
43
|
+
}
|