@akanjs/devkit 0.0.45 → 0.0.46
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/index.js +96 -556
- package/package.json +1 -5
package/index.js
CHANGED
|
@@ -226,8 +226,8 @@ var getModelFileData = (modulePath, modelName) => {
|
|
|
226
226
|
const constantFileLines = constantFileStr.split("\n");
|
|
227
227
|
const importLibNames = constantFileLines.filter((line) => line.startsWith("import { cnst as ")).map((line) => line.split("cnst as ")[1].split(" ")[0]);
|
|
228
228
|
const importLocalPaths = constantFileLines.filter((line) => line.startsWith("import { ") && line.includes('from "../')).map((line) => line.split("from ")[1].split('"')[1]);
|
|
229
|
-
const importModelNames = importLocalPaths.map((
|
|
230
|
-
const hasImportScalar = !!importLocalPaths.map((
|
|
229
|
+
const importModelNames = importLocalPaths.map((path3) => path3.split("/")[1]).filter((name) => !name.startsWith("_"));
|
|
230
|
+
const hasImportScalar = !!importLocalPaths.map((path3) => path3.split("/")[1]).filter((name) => name.startsWith("_")).length;
|
|
231
231
|
return {
|
|
232
232
|
moduleType,
|
|
233
233
|
moduleName,
|
|
@@ -250,8 +250,8 @@ var import_ora = __toESM(require("ora"));
|
|
|
250
250
|
var ts = __toESM(require("typescript"));
|
|
251
251
|
var getRelatedCnsts = (constantFilePath) => {
|
|
252
252
|
const tsConfigPath = `./tsconfig.json`;
|
|
253
|
-
const configFile = ts.readConfigFile(tsConfigPath, (
|
|
254
|
-
return ts.sys.readFile(
|
|
253
|
+
const configFile = ts.readConfigFile(tsConfigPath, (path3) => {
|
|
254
|
+
return ts.sys.readFile(path3);
|
|
255
255
|
});
|
|
256
256
|
const parsedConfig = ts.parseJsonConfigFileContent(
|
|
257
257
|
configFile.config,
|
|
@@ -399,478 +399,17 @@ var streamAi = async (question, callback) => {
|
|
|
399
399
|
}
|
|
400
400
|
};
|
|
401
401
|
|
|
402
|
-
// pkgs/@akanjs/common/src/isDayjs.ts
|
|
403
|
-
var import_dayjs = require("dayjs");
|
|
404
|
-
|
|
405
|
-
// pkgs/@akanjs/common/src/isQueryEqual.ts
|
|
406
|
-
var import_dayjs2 = __toESM(require("dayjs"));
|
|
407
|
-
|
|
408
|
-
// pkgs/@akanjs/common/src/isValidDate.ts
|
|
409
|
-
var import_dayjs3 = __toESM(require("dayjs"));
|
|
410
|
-
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
411
|
-
import_dayjs3.default.extend(import_customParseFormat.default);
|
|
412
|
-
|
|
413
|
-
// pkgs/@akanjs/common/src/pluralize.ts
|
|
414
|
-
var import_pluralize = __toESM(require("pluralize"));
|
|
415
|
-
|
|
416
|
-
// pkgs/@akanjs/common/src/capitalize.ts
|
|
417
|
-
var capitalize = (str) => {
|
|
418
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
// pkgs/@akanjs/common/src/Logger.ts
|
|
422
|
-
var import_dayjs4 = __toESM(require("dayjs"));
|
|
423
|
-
var logLevels = ["trace", "verbose", "debug", "log", "info", "warn", "error"];
|
|
424
|
-
var clc = {
|
|
425
|
-
bold: (text) => `\x1B[1m${text}\x1B[0m`,
|
|
426
|
-
green: (text) => `\x1B[32m${text}\x1B[39m`,
|
|
427
|
-
yellow: (text) => `\x1B[33m${text}\x1B[39m`,
|
|
428
|
-
red: (text) => `\x1B[31m${text}\x1B[39m`,
|
|
429
|
-
magentaBright: (text) => `\x1B[95m${text}\x1B[39m`,
|
|
430
|
-
cyanBright: (text) => `\x1B[96m${text}\x1B[39m`
|
|
431
|
-
};
|
|
432
|
-
var colorizeMap = {
|
|
433
|
-
trace: clc.bold,
|
|
434
|
-
verbose: clc.cyanBright,
|
|
435
|
-
debug: clc.magentaBright,
|
|
436
|
-
log: clc.green,
|
|
437
|
-
info: clc.green,
|
|
438
|
-
warn: clc.yellow,
|
|
439
|
-
error: clc.red
|
|
440
|
-
};
|
|
441
|
-
var Logger = class _Logger {
|
|
442
|
-
static #ignoreCtxSet = /* @__PURE__ */ new Set([
|
|
443
|
-
"InstanceLoader",
|
|
444
|
-
"RoutesResolver",
|
|
445
|
-
"RouterExplorer",
|
|
446
|
-
"NestFactory",
|
|
447
|
-
"WebSocketsController",
|
|
448
|
-
"GraphQLModule",
|
|
449
|
-
"NestApplication"
|
|
450
|
-
]);
|
|
451
|
-
static level = process.env.NEXT_PUBLIC_LOG_LEVEL ?? "log";
|
|
452
|
-
static #levelIdx = logLevels.findIndex((l) => l === process.env.NEXT_PUBLIC_LOG_LEVEL);
|
|
453
|
-
static #startAt = (0, import_dayjs4.default)();
|
|
454
|
-
static setLevel(level) {
|
|
455
|
-
this.level = level;
|
|
456
|
-
this.#levelIdx = logLevels.findIndex((l) => l === level);
|
|
457
|
-
}
|
|
458
|
-
name;
|
|
459
|
-
constructor(name) {
|
|
460
|
-
this.name = name;
|
|
461
|
-
}
|
|
462
|
-
trace(msg, context = "") {
|
|
463
|
-
if (_Logger.#levelIdx <= 0)
|
|
464
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "trace");
|
|
465
|
-
}
|
|
466
|
-
verbose(msg, context = "") {
|
|
467
|
-
if (_Logger.#levelIdx <= 1)
|
|
468
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "verbose");
|
|
469
|
-
}
|
|
470
|
-
debug(msg, context = "") {
|
|
471
|
-
if (_Logger.#levelIdx <= 2)
|
|
472
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "debug");
|
|
473
|
-
}
|
|
474
|
-
log(msg, context = "") {
|
|
475
|
-
if (_Logger.#levelIdx <= 3)
|
|
476
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "log");
|
|
477
|
-
}
|
|
478
|
-
info(msg, context = "") {
|
|
479
|
-
if (_Logger.#levelIdx <= 4)
|
|
480
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "info");
|
|
481
|
-
}
|
|
482
|
-
warn(msg, context = "") {
|
|
483
|
-
if (_Logger.#levelIdx <= 5)
|
|
484
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "warn");
|
|
485
|
-
}
|
|
486
|
-
error(msg, context = "") {
|
|
487
|
-
if (_Logger.#levelIdx <= 6)
|
|
488
|
-
_Logger.#printMessages(this.name ?? "App", msg, context, "error");
|
|
489
|
-
}
|
|
490
|
-
raw(msg, method) {
|
|
491
|
-
_Logger.rawLog(msg, method);
|
|
492
|
-
}
|
|
493
|
-
rawLog(msg, method) {
|
|
494
|
-
_Logger.rawLog(msg, method);
|
|
495
|
-
}
|
|
496
|
-
static trace(msg, context = "") {
|
|
497
|
-
if (_Logger.#levelIdx <= 0)
|
|
498
|
-
_Logger.#printMessages("App", msg, context, "trace");
|
|
499
|
-
}
|
|
500
|
-
static verbose(msg, context = "") {
|
|
501
|
-
if (_Logger.#levelIdx <= 1)
|
|
502
|
-
_Logger.#printMessages("App", msg, context, "verbose");
|
|
503
|
-
}
|
|
504
|
-
static debug(msg, context = "") {
|
|
505
|
-
if (_Logger.#levelIdx <= 2)
|
|
506
|
-
_Logger.#printMessages("App", msg, context, "debug");
|
|
507
|
-
}
|
|
508
|
-
static log(msg, context = "") {
|
|
509
|
-
if (_Logger.#levelIdx <= 3)
|
|
510
|
-
_Logger.#printMessages("App", msg, context, "log");
|
|
511
|
-
}
|
|
512
|
-
static info(msg, context = "") {
|
|
513
|
-
if (_Logger.#levelIdx <= 4)
|
|
514
|
-
_Logger.#printMessages("App", msg, context, "info");
|
|
515
|
-
}
|
|
516
|
-
static warn(msg, context = "") {
|
|
517
|
-
if (_Logger.#levelIdx <= 5)
|
|
518
|
-
_Logger.#printMessages("App", msg, context, "warn");
|
|
519
|
-
}
|
|
520
|
-
static error(msg, context = "") {
|
|
521
|
-
if (_Logger.#levelIdx <= 6)
|
|
522
|
-
_Logger.#printMessages("App", msg, context, "error");
|
|
523
|
-
}
|
|
524
|
-
static #colorize(msg, logLevel) {
|
|
525
|
-
return colorizeMap[logLevel](msg);
|
|
526
|
-
}
|
|
527
|
-
static #printMessages(name, content, context, logLevel, writeStreamType = logLevel === "error" ? "stderr" : "stdout") {
|
|
528
|
-
if (this.#ignoreCtxSet.has(context))
|
|
529
|
-
return;
|
|
530
|
-
const now = (0, import_dayjs4.default)();
|
|
531
|
-
const processMsg = this.#colorize(
|
|
532
|
-
`[${name ?? "App"}] ${global.process?.pid ?? "window"} -`,
|
|
533
|
-
logLevel
|
|
534
|
-
);
|
|
535
|
-
const timestampMsg = now.format("MM/DD/YYYY, HH:mm:ss A");
|
|
536
|
-
const logLevelMsg = this.#colorize(logLevel.toUpperCase().padStart(7, " "), logLevel);
|
|
537
|
-
const contextMsg = context ? clc.yellow(`[${context}] `) : "";
|
|
538
|
-
const contentMsg = this.#colorize(content, logLevel);
|
|
539
|
-
const timeDiffMsg = clc.yellow(`+${now.diff(_Logger.#startAt, "ms")}ms`);
|
|
540
|
-
if (typeof window === "undefined")
|
|
541
|
-
process[writeStreamType].write(
|
|
542
|
-
`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
543
|
-
`
|
|
544
|
-
);
|
|
545
|
-
else
|
|
546
|
-
console.log(`${processMsg} ${timestampMsg} ${logLevelMsg} ${contextMsg} ${contentMsg} ${timeDiffMsg}
|
|
547
|
-
`);
|
|
548
|
-
}
|
|
549
|
-
static rawLog(msg, method) {
|
|
550
|
-
this.raw(`${msg}
|
|
551
|
-
`, method);
|
|
552
|
-
}
|
|
553
|
-
static raw(msg, method) {
|
|
554
|
-
if (typeof window === "undefined" && method !== "console" && global.process)
|
|
555
|
-
global.process.stdout.write(msg);
|
|
556
|
-
else
|
|
557
|
-
console.log(msg);
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
// pkgs/@akanjs/config/src/akanConfig.ts
|
|
562
|
-
var import_fs6 = __toESM(require("fs"));
|
|
563
|
-
var import_path2 = __toESM(require("path"));
|
|
564
|
-
|
|
565
|
-
// pkgs/@akanjs/config/src/baseConfigEnv.ts
|
|
566
|
-
var getBaseConfigEnv = (appName = process.env.NEXT_PUBLIC_APP_NAME) => {
|
|
567
|
-
if (!appName)
|
|
568
|
-
throw new Error("NEXT_PUBLIC_APP_NAME is not set");
|
|
569
|
-
const repoName = process.env.NEXT_PUBLIC_REPO_NAME;
|
|
570
|
-
if (!repoName)
|
|
571
|
-
throw new Error("NEXT_PUBLIC_REPO_NAME is not set");
|
|
572
|
-
const serveDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN;
|
|
573
|
-
if (!serveDomain)
|
|
574
|
-
throw new Error("NEXT_PUBLIC_SERVE_DOMAIN is not set");
|
|
575
|
-
const env = process.env.NEXT_PUBLIC_ENV ?? "debug";
|
|
576
|
-
if (!env)
|
|
577
|
-
throw new Error("NEXT_PUBLIC_ENV is not set");
|
|
578
|
-
return { appName, repoName, serveDomain, env };
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
// pkgs/@akanjs/config/src/nextConfig.ts
|
|
582
|
-
var import_bundle_analyzer = __toESM(require("@next/bundle-analyzer"));
|
|
583
|
-
var import_next_pwa = __toESM(require("next-pwa"));
|
|
584
|
-
var import_cache = __toESM(require("next-pwa/cache"));
|
|
585
|
-
var import_path = __toESM(require("path"));
|
|
586
|
-
var composePlugins = (...plugins) => {
|
|
587
|
-
return function(baseConfig) {
|
|
588
|
-
return async function combined(phase, context) {
|
|
589
|
-
let config = baseConfig;
|
|
590
|
-
for (const plugin of plugins) {
|
|
591
|
-
const fn = plugin;
|
|
592
|
-
const configOrFn = fn(config);
|
|
593
|
-
if (typeof configOrFn === "function")
|
|
594
|
-
config = await configOrFn(phase, context);
|
|
595
|
-
else
|
|
596
|
-
config = configOrFn;
|
|
597
|
-
}
|
|
598
|
-
return config;
|
|
599
|
-
};
|
|
600
|
-
};
|
|
601
|
-
};
|
|
602
|
-
var commandType = process.env.AKAN_COMMAND_TYPE?.includes("serve") ? "serve" : process.env.AKAN_COMMAND_TYPE?.includes("build") ? "build" : "deploy";
|
|
603
|
-
var withPWA = (0, import_next_pwa.default)({
|
|
604
|
-
dest: "public",
|
|
605
|
-
register: true,
|
|
606
|
-
skipWaiting: true,
|
|
607
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
608
|
-
runtimeCaching: import_cache.default,
|
|
609
|
-
disable: commandType === "serve"
|
|
610
|
-
});
|
|
611
|
-
var devDomain = process.env.NEXT_PUBLIC_SERVE_DOMAIN ?? "akanjs.com";
|
|
612
|
-
var withBase = (appName, config, libs, routes = []) => {
|
|
613
|
-
return composePlugins(
|
|
614
|
-
(0, import_bundle_analyzer.default)({ enabled: process.env.ANALYZE === "true" }),
|
|
615
|
-
...commandType !== "serve" || process.env.USE_PWA === "true" ? [withPWA] : []
|
|
616
|
-
)({
|
|
617
|
-
...config,
|
|
618
|
-
eslint: { ...config.eslint, ignoreDuringBuilds: true },
|
|
619
|
-
env: {
|
|
620
|
-
...config.env,
|
|
621
|
-
basePaths: routes.map(({ basePath: basePath2 }) => basePath2).join(",")
|
|
622
|
-
},
|
|
623
|
-
transpilePackages: [
|
|
624
|
-
"swiper",
|
|
625
|
-
"ssr-window",
|
|
626
|
-
"dom7",
|
|
627
|
-
...libs.map((lib) => `@${lib}`),
|
|
628
|
-
"@akanjs/base",
|
|
629
|
-
"@akanjs/common",
|
|
630
|
-
"@akanjs/next",
|
|
631
|
-
"@akanjs/ui",
|
|
632
|
-
"@akanjs/client",
|
|
633
|
-
"@akanjs/server",
|
|
634
|
-
"@akanjs/service",
|
|
635
|
-
"@akanjs/signal",
|
|
636
|
-
"@akanjs/store",
|
|
637
|
-
"@akanjs/dictionary",
|
|
638
|
-
"@akanjs/constant",
|
|
639
|
-
"@akanjs/config",
|
|
640
|
-
"@akanjs/document"
|
|
641
|
-
],
|
|
642
|
-
reactStrictMode: commandType === "serve" ? false : true,
|
|
643
|
-
experimental: {
|
|
644
|
-
...config.experimental ?? {},
|
|
645
|
-
optimizePackageImports: [
|
|
646
|
-
...[appName, ...libs].map((lib) => [`@${lib}/ui`, `@${lib}/next`, `@${lib}/common`, `@${lib}/client`]).flat(),
|
|
647
|
-
"@contract",
|
|
648
|
-
"@akanjs/next",
|
|
649
|
-
"@akanjs/common"
|
|
650
|
-
]
|
|
651
|
-
},
|
|
652
|
-
// modularizeImports: {
|
|
653
|
-
// "react-icons/?(((\\w*)?/?)*)": {
|
|
654
|
-
// transform: "@react-icons/all-files/{{ matches.[1] }}/{{member}}",
|
|
655
|
-
// skipDefaultConversion: true,
|
|
656
|
-
// },
|
|
657
|
-
// lodash: { transform: "lodash/{{member}}", preventFullImport: true },
|
|
658
|
-
// ...Object.fromEntries(
|
|
659
|
-
// [appName, ...libs].reduce(
|
|
660
|
-
// (acc, lib) => [
|
|
661
|
-
// ...acc,
|
|
662
|
-
// [`@${lib}/ui`, { transform: `@${lib}/ui/{{member}}`, skipDefaultConversion: true }],
|
|
663
|
-
// [`@${lib}/next`, { transform: `@${lib}/next/{{member}}`, skipDefaultConversion: true }],
|
|
664
|
-
// [`@${lib}/common`, { transform: `@${lib}/common/{{member}}`, skipDefaultConversion: true }],
|
|
665
|
-
// [`@${lib}/client`, { transform: `@${lib}/lib/{{ camelCase member }}`, skipDefaultConversion: true }],
|
|
666
|
-
// ],
|
|
667
|
-
// [
|
|
668
|
-
// ["@contract", { transform: `@contract/src/{{member}}`, skipDefaultConversion: true }],
|
|
669
|
-
// [`@akanjs/next`, { transform: `@akanjs/next/src/{{member}}`, skipDefaultConversion: true }],
|
|
670
|
-
// [`@akanjs/common`, { transform: `@akanjs/common/src/{{member}}`, skipDefaultConversion: true }],
|
|
671
|
-
// ]
|
|
672
|
-
// )
|
|
673
|
-
// ),
|
|
674
|
-
// ...(config.modularizeImports ?? {}),
|
|
675
|
-
// },
|
|
676
|
-
images: {
|
|
677
|
-
formats: ["image/avif", "image/webp"],
|
|
678
|
-
...config.images ?? {},
|
|
679
|
-
remotePatterns: [
|
|
680
|
-
...config.images?.remotePatterns ?? [],
|
|
681
|
-
...routes.map(({ domains }) => [
|
|
682
|
-
...domains.main?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? [],
|
|
683
|
-
...domains.develop?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? [],
|
|
684
|
-
...domains.debug?.map((domain) => ({ protocol: "https", hostname: `**.${domain}` })) ?? []
|
|
685
|
-
]).flat(),
|
|
686
|
-
{ protocol: "https", hostname: `**.${devDomain}` }
|
|
687
|
-
]
|
|
688
|
-
},
|
|
689
|
-
webpack: (config2) => {
|
|
690
|
-
config2.resolve.alias.canvas = false;
|
|
691
|
-
config2.resolve.alias.encoding = false;
|
|
692
|
-
if (process.env.USE_AKANJS_PKGS === "true")
|
|
693
|
-
config2.resolve.alias["@akanjs/config"] = import_path.default.resolve(__dirname, "../../../../pkgs/@akanjs/config");
|
|
694
|
-
return config2;
|
|
695
|
-
},
|
|
696
|
-
redirects() {
|
|
697
|
-
return routes.map(({ basePath: basePath2, domains }) => [
|
|
698
|
-
{ basePath: basePath2, domain: `${basePath2}-debug.${devDomain}` },
|
|
699
|
-
{ basePath: basePath2, domain: `${basePath2}-develop.${devDomain}` },
|
|
700
|
-
{ basePath: basePath2, domain: `${basePath2}-main.${devDomain}` },
|
|
701
|
-
...domains.main?.map((domain) => ({ basePath: basePath2, domain })) ?? [],
|
|
702
|
-
...domains.develop?.map((domain) => ({ basePath: basePath2, domain })) ?? [],
|
|
703
|
-
...domains.debug?.map((domain) => ({ basePath: basePath2, domain })) ?? []
|
|
704
|
-
]).flat().map(({ basePath: basePath2, domain }) => ({
|
|
705
|
-
source: `/:locale/${basePath2}/:path*`,
|
|
706
|
-
has: [{ type: "host", value: domain }],
|
|
707
|
-
permanent: true,
|
|
708
|
-
destination: "/:locale/:path*"
|
|
709
|
-
}));
|
|
710
|
-
},
|
|
711
|
-
rewrites() {
|
|
712
|
-
return routes.map(({ basePath: basePath2, domains }) => [
|
|
713
|
-
{ basePath: basePath2, domain: `${basePath2}-debug.${devDomain}` },
|
|
714
|
-
{ basePath: basePath2, domain: `${basePath2}-develop.${devDomain}` },
|
|
715
|
-
{ basePath: basePath2, domain: `${basePath2}-main.${devDomain}` },
|
|
716
|
-
...domains.main?.map((domain) => ({ basePath: basePath2, domain })) ?? [],
|
|
717
|
-
...domains.develop?.map((domain) => ({ basePath: basePath2, domain })) ?? [],
|
|
718
|
-
...domains.debug?.map((domain) => ({ basePath: basePath2, domain })) ?? []
|
|
719
|
-
]).flat().map(({ basePath: basePath2, domain }) => [
|
|
720
|
-
{
|
|
721
|
-
source: "/:locale",
|
|
722
|
-
has: [{ type: "host", value: domain }],
|
|
723
|
-
destination: `/:locale/${basePath2}`
|
|
724
|
-
},
|
|
725
|
-
{
|
|
726
|
-
source: `/:locale/:path((?!${basePath2}$)(?!admin(?:/|$)).*)`,
|
|
727
|
-
has: [{ type: "host", value: domain }],
|
|
728
|
-
destination: `/:locale/${basePath2}/:path*`
|
|
729
|
-
}
|
|
730
|
-
]).flat();
|
|
731
|
-
}
|
|
732
|
-
});
|
|
733
|
-
};
|
|
734
|
-
|
|
735
|
-
// pkgs/@akanjs/config/src/akanConfig.ts
|
|
736
|
-
var makeAppConfig = (config, props = {}) => {
|
|
737
|
-
const baseConfigEnv = getBaseConfigEnv(props.appName);
|
|
738
|
-
const {
|
|
739
|
-
appName = baseConfigEnv.appName,
|
|
740
|
-
repoName = baseConfigEnv.repoName,
|
|
741
|
-
serveDomain = baseConfigEnv.serveDomain,
|
|
742
|
-
env = baseConfigEnv.env,
|
|
743
|
-
command = "build"
|
|
744
|
-
} = props;
|
|
745
|
-
return {
|
|
746
|
-
rootLib: config.rootLib,
|
|
747
|
-
libs: config.libs ?? [],
|
|
748
|
-
backend: {
|
|
749
|
-
dockerfile: config.backend?.dockerfile ?? `FROM node:22-slim
|
|
750
|
-
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
|
|
751
|
-
RUN apt-get update && apt-get upgrade -y
|
|
752
|
-
RUN apt-get install -y ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils udev
|
|
753
|
-
ARG TARGETARCH
|
|
754
|
-
RUN if [ "$TARGETARCH" = "amd64" ]; then wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian92-x86_64-100.3.1.deb && apt-get install -y ./mongodb-database-tools-*.deb && rm -f mongodb-database-tools-*.deb; fi
|
|
755
|
-
RUN apt-get install -y git redis build-essential python3
|
|
756
|
-
RUN rm -rf /var/lib/apt/lists/*
|
|
757
|
-
RUN mkdir -p /workspace
|
|
758
|
-
WORKDIR /workspace
|
|
759
|
-
COPY ./package.json ./package.json
|
|
760
|
-
RUN npx pnpm i --prod
|
|
761
|
-
COPY . .
|
|
762
|
-
ENV PORT 8080
|
|
763
|
-
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
764
|
-
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
765
|
-
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
766
|
-
ENV NEXT_PUBLIC_APP_NAME=${appName}
|
|
767
|
-
ENV NEXT_PUBLIC_ENV=${env}
|
|
768
|
-
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
769
|
-
CMD ["node", "main.js"]`,
|
|
770
|
-
explicitDependencies: config.backend?.explicitDependencies ?? []
|
|
771
|
-
},
|
|
772
|
-
frontend: {
|
|
773
|
-
dockerfile: config.frontend?.dockerfile ?? `FROM node:22-alpine
|
|
774
|
-
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
|
|
775
|
-
RUN apk --no-cache add git
|
|
776
|
-
RUN mkdir -p /workspace
|
|
777
|
-
WORKDIR /workspace
|
|
778
|
-
COPY ./package.json ./package.json
|
|
779
|
-
RUN npx pnpm i --prod
|
|
780
|
-
COPY . .
|
|
781
|
-
ENV PORT 4200
|
|
782
|
-
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
783
|
-
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
784
|
-
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
785
|
-
ENV NEXT_PUBLIC_APP_NAME=${appName}
|
|
786
|
-
ENV NEXT_PUBLIC_ENV=${env}
|
|
787
|
-
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
788
|
-
CMD ["npm", "start"]`,
|
|
789
|
-
nextConfig: withBase(
|
|
790
|
-
appName,
|
|
791
|
-
config.frontend?.nextConfig ? typeof config.frontend.nextConfig === "function" ? config.frontend.nextConfig() : config.frontend.nextConfig : {},
|
|
792
|
-
config.libs ?? [],
|
|
793
|
-
config.frontend?.routes
|
|
794
|
-
),
|
|
795
|
-
explicitDependencies: config.frontend?.explicitDependencies ?? []
|
|
796
|
-
}
|
|
797
|
-
};
|
|
798
|
-
};
|
|
799
|
-
var getAppConfig = async (appRoot, props) => {
|
|
800
|
-
const akanConfigPath = import_path2.default.join(appRoot, "akan.config.ts");
|
|
801
|
-
if (!import_fs6.default.existsSync(akanConfigPath))
|
|
802
|
-
throw new Error(`application akan.config.ts is not found ${appRoot}`);
|
|
803
|
-
const configImp = (await import(`${appRoot}/akan.config.ts`)).default;
|
|
804
|
-
const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
805
|
-
return makeAppConfig(config, props);
|
|
806
|
-
};
|
|
807
|
-
var makeLibConfig = (config, props = {}) => {
|
|
808
|
-
return {
|
|
809
|
-
rootLib: config.rootLib,
|
|
810
|
-
libs: config.libs ?? [],
|
|
811
|
-
backend: {
|
|
812
|
-
explicitDependencies: config.backend?.explicitDependencies ?? []
|
|
813
|
-
},
|
|
814
|
-
frontend: {
|
|
815
|
-
explicitDependencies: config.frontend?.explicitDependencies ?? []
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
};
|
|
819
|
-
var getLibConfig = async (libRoot, props) => {
|
|
820
|
-
const akanConfigPath = import_path2.default.join(libRoot, "akan.config.ts");
|
|
821
|
-
if (!import_fs6.default.existsSync(akanConfigPath))
|
|
822
|
-
throw new Error(`library akan.config.ts is not found ${libRoot}`);
|
|
823
|
-
const configImp = (await import(`${libRoot}/akan.config.ts`)).default;
|
|
824
|
-
const config = typeof configImp === "function" ? configImp(props) : configImp;
|
|
825
|
-
return makeLibConfig(config, props);
|
|
826
|
-
};
|
|
827
|
-
|
|
828
|
-
// pkgs/@akanjs/config/index.ts
|
|
829
|
-
var getDefaultFileScan = () => ({
|
|
830
|
-
constants: {
|
|
831
|
-
databases: [],
|
|
832
|
-
scalars: []
|
|
833
|
-
},
|
|
834
|
-
dictionary: {
|
|
835
|
-
databases: [],
|
|
836
|
-
services: [],
|
|
837
|
-
scalars: []
|
|
838
|
-
},
|
|
839
|
-
documents: {
|
|
840
|
-
databases: [],
|
|
841
|
-
scalars: []
|
|
842
|
-
},
|
|
843
|
-
services: {
|
|
844
|
-
databases: [],
|
|
845
|
-
services: [],
|
|
846
|
-
scalars: []
|
|
847
|
-
},
|
|
848
|
-
signal: {
|
|
849
|
-
databases: [],
|
|
850
|
-
services: [],
|
|
851
|
-
scalars: []
|
|
852
|
-
},
|
|
853
|
-
store: {
|
|
854
|
-
databases: [],
|
|
855
|
-
services: [],
|
|
856
|
-
scalars: []
|
|
857
|
-
},
|
|
858
|
-
components: {
|
|
859
|
-
databases: [],
|
|
860
|
-
services: [],
|
|
861
|
-
scalars: []
|
|
862
|
-
}
|
|
863
|
-
});
|
|
864
|
-
|
|
865
402
|
// pkgs/@akanjs/devkit/src/executors.ts
|
|
403
|
+
var import_common = require("@akanjs/common");
|
|
404
|
+
var import_config = require("@akanjs/config");
|
|
866
405
|
var import_child_process = require("child_process");
|
|
867
|
-
var
|
|
406
|
+
var import_fs6 = __toESM(require("fs"));
|
|
868
407
|
var import_promises = __toESM(require("fs/promises"));
|
|
869
|
-
var
|
|
408
|
+
var import_path = __toESM(require("path"));
|
|
870
409
|
|
|
871
410
|
// pkgs/@akanjs/devkit/src/dependencyScanner.ts
|
|
872
|
-
var
|
|
873
|
-
var
|
|
411
|
+
var fs6 = __toESM(require("fs"));
|
|
412
|
+
var path = __toESM(require("path"));
|
|
874
413
|
var ts2 = __toESM(require("typescript"));
|
|
875
414
|
var TypeScriptDependencyScanner = class {
|
|
876
415
|
constructor(directory) {
|
|
@@ -914,9 +453,9 @@ var TypeScriptDependencyScanner = class {
|
|
|
914
453
|
async #findTypeScriptFiles(directory) {
|
|
915
454
|
const files = [];
|
|
916
455
|
const processDirectory = async (dir) => {
|
|
917
|
-
const entries = await
|
|
456
|
+
const entries = await fs6.promises.readdir(dir, { withFileTypes: true });
|
|
918
457
|
for (const entry of entries) {
|
|
919
|
-
const fullPath =
|
|
458
|
+
const fullPath = path.join(dir, entry.name);
|
|
920
459
|
if (entry.isDirectory()) {
|
|
921
460
|
if (!["node_modules", "dist", "build", ".git", ".next", "public", "ios", "android"].includes(entry.name))
|
|
922
461
|
await processDirectory(fullPath);
|
|
@@ -932,26 +471,26 @@ var TypeScriptDependencyScanner = class {
|
|
|
932
471
|
return;
|
|
933
472
|
this.#visitedFiles.add(filePath);
|
|
934
473
|
try {
|
|
935
|
-
const fileContent = await
|
|
474
|
+
const fileContent = await fs6.promises.readFile(filePath, "utf-8");
|
|
936
475
|
const imports = this.#extractImports(fileContent, filePath);
|
|
937
476
|
const resolvedImports = imports.map((importPath) => {
|
|
938
477
|
if (importPath.startsWith(".")) {
|
|
939
|
-
const resolvedPath = "./" +
|
|
478
|
+
const resolvedPath = "./" + path.join(path.relative(baseDir, filePath), importPath);
|
|
940
479
|
return this.#ensureExtension(resolvedPath);
|
|
941
480
|
}
|
|
942
481
|
return importPath;
|
|
943
482
|
});
|
|
944
|
-
const relativePath =
|
|
483
|
+
const relativePath = path.relative(baseDir, filePath);
|
|
945
484
|
this.#fileDependencies.set(relativePath, resolvedImports);
|
|
946
485
|
} catch (error) {
|
|
947
486
|
}
|
|
948
487
|
}
|
|
949
488
|
#ensureExtension(filePath) {
|
|
950
|
-
if (
|
|
489
|
+
if (fs6.existsSync(`${filePath}.ts`))
|
|
951
490
|
return `${filePath}.ts`;
|
|
952
|
-
else if (
|
|
491
|
+
else if (fs6.existsSync(`${filePath}.tsx`))
|
|
953
492
|
return `${filePath}.tsx`;
|
|
954
|
-
else if (
|
|
493
|
+
else if (fs6.existsSync(filePath))
|
|
955
494
|
return filePath;
|
|
956
495
|
return `${filePath}.ts`;
|
|
957
496
|
}
|
|
@@ -1001,18 +540,18 @@ var Executor = class {
|
|
|
1001
540
|
logger;
|
|
1002
541
|
cwdPath;
|
|
1003
542
|
constructor(name, cwdPath) {
|
|
1004
|
-
this.logger = new Logger(name);
|
|
543
|
+
this.logger = new import_common.Logger(name);
|
|
1005
544
|
this.cwdPath = cwdPath;
|
|
1006
|
-
if (!
|
|
1007
|
-
|
|
545
|
+
if (!import_fs6.default.existsSync(cwdPath))
|
|
546
|
+
import_fs6.default.mkdirSync(cwdPath, { recursive: true });
|
|
1008
547
|
}
|
|
1009
548
|
exec(command, options = {}) {
|
|
1010
549
|
const proc = (0, import_child_process.exec)(command, { cwd: this.cwdPath, ...options });
|
|
1011
550
|
proc.stdout?.on("data", (data) => {
|
|
1012
|
-
Logger.raw(data.toString());
|
|
551
|
+
import_common.Logger.raw(data.toString());
|
|
1013
552
|
});
|
|
1014
553
|
proc.stderr?.on("data", (data) => {
|
|
1015
|
-
Logger.raw(data.toString());
|
|
554
|
+
import_common.Logger.raw(data.toString());
|
|
1016
555
|
});
|
|
1017
556
|
return new Promise((resolve, reject) => {
|
|
1018
557
|
proc.on("exit", (code, signal) => {
|
|
@@ -1026,7 +565,7 @@ var Executor = class {
|
|
|
1026
565
|
spawn(command, args = [], options = {}) {
|
|
1027
566
|
const proc = (0, import_child_process.spawn)(command, args, { cwd: this.cwdPath, stdio: "inherit", ...options });
|
|
1028
567
|
proc.stderr?.on("data", (data) => {
|
|
1029
|
-
Logger.raw(data.toString());
|
|
568
|
+
import_common.Logger.raw(data.toString());
|
|
1030
569
|
});
|
|
1031
570
|
return new Promise((resolve, reject) => {
|
|
1032
571
|
proc.on("exit", (code, signal) => {
|
|
@@ -1044,10 +583,10 @@ var Executor = class {
|
|
|
1044
583
|
...options
|
|
1045
584
|
});
|
|
1046
585
|
proc.stdout?.on("data", (data) => {
|
|
1047
|
-
Logger.raw(data.toString());
|
|
586
|
+
import_common.Logger.raw(data.toString());
|
|
1048
587
|
});
|
|
1049
588
|
proc.stderr?.on("data", (data) => {
|
|
1050
|
-
Logger.raw(data.toString());
|
|
589
|
+
import_common.Logger.raw(data.toString());
|
|
1051
590
|
});
|
|
1052
591
|
return new Promise((resolve, reject) => {
|
|
1053
592
|
proc.on("exit", (code, signal) => {
|
|
@@ -1059,28 +598,28 @@ var Executor = class {
|
|
|
1059
598
|
});
|
|
1060
599
|
}
|
|
1061
600
|
mkdir(dirPath) {
|
|
1062
|
-
const writePath =
|
|
1063
|
-
if (!
|
|
1064
|
-
|
|
601
|
+
const writePath = import_path.default.isAbsolute(dirPath) ? dirPath : `${this.cwdPath}/${dirPath}`;
|
|
602
|
+
if (!import_fs6.default.existsSync(writePath))
|
|
603
|
+
import_fs6.default.mkdirSync(writePath, { recursive: true });
|
|
1065
604
|
this.logger.verbose(`Make directory ${writePath}`);
|
|
1066
605
|
return this;
|
|
1067
606
|
}
|
|
1068
607
|
writeFile(filePath, content) {
|
|
1069
|
-
const writePath =
|
|
1070
|
-
const dir =
|
|
1071
|
-
if (!
|
|
1072
|
-
|
|
608
|
+
const writePath = import_path.default.isAbsolute(filePath) ? filePath : `${this.cwdPath}/${filePath}`;
|
|
609
|
+
const dir = import_path.default.dirname(writePath);
|
|
610
|
+
if (!import_fs6.default.existsSync(dir))
|
|
611
|
+
import_fs6.default.mkdirSync(dir, { recursive: true });
|
|
1073
612
|
const contentStr = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
1074
|
-
if (
|
|
1075
|
-
const currentContent =
|
|
613
|
+
if (import_fs6.default.existsSync(writePath)) {
|
|
614
|
+
const currentContent = import_fs6.default.readFileSync(writePath, "utf8");
|
|
1076
615
|
if (currentContent === contentStr)
|
|
1077
616
|
this.logger.verbose(`File ${writePath} is unchanged`);
|
|
1078
617
|
else {
|
|
1079
|
-
|
|
618
|
+
import_fs6.default.writeFileSync(writePath, contentStr, "utf8");
|
|
1080
619
|
this.logger.verbose(`File ${writePath} is changed`);
|
|
1081
620
|
}
|
|
1082
621
|
} else {
|
|
1083
|
-
|
|
622
|
+
import_fs6.default.writeFileSync(writePath, contentStr, "utf8");
|
|
1084
623
|
this.logger.verbose(`File ${writePath} is created`);
|
|
1085
624
|
}
|
|
1086
625
|
return this;
|
|
@@ -1090,16 +629,16 @@ var Executor = class {
|
|
|
1090
629
|
return this;
|
|
1091
630
|
}
|
|
1092
631
|
readFile(filePath) {
|
|
1093
|
-
const readPath =
|
|
1094
|
-
return
|
|
632
|
+
const readPath = import_path.default.isAbsolute(filePath) ? filePath : `${this.cwdPath}/${filePath}`;
|
|
633
|
+
return import_fs6.default.readFileSync(readPath, "utf8");
|
|
1095
634
|
}
|
|
1096
635
|
readJson(filePath) {
|
|
1097
|
-
const readPath =
|
|
1098
|
-
return JSON.parse(
|
|
636
|
+
const readPath = import_path.default.isAbsolute(filePath) ? filePath : `${this.cwdPath}/${filePath}`;
|
|
637
|
+
return JSON.parse(import_fs6.default.readFileSync(readPath, "utf8"));
|
|
1099
638
|
}
|
|
1100
639
|
async cp(srcPath, destPath) {
|
|
1101
|
-
const src =
|
|
1102
|
-
const dest =
|
|
640
|
+
const src = import_path.default.isAbsolute(srcPath) ? srcPath : `${this.cwdPath}/${srcPath}`;
|
|
641
|
+
const dest = import_path.default.isAbsolute(destPath) ? destPath : `${this.cwdPath}/${destPath}`;
|
|
1103
642
|
await import_promises.default.cp(src, dest, { recursive: true });
|
|
1104
643
|
}
|
|
1105
644
|
log(msg) {
|
|
@@ -1131,7 +670,7 @@ var Executor = class {
|
|
|
1131
670
|
const getContent = await import(templatePath);
|
|
1132
671
|
const content = getContent.default(scanResult ?? null, dict);
|
|
1133
672
|
const convertedTargetPath = Object.entries(dict).reduce(
|
|
1134
|
-
(
|
|
673
|
+
(path3, [key, value]) => path3.replace(new RegExp(`__${key}__`, "g"), value),
|
|
1135
674
|
targetPath.replace(".js", ".ts")
|
|
1136
675
|
);
|
|
1137
676
|
if (content === null)
|
|
@@ -1141,7 +680,7 @@ var Executor = class {
|
|
|
1141
680
|
} else if (targetPath.endsWith(".template")) {
|
|
1142
681
|
const content = await import_promises.default.readFile(templatePath, "utf8");
|
|
1143
682
|
const convertedTargetPath = Object.entries(dict).reduce(
|
|
1144
|
-
(
|
|
683
|
+
(path3, [key, value]) => path3.replace(new RegExp(`__${key}__`, "g"), value),
|
|
1145
684
|
targetPath.slice(0, -9)
|
|
1146
685
|
);
|
|
1147
686
|
const convertedContent = Object.entries(dict).reduce(
|
|
@@ -1159,25 +698,25 @@ var Executor = class {
|
|
|
1159
698
|
dict = {}
|
|
1160
699
|
}) {
|
|
1161
700
|
const templatePath = `${__dirname}/src/templates${template ? `/${template}` : ""}`.replace(".ts", ".js");
|
|
1162
|
-
if (
|
|
1163
|
-
const filename =
|
|
1164
|
-
await this.#applyTemplateFile({ templatePath, targetPath:
|
|
701
|
+
if (import_fs6.default.statSync(templatePath).isFile()) {
|
|
702
|
+
const filename = import_path.default.basename(templatePath);
|
|
703
|
+
await this.#applyTemplateFile({ templatePath, targetPath: import_path.default.join(basePath2, filename), scanResult }, dict);
|
|
1165
704
|
} else {
|
|
1166
|
-
if (!
|
|
705
|
+
if (!import_fs6.default.existsSync(basePath2))
|
|
1167
706
|
await import_promises.default.mkdir(basePath2, { recursive: true });
|
|
1168
707
|
const subdirs = await import_promises.default.readdir(templatePath);
|
|
1169
708
|
await Promise.all(
|
|
1170
709
|
subdirs.map(async (subdir) => {
|
|
1171
|
-
const subpath =
|
|
1172
|
-
if (
|
|
710
|
+
const subpath = import_path.default.join(templatePath, subdir);
|
|
711
|
+
if (import_fs6.default.statSync(subpath).isFile())
|
|
1173
712
|
await this.#applyTemplateFile(
|
|
1174
|
-
{ templatePath: subpath, targetPath:
|
|
713
|
+
{ templatePath: subpath, targetPath: import_path.default.join(basePath2, subdir), scanResult },
|
|
1175
714
|
dict
|
|
1176
715
|
);
|
|
1177
716
|
else
|
|
1178
717
|
await this.applyTemplate({
|
|
1179
|
-
basePath:
|
|
1180
|
-
template:
|
|
718
|
+
basePath: import_path.default.join(basePath2, subdir),
|
|
719
|
+
template: import_path.default.join(template, subdir),
|
|
1181
720
|
scanResult,
|
|
1182
721
|
dict
|
|
1183
722
|
});
|
|
@@ -1195,7 +734,7 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1195
734
|
this.repoName = repoName;
|
|
1196
735
|
}
|
|
1197
736
|
static fromRoot() {
|
|
1198
|
-
const repoName =
|
|
737
|
+
const repoName = import_path.default.basename(process.cwd());
|
|
1199
738
|
return new _WorkspaceExecutor({ workspaceRoot: process.cwd(), repoName });
|
|
1200
739
|
}
|
|
1201
740
|
async scan() {
|
|
@@ -1251,9 +790,9 @@ var WorkspaceExecutor = class _WorkspaceExecutor extends Executor {
|
|
|
1251
790
|
dirs.map(async (dir) => {
|
|
1252
791
|
if (AVOID_DIRS.includes(dir))
|
|
1253
792
|
return;
|
|
1254
|
-
const dirPath =
|
|
1255
|
-
if (
|
|
1256
|
-
const hasTargetFile =
|
|
793
|
+
const dirPath = import_path.default.join(dirname, dir);
|
|
794
|
+
if (import_fs6.default.lstatSync(dirPath).isDirectory()) {
|
|
795
|
+
const hasTargetFile = import_fs6.default.existsSync(import_path.default.join(dirPath, targetFilename));
|
|
1257
796
|
if (hasTargetFile)
|
|
1258
797
|
results.push(`${prefix}${dir}`);
|
|
1259
798
|
if (maxDepth > 0)
|
|
@@ -1277,7 +816,7 @@ var SysExecutor = class extends Executor {
|
|
|
1277
816
|
this.type = type;
|
|
1278
817
|
}
|
|
1279
818
|
async getConfig(command) {
|
|
1280
|
-
return this.type === "app" ? await getAppConfig(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command }) : await getLibConfig(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
819
|
+
return this.type === "app" ? await (0, import_config.getAppConfig)(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command }) : await (0, import_config.getLibConfig)(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
1281
820
|
}
|
|
1282
821
|
async scan({
|
|
1283
822
|
tsconfig = this.getTsConfig(`${this.cwdPath}/tsconfig.json`),
|
|
@@ -1289,31 +828,31 @@ var SysExecutor = class extends Executor {
|
|
|
1289
828
|
const scanner = new TypeScriptDependencyScanner(this.cwdPath);
|
|
1290
829
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
1291
830
|
const pkgPathSet = new Set(
|
|
1292
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((
|
|
831
|
+
Object.keys(tsconfig.compilerOptions.paths).filter((path3) => tsconfig.compilerOptions.paths[path3].some((resolve) => resolve.startsWith("pkgs/"))).map((path3) => path3.replace("/*", ""))
|
|
1293
832
|
);
|
|
1294
833
|
const libPathSet = new Set(
|
|
1295
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((
|
|
834
|
+
Object.keys(tsconfig.compilerOptions.paths).filter((path3) => tsconfig.compilerOptions.paths[path3].some((resolve) => resolve.startsWith("libs/"))).map((path3) => path3.replace("/*", ""))
|
|
1296
835
|
);
|
|
1297
836
|
const [npmDepSet, pkgPathDepSet, libPathDepSet] = await scanner.getImportSets([npmSet, pkgPathSet, libPathSet]);
|
|
1298
|
-
const pkgDeps = [...pkgPathDepSet].map((
|
|
1299
|
-
const pathSplitLength =
|
|
1300
|
-
return tsconfig.compilerOptions.paths[
|
|
837
|
+
const pkgDeps = [...pkgPathDepSet].map((path3) => {
|
|
838
|
+
const pathSplitLength = path3.split("/").length;
|
|
839
|
+
return tsconfig.compilerOptions.paths[path3][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1301
840
|
});
|
|
1302
|
-
const libDeps = [...libPathDepSet].map((
|
|
1303
|
-
const pathSplitLength =
|
|
1304
|
-
return tsconfig.compilerOptions.paths[
|
|
841
|
+
const libDeps = [...libPathDepSet].map((path3) => {
|
|
842
|
+
const pathSplitLength = path3.split("/").length;
|
|
843
|
+
return tsconfig.compilerOptions.paths[path3][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1305
844
|
}).filter((libName) => libName !== this.name);
|
|
1306
|
-
if (!
|
|
1307
|
-
|
|
1308
|
-
const files = getDefaultFileScan();
|
|
845
|
+
if (!import_fs6.default.existsSync(`${this.cwdPath}/lib/__scalar`))
|
|
846
|
+
import_fs6.default.mkdirSync(`${this.cwdPath}/lib/__scalar`, { recursive: true });
|
|
847
|
+
const files = (0, import_config.getDefaultFileScan)();
|
|
1309
848
|
const dirnames = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter(
|
|
1310
|
-
(name) =>
|
|
849
|
+
(name) => import_fs6.default.lstatSync(`${this.cwdPath}/lib/${name}`).isDirectory()
|
|
1311
850
|
);
|
|
1312
851
|
const databaseDirs = dirnames.filter((name) => !name.startsWith("_"));
|
|
1313
852
|
const serviceDirs = dirnames.filter((name) => name.startsWith("_") && !name.startsWith("__"));
|
|
1314
853
|
await Promise.all(
|
|
1315
854
|
databaseDirs.map(async (name) => {
|
|
1316
|
-
const filenames = await import_promises.default.readdir(
|
|
855
|
+
const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib", name));
|
|
1317
856
|
filenames.forEach((filename) => {
|
|
1318
857
|
if (filename.endsWith(".constant.ts"))
|
|
1319
858
|
files.constants.databases.push(name);
|
|
@@ -1335,7 +874,7 @@ var SysExecutor = class extends Executor {
|
|
|
1335
874
|
await Promise.all(
|
|
1336
875
|
serviceDirs.map(async (dirname) => {
|
|
1337
876
|
const name = dirname.slice(1);
|
|
1338
|
-
const filenames = await import_promises.default.readdir(
|
|
877
|
+
const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib", dirname));
|
|
1339
878
|
filenames.forEach((filename) => {
|
|
1340
879
|
if (filename.endsWith(".dictionary.ts"))
|
|
1341
880
|
files.dictionary.services.push(name);
|
|
@@ -1355,7 +894,7 @@ var SysExecutor = class extends Executor {
|
|
|
1355
894
|
);
|
|
1356
895
|
await Promise.all(
|
|
1357
896
|
scalarDirs.map(async (name) => {
|
|
1358
|
-
const filenames = await import_promises.default.readdir(
|
|
897
|
+
const filenames = await import_promises.default.readdir(import_path.default.join(this.cwdPath, "lib/__scalar", name));
|
|
1359
898
|
filenames.forEach((filename) => {
|
|
1360
899
|
if (filename.endsWith(".constant.ts"))
|
|
1361
900
|
files.constants.scalars.push(name);
|
|
@@ -1409,15 +948,15 @@ var SysExecutor = class extends Executor {
|
|
|
1409
948
|
return scanResult;
|
|
1410
949
|
}
|
|
1411
950
|
async getDatabaseModules() {
|
|
1412
|
-
const databaseModules = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_")).filter((name) =>
|
|
951
|
+
const databaseModules = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => !name.startsWith("_")).filter((name) => import_fs6.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.constant.ts`));
|
|
1413
952
|
return databaseModules;
|
|
1414
953
|
}
|
|
1415
954
|
async getServiceModules() {
|
|
1416
|
-
const serviceModules = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) =>
|
|
955
|
+
const serviceModules = (await import_promises.default.readdir(`${this.cwdPath}/lib`)).filter((name) => name.startsWith("_") && !name.startsWith("__")).filter((name) => import_fs6.default.existsSync(`${this.cwdPath}/lib/${name}/${name}.service.ts`));
|
|
1417
956
|
return serviceModules;
|
|
1418
957
|
}
|
|
1419
958
|
async getScalarModules() {
|
|
1420
|
-
const scalarModules = (await import_promises.default.readdir(`${this.cwdPath}/lib/__scalar`)).filter((name) => !name.startsWith("_")).filter((name) =>
|
|
959
|
+
const scalarModules = (await import_promises.default.readdir(`${this.cwdPath}/lib/__scalar`)).filter((name) => !name.startsWith("_")).filter((name) => import_fs6.default.existsSync(`${this.cwdPath}/lib/__scalar/${name}/${name}.constant.ts`));
|
|
1421
960
|
return scalarModules;
|
|
1422
961
|
}
|
|
1423
962
|
};
|
|
@@ -1431,13 +970,13 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
1431
970
|
return new _AppExecutor({ workspace: executor.workspace, name });
|
|
1432
971
|
}
|
|
1433
972
|
async getConfig(command) {
|
|
1434
|
-
return await getAppConfig(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
973
|
+
return await (0, import_config.getAppConfig)(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
1435
974
|
}
|
|
1436
975
|
async syncAssets(libDeps) {
|
|
1437
976
|
const projectPublicLibPath = `${this.cwdPath}/public/libs`;
|
|
1438
|
-
if (
|
|
977
|
+
if (import_fs6.default.existsSync(projectPublicLibPath))
|
|
1439
978
|
await import_promises.default.rm(projectPublicLibPath, { recursive: true });
|
|
1440
|
-
const targetDeps = libDeps.filter((dep) =>
|
|
979
|
+
const targetDeps = libDeps.filter((dep) => import_fs6.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`));
|
|
1441
980
|
await Promise.all(targetDeps.map((dep) => import_promises.default.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })));
|
|
1442
981
|
await Promise.all(
|
|
1443
982
|
targetDeps.map(
|
|
@@ -1472,7 +1011,7 @@ var LibExecutor = class _LibExecutor extends SysExecutor {
|
|
|
1472
1011
|
return new _LibExecutor({ workspace: executor.workspace, name });
|
|
1473
1012
|
}
|
|
1474
1013
|
async getConfig(command) {
|
|
1475
|
-
return await getLibConfig(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
1014
|
+
return await (0, import_config.getLibConfig)(this.cwdPath, { ...getBaseDevEnv(), appName: this.name, command });
|
|
1476
1015
|
}
|
|
1477
1016
|
};
|
|
1478
1017
|
var DistLibExecutor = class _DistLibExecutor extends Executor {
|
|
@@ -1508,12 +1047,12 @@ var PkgExecutor = class _PkgExecutor extends Executor {
|
|
|
1508
1047
|
const scanner = new TypeScriptDependencyScanner(this.cwdPath);
|
|
1509
1048
|
const npmSet = new Set(Object.keys({ ...rootPackageJson.dependencies, ...rootPackageJson.devDependencies }));
|
|
1510
1049
|
const pkgPathSet = new Set(
|
|
1511
|
-
Object.keys(tsconfig.compilerOptions.paths).filter((
|
|
1050
|
+
Object.keys(tsconfig.compilerOptions.paths).filter((path3) => tsconfig.compilerOptions.paths[path3].some((resolve) => resolve.startsWith("pkgs/"))).map((path3) => path3.replace("/*", ""))
|
|
1512
1051
|
);
|
|
1513
1052
|
const [npmDepSet, pkgPathDepSet] = await scanner.getImportSets([npmSet, pkgPathSet]);
|
|
1514
|
-
const pkgDeps = [...pkgPathDepSet].map((
|
|
1515
|
-
const pathSplitLength =
|
|
1516
|
-
return tsconfig.compilerOptions.paths[
|
|
1053
|
+
const pkgDeps = [...pkgPathDepSet].map((path3) => {
|
|
1054
|
+
const pathSplitLength = path3.split("/").length;
|
|
1055
|
+
return tsconfig.compilerOptions.paths[path3][0].split("/").slice(1, 1 + pathSplitLength).join("/");
|
|
1517
1056
|
}).filter((pkg) => pkg !== this.name);
|
|
1518
1057
|
const pkgScanResult = {
|
|
1519
1058
|
name: this.name,
|
|
@@ -1553,14 +1092,14 @@ var defaultHostConfig = {};
|
|
|
1553
1092
|
var defaultAkanGlobalConfig = {};
|
|
1554
1093
|
|
|
1555
1094
|
// pkgs/@akanjs/devkit/src/auth.ts
|
|
1556
|
-
var
|
|
1095
|
+
var import_fs7 = __toESM(require("fs"));
|
|
1557
1096
|
var getAkanGlobalConfig = () => {
|
|
1558
|
-
const akanConfig =
|
|
1097
|
+
const akanConfig = import_fs7.default.existsSync(configPath) ? JSON.parse(import_fs7.default.readFileSync(configPath, "utf8")) : defaultAkanGlobalConfig;
|
|
1559
1098
|
return akanConfig;
|
|
1560
1099
|
};
|
|
1561
1100
|
var setAkanGlobalConfig = (akanConfig) => {
|
|
1562
|
-
|
|
1563
|
-
|
|
1101
|
+
import_fs7.default.mkdirSync(basePath, { recursive: true });
|
|
1102
|
+
import_fs7.default.writeFileSync(configPath, JSON.stringify(akanConfig, null, 2));
|
|
1564
1103
|
};
|
|
1565
1104
|
var getHostConfig = (host = akanCloudHost) => {
|
|
1566
1105
|
const akanConfig = getAkanGlobalConfig();
|
|
@@ -1582,8 +1121,9 @@ var getSelf = async (token) => {
|
|
|
1582
1121
|
};
|
|
1583
1122
|
|
|
1584
1123
|
// pkgs/@akanjs/devkit/src/capacitorApp.ts
|
|
1124
|
+
var import_common2 = require("@akanjs/common");
|
|
1585
1125
|
var import_project = require("@trapezedev/project");
|
|
1586
|
-
var
|
|
1126
|
+
var import_fs8 = __toESM(require("fs"));
|
|
1587
1127
|
var CapacitorApp = class {
|
|
1588
1128
|
constructor(app) {
|
|
1589
1129
|
this.app = app;
|
|
@@ -1609,7 +1149,7 @@ var CapacitorApp = class {
|
|
|
1609
1149
|
await this.project.commit();
|
|
1610
1150
|
}
|
|
1611
1151
|
async releaseIos() {
|
|
1612
|
-
const isAdded =
|
|
1152
|
+
const isAdded = import_fs8.default.existsSync(`${this.app.cwdPath}/ios/App/Podfile`);
|
|
1613
1153
|
if (!isAdded) {
|
|
1614
1154
|
await this.app.spawn("npx cap add ios");
|
|
1615
1155
|
await this.app.spawn("npx @capacitor/assets generate");
|
|
@@ -1618,7 +1158,7 @@ var CapacitorApp = class {
|
|
|
1618
1158
|
await this.app.spawn("cross-env", ["APP_OPERATION_MODE=release", "npx", "cap", "sync", "ios"]);
|
|
1619
1159
|
}
|
|
1620
1160
|
async releaseAndroid() {
|
|
1621
|
-
const isAdded =
|
|
1161
|
+
const isAdded = import_fs8.default.existsSync(`${this.app.cwdPath}/android/app/build.gradle`);
|
|
1622
1162
|
if (!isAdded) {
|
|
1623
1163
|
await this.app.spawn("npx cap add android");
|
|
1624
1164
|
await this.app.spawn("npx @capacitor/assets generate");
|
|
@@ -1650,7 +1190,7 @@ var CapacitorApp = class {
|
|
|
1650
1190
|
}
|
|
1651
1191
|
async #setPermissionInIos(permissions) {
|
|
1652
1192
|
const updateNs = Object.fromEntries(
|
|
1653
|
-
Object.entries(permissions).map(([key, value]) => [`NS${capitalize(key)}`, value])
|
|
1193
|
+
Object.entries(permissions).map(([key, value]) => [`NS${(0, import_common2.capitalize)(key)}`, value])
|
|
1654
1194
|
);
|
|
1655
1195
|
await Promise.all([
|
|
1656
1196
|
this.project.ios.updateInfoPlist(this.iosTargetName, "Debug", updateNs),
|
|
@@ -1704,7 +1244,7 @@ var CapacitorApp = class {
|
|
|
1704
1244
|
};
|
|
1705
1245
|
|
|
1706
1246
|
// pkgs/@akanjs/devkit/src/extractDeps.ts
|
|
1707
|
-
var
|
|
1247
|
+
var fs10 = __toESM(require("fs"));
|
|
1708
1248
|
var NODE_NATIVE_MODULE_SET = /* @__PURE__ */ new Set([
|
|
1709
1249
|
"assert",
|
|
1710
1250
|
"async_hooks",
|
|
@@ -1750,7 +1290,7 @@ var NODE_NATIVE_MODULE_SET = /* @__PURE__ */ new Set([
|
|
|
1750
1290
|
var extractDependencies = (bundlePath, pacakgeJson, defaultDependencies = []) => {
|
|
1751
1291
|
if (!pacakgeJson.dependencies)
|
|
1752
1292
|
throw new Error("No dependencies found in package.json");
|
|
1753
|
-
const code =
|
|
1293
|
+
const code = fs10.readFileSync(bundlePath, "utf8");
|
|
1754
1294
|
const dependencies = new Set(defaultDependencies);
|
|
1755
1295
|
const existingDependencies = /* @__PURE__ */ new Set([
|
|
1756
1296
|
...Object.keys(pacakgeJson.dependencies ?? {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/devkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -18,18 +18,14 @@
|
|
|
18
18
|
"@inquirer/prompts": "^7.2.1",
|
|
19
19
|
"@langchain/core": "^0.3.27",
|
|
20
20
|
"@langchain/openai": "^0.3.16",
|
|
21
|
-
"@next/bundle-analyzer": "^15.1.3",
|
|
22
21
|
"@nx/devkit": "^20.7.2",
|
|
23
22
|
"@trapezedev/project": "^7.1.3",
|
|
24
23
|
"axios": "^1.7.9",
|
|
25
24
|
"commander": "^13.1.0",
|
|
26
|
-
"dayjs": "^1.11.13",
|
|
27
25
|
"dotenv": "^16.4.7",
|
|
28
26
|
"form-data": "^4.0.1",
|
|
29
27
|
"js-yaml": "^4.1.0",
|
|
30
|
-
"next-pwa": "^5.6.0",
|
|
31
28
|
"ora": "^3.4.0",
|
|
32
|
-
"pluralize": "^8.0.0",
|
|
33
29
|
"reflect-metadata": "^0.2.2",
|
|
34
30
|
"tunnel-ssh": "^5.2.0",
|
|
35
31
|
"typescript": "^5.8.3"
|