@kanjijs/cli 0.2.0-beta.20 → 0.2.0-beta.22

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/dist/index.js CHANGED
@@ -20002,6 +20002,7 @@ class DevCommand extends Command2 {
20002
20002
  var import_fs_extra = __toESM(require_lib(), 1);
20003
20003
  var import_picocolors2 = __toESM(require_picocolors(), 1);
20004
20004
  import path2 from "path";
20005
+ import { execSync } from "child_process";
20005
20006
  class GenerateCommand extends Command2 {
20006
20007
  load(program2) {
20007
20008
  program2.command("g <type> <name>").description("Generate a new resource (e.g. 'kanjijs g resource users')").alias("generate").option("-r, --repository", "Generate with Repository pattern").option("-m, --module <name>", "Generate schema in a specific module").action(async (type, name, options) => {
@@ -20087,6 +20088,26 @@ ${exportStatement}`);
20087
20088
  return \`This action removes a #\${id} ${lowerName}\`;
20088
20089
  }`;
20089
20090
  if (options.repository) {
20091
+ const pkgPath = path2.join(process.cwd(), "package.json");
20092
+ if (await import_fs_extra.default.pathExists(pkgPath)) {
20093
+ const pkg = await import_fs_extra.default.readJson(pkgPath);
20094
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
20095
+ const missing = [];
20096
+ if (!deps["@kanjijs/store"])
20097
+ missing.push("@kanjijs/store");
20098
+ if (!deps["drizzle-orm"])
20099
+ missing.push("drizzle-orm");
20100
+ if (!deps["postgres"])
20101
+ missing.push("postgres");
20102
+ if (missing.length > 0) {
20103
+ console.log(import_picocolors2.default.yellow(`Installing missing dependencies for Repository pattern: ${missing.join(", ")}...`));
20104
+ try {
20105
+ execSync(`bun add ${missing.join(" ")}`, { stdio: "inherit" });
20106
+ } catch (e) {
20107
+ console.error(import_picocolors2.default.red("Failed to install dependencies. Please install them manually."));
20108
+ }
20109
+ }
20110
+ }
20090
20111
  const commonDir = path2.join(process.cwd(), "src", "common");
20091
20112
  const baseRepoPath = path2.join(commonDir, "base.repository.ts");
20092
20113
  if (!await import_fs_extra.default.pathExists(baseRepoPath)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanjijs/cli",
3
- "version": "0.2.0-beta.20",
3
+ "version": "0.2.0-beta.22",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "kanji": "./dist/index.js"
@@ -21,7 +21,7 @@
21
21
  "fs-extra": "^11.3.3",
22
22
  "picocolors": "^1.1.1",
23
23
  "openapi-typescript-codegen": "^0.25.0",
24
- "@kanjijs/openapi": "^0.2.0-beta.20"
24
+ "@kanjijs/openapi": "^0.2.0-beta.22"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/fs-extra": "^11.0.4"
@@ -7,12 +7,12 @@
7
7
  "start": "bun run src/main.ts"
8
8
  },
9
9
  "dependencies": {
10
- "@kanjijs/core": "^0.2.0-beta.20",
11
- "@kanjijs/platform-bun": "^0.2.0-beta.20",
12
- "@kanjijs/platform-hono": "^0.2.0-beta.20",
13
- "@kanjijs/auth": "^0.2.0-beta.20",
14
- "@kanjijs/logger": "^0.2.0-beta.20",
15
- "@kanjijs/throttler": "^0.2.0-beta.20",
10
+ "@kanjijs/core": "^0.2.0-beta.22",
11
+ "@kanjijs/platform-bun": "^0.2.0-beta.22",
12
+ "@kanjijs/platform-hono": "^0.2.0-beta.22",
13
+ "@kanjijs/auth": "^0.2.0-beta.22",
14
+ "@kanjijs/logger": "^0.2.0-beta.22",
15
+ "@kanjijs/throttler": "^0.2.0-beta.22",
16
16
  "hono": "^4.0.0",
17
17
  "reflect-metadata": "^0.2.0",
18
18
  "zod": "^3.0.0"