@goodie-ts/cli 0.5.1 → 0.6.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/bin/goodie.js +2 -0
- package/dist/bin.js +0 -0
- package/dist/commands/generate.d.ts +22 -0
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +80 -14
- package/dist/commands/generate.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/run-transform.d.ts +16 -1
- package/dist/run-transform.d.ts.map +1 -1
- package/dist/run-transform.js +49 -4
- package/dist/run-transform.js.map +1 -1
- package/package.json +4 -3
package/bin/goodie.js
ADDED
package/dist/bin.js
CHANGED
|
File without changes
|
|
@@ -9,6 +9,28 @@ export declare const generate: import("citty").CommandDef<{
|
|
|
9
9
|
description: string;
|
|
10
10
|
default: string;
|
|
11
11
|
};
|
|
12
|
+
mode: {
|
|
13
|
+
type: "string";
|
|
14
|
+
description: string;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
'package-name': {
|
|
18
|
+
type: "string";
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
'beans-output': {
|
|
22
|
+
type: "string";
|
|
23
|
+
description: string;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
'code-output': {
|
|
27
|
+
type: "string";
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
scan: {
|
|
31
|
+
type: "string";
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
12
34
|
watch: {
|
|
13
35
|
type: "boolean";
|
|
14
36
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiHnB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import { defineCommand } from 'citty';
|
|
3
|
-
import { logOutcome, runTransform } from '../run-transform.js';
|
|
4
|
+
import { logLibraryOutcome, logOutcome, runTransform, runTransformLibrary, } from '../run-transform.js';
|
|
4
5
|
import { watchAndRebuild } from '../watch.js';
|
|
5
6
|
export const generate = defineCommand({
|
|
6
7
|
meta: {
|
|
@@ -17,6 +18,28 @@ export const generate = defineCommand({
|
|
|
17
18
|
description: 'Output file path',
|
|
18
19
|
default: 'src/AppContext.generated.ts',
|
|
19
20
|
},
|
|
21
|
+
mode: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
description: 'Transform mode: "app" (default) or "library"',
|
|
24
|
+
default: 'app',
|
|
25
|
+
},
|
|
26
|
+
'package-name': {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Package name for library mode (auto-detected from package.json if omitted)',
|
|
29
|
+
},
|
|
30
|
+
'beans-output': {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Output path for beans.json in library mode',
|
|
33
|
+
default: 'dist/beans.json',
|
|
34
|
+
},
|
|
35
|
+
'code-output': {
|
|
36
|
+
type: 'string',
|
|
37
|
+
description: 'Also emit generated code (e.g. for integration tests). Only used in library mode.',
|
|
38
|
+
},
|
|
39
|
+
scan: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: 'Comma-separated npm scopes to scan for library beans (e.g. "@goodie-ts,@acme")',
|
|
42
|
+
},
|
|
20
43
|
watch: {
|
|
21
44
|
type: 'boolean',
|
|
22
45
|
description: 'Watch for changes and rebuild',
|
|
@@ -31,24 +54,67 @@ export const generate = defineCommand({
|
|
|
31
54
|
const cwd = process.cwd();
|
|
32
55
|
const tsConfigPath = path.resolve(cwd, args.tsconfig);
|
|
33
56
|
const outputPath = path.resolve(cwd, args.output);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
const scanScopes = args.scan
|
|
58
|
+
? args.scan.split(',').map((s) => s.trim())
|
|
59
|
+
: undefined;
|
|
60
|
+
if (args.mode === 'library') {
|
|
61
|
+
const packageName = args['package-name'] ?? detectPackageName(cwd);
|
|
62
|
+
const beansOutputPath = path.resolve(cwd, args['beans-output']);
|
|
63
|
+
const codeOutputPath = args['code-output']
|
|
64
|
+
? path.resolve(cwd, args['code-output'])
|
|
65
|
+
: undefined;
|
|
66
|
+
const outcome = await runTransformLibrary({
|
|
67
|
+
tsConfigPath,
|
|
68
|
+
packageName,
|
|
69
|
+
beansOutputPath,
|
|
70
|
+
codeOutputPath,
|
|
71
|
+
});
|
|
72
|
+
logLibraryOutcome(outcome);
|
|
73
|
+
if (!outcome.success) {
|
|
74
|
+
process.exitCode = 1;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (args.watch) {
|
|
78
|
+
console.warn('[goodie] --watch is not supported in library mode. Run without --watch.');
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
}
|
|
40
81
|
}
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
? path.resolve(cwd, args['watch-dir'])
|
|
44
|
-
: cwd;
|
|
45
|
-
console.log(`[goodie] Watching ${path.relative(cwd, watchDir) || '.'} for changes...`);
|
|
46
|
-
watchAndRebuild({
|
|
82
|
+
else {
|
|
83
|
+
const outcome = await runTransform({
|
|
47
84
|
tsConfigPath,
|
|
48
85
|
outputPath,
|
|
49
|
-
|
|
86
|
+
scanScopes,
|
|
50
87
|
});
|
|
88
|
+
logOutcome(outcome);
|
|
89
|
+
if (!outcome.success) {
|
|
90
|
+
process.exitCode = 1;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (args.watch) {
|
|
94
|
+
const watchDir = args['watch-dir']
|
|
95
|
+
? path.resolve(cwd, args['watch-dir'])
|
|
96
|
+
: cwd;
|
|
97
|
+
console.log(`[goodie] Watching ${path.relative(cwd, watchDir) || '.'} for changes...`);
|
|
98
|
+
watchAndRebuild({
|
|
99
|
+
tsConfigPath,
|
|
100
|
+
outputPath,
|
|
101
|
+
watchDir,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
51
104
|
}
|
|
52
105
|
},
|
|
53
106
|
});
|
|
107
|
+
function detectPackageName(cwd) {
|
|
108
|
+
const pkgJsonPath = path.join(cwd, 'package.json');
|
|
109
|
+
try {
|
|
110
|
+
const raw = fs.readFileSync(pkgJsonPath, 'utf-8');
|
|
111
|
+
const pkg = JSON.parse(raw);
|
|
112
|
+
if (pkg.name)
|
|
113
|
+
return pkg.name;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Fall through to error
|
|
117
|
+
}
|
|
118
|
+
throw new Error('Could not detect package name. Provide --package-name or ensure package.json exists with a "name" field.');
|
|
119
|
+
}
|
|
54
120
|
//# sourceMappingURL=generate.js.map
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,MAAM,QAAQ,GAAG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,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC;oBAChC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;oBACtC,CAAC,CAAC,GAAG,CAAC;gBACR,OAAO,CAAC,GAAG,CACT,qBAAqB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,GAAG,iBAAiB,CAC1E,CAAC;gBACF,eAAe,CAAC;oBACd,YAAY;oBACZ,UAAU;oBACV,QAAQ;iBACT,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,GAAW;IACpC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAsB,CAAC;QACjD,IAAI,GAAG,CAAC,IAAI;YAAE,OAAO,GAAG,CAAC,IAAI,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,wBAAwB;IAC1B,CAAC;IACD,MAAM,IAAI,KAAK,CACb,0GAA0G,CAC3G,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { RunTransformOptions, TransformFailure, TransformOutcome, TransformSuccess, } from './run-transform.js';
|
|
2
|
-
export { logOutcome, runTransform } from './run-transform.js';
|
|
1
|
+
export type { LibraryTransformOutcome, LibraryTransformSuccess, RunTransformLibraryOptions, RunTransformOptions, TransformFailure, TransformOutcome, TransformSuccess, } from './run-transform.js';
|
|
2
|
+
export { logLibraryOutcome, logOutcome, runTransform, runTransformLibrary, } from './run-transform.js';
|
|
3
3
|
export type { WatchHandle, WatchOptions } from './watch.js';
|
|
4
4
|
export { watchAndRebuild } from './watch.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/run-transform.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type { TransformResult } from '@goodie-ts/transformer';
|
|
1
|
+
import type { TransformLibraryResult, TransformResult } from '@goodie-ts/transformer';
|
|
2
2
|
export interface RunTransformOptions {
|
|
3
3
|
tsConfigPath: string;
|
|
4
4
|
outputPath: string;
|
|
5
|
+
scanScopes?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface RunTransformLibraryOptions {
|
|
8
|
+
tsConfigPath: string;
|
|
9
|
+
packageName: string;
|
|
10
|
+
beansOutputPath: string;
|
|
11
|
+
codeOutputPath?: string;
|
|
5
12
|
}
|
|
6
13
|
export interface TransformSuccess {
|
|
7
14
|
success: true;
|
|
@@ -14,5 +21,13 @@ export interface TransformFailure {
|
|
|
14
21
|
}
|
|
15
22
|
export type TransformOutcome = TransformSuccess | TransformFailure;
|
|
16
23
|
export declare function runTransform(options: RunTransformOptions): Promise<TransformOutcome>;
|
|
24
|
+
export interface LibraryTransformSuccess {
|
|
25
|
+
success: true;
|
|
26
|
+
result: TransformLibraryResult;
|
|
27
|
+
durationMs: number;
|
|
28
|
+
}
|
|
29
|
+
export type LibraryTransformOutcome = LibraryTransformSuccess | TransformFailure;
|
|
30
|
+
export declare function runTransformLibrary(options: RunTransformLibraryOptions): Promise<LibraryTransformOutcome>;
|
|
17
31
|
export declare function logOutcome(outcome: TransformOutcome): void;
|
|
32
|
+
export declare function logLibraryOutcome(outcome: LibraryTransformOutcome): void;
|
|
18
33
|
//# sourceMappingURL=run-transform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-transform.d.ts","sourceRoot":"","sources":["../src/run-transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"run-transform.d.ts","sourceRoot":"","sources":["../src/run-transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAOhC,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEnE,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAmB3B;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,sBAAsB,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,uBAAuB,GAC/B,uBAAuB,GACvB,gBAAgB,CAAC;AAErB,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAoBlC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAa1D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAqBxE"}
|
package/dist/run-transform.js
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { TransformerError, transform } from '@goodie-ts/transformer';
|
|
2
|
+
import { TransformerError, transform, transformLibrary, } from '@goodie-ts/transformer';
|
|
3
3
|
export async function runTransform(options) {
|
|
4
4
|
const start = performance.now();
|
|
5
5
|
try {
|
|
6
6
|
const result = await transform({
|
|
7
7
|
tsConfigFilePath: options.tsConfigPath,
|
|
8
8
|
outputPath: options.outputPath,
|
|
9
|
+
scanScopes: options.scanScopes,
|
|
10
|
+
});
|
|
11
|
+
const durationMs = performance.now() - start;
|
|
12
|
+
return { success: true, result, durationMs };
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (error instanceof TransformerError) {
|
|
16
|
+
return { success: false, error };
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
success: false,
|
|
20
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export async function runTransformLibrary(options) {
|
|
25
|
+
const start = performance.now();
|
|
26
|
+
try {
|
|
27
|
+
const result = await transformLibrary({
|
|
28
|
+
tsConfigFilePath: options.tsConfigPath,
|
|
29
|
+
packageName: options.packageName,
|
|
30
|
+
beansOutputPath: options.beansOutputPath,
|
|
31
|
+
codeOutputPath: options.codeOutputPath,
|
|
9
32
|
});
|
|
10
33
|
const durationMs = performance.now() - start;
|
|
11
34
|
return { success: true, result, durationMs };
|
|
@@ -30,10 +53,32 @@ export function logOutcome(outcome) {
|
|
|
30
53
|
}
|
|
31
54
|
}
|
|
32
55
|
else {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
56
|
+
logError(outcome);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function logLibraryOutcome(outcome) {
|
|
60
|
+
if (outcome.success) {
|
|
61
|
+
const { result, durationMs } = outcome;
|
|
62
|
+
const ms = Math.round(durationMs);
|
|
63
|
+
const cwd = process.cwd();
|
|
64
|
+
const beansPath = path.relative(cwd, result.outputPath);
|
|
65
|
+
const codePath = result.codeOutputPath
|
|
66
|
+
? path.relative(cwd, result.codeOutputPath)
|
|
67
|
+
: undefined;
|
|
68
|
+
const outputs = codePath ? `${beansPath} + ${codePath}` : beansPath;
|
|
69
|
+
console.log(`[goodie] Library build: ${result.beans.length} bean(s) → ${outputs} in ${ms}ms`);
|
|
70
|
+
for (const w of result.warnings) {
|
|
71
|
+
console.warn(`[goodie] Warning: ${w}`);
|
|
36
72
|
}
|
|
37
73
|
}
|
|
74
|
+
else {
|
|
75
|
+
logError(outcome);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function logError(outcome) {
|
|
79
|
+
console.error(`[goodie] Transform failed: ${outcome.error.message}`);
|
|
80
|
+
if (outcome.error instanceof TransformerError && outcome.error.hint) {
|
|
81
|
+
console.error(`[goodie] Hint: ${outcome.error.hint}`);
|
|
82
|
+
}
|
|
38
83
|
}
|
|
39
84
|
//# sourceMappingURL=run-transform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-transform.js","sourceRoot":"","sources":["../src/run-transform.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"run-transform.js","sourceRoot":"","sources":["../src/run-transform.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAK7B,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AA4BhC,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA4B;IAE5B,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAChC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC;YAC7B,gBAAgB,EAAE,OAAO,CAAC,YAAY;YACtC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QAC7C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;YACtC,OAAO,EAAE,OA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AChC,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;SAAM,CAAC;QACN,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,OAAyB;IACzC,OAAO,CAAC,KAAK,CAAC,8BAA8B,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,IAAI,OAAO,CAAC,KAAK,YAAY,gBAAgB,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACpE,OAAO,CAAC,KAAK,CAAC,kBAAkB,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodie-ts/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "CLI for goodie-ts compile-time dependency injection",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"main": "dist/index.js",
|
|
19
19
|
"types": "dist/index.d.ts",
|
|
20
20
|
"bin": {
|
|
21
|
-
"goodie": "
|
|
21
|
+
"goodie": "bin/goodie.js"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"citty": "^0.1.6",
|
|
31
|
-
"@goodie-ts/transformer": "0.
|
|
31
|
+
"@goodie-ts/transformer": "^0.6.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^22.0.0"
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
|
+
"bin",
|
|
37
38
|
"dist"
|
|
38
39
|
],
|
|
39
40
|
"scripts": {
|