@akanjs/devkit 0.0.32
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/README.md +11 -0
- package/index.d.ts +1 -0
- package/index.js +21 -0
- package/package.json +24 -0
- package/src/addText.d.ts +10 -0
- package/src/addText.js +44 -0
- package/src/baseDevEnv.d.ts +4 -0
- package/src/baseDevEnv.js +38 -0
- package/src/createTunnel.d.ts +7 -0
- package/src/createTunnel.js +41 -0
- package/src/explicitPackages.d.ts +9 -0
- package/src/explicitPackages.js +143 -0
- package/src/getCredentials.d.ts +18 -0
- package/src/getCredentials.js +44 -0
- package/src/getDependencies.d.ts +4 -0
- package/src/getDependencies.js +55 -0
- package/src/getExecutor.d.ts +13 -0
- package/src/getExecutor.js +94 -0
- package/src/getModelFileData.d.ts +16 -0
- package/src/getModelFileData.js +66 -0
- package/src/getRelatedCnsts.d.ts +9 -0
- package/src/getRelatedCnsts.js +142 -0
- package/src/getScriptExecutor.d.ts +13 -0
- package/src/getScriptExecutor.js +73 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +47 -0
- package/src/makeDocker.d.ts +8 -0
- package/src/makeDocker.js +61 -0
- package/src/selectModel.d.ts +1 -0
- package/src/selectModel.js +46 -0
- package/src/streamAi.d.ts +6 -0
- package/src/streamAi.js +60 -0
- package/src/syncAssets.d.ts +7 -0
- package/src/syncAssets.js +52 -0
- package/src/uploadRelease.d.ts +9 -0
- package/src/uploadRelease.js +85 -0
|
@@ -0,0 +1,66 @@
|
|
|
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 getModelFileData_exports = {};
|
|
29
|
+
__export(getModelFileData_exports, {
|
|
30
|
+
getModelFileData: () => getModelFileData
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(getModelFileData_exports);
|
|
33
|
+
var import_fs = __toESM(require("fs"));
|
|
34
|
+
const getModelFileData = (modulePath, modelName) => {
|
|
35
|
+
const moduleType = modulePath.startsWith("apps") ? "app" : "lib";
|
|
36
|
+
const moduleName = modulePath.split("/")[1];
|
|
37
|
+
const constantFilePath = `${modulePath}/lib/${modelName}/${modelName}.constant.ts`;
|
|
38
|
+
const unitFilePath = `${modulePath}/lib/${modelName}/${modelName}.Unit.tsx`;
|
|
39
|
+
const viewFilePath = `${modulePath}/lib/${modelName}/${modelName}.View.tsx`;
|
|
40
|
+
const constantFileStr = import_fs.default.readFileSync(constantFilePath, "utf8");
|
|
41
|
+
const unitFileStr = import_fs.default.readFileSync(unitFilePath, "utf8");
|
|
42
|
+
const viewFileStr = import_fs.default.readFileSync(viewFilePath, "utf8");
|
|
43
|
+
const constantFileLines = constantFileStr.split("\n");
|
|
44
|
+
const importLibNames = constantFileLines.filter((line) => line.startsWith("import { cnst as ")).map((line) => line.split("cnst as ")[1].split(" ")[0]);
|
|
45
|
+
const importLocalPaths = constantFileLines.filter((line) => line.startsWith("import { ") && line.includes('from "../')).map((line) => line.split("from ")[1].split('"')[1]);
|
|
46
|
+
const importModelNames = importLocalPaths.map((path) => path.split("/")[1]).filter((name) => !name.startsWith("_"));
|
|
47
|
+
const hasImportScalar = !!importLocalPaths.map((path) => path.split("/")[1]).filter((name) => name.startsWith("_")).length;
|
|
48
|
+
return {
|
|
49
|
+
moduleType,
|
|
50
|
+
moduleName,
|
|
51
|
+
modelName,
|
|
52
|
+
constantFilePath,
|
|
53
|
+
unitFilePath,
|
|
54
|
+
viewFilePath,
|
|
55
|
+
importModelNames,
|
|
56
|
+
hasImportScalar,
|
|
57
|
+
importLibNames,
|
|
58
|
+
constantFileStr,
|
|
59
|
+
unitFileStr,
|
|
60
|
+
viewFileStr
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
getModelFileData
|
|
66
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
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 getRelatedCnsts_exports = {};
|
|
29
|
+
__export(getRelatedCnsts_exports, {
|
|
30
|
+
getRelatedCnsts: () => getRelatedCnsts
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(getRelatedCnsts_exports);
|
|
33
|
+
var import_fs = __toESM(require("fs"));
|
|
34
|
+
var import_ora = __toESM(require("ora"));
|
|
35
|
+
var ts = __toESM(require("typescript"));
|
|
36
|
+
const getRelatedCnsts = (constantFilePath) => {
|
|
37
|
+
const tsConfigPath = `./tsconfig.json`;
|
|
38
|
+
const configFile = ts.readConfigFile(tsConfigPath, (path) => {
|
|
39
|
+
return ts.sys.readFile(path);
|
|
40
|
+
});
|
|
41
|
+
const parsedConfig = ts.parseJsonConfigFileContent(
|
|
42
|
+
configFile.config,
|
|
43
|
+
ts.sys,
|
|
44
|
+
import_fs.default.realpathSync(tsConfigPath).replace(/[^/\\]+$/, "")
|
|
45
|
+
);
|
|
46
|
+
const propertyMap = /* @__PURE__ */ new Map();
|
|
47
|
+
function findPropertyOriginAll(filePath) {
|
|
48
|
+
const program = ts.createProgram([filePath], parsedConfig.options);
|
|
49
|
+
const checker = program.getTypeChecker();
|
|
50
|
+
const source = program.getSourceFile(filePath);
|
|
51
|
+
if (!source)
|
|
52
|
+
return null;
|
|
53
|
+
function visit(node) {
|
|
54
|
+
if (!source)
|
|
55
|
+
return;
|
|
56
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
57
|
+
const left = node.expression;
|
|
58
|
+
const right = node.name;
|
|
59
|
+
const { line } = ts.getLineAndCharacterOfPosition(source, node.getStart());
|
|
60
|
+
//!Field.Prop 거르기가 빡세네.
|
|
61
|
+
const sourceLines = source.getFullText().split("\n");
|
|
62
|
+
if (ts.isIdentifier(left) && sourceLines.length && (sourceLines[line].includes(`@Field.Prop(() => ${left.text}.${right.text}`) || sourceLines[line].includes(`base.Filter(${left.text}.${right.text},`))) {
|
|
63
|
+
const symbol = checker.getSymbolAtLocation(right);
|
|
64
|
+
if (symbol?.declarations && symbol.declarations.length > 0) {
|
|
65
|
+
const key = symbol.declarations[0].getSourceFile().fileName.split("/").pop()?.split(".")[0] ?? "";
|
|
66
|
+
const property = propertyMap.get(key);
|
|
67
|
+
const isScalar = symbol.declarations[0].getSourceFile().fileName.includes("_");
|
|
68
|
+
const filePath2 = symbol.declarations[0].getSourceFile().fileName.replace(`${ts.sys.getCurrentDirectory()}/`, "");
|
|
69
|
+
if (property) {
|
|
70
|
+
propertyMap.set(`${left.text}.${right.text}`, {
|
|
71
|
+
filePath: filePath2,
|
|
72
|
+
isLibModule: true,
|
|
73
|
+
isImport: false,
|
|
74
|
+
libName: left.text,
|
|
75
|
+
isScalar
|
|
76
|
+
});
|
|
77
|
+
} else
|
|
78
|
+
propertyMap.set(key, {
|
|
79
|
+
filePath: filePath2,
|
|
80
|
+
isLibModule: true,
|
|
81
|
+
isImport: false,
|
|
82
|
+
libName: left.text,
|
|
83
|
+
isScalar
|
|
84
|
+
});
|
|
85
|
+
findPropertyOriginAll(filePath2);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} else if (ts.isImportDeclaration(node)) {
|
|
89
|
+
const importPath = node.moduleSpecifier.getText().slice(1, -1);
|
|
90
|
+
if (importPath.startsWith(".")) {
|
|
91
|
+
const resolved = ts.resolveModuleName(importPath, filePath, parsedConfig.options, ts.sys).resolvedModule?.resolvedFileName;
|
|
92
|
+
const moduleName = importPath.split("/").pop()?.split(".")[0] ?? "";
|
|
93
|
+
const property = propertyMap.get(moduleName);
|
|
94
|
+
const isScalar = importPath.includes("_");
|
|
95
|
+
if (moduleName && resolved && (!property || property.filePath !== resolved)) {
|
|
96
|
+
propertyMap.set(moduleName, {
|
|
97
|
+
filePath: resolved,
|
|
98
|
+
isLibModule: false,
|
|
99
|
+
isImport: true,
|
|
100
|
+
isScalar
|
|
101
|
+
});
|
|
102
|
+
findPropertyOriginAll(resolved);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
ts.forEachChild(node, visit);
|
|
107
|
+
}
|
|
108
|
+
visit(source);
|
|
109
|
+
return propertyMap;
|
|
110
|
+
}
|
|
111
|
+
function findPropertyOrigin(filePath, aliasName, libName) {
|
|
112
|
+
const program = ts.createProgram([filePath], parsedConfig.options);
|
|
113
|
+
const checker = program.getTypeChecker();
|
|
114
|
+
const source = program.getSourceFile(filePath);
|
|
115
|
+
const propertyMap2 = /* @__PURE__ */ new Map();
|
|
116
|
+
if (!source)
|
|
117
|
+
return null;
|
|
118
|
+
function visit(node) {
|
|
119
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
120
|
+
const left = node.expression;
|
|
121
|
+
const right = node.name;
|
|
122
|
+
if (ts.isIdentifier(left) && left.text === aliasName && right.text === libName) {
|
|
123
|
+
const symbol = checker.getSymbolAtLocation(right);
|
|
124
|
+
if (symbol?.declarations && symbol.declarations.length > 0) {
|
|
125
|
+
return symbol.declarations[0].getSourceFile().fileName;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return ts.forEachChild(node, visit) || null;
|
|
130
|
+
}
|
|
131
|
+
return visit(source);
|
|
132
|
+
}
|
|
133
|
+
const spinner = (0, import_ora.default)("Finding property origin...");
|
|
134
|
+
spinner.start();
|
|
135
|
+
const paths = findPropertyOriginAll(constantFilePath);
|
|
136
|
+
spinner.succeed("property origin found.");
|
|
137
|
+
return { paths };
|
|
138
|
+
};
|
|
139
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
140
|
+
0 && (module.exports = {
|
|
141
|
+
getRelatedCnsts
|
|
142
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface AppInfo {
|
|
2
|
+
appName: string;
|
|
3
|
+
projectConfig: any;
|
|
4
|
+
}
|
|
5
|
+
export interface LibInfo {
|
|
6
|
+
libName: string;
|
|
7
|
+
projectConfig: any;
|
|
8
|
+
}
|
|
9
|
+
export declare const getScriptExecutor: () => {
|
|
10
|
+
apps: AppInfo[];
|
|
11
|
+
libs: LibInfo[];
|
|
12
|
+
workspaceRoot: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
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 getScriptExecutor_exports = {};
|
|
29
|
+
__export(getScriptExecutor_exports, {
|
|
30
|
+
getScriptExecutor: () => getScriptExecutor
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(getScriptExecutor_exports);
|
|
33
|
+
var fs = __toESM(require("fs"));
|
|
34
|
+
const getScriptExecutor = () => {
|
|
35
|
+
const workspaceRoot = process.cwd();
|
|
36
|
+
const apps = fs.readdirSync(`${workspaceRoot}/apps`).filter((appName) => {
|
|
37
|
+
const isDirectory = fs.lstatSync(`${workspaceRoot}/apps/${appName}`).isDirectory();
|
|
38
|
+
if (!isDirectory)
|
|
39
|
+
return false;
|
|
40
|
+
const hasProjectJson = fs.existsSync(`${workspaceRoot}/apps/${appName}/project.json`);
|
|
41
|
+
if (!hasProjectJson)
|
|
42
|
+
return false;
|
|
43
|
+
return true;
|
|
44
|
+
}).map((appName) => {
|
|
45
|
+
const projectConfig = JSON.parse(
|
|
46
|
+
fs.readFileSync(`${workspaceRoot}/apps/${appName}/project.json`, "utf8")
|
|
47
|
+
);
|
|
48
|
+
return { appName, projectConfig };
|
|
49
|
+
});
|
|
50
|
+
const libs = fs.readdirSync(`${workspaceRoot}/libs`).filter((libName) => {
|
|
51
|
+
const isDirectory = fs.lstatSync(`${workspaceRoot}/libs/${libName}`).isDirectory();
|
|
52
|
+
if (!isDirectory)
|
|
53
|
+
return false;
|
|
54
|
+
const hasProjectJson = fs.existsSync(`${workspaceRoot}/libs/${libName}/project.json`);
|
|
55
|
+
if (!hasProjectJson)
|
|
56
|
+
return false;
|
|
57
|
+
return true;
|
|
58
|
+
}).map((libName) => {
|
|
59
|
+
const projectConfig = JSON.parse(
|
|
60
|
+
fs.readFileSync(`${workspaceRoot}/libs/${libName}/project.json`, "utf8")
|
|
61
|
+
);
|
|
62
|
+
return { libName, projectConfig };
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
apps,
|
|
66
|
+
libs,
|
|
67
|
+
workspaceRoot
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
getScriptExecutor
|
|
73
|
+
});
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./addText";
|
|
2
|
+
export * from "./createTunnel";
|
|
3
|
+
export * from "./explicitPackages";
|
|
4
|
+
export * from "./getCredentials";
|
|
5
|
+
export * from "./getDependencies";
|
|
6
|
+
export * from "./getExecutor";
|
|
7
|
+
export * from "./getScriptExecutor";
|
|
8
|
+
export * from "./makeDocker";
|
|
9
|
+
export * from "./syncAssets";
|
|
10
|
+
export * from "./uploadRelease";
|
|
11
|
+
export * from "./getModelFileData";
|
|
12
|
+
export * from "./getRelatedCnsts";
|
|
13
|
+
export * from "./selectModel";
|
|
14
|
+
export * from "./streamAi";
|
package/src/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var src_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
|
17
|
+
__reExport(src_exports, require("./addText"), module.exports);
|
|
18
|
+
__reExport(src_exports, require("./createTunnel"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./explicitPackages"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./getCredentials"), module.exports);
|
|
21
|
+
__reExport(src_exports, require("./getDependencies"), module.exports);
|
|
22
|
+
__reExport(src_exports, require("./getExecutor"), module.exports);
|
|
23
|
+
__reExport(src_exports, require("./getScriptExecutor"), module.exports);
|
|
24
|
+
__reExport(src_exports, require("./makeDocker"), module.exports);
|
|
25
|
+
__reExport(src_exports, require("./syncAssets"), module.exports);
|
|
26
|
+
__reExport(src_exports, require("./uploadRelease"), module.exports);
|
|
27
|
+
__reExport(src_exports, require("./getModelFileData"), module.exports);
|
|
28
|
+
__reExport(src_exports, require("./getRelatedCnsts"), module.exports);
|
|
29
|
+
__reExport(src_exports, require("./selectModel"), module.exports);
|
|
30
|
+
__reExport(src_exports, require("./streamAi"), module.exports);
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
...require("./addText"),
|
|
34
|
+
...require("./createTunnel"),
|
|
35
|
+
...require("./explicitPackages"),
|
|
36
|
+
...require("./getCredentials"),
|
|
37
|
+
...require("./getDependencies"),
|
|
38
|
+
...require("./getExecutor"),
|
|
39
|
+
...require("./getScriptExecutor"),
|
|
40
|
+
...require("./makeDocker"),
|
|
41
|
+
...require("./syncAssets"),
|
|
42
|
+
...require("./uploadRelease"),
|
|
43
|
+
...require("./getModelFileData"),
|
|
44
|
+
...require("./getRelatedCnsts"),
|
|
45
|
+
...require("./selectModel"),
|
|
46
|
+
...require("./streamAi")
|
|
47
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface MakeDockerParams {
|
|
2
|
+
workspaceRoot: string;
|
|
3
|
+
projectName: string;
|
|
4
|
+
repoName: string;
|
|
5
|
+
serveDomain: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const makeDocker: (type: "backend" | "frontend", branch: "debug" | "develop" | "main", { workspaceRoot, projectName, repoName, serveDomain }: MakeDockerParams) => void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
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 makeDocker_exports = {};
|
|
29
|
+
__export(makeDocker_exports, {
|
|
30
|
+
makeDocker: () => makeDocker
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(makeDocker_exports);
|
|
33
|
+
var import_fs = __toESM(require("fs"));
|
|
34
|
+
const makeDocker = (type, branch, { workspaceRoot, projectName, repoName, serveDomain }) => {
|
|
35
|
+
const dockerfileStr = `FROM ${type === "backend" ? "node:22-slim" : "node:22-alpine"}
|
|
36
|
+
RUN ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime
|
|
37
|
+
${type === "backend" ? `RUN apt-get update && apt-get upgrade -y
|
|
38
|
+
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
|
|
39
|
+
ARG TARGETARCH
|
|
40
|
+
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
|
|
41
|
+
RUN apt-get install -y git redis build-essential python3
|
|
42
|
+
RUN rm -rf /var/lib/apt/lists/*` : "RUN apk --no-cache add git"}
|
|
43
|
+
RUN mkdir -p /workspace
|
|
44
|
+
WORKDIR /workspace
|
|
45
|
+
COPY ./package.json ./package.json
|
|
46
|
+
RUN npx pnpm i --prod
|
|
47
|
+
COPY . .
|
|
48
|
+
ENV PORT ${type === "backend" ? "8080" : "4200"}
|
|
49
|
+
ENV NODE_OPTIONS=--max_old_space_size=8192
|
|
50
|
+
ENV NEXT_PUBLIC_REPO_NAME=${repoName}
|
|
51
|
+
ENV NEXT_PUBLIC_SERVE_DOMAIN=${serveDomain}
|
|
52
|
+
ENV NEXT_PUBLIC_APP_NAME=${projectName}
|
|
53
|
+
ENV NEXT_PUBLIC_ENV=${branch}
|
|
54
|
+
ENV NEXT_PUBLIC_OPERATION_MODE=cloud
|
|
55
|
+
CMD ${type === "backend" ? `["node", "main.js"]` : "npm start"}`;
|
|
56
|
+
import_fs.default.writeFileSync(`${workspaceRoot}/dist/apps/${projectName}/${type}/Dockerfile`, dockerfileStr);
|
|
57
|
+
};
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
makeDocker
|
|
61
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const selectModel: (modulePath: string) => Promise<string>;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 selectModel_exports = {};
|
|
29
|
+
__export(selectModel_exports, {
|
|
30
|
+
selectModel: () => selectModel
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(selectModel_exports);
|
|
33
|
+
var import_prompts = require("@inquirer/prompts");
|
|
34
|
+
var import_fs = __toESM(require("fs"));
|
|
35
|
+
const selectModel = async (modulePath) => {
|
|
36
|
+
const modelNames = import_fs.default.readdirSync(`${modulePath}/lib`).filter((dir) => !dir.includes(".") && !dir.startsWith("_"));
|
|
37
|
+
const modelName = await (0, import_prompts.select)({
|
|
38
|
+
message: "Select the model to create the unit for",
|
|
39
|
+
choices: modelNames.map((name) => ({ name, value: name }))
|
|
40
|
+
});
|
|
41
|
+
return modelName;
|
|
42
|
+
};
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
selectModel
|
|
46
|
+
});
|
package/src/streamAi.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
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 streamAi_exports = {};
|
|
19
|
+
__export(streamAi_exports, {
|
|
20
|
+
streamAi: () => streamAi
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(streamAi_exports);
|
|
23
|
+
var import_prompts = require("@langchain/core/prompts");
|
|
24
|
+
var import_runnables = require("@langchain/core/runnables");
|
|
25
|
+
var import_openai = require("@langchain/openai");
|
|
26
|
+
const streamAi = async (question, callback) => {
|
|
27
|
+
const createStreamingModel = (apiKey = process.env.DEEPSEEK_API_KEY) => {
|
|
28
|
+
if (!apiKey)
|
|
29
|
+
throw new Error(`process.env.DEEPSEEK_API_KEY is not set`);
|
|
30
|
+
return new import_openai.ChatOpenAI({
|
|
31
|
+
modelName: "deepseek-reasoner",
|
|
32
|
+
temperature: 0.7,
|
|
33
|
+
streaming: true,
|
|
34
|
+
// Enable streaming
|
|
35
|
+
configuration: { baseURL: "https://api.deepseek.com/v1", apiKey }
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const createProcessingChain = () => {
|
|
39
|
+
return import_runnables.RunnableSequence.from([import_prompts.PromptTemplate.fromTemplate(`Answer concisely: {question}`), createStreamingModel()]);
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
const chain = createProcessingChain();
|
|
43
|
+
const stream = await chain.stream({ question });
|
|
44
|
+
let fullResponse = "";
|
|
45
|
+
for await (const chunk of stream) {
|
|
46
|
+
const content = chunk.content;
|
|
47
|
+
if (typeof content === "string") {
|
|
48
|
+
fullResponse += content;
|
|
49
|
+
callback(content);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { content: fullResponse };
|
|
53
|
+
} catch (error) {
|
|
54
|
+
throw new Error("Failed to stream response");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
streamAi
|
|
60
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
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 syncAssets_exports = {};
|
|
29
|
+
__export(syncAssets_exports, {
|
|
30
|
+
syncAssets: () => syncAssets
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(syncAssets_exports);
|
|
33
|
+
var import_fs = __toESM(require("fs"));
|
|
34
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
35
|
+
const syncAssets = async ({ workspaceRoot, projectRoot, libDeps }) => {
|
|
36
|
+
const projectPublicLibPath = `${workspaceRoot}/${projectRoot}/public/libs`;
|
|
37
|
+
if (import_fs.default.existsSync(projectPublicLibPath))
|
|
38
|
+
await import_promises.default.rm(projectPublicLibPath, { recursive: true });
|
|
39
|
+
const targetDeps = libDeps.filter((dep) => import_fs.default.existsSync(`${workspaceRoot}/libs/${dep}/public`));
|
|
40
|
+
await Promise.all(targetDeps.map((dep) => import_promises.default.mkdir(`${projectPublicLibPath}/${dep}`, { recursive: true })));
|
|
41
|
+
await Promise.all(
|
|
42
|
+
targetDeps.map(
|
|
43
|
+
(dep) => import_promises.default.cp(`${workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
|
|
44
|
+
recursive: true
|
|
45
|
+
})
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
syncAssets
|
|
52
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const uploadRelease: (projectName: string, { workspaceRoot, branch, buildNum, platformVersion, local, }: {
|
|
2
|
+
workspaceRoot: string;
|
|
3
|
+
branch: "debug" | "develop" | "main";
|
|
4
|
+
buildNum: number;
|
|
5
|
+
platformVersion?: string;
|
|
6
|
+
local?: boolean;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
} | null>;
|