pokit 0.0.2 → 0.0.3
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/pok.ts +25 -22
- package/package.json +2 -7
package/bin/pok.ts
CHANGED
|
@@ -3,40 +3,43 @@
|
|
|
3
3
|
* pokit - Global CLI launcher for pok
|
|
4
4
|
*
|
|
5
5
|
* This is a thin wrapper that:
|
|
6
|
-
* 1. Tries to
|
|
7
|
-
* 2.
|
|
8
|
-
* 3.
|
|
6
|
+
* 1. Tries to resolve @pokit/core from the current working directory
|
|
7
|
+
* 2. Falls back to global @pokit/core if not found locally
|
|
8
|
+
* 3. Calls runCli() to handle the actual CLI logic
|
|
9
9
|
*
|
|
10
10
|
* Install globally with: bun add -g pokit
|
|
11
11
|
* Then run `pok` from any project with @pokit/core installed.
|
|
12
|
+
*
|
|
13
|
+
* For use outside a project, also install: bun add -g @pokit/core
|
|
12
14
|
*/
|
|
13
15
|
|
|
16
|
+
import { resolve } from 'bun';
|
|
17
|
+
|
|
14
18
|
async function main() {
|
|
19
|
+
const cwd = process.cwd();
|
|
20
|
+
let corePath: string;
|
|
21
|
+
|
|
15
22
|
try {
|
|
16
|
-
|
|
17
|
-
await
|
|
18
|
-
} catch
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
error.message.includes('could not resolve') ||
|
|
24
|
-
error.message.includes('Module not found'))
|
|
25
|
-
) {
|
|
23
|
+
// Try local first
|
|
24
|
+
corePath = await resolve('@pokit/core', cwd);
|
|
25
|
+
} catch {
|
|
26
|
+
// Fall back to global
|
|
27
|
+
try {
|
|
28
|
+
corePath = await resolve('@pokit/core', import.meta.dir);
|
|
29
|
+
} catch {
|
|
26
30
|
console.error(
|
|
27
|
-
'Error: @pokit/core is not installed
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
' bun add @pokit/core\n'
|
|
31
|
+
'Error: @pokit/core is not installed.\n\n' +
|
|
32
|
+
'Install locally in your project:\n' +
|
|
33
|
+
' bun add @pokit/core\n\n' +
|
|
34
|
+
'Or install globally:\n' +
|
|
35
|
+
' bun add -g @pokit/core\n'
|
|
33
36
|
);
|
|
34
37
|
process.exit(1);
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
// Re-throw other errors
|
|
38
|
-
throw error;
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
const { runCli } = await import(corePath);
|
|
42
|
+
await runCli(process.argv.slice(2));
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
main().catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pokit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Global CLI launcher for pok - install once, run anywhere",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,10 +32,5 @@
|
|
|
32
32
|
"cli",
|
|
33
33
|
"pok",
|
|
34
34
|
"pokit"
|
|
35
|
-
]
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"@pokit/core": "^0.0.2",
|
|
38
|
-
"@pokit/reporter-clack": "^0.0.2",
|
|
39
|
-
"@pokit/prompter-clack": "^0.0.2"
|
|
40
|
-
}
|
|
35
|
+
]
|
|
41
36
|
}
|