@akanjs/devkit 0.0.97 → 0.0.99

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.
Files changed (65) hide show
  1. package/index.cjs +21 -0
  2. package/index.js +1 -21
  3. package/package.json +4 -4
  4. package/src/{aiEditor.mjs → aiEditor.cjs} +56 -22
  5. package/src/aiEditor.js +22 -56
  6. package/src/auth.cjs +72 -0
  7. package/src/auth.js +18 -48
  8. package/src/{builder.mjs → builder.cjs} +44 -11
  9. package/src/builder.js +11 -44
  10. package/src/{capacitorApp.mjs → capacitorApp.cjs} +42 -9
  11. package/src/capacitorApp.js +9 -42
  12. package/src/commandDecorators/{argMeta.mjs → argMeta.cjs} +34 -3
  13. package/src/commandDecorators/argMeta.js +3 -34
  14. package/src/commandDecorators/{command.mjs → command.cjs} +70 -37
  15. package/src/commandDecorators/command.js +37 -70
  16. package/src/commandDecorators/commandMeta.cjs +30 -0
  17. package/src/commandDecorators/commandMeta.js +2 -25
  18. package/src/commandDecorators/index.cjs +29 -0
  19. package/src/commandDecorators/index.js +5 -29
  20. package/src/commandDecorators/targetMeta.cjs +57 -0
  21. package/src/commandDecorators/targetMeta.js +2 -26
  22. package/src/commandDecorators/types.cjs +15 -0
  23. package/src/commandDecorators/types.js +0 -15
  24. package/src/constants.cjs +47 -0
  25. package/src/constants.js +4 -33
  26. package/src/createTunnel.cjs +49 -0
  27. package/src/createTunnel.js +4 -27
  28. package/src/{dependencyScanner.mjs → dependencyScanner.cjs} +38 -5
  29. package/src/dependencyScanner.js +5 -38
  30. package/src/{executors.mjs → executors.cjs} +123 -89
  31. package/src/executors.d.ts +1 -1
  32. package/src/executors.js +89 -123
  33. package/src/{extractDeps.mjs → extractDeps.cjs} +25 -2
  34. package/src/extractDeps.js +2 -25
  35. package/src/getCredentials.cjs +44 -0
  36. package/src/getCredentials.js +6 -39
  37. package/src/getModelFileData.cjs +66 -0
  38. package/src/getModelFileData.js +6 -39
  39. package/src/{getRelatedCnsts.mjs → getRelatedCnsts.cjs} +48 -9
  40. package/src/getRelatedCnsts.js +9 -48
  41. package/src/index.cjs +53 -0
  42. package/src/index.js +17 -53
  43. package/src/selectModel.cjs +46 -0
  44. package/src/selectModel.js +6 -39
  45. package/src/streamAi.cjs +62 -0
  46. package/src/streamAi.js +7 -30
  47. package/src/types.cjs +15 -0
  48. package/src/types.js +0 -15
  49. package/src/uploadRelease.cjs +85 -0
  50. package/src/uploadRelease.js +15 -48
  51. package/index.mjs +0 -1
  52. package/src/auth.mjs +0 -42
  53. package/src/commandDecorators/commandMeta.mjs +0 -7
  54. package/src/commandDecorators/index.mjs +0 -5
  55. package/src/commandDecorators/targetMeta.mjs +0 -33
  56. package/src/commandDecorators/types.mjs +0 -0
  57. package/src/constants.mjs +0 -18
  58. package/src/createTunnel.mjs +0 -26
  59. package/src/getCredentials.mjs +0 -11
  60. package/src/getModelFileData.mjs +0 -33
  61. package/src/index.mjs +0 -17
  62. package/src/selectModel.mjs +0 -13
  63. package/src/streamAi.mjs +0 -39
  64. package/src/types.mjs +0 -0
  65. package/src/uploadRelease.mjs +0 -52
