@zero.core/cli 1.0.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 +202 -0
- package/NOTICE +7 -0
- package/README.md +240 -0
- package/dist/cli.d.ts +4 -0
- package/dist/commands/apiGenerateCommand.d.ts +4 -0
- package/dist/commands/clientCommand.d.ts +4 -0
- package/dist/commands/diCommand.d.ts +4 -0
- package/dist/commands/doctorCommand.d.ts +19 -0
- package/dist/commands/newCommand.d.ts +4 -0
- package/dist/commands/openApiCommand.d.ts +4 -0
- package/dist/commands/pubSubCommand.d.ts +35 -0
- package/dist/commands/tasksCommand.d.ts +4 -0
- package/dist/context.d.ts +23 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1469 -0
- package/dist/utils/args.d.ts +17 -0
- package/dist/utils/clientGenerator.d.ts +25 -0
- package/dist/utils/fs.d.ts +20 -0
- package/dist/utils/names.d.ts +8 -0
- package/dist/utils/text.d.ts +6 -0
- package/dist/utils/versionCheck.d.ts +17 -0
- package/package.json +50 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ParsedArgs {
|
|
2
|
+
positionals: string[];
|
|
3
|
+
options: Map<string, string | boolean>;
|
|
4
|
+
}
|
|
5
|
+
export declare class ArgParser {
|
|
6
|
+
parse(argv: string[]): ParsedArgs;
|
|
7
|
+
}
|
|
8
|
+
export declare class OptionsReader {
|
|
9
|
+
private readonly args;
|
|
10
|
+
constructor(args: ParsedArgs);
|
|
11
|
+
string(name: string, fallback?: string): string | undefined;
|
|
12
|
+
requiredString(name: string): string;
|
|
13
|
+
boolean(name: string, fallback?: boolean): boolean;
|
|
14
|
+
integer(name: string, fallback?: number): number | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function hasHelp(argv: string[]): boolean;
|
|
17
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare class TypeScriptClientGenerator {
|
|
2
|
+
private readonly document;
|
|
3
|
+
private readonly options;
|
|
4
|
+
constructor(document: OpenApiDocumentLike, options?: TypeScriptClientOptions);
|
|
5
|
+
generate(): string;
|
|
6
|
+
private operations;
|
|
7
|
+
private methodSource;
|
|
8
|
+
}
|
|
9
|
+
export interface TypeScriptClientOptions {
|
|
10
|
+
clientName?: string;
|
|
11
|
+
optionsName?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface OpenApiDocumentLike {
|
|
14
|
+
paths?: Record<string, Record<string, OpenApiClientOperation | undefined>>;
|
|
15
|
+
}
|
|
16
|
+
interface OpenApiClientOperation {
|
|
17
|
+
operationId?: string;
|
|
18
|
+
parameters?: OpenApiParameterLike[];
|
|
19
|
+
requestBody?: unknown;
|
|
20
|
+
}
|
|
21
|
+
interface OpenApiParameterLike {
|
|
22
|
+
in: string;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=clientGenerator.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class WorkspaceFileSystem {
|
|
2
|
+
readonly cwd: string;
|
|
3
|
+
constructor(cwd: string);
|
|
4
|
+
resolve(...parts: string[]): string;
|
|
5
|
+
exists(filePath: string): Promise<boolean>;
|
|
6
|
+
ensureDir(dir: string): Promise<void>;
|
|
7
|
+
readText(filePath: string): Promise<string>;
|
|
8
|
+
readJson<T>(filePath: string): Promise<T>;
|
|
9
|
+
writeText(filePath: string, content: string, options?: WriteTextOptions): Promise<void>;
|
|
10
|
+
listFiles(dir: string, options?: ListFileOptions): Promise<string[]>;
|
|
11
|
+
toFileUrl(filePath: string): string;
|
|
12
|
+
}
|
|
13
|
+
export interface WriteTextOptions {
|
|
14
|
+
force?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ListFileOptions {
|
|
17
|
+
recursive?: boolean;
|
|
18
|
+
pattern?: RegExp;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CliContext } from "../context";
|
|
2
|
+
export declare const CLI_PACKAGE_NAME = "@zero.core/cli";
|
|
3
|
+
export declare const CLI_VERSION = "1.0.0";
|
|
4
|
+
export interface VersionChecker {
|
|
5
|
+
latestVersion: (packageName: string, options: VersionCheckRequestOptions) => Promise<string | undefined>;
|
|
6
|
+
}
|
|
7
|
+
export interface VersionCheckRequestOptions {
|
|
8
|
+
registryUrl: string;
|
|
9
|
+
timeoutMs: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class NpmRegistryVersionChecker implements VersionChecker {
|
|
12
|
+
latestVersion(packageName: string, options: VersionCheckRequestOptions): Promise<string | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare function maybeNotifyCliUpdate(options: Map<string, string | boolean>, context: CliContext): Promise<void>;
|
|
15
|
+
export declare function shouldCheckForUpdates(options: Map<string, string | boolean>, env: NodeJS.ProcessEnv): boolean;
|
|
16
|
+
export declare function compareVersions(left: string, right: string): number;
|
|
17
|
+
//# sourceMappingURL=versionCheck.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zero.core/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "General command-line tooling for the ZeroCore ecosystem.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"packageManager": "yarn@1.22.22",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"zerocore": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/**/*.js",
|
|
24
|
+
"dist/**/*.d.ts",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"NOTICE"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "yarn clean && yarn build:js && yarn build:types && chmod +x dist/index.js",
|
|
34
|
+
"build:js": "esbuild src/index.ts --bundle --platform=node --format=esm --packages=external --sourcemap --outfile=dist/index.js",
|
|
35
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
36
|
+
"clean": "rm -rf dist",
|
|
37
|
+
"dev": "tsx src/index.ts",
|
|
38
|
+
"test": "tsx --test --tsconfig tsconfig.json test/**/*.test.ts",
|
|
39
|
+
"test:production": "yarn typecheck && yarn test && yarn build",
|
|
40
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"tsx": "^4.19.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "^22.10.0",
|
|
47
|
+
"esbuild": "^0.27.0",
|
|
48
|
+
"typescript": "^5.7.0"
|
|
49
|
+
}
|
|
50
|
+
}
|