@milkio/cookbook-command 1.0.0-alpha.99 → 1.0.0-beta.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 akirarika
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/index.d.ts ADDED
@@ -0,0 +1,75 @@
1
+ import type { consola } from "consola";
2
+ export declare function defineCookbookCommand<Handler extends CookbookCommandHandler>(handler: Handler): Promise<Handler>;
3
+ export type CookbookCommandHandler = (utils: {
4
+ log: (typeof consola)["log"];
5
+ info: (typeof consola)["info"];
6
+ warn: (typeof consola)["warn"];
7
+ error: (typeof consola)["error"];
8
+ success: (typeof consola)["success"];
9
+ debug: (typeof consola)["debug"];
10
+ fatal: (typeof consola)["fatal"];
11
+ trace: (typeof consola)["trace"];
12
+ start: (typeof consola)["start"];
13
+ box: (typeof consola)["box"];
14
+ prompt: (typeof consola)["prompt"];
15
+ getScriptPath: () => string;
16
+ getWorkspacePath: () => string;
17
+ getParams: () => {
18
+ command: string;
19
+ commands: Array<string>;
20
+ options: Record<string, string | true>;
21
+ raw: Array<string>;
22
+ };
23
+ inputBoolean: (options: {
24
+ env: string;
25
+ message: string;
26
+ placeholder?: string;
27
+ }) => Promise<boolean>;
28
+ inputString: (options: {
29
+ env: string;
30
+ message: string;
31
+ placeholder?: string;
32
+ }) => Promise<string>;
33
+ canUseAI: () => Promise<false | {
34
+ aiBaseUrl: string;
35
+ aiApiKey: string;
36
+ aiModel: string;
37
+ }>;
38
+ fetchEventSource: (input: string | URL | globalThis.Request, init?: RequestInit) => AsyncIterableIterator<{
39
+ data: any;
40
+ event?: string;
41
+ id?: string;
42
+ }>;
43
+ openProgress: (message: string) => Promise<void>;
44
+ closeProgress: (message: string) => Promise<void>;
45
+ getCookbookToml: () => Promise<CookbookToml>;
46
+ }) => Promise<void>;
47
+ export interface CookbookToml {
48
+ projects: Record<string, {
49
+ type: "milkio" | "custom";
50
+ port: number;
51
+ start: string;
52
+ build: string;
53
+ meta: Partial<{
54
+ inspect: boolean;
55
+ }>;
56
+ name?: string;
57
+ watch?: boolean;
58
+ lazyRoutes?: boolean;
59
+ typiaMode?: "generation" | "bundler";
60
+ significant?: Array<string>;
61
+ insignificant?: Array<string>;
62
+ autoStart?: boolean;
63
+ autoStartDelay?: number;
64
+ connectTestUrl?: string;
65
+ prismaMigrateMode?: "migrate-dev" | "push";
66
+ }>;
67
+ general: {
68
+ start: string;
69
+ packageManager: string;
70
+ cookbookPort: number;
71
+ };
72
+ config: {
73
+ [key: string]: string | number | boolean;
74
+ };
75
+ }
package/index.js ADDED
@@ -0,0 +1,10 @@
1
+ // packages/cookbook-command/index.ts
2
+ async function defineCookbookCommand(handler) {
3
+ return handler;
4
+ }
5
+ export {
6
+ defineCookbookCommand
7
+ };
8
+
9
+ //# debugId=2AAC545397E17B9764756E2164756E21
10
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cjogc3RyaW5nO1xyXG4gICAgY29va2Jvb2tQb3J0OiBudW1iZXI7XHJcbiAgfTtcclxuICBjb25maWc6IHtcclxuICAgIFtrZXk6IHN0cmluZ106IHN0cmluZyB8IG51bWJlciB8IGJvb2xlYW47XHJcbiAgfTtcclxufVxyXG4iCiAgXSwKICAibWFwcGluZ3MiOiAiO0FBRUEsZUFBc0IscUJBQTZELENBQUMsU0FBb0M7QUFBQSxFQUN0SCxPQUFPO0FBQUE7IiwKICAiZGVidWdJZCI6ICIyQUFDNTQ1Mzk3RTE3Qjk3NjQ3NTZFMjE2NDc1NkUyMSIsCiAgIm5hbWVzIjogW10KfQ==
package/package.json CHANGED
@@ -1,10 +1 @@
1
- {
2
- "name": "@milkio/cookbook-command",
3
- "module": "index.ts",
4
- "type": "module",
5
- "dependencies": {
6
- "consola": "^3.4.0",
7
- "openai": "^4.87.3"
8
- },
9
- "version": "1.0.0-alpha.99"
10
- }
1
+ {"name":"@milkio/cookbook-command","version":"1.0.0-beta.0","type":"module","module":"./index.js","types":"./index.d.ts","dependencies":{}}
package/README.md DELETED
@@ -1,15 +0,0 @@
1
- # @milkio/cookbook-command
2
-
3
- To install dependencies:
4
-
5
- ```bash
6
- bun install
7
- ```
8
-
9
- To run:
10
-
11
- ```bash
12
- bun run index.ts
13
- ```
14
-
15
- This project was created using `bun init` in bun v1.2.4. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
package/index.ts DELETED
@@ -1,61 +0,0 @@
1
- import type { consola } from "consola";
2
- import type OpenAI from "openai";
3
-
4
- export async function defineCookbookCommand<Handler extends CookbookCommandHandler>(handler: Handler): Promise<Handler> {
5
- return handler;
6
- }
7
-
8
- export type CookbookCommandHandler = (utils: {
9
- log: typeof consola['log'],
10
- info: typeof consola['info'],
11
- warn: typeof consola['warn'],
12
- error: typeof consola['error'],
13
- success: typeof consola['success'],
14
- debug: typeof consola['debug'],
15
- fatal: typeof consola['fatal'],
16
- trace: typeof consola['trace'],
17
- start: typeof consola['start'],
18
- box: typeof consola['box'],
19
- prompt: typeof consola['prompt'],
20
- getScriptPath: () => string,
21
- getWorkspacePath: () => string,
22
- getParams: () => {
23
- command: string;
24
- commands: Array<string>;
25
- options: Record<string, string | true>;
26
- raw: Array<string>;
27
- },
28
- inputBoolean: (options: { env: string, message: string, placeholder?: string }) => Promise<boolean>,
29
- inputString: (options: { env: string, message: string, placeholder?: string }) => Promise<string>,
30
- useAI: () => Promise<{ model: string, client: OpenAI }>,
31
- canUseAI: () => Promise<boolean>,
32
- openProgress: (message: string) => Promise<void>,
33
- closeProgress: (message: string) => Promise<void>,
34
- getCookbookToml: () => Promise<CookbookToml>,
35
- }) => Promise<void>;
36
-
37
- export interface CookbookToml {
38
- projects: Record<string, {
39
- type: 'milkio' | 'custom'
40
- port: number
41
- start: Array<string>
42
- build: Array<string>
43
- name?: string
44
- watch?: boolean
45
- lazyRoutes?: boolean
46
- typiaMode?: 'generation' | 'bundler'
47
- significant?: Array<string>
48
- insignificant?: Array<string>
49
- autoStart?: boolean
50
- autoStartDelay?: number
51
- connectTestUrl?: string
52
- }>
53
- general: {
54
- start: string
55
- packageManager: string
56
- cookbookPort: number
57
- },
58
- config: {
59
- [key: string]: string | number | boolean
60
- }
61
- }
package/tsconfig.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // Enable latest features
4
- "lib": ["ESNext", "DOM"],
5
- "target": "ESNext",
6
- "module": "ESNext",
7
- "moduleDetection": "force",
8
- "jsx": "react-jsx",
9
- "allowJs": true,
10
-
11
- // Bundler mode
12
- "moduleResolution": "bundler",
13
- "allowImportingTsExtensions": true,
14
- "verbatimModuleSyntax": true,
15
- "noEmit": true,
16
-
17
- // Best practices
18
- "strict": true,
19
- "skipLibCheck": true,
20
- "noFallthroughCasesInSwitch": true,
21
-
22
- // Some stricter flags (disabled by default)
23
- "noUnusedLocals": false,
24
- "noUnusedParameters": false,
25
- "noPropertyAccessFromIndexSignature": false
26
- }
27
- }