package/src/executors.js CHANGED
@@ -1,65 +1,32 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var executors_exports = {};
29
- __export(executors_exports, {
30
- AppExecutor: () => AppExecutor,
31
- Executor: () => Executor,
32
- LibExecutor: () => LibExecutor,
33
- PkgExecutor: () => PkgExecutor,
34
- SysExecutor: () => SysExecutor,
35
- WorkspaceExecutor: () => WorkspaceExecutor
36
- });
37
- module.exports = __toCommonJS(executors_exports);
38
- var import_common = require("@akanjs/common");
39
- var import_config = require("@akanjs/config");
40
- var import_chalk = __toESM(require("chalk"));
41
- var import_child_process = require("child_process");
42
- var import_dotenv = __toESM(require("dotenv"));
43
- var import_fs = __toESM(require("fs"));
44
- var import_promises = __toESM(require("fs/promises"));
45
- var import_path = __toESM(require("path"));
46
- var import_dependencyScanner = require("./dependencyScanner");
1
+ import { Logger } from "@akanjs/common";
2
+ import {
3
+ getAppConfig,
4
+ getDefaultFileScan,
5
+ getLibConfig
6
+ } from "@akanjs/config";
7
+ import chalk from "chalk";
8
+ import { exec, fork, spawn } from "child_process";
9
+ import dotenv from "dotenv";
10
+ import fs from "fs";
11
+ import fsPromise from "fs/promises";
12
+ import path from "path";
13
+ import { TypeScriptDependencyScanner } from "./dependencyScanner";
47
14
  class Executor {
48
15
  logger;
49
16
  cwdPath;
50
17
  constructor(name, cwdPath) {
51
- this.logger = new import_common.Logger(name);
18
+ this.logger = new Logger(name);
52
19
  this.cwdPath = cwdPath;
53
- if (!import_fs.default.existsSync(cwdPath))
54
- import_fs.default.mkdirSync(cwdPath, { recursive: true });
20
+ if (!fs.existsSync(cwdPath))
21
+ fs.mkdirSync(cwdPath, { recursive: true });
55
22
  }
56
23
  exec(command, options = {}) {
57
- const proc = (0, import_child_process.exec)(command, { cwd: this.cwdPath, ...options });
24
+ const proc = exec(command, { cwd: this.cwdPath, ...options });
58
25
  proc.stdout?.on("data", (data) => {
59
- import_common.Logger.raw(data.toString());
26
+ Logger.raw(data.toString());
60
27
  });
61
28
  proc.stderr?.on("data", (data) => {
62
- import_common.Logger.raw(import_chalk.default.red(data.toString()));
29
+ Logger.raw(chalk.red(data.toString()));
63
30
  });
64
31
  return new Promise((resolve, reject) => {
65
32
  proc.on("exit", (code, signal) => {
@@ -71,12 +38,12 @@ class Executor {
71
38
  });
72
39
  }
73
40
  spawn(command, args = [], options = {}) {
74
- const proc = (0, import_child_process.spawn)(command, args, { cwd: this.cwdPath, stdio: "inherit", ...options });
41
+ const proc = spawn(command, args, { cwd: this.cwdPath, stdio: "inherit", ...options });
75
42
  proc.stdout?.on("data", (data) => {
76
- import_common.Logger.raw(import_chalk.default.dim(data.toString()));
43
+ Logger.raw(chalk.dim(data.toString()));
77
44
  });
78
45
  proc.stderr?.on("data", (data) => {
79
- import_common.Logger.raw(import_chalk.default.dim(data.toString()));
46
+ Logger.raw(chalk.dim(data.toString()));
80
47
  });
81
48
  return new Promise((resolve, reject) => {
82
49
  proc.on("exit", (code, signal) => {
@@ -88,16 +55,16 @@ class Executor {
88
55
  });
89
56
  }
90
57
  fork(modulePath, args = [], options = {}) {
91
- const proc = (0, import_child_process.fork)(modulePath, args, {
58
+ const proc = fork(modulePath, args, {
92
59
  cwd: this.cwdPath,
93
60
  stdio: ["ignore", "inherit", "inherit", "ipc"],
94
61
  ...options
95
62
  });
96
63
  proc.stdout?.on("data", (data) => {
97
- import_common.Logger.raw(data.toString());
64
+ Logger.raw(data.toString());
98
65
  });
99
66
  proc.stderr?.on("data", (data) => {
100
- import_common.Logger.raw(data.toString());
67
+ Logger.raw(data.toString());
101
68
  });
102
69
  return new Promise((resolve, reject) => {
103
70
  proc.on("exit", (code, signal) => {
@@ -109,35 +76,35 @@ class Executor {
109
76
  });
110
77
  }
111
78
  #getPath(filePath) {
112
- return import_path.default.isAbsolute(filePath) ? filePath : `${this.cwdPath}/${filePath}`;
79
+ return path.isAbsolute(filePath) ? filePath : `${this.cwdPath}/${filePath}`;
113
80
  }
114
81
  mkdir(dirPath) {
115
82
  const writePath = this.#getPath(dirPath);
116
- if (!import_fs.default.existsSync(writePath))
117
- import_fs.default.mkdirSync(writePath, { recursive: true });
83
+ if (!fs.existsSync(writePath))
84
+ fs.mkdirSync(writePath, { recursive: true });
118
85
  this.logger.verbose(`Make directory ${writePath}`);
119
86
  return this;
120
87
  }
121
88
  exists(filePath) {
122
89
  const readPath = this.#getPath(filePath);
123
- return import_fs.default.existsSync(readPath);
90
+ return fs.existsSync(readPath);
124
91
  }
125
92
  writeFile(filePath, content, { overwrite = true } = {}) {
126
93
  const writePath = this.#getPath(filePath);
127
- const dir = import_path.default.dirname(writePath);
128
- if (!import_fs.default.existsSync(dir))
129
- import_fs.default.mkdirSync(dir, { recursive: true });
94
+ const dir = path.dirname(writePath);
95
+ if (!fs.existsSync(dir))
96
+ fs.mkdirSync(dir, { recursive: true });
130
97
  const contentStr = typeof content === "string" ? content : JSON.stringify(content, null, 2);
131
- if (import_fs.default.existsSync(writePath)) {
132
- const currentContent = import_fs.default.readFileSync(writePath, "utf8");
98
+ if (fs.existsSync(writePath)) {
99
+ const currentContent = fs.readFileSync(writePath, "utf8");
133
100
  if (currentContent === contentStr || !overwrite)
134
101
  this.logger.verbose(`File ${writePath} is unchanged`);
135
102
  else {
136
- import_fs.default.writeFileSync(writePath, contentStr, "utf8");
103
+ fs.writeFileSync(writePath, contentStr, "utf8");
137
104
  this.logger.verbose(`File ${writePath} is changed`);
138
105
  }
139
106
  } else {
140
- import_fs.default.writeFileSync(writePath, contentStr, "utf8");
107
+ fs.writeFileSync(writePath, contentStr, "utf8");
141
108
  this.logger.verbose(`File ${writePath} is created`);
142
109
  }
143
110
  return this;
@@ -147,22 +114,22 @@ class Executor {
147
114
  return this;
148
115
  }
149
116
  getLocalFile(filePath) {
150
- const filepath = import_path.default.isAbsolute(filePath) ? filePath : filePath.replace(this.cwdPath, "");
117
+ const filepath = path.isAbsolute(filePath) ? filePath : filePath.replace(this.cwdPath, "");
151
118
  const content = this.readFile(filepath);
152
119
  return { filepath, content };
153
120
  }
154
121
  readFile(filePath) {
155
122
  const readPath = this.#getPath(filePath);
156
- return import_fs.default.readFileSync(readPath, "utf8");
123
+ return fs.readFileSync(readPath, "utf8");
157
124
  }
158
125
  readJson(filePath) {
159
126
  const readPath = this.#getPath(filePath);
160
- return JSON.parse(import_fs.default.readFileSync(readPath, "utf8"));
127
+ return JSON.parse(fs.readFileSync(readPath, "utf8"));
161
128
  }
162
129
  async cp(srcPath, destPath) {
163
130
  const src = this.#getPath(srcPath);
164
131
  const dest = this.#getPath(destPath);
165
- await import_promises.default.cp(src, dest, { recursive: true });
132
+ await fsPromise.cp(src, dest, { recursive: true });
166
133
  }
167
134
  log(msg) {
168
135
  this.logger.info(msg);
@@ -195,9 +162,9 @@ class Executor {
195
162
  const result = getContent.default(scanResult ?? null, dict);
196
163
  if (result === null)
197
164
  return;
198
- const filename = typeof result === "object" ? result.filename : import_path.default.basename(targetPath).replace(".js", ".ts");
165
+ const filename = typeof result === "object" ? result.filename : path.basename(targetPath).replace(".js", ".ts");
199
166
  const content = typeof result === "object" ? result.content : result;
200
- const dirname = import_path.default.dirname(targetPath);
167
+ const dirname = path.dirname(targetPath);
201
168
  const convertedTargetPath = Object.entries(dict).reduce(
202
169
  (path2, [key, value]) => path2.replace(new RegExp(`__${key}__`, "g"), value),
203
170
  `${dirname}/${filename}`
@@ -205,7 +172,7 @@ class Executor {
205
172
  this.logger.verbose(`Apply template ${templatePath} to ${convertedTargetPath}`);
206
173
  this.writeFile(convertedTargetPath, content);
207
174
  } else if (targetPath.endsWith(".template")) {
208
- const content = await import_promises.default.readFile(templatePath, "utf8");
175
+ const content = await fsPromise.readFile(templatePath, "utf8");
209
176
  const convertedTargetPath = Object.entries(dict).reduce(
210
177
  (path2, [key, value]) => path2.replace(new RegExp(`__${key}__`, "g"), value),
211
178
  targetPath.slice(0, -9)
@@ -226,26 +193,26 @@ class Executor {
226
193
  overwrite = true
227
194
  }) {
228
195
  const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`.replace(".ts", ".js");
229
- if (import_fs.default.statSync(templatePath).isFile()) {
230
- const filename = import_path.default.basename(templatePath);
196
+ if (fs.statSync(templatePath).isFile()) {
197
+ const filename = path.basename(templatePath);
231
198
  await this.#applyTemplateFile(
232
- { templatePath, targetPath: import_path.default.join(basePath, filename), scanResult, overwrite },
199
+ { templatePath, targetPath: path.join(basePath, filename), scanResult, overwrite },
233
200
  dict
234
201
  );
235
202
  } else {
236
- const subdirs = await import_promises.default.readdir(templatePath);
203
+ const subdirs = await fsPromise.readdir(templatePath);
237
204
  await Promise.all(
238
205
  subdirs.map(async (subdir) => {
239
- const subpath = import_path.default.join(templatePath, subdir);
240
- if (import_fs.default.statSync(subpath).isFile())
206
+ const subpath = path.join(templatePath, subdir);
207
+ if (fs.statSync(subpath).isFile())
241
208
  await this.#applyTemplateFile(
242
- { templatePath: subpath, targetPath: import_path.default.join(basePath, subdir), scanResult, overwrite },
209
+ { templatePath: subpath, targetPath: path.join(basePath, subdir), scanResult, overwrite },
243
210
  dict
244
211
  );
245
212
  else
246
213
  await this.applyTemplate({
247
- basePath: import_path.default.join(basePath, subdir),
248
- template: import_path.default.join(template, subdir),
214
+ basePath: path.join(basePath, subdir),
215
+ template: path.join(template, subdir),
249
216
  scanResult,
250
217
  dict,
251
218
  overwrite
@@ -264,11 +231,11 @@ class WorkspaceExecutor extends Executor {
264
231
  this.repoName = repoName;
265
232
  }
266
233
  static fromRoot() {
267
- const repoName = import_path.default.basename(process.cwd());
234
+ const repoName = path.basename(process.cwd());
268
235
  return new WorkspaceExecutor({ workspaceRoot: process.cwd(), repoName });
269
236
  }
270
237
  getBaseDevEnv() {
271
- const envFile = import_dotenv.default.parse(this.readFile(".env"));
238
+ const envFile = dotenv.parse(this.readFile(".env"));
272
239
  const appName = process.env.NEXT_PUBLIC_APP_NAME ?? envFile.NEXT_PUBLIC_APP_NAME;
273
240
  const repoName = process.env.NEXT_PUBLIC_REPO_NAME ?? envFile.NEXT_PUBLIC_REPO_NAME;
274
241
  if (!repoName)
@@ -337,13 +304,13 @@ class WorkspaceExecutor extends Executor {
337
304
  async getDirInModule(basePath, name) {
338
305
  const AVOID_DIRS = ["__lib", "__scalar", `_${name}`];
339
306
  const getDirs = async (dirname, maxDepth = 3, results = [], prefix = "") => {
340
- const dirs = await import_promises.default.readdir(dirname);
307
+ const dirs = await fsPromise.readdir(dirname);
341
308
  await Promise.all(
342
309
  dirs.map(async (dir) => {
343
310
  if (AVOID_DIRS.includes(dir))
344
311
  return;
345
- const dirPath = import_path.default.join(dirname, dir);
346
- if (import_fs.default.lstatSync(dirPath).isDirectory()) {
312
+ const dirPath = path.join(dirname, dir);
313
+ if (fs.lstatSync(dirPath).isDirectory()) {
347
314
  results.push(`${name}/${prefix}${dir}`);
348
315
  if (maxDepth > 0)
349
316
  await getDirs(dirPath, maxDepth - 1, results, `${prefix}${dir}/`);
@@ -364,14 +331,14 @@ class WorkspaceExecutor extends Executor {
364
331
  async #getDirHasFile(basePath, targetFilename) {
365
332
  const AVOID_DIRS = ["node_modules", "dist", "public", "./next"];
366
333
  const getDirs = async (dirname, maxDepth = 3, results = [], prefix = "") => {
367
- const dirs = await import_promises.default.readdir(dirname);
334
+ const dirs = await fsPromise.readdir(dirname);
368
335
  await Promise.all(
369
336
  dirs.map(async (dir) => {
370
337
  if (AVOID_DIRS.includes(dir))
371
338
  return;
372
- const dirPath = import_path.default.join(dirname, dir);
373
- if (import_fs.default.lstatSync(dirPath).isDirectory()) {
374
- const hasTargetFile = import_fs.default.existsSync(import_path.default.join(dirPath, targetFilename));
339
+ const dirPath = path.join(dirname, dir);
340
+ if (fs.lstatSync(dirPath).isDirectory()) {
341
+ const hasTargetFile = fs.existsSync(path.join(dirPath, targetFilename));
375
342
  if (hasTargetFile)
376
343
  results.push(`${prefix}${dir}`);
377
344
  if (maxDepth > 0)
@@ -411,7 +378,7 @@ class SysExecutor extends Executor {
411
378
  this.type = type;
412
379
  }
413
380
  async getConfig(command) {
414
- return this.type === "app" ? await (0, import_config.getAppConfig)(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "app", name: this.name, command }) : await (0, import_config.getLibConfig)(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "lib", name: this.name, command });
381
+ return this.type === "app" ? await getAppConfig(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "app", name: this.name, command }) : await getLibConfig(this.cwdPath, { ...this.workspace.getBaseDevEnv(), type: "lib", name: this.name, command });
415
382
  }
416
383
  async getModules() {
417
384
  const path2 = this.type === "app" ? `apps/${this.name}/lib` : `libs/${this.name}/lib`;
@@ -424,7 +391,7 @@ class SysExecutor extends Executor {
424
391
  if (libScanResults[this.name])
425
392
  return libScanResults[this.name];
426
393
  const rootPackageJson = this.readJson(`${this.workspace.workspaceRoot}/package.json`);
427
- const scanner = new import_dependencyScanner.TypeScriptDependencyScanner(this.cwdPath);
394
+ const scanner = new TypeScriptDependencyScanner(this.cwdPath);
428
395
  const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
429
396
  const pkgPathSet = new Set(
430
397
  Object.keys(tsconfig.compilerOptions.paths).filter((path2) => tsconfig.compilerOptions.paths[path2].some((resolve) => resolve.startsWith("pkgs/"))).map((path2) => path2.replace("/*", ""))
@@ -441,17 +408,17 @@ class SysExecutor extends Executor {
441
408
  const pathSplitLength = path2.split("/").length;
442
409
  return tsconfig.compilerOptions.paths[path2][0].split("/").slice(1, 1 + pathSplitLength).join("/");
443
410
  }).filter((libName) => libName !== this.name);
444
- if (!import_fs.default.existsSync(`${this.cwdPath}/lib/__scalar`))
445
- import_fs.default.mkdirSync(`${this.cwdPath}/lib/__scalar`, { recursive: true });
446
- const files = (0, import_config.getDefaultFileScan)();
447
- const dirnames = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter(
448
- (name) => import_fs.default.lstatSync(`${this.cwdPath}/lib/${name}`).isDirectory()
411
+ if (!fs.existsSync(`${this.cwdPath}/lib/__scalar`))
412
+ fs.mkdirSync(`${this.cwdPath}/lib/__scalar`, { recursive: true });
413
+ const files = getDefaultFileScan();
414
+ const dirnames = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter(
415
+ (name) => fs.lstatSync(`${this.cwdPath}/lib/${name}`).isDirectory()
449
416
  );
450
417
  const databaseDirs = dirnames.filter((name) => !name.startsWith("_"));
451
418
  const serviceDirs = dirnames.filter((name) => name.startsWith("_") && !name.startsWith("__"));
452
419
  await Promise.all(
453
420
  databaseDirs.map(async (name) => {
454
- const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib", name));
421
+ const filenames = await fsPromise.readdir(path.join(this.cwdPath, "lib", name));
455
422
  filenames.forEach((filename) => {
456
423
  if (filename.endsWith(".constant.ts"))
457
424
  files.constants.databases.push(name);
@@ -473,7 +440,7 @@ class SysExecutor extends Executor {
473
440
  await Promise.all(
474
441
  serviceDirs.map(async (dirname) => {
475
442
  const name = dirname.slice(1);
476
- const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib", dirname));
443
+ const filenames = await fsPromise.readdir(path.join(this.cwdPath, "lib", dirname));
477
444
  filenames.forEach((filename) => {
478
445
  if (filename.endsWith(".dictionary.ts"))
479
446
  files.dictionary.services.push(name);
@@ -488,12 +455,12 @@ class SysExecutor extends Executor {
488
455
  });
489
456
  })
490
457
  );
491
- const scalarDirs = (await import_promises.default.readdir(`${this.cwdPath}/lib/__scalar`)).filter(
458
+ const scalarDirs = (await fsPromise.readdir(`${this.cwdPath}/lib/__scalar`)).filter(
492
459
  (name) => !name.startsWith("_")
493
460
  );
494
461
  await Promise.all(
495
462
  scalarDirs.map(async (name) => {
496
- const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib/__scalar", name));
463
+ const filenames = await fsPromise.readdir(path.join(this.cwdPath, "lib/__scalar", name));
497
464
  filenames.forEach((filename) => {
498
465
  if (filename.endsWith(".constant.ts"))
499
466
  files.constants.scalars.push(name);
@@ -568,32 +535,32 @@ class SysExecutor extends Executor {
568
535
  return scanResult;
569
536
  }
570
537
  getLocalFile(filePath) {
571
- const filepath = import_path.default.isAbsolute(filePath) ? filePath : `${this.type}s/${this.name}/${filePath}`;
538
+ const filepath = path.isAbsolute(filePath) ? filePath : `${this.type}s/${this.name}/${filePath}`;
572
539
  const content = this.workspace.readFile(filepath);
573
540
  return { filepath, content };
574
541
  }
575
542
  async getDatabaseModules() {
576
- const databaseModules = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.constant.ts`));
543
+ const databaseModules = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.constant.ts`));
577
544
  return databaseModules;
578
545
  }
579
546
  async getServiceModules() {
580
- const serviceModules = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.service.ts`));
547
+ const serviceModules = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.service.ts`));
581
548
  return serviceModules;
582
549
  }
583
550
  async getScalarModules() {
584
- const scalarModules = (await import_promises.default.readdir(`${this.cwdPath}/lib/__scalar`)).filter((name) => !name.startsWith("_")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/__scalar/${name}/${name}.constant.ts`));
551
+ const scalarModules = (await fsPromise.readdir(`${this.cwdPath}/lib/__scalar`)).filter((name) => !name.startsWith("_")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/__scalar/${name}/${name}.constant.ts`));
585
552
  return scalarModules;
586
553
  }
587
554
  async getViewComponents() {
588
- const viewComponents = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.View.tsx`));
555
+ const viewComponents = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_") && !name.startsWith("__") && !name.endsWith(".ts")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.View.tsx`));
589
556
  return viewComponents;
590
557
  }
591
558
  async getUnitComponents() {
592
- const unitComponents = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.Unit.tsx`));
559
+ const unitComponents = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.Unit.tsx`));
593
560
  return unitComponents;
594
561
  }
595
562
  async getTemplateComponents() {
596
- const templateComponents = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => import_fs.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.Template.tsx`));
563
+ const templateComponents = (await fsPromise.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => fs.existsSync(`${this.cwdPath}/lib/${name}/${name}.Template.tsx`));
597
564
  return templateComponents;
598
565
  }
599
566
  async getViewsSourceCode() {
@@ -639,7 +606,7 @@ class AppExecutor extends SysExecutor {
639
606
  return new AppExecutor({ workspace: executor.workspace, name });
640
607
  }
641
608
  async getConfig(command) {
642
- return await (0, import_config.getAppConfig)(this.cwdPath, {
609
+ return await getAppConfig(this.cwdPath, {
643
610
  ...this.workspace.getBaseDevEnv(),
644
611
  type: "app",
645
612
  name: this.name,
@@ -648,13 +615,13 @@ class AppExecutor extends SysExecutor {
648
615
  }
649
616
  async syncAssets(libDeps) {
650
617
  const projectPublicLibPath = `${this.cwdPath}/public/libs`;
651
- if (import_fs.default.existsSync(projectPublicLibPath))
652
- await import_promises.default.rm(projectPublicLibPath, { recursive: true });
653
- const targetDeps = libDeps.filter((dep) => import_fs.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
654
- await Promise.all(targetDeps.map((dep) => import_promises.default.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })));
618
+ if (fs.existsSync(projectPublicLibPath))
619
+ await fsPromise.rm(projectPublicLibPath, { recursive: true });
620
+ const targetDeps = libDeps.filter((dep) => fs.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
621
+ await Promise.all(targetDeps.map((dep) => fsPromise.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })));
655
622
  await Promise.all(
656
623
  targetDeps.map(
657
- (dep) => import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
624
+ (dep) => fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
658
625
  recursive: true
659
626
  })
660
627
  )
@@ -675,7 +642,7 @@ class LibExecutor extends SysExecutor {
675
642
  return new LibExecutor({ workspace: executor.workspace, name });
676
643
  }
677
644
  async getConfig(command) {
678
- return await (0, import_config.getLibConfig)(this.cwdPath, {
645
+ return await getLibConfig(this.cwdPath, {
679
646
  ...this.workspace.getBaseDevEnv(),
680
647
  type: "lib",
681
648
  name: this.name,
@@ -703,7 +670,7 @@ class PkgExecutor extends Executor {
703
670
  tsconfig = this.getTsConfig(`${this.cwdPath}/tsconfig.json`)
704
671
  } = {}) {
705
672
  const rootPackageJson = this.readJson(`${this.workspace.workspaceRoot}/package.json`);
706
- const scanner = new import_dependencyScanner.TypeScriptDependencyScanner(this.cwdPath);
673
+ const scanner = new TypeScriptDependencyScanner(this.cwdPath);
707
674
  const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
708
675
  const pkgPathSet = new Set(
709
676
  Object.keys(tsconfig.compilerOptions.paths).filter((path2) => tsconfig.compilerOptions.paths[path2].some((resolve) => resolve.startsWith("pkgs/"))).map((path2) => path2.replace("/*", ""))
@@ -721,12 +688,11 @@ class PkgExecutor extends Executor {
721
688
  return pkgScanResult;
722
689
  }
723
690
  }
724
- // Annotate the CommonJS export names for ESM import in node:
725
- 0 && (module.exports = {
691
+ export {
726
692
  AppExecutor,
727
693
  Executor,
728
694
  LibExecutor,
729
695
  PkgExecutor,
730
696
  SysExecutor,
731
697
  WorkspaceExecutor
732
- });
698
+ };
@@ -1,3 +1,25 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var extractDeps_exports = {};
19
+ __export(extractDeps_exports, {
20
+ extractDependencies: () => extractDependencies
21
+ });
22
+ module.exports = __toCommonJS(extractDeps_exports);
1
23
  const NODE_NATIVE_MODULE_SET = /* @__PURE__ */ new Set([
2
24
  "assert",
3
25
  "async_hooks",
@@ -75,6 +97,7 @@ const extractDependencies = (filepaths, pacakgeJson, defaultDependencies = []) =
75
97
  })
76
98
  );
77
99
  };
78
- export {
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
79
102
  extractDependencies
80
- };
103
+ });
@@ -1,25 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var extractDeps_exports = {};
19
- __export(extractDeps_exports, {
20
- extractDependencies: () => extractDependencies
21
- });
22
- module.exports = __toCommonJS(extractDeps_exports);
23
1
  const NODE_NATIVE_MODULE_SET = /* @__PURE__ */ new Set([
24
2
  "assert",
25
3
  "async_hooks",
@@ -97,7 +75,6 @@ const extractDependencies = (filepaths, pacakgeJson, defaultDependencies = []) =
97
75
  })
98
76
  );
99
77
  };
100
- // Annotate the CommonJS export names for ESM import in node:
101
- 0 && (module.exports = {
78
+ export {
102
79
  extractDependencies
103
- });
80
+ };
@@ -0,0 +1,44 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var getCredentials_exports = {};
29
+ __export(getCredentials_exports, {
30
+ getCredentials: () => getCredentials
31
+ });
32
+ module.exports = __toCommonJS(getCredentials_exports);
33
+ var import_fs = __toESM(require("fs"), 1);
34
+ var import_js_yaml = __toESM(require("js-yaml"), 1);
35
+ const getCredentials = (app, environment) => {
36
+ const secret = import_js_yaml.default.load(
37
+ import_fs.default.readFileSync(`${app.workspace.workspaceRoot}/infra/app/values/${app.name}-secret.yaml`, "utf-8")
38
+ );
39
+ return secret[environment];
40
+ };
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ getCredentials
44
+ });
@@ -1,44 +1,11 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var getCredentials_exports = {};
29
- __export(getCredentials_exports, {
30
- getCredentials: () => getCredentials
31
- });
32
- module.exports = __toCommonJS(getCredentials_exports);
33
- var import_fs = __toESM(require("fs"));
34
- var import_js_yaml = __toESM(require("js-yaml"));
1
+ import fs from "fs";
2
+ import yaml from "js-yaml";
35
3
  const getCredentials = (app, environment) => {
36
- const secret = import_js_yaml.default.load(
37
- import_fs.default.readFileSync(`${app.workspace.workspaceRoot}/infra/app/values/${app.name}-secret.yaml`, "utf-8")
4
+ const secret = yaml.load(
5
+ fs.readFileSync(`${app.workspace.workspaceRoot}/infra/app/values/${app.name}-secret.yaml`, "utf-8")
38
6
  );
39
7
  return secret[environment];
40
8
  };
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
9
+ export {
43
10
  getCredentials
44
- });
11
+ };