@kuckit/cli 0.1.0 → 0.2.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.
@@ -2,7 +2,6 @@ import { access, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { execSync } from "node:child_process";
4
4
  import { accessSync, constants, existsSync } from "node:fs";
5
- import { tryLoadKuckitConfig } from "@kuckit/sdk";
6
5
 
7
6
  //#region src/commands/generate-module.ts
8
7
  function toKebabCase(str) {
@@ -67,8 +66,8 @@ async function generateModule(name, options) {
67
66
  },
68
67
  scripts: { build: "tsdown" },
69
68
  peerDependencies: {
70
- "@kuckit/sdk": "workspace:*",
71
- "@kuckit/sdk-react": "workspace:*",
69
+ "@kuckit/sdk": "^0.1.0",
70
+ "@kuckit/sdk-react": "^0.1.0",
72
71
  "drizzle-orm": "^0.38",
73
72
  typescript: "^5"
74
73
  },
@@ -394,6 +393,23 @@ Run 'bun run dev' to start the server with the new module.
394
393
  `);
395
394
  }
396
395
 
396
+ //#endregion
397
+ //#region src/lib/sdk-loader.ts
398
+ async function loadTryLoadKuckitConfig() {
399
+ try {
400
+ const sdk = await import("@kuckit/sdk");
401
+ if (!sdk.tryLoadKuckitConfig) throw new Error("Invalid @kuckit/sdk version: tryLoadKuckitConfig not found.");
402
+ return sdk.tryLoadKuckitConfig;
403
+ } catch {
404
+ console.error("Error: This command requires @kuckit/sdk to be installed in your project.");
405
+ console.error("Install it with one of:");
406
+ console.error(" npm install -D @kuckit/sdk");
407
+ console.error(" pnpm add -D @kuckit/sdk");
408
+ console.error(" bun add -d @kuckit/sdk");
409
+ process.exit(1);
410
+ }
411
+ }
412
+
397
413
  //#endregion
398
414
  //#region src/commands/discover-module.ts
399
415
  async function readKuckitMetadataFromPath(packageJsonPath) {
@@ -495,7 +511,7 @@ async function addModulesToConfig(packages, configPath) {
495
511
  async function discoverModules(options) {
496
512
  const cwd = process.cwd();
497
513
  if (!options.json) console.log("Scanning for Kuckit modules...\n");
498
- const config = await tryLoadKuckitConfig(cwd);
514
+ const config = await (await loadTryLoadKuckitConfig())(cwd);
499
515
  const configuredPackages = new Set(config?.modules.map((m) => m.package) ?? []);
500
516
  const workspaceModules = await scanWorkspacePackages(cwd);
501
517
  const nodeModules = await scanNodeModules(cwd);
@@ -576,4 +592,4 @@ async function discoverModules(options) {
576
592
  }
577
593
 
578
594
  //#endregion
579
- export { addModule as n, generateModule as r, discoverModules as t };
595
+ export { generateModule as i, loadTryLoadKuckitConfig as n, addModule as r, discoverModules as t };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as addModule, r as generateModule, t as discoverModules } from "./discover-module-DpVX5MIS.js";
1
+ import { i as generateModule, r as addModule, t as discoverModules } from "./discover-module-B7rxN4vq.js";
2
2
 
3
3
  export { addModule, discoverModules, generateModule };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuckit/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CLI tools for Kuckit SDK module development",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,11 +38,11 @@
38
38
  }
39
39
  },
40
40
  "scripts": {
41
- "build": "tsdown"
41
+ "build": "tsdown",
42
+ "prepublishOnly": "npm run build && node ../../scripts/check-no-workspace-protocol.cjs"
42
43
  },
43
44
  "dependencies": {
44
45
  "@inquirer/prompts": "^7.2.1",
45
- "@kuckit/sdk": "workspace:*",
46
46
  "commander": "^13.1.0",
47
47
  "drizzle-kit": "^0.31.2",
48
48
  "jiti": "^2.4.2",
@@ -51,5 +51,13 @@
51
51
  "devDependencies": {
52
52
  "@types/node": "^22.13.13",
53
53
  "tsdown": "catalog:"
54
+ },
55
+ "peerDependencies": {
56
+ "@kuckit/sdk": ">=0.1.0"
57
+ },
58
+ "peerDependenciesMeta": {
59
+ "@kuckit/sdk": {
60
+ "optional": true
61
+ }
54
62
  }
55
63
  }