@akanjs/devkit 0.0.53 → 0.0.54
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 +1 -17
- package/package.json +3 -17
- package/src/aiEditor.js +8 -27
- package/src/auth.js +23 -45
- package/src/baseDevEnv.js +4 -23
- package/src/capacitorApp.js +10 -39
- package/src/commandDecorators/argMeta.js +12 -31
- package/src/commandDecorators/command.js +30 -49
- package/src/commandDecorators/commandMeta.js +3 -22
- package/src/commandDecorators/index.js +5 -21
- package/src/commandDecorators/targetMeta.js +4 -23
- package/src/commandDecorators/types.js +0 -15
- package/src/constants.js +11 -30
- package/src/createTunnel.js +7 -26
- package/src/dependencyScanner.js +6 -35
- package/src/executors.js +91 -116
- package/src/extractDeps.js +3 -22
- package/src/getCredentials.js +7 -36
- package/src/getDependencies.js +5 -24
- package/src/getModelFileData.js +7 -36
- package/src/getRelatedCnsts.js +8 -37
- package/src/index.js +18 -34
- package/src/installExternalLib.js +3 -22
- package/src/selectModel.js +7 -36
- package/src/streamAi.js +8 -27
- package/src/types.d.ts +1 -0
- package/src/types.js +0 -15
- package/src/uploadRelease.js +16 -45
package/src/getModelFileData.js
CHANGED
|
@@ -1,45 +1,13 @@
|
|
|
1
|
-
|
|
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"));
|
|
1
|
+
import fs from "fs";
|
|
34
2
|
const getModelFileData = (modulePath, modelName) => {
|
|
35
3
|
const moduleType = modulePath.startsWith("apps") ? "app" : "lib";
|
|
36
4
|
const moduleName = modulePath.split("/")[1];
|
|
37
5
|
const constantFilePath = `${modulePath}/lib/${modelName}/${modelName}.constant.ts`;
|
|
38
6
|
const unitFilePath = `${modulePath}/lib/${modelName}/${modelName}.Unit.tsx`;
|
|
39
7
|
const viewFilePath = `${modulePath}/lib/${modelName}/${modelName}.View.tsx`;
|
|
40
|
-
const constantFileStr =
|
|
41
|
-
const unitFileStr =
|
|
42
|
-
const viewFileStr =
|
|
8
|
+
const constantFileStr = fs.readFileSync(constantFilePath, "utf8");
|
|
9
|
+
const unitFileStr = fs.readFileSync(unitFilePath, "utf8");
|
|
10
|
+
const viewFileStr = fs.readFileSync(viewFilePath, "utf8");
|
|
43
11
|
const constantFileLines = constantFileStr.split("\n");
|
|
44
12
|
const importLibNames = constantFileLines.filter((line) => line.startsWith("import { cnst as ")).map((line) => line.split("cnst as ")[1].split(" ")[0]);
|
|
45
13
|
const importLocalPaths = constantFileLines.filter((line) => line.startsWith("import { ") && line.includes('from "../')).map((line) => line.split("from ")[1].split('"')[1]);
|
|
@@ -60,3 +28,6 @@ const getModelFileData = (modulePath, modelName) => {
|
|
|
60
28
|
viewFileStr
|
|
61
29
|
};
|
|
62
30
|
};
|
|
31
|
+
export {
|
|
32
|
+
getModelFileData
|
|
33
|
+
};
|
package/src/getRelatedCnsts.js
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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"));
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import ora from "ora";
|
|
3
|
+
import * as ts from "typescript";
|
|
36
4
|
const getRelatedCnsts = (constantFilePath) => {
|
|
37
5
|
const tsConfigPath = `./tsconfig.json`;
|
|
38
6
|
const configFile = ts.readConfigFile(tsConfigPath, (path) => {
|
|
@@ -41,7 +9,7 @@ const getRelatedCnsts = (constantFilePath) => {
|
|
|
41
9
|
const parsedConfig = ts.parseJsonConfigFileContent(
|
|
42
10
|
configFile.config,
|
|
43
11
|
ts.sys,
|
|
44
|
-
|
|
12
|
+
fs.realpathSync(tsConfigPath).replace(/[^/\\]+$/, "")
|
|
45
13
|
);
|
|
46
14
|
const propertyMap = /* @__PURE__ */ new Map();
|
|
47
15
|
function findPropertyOriginAll(filePath) {
|
|
@@ -130,9 +98,12 @@ const getRelatedCnsts = (constantFilePath) => {
|
|
|
130
98
|
}
|
|
131
99
|
return visit(source);
|
|
132
100
|
}
|
|
133
|
-
const spinner = (
|
|
101
|
+
const spinner = ora("Finding property origin...");
|
|
134
102
|
spinner.start();
|
|
135
103
|
const paths = findPropertyOriginAll(constantFilePath);
|
|
136
104
|
spinner.succeed("property origin found.");
|
|
137
105
|
return { paths };
|
|
138
106
|
};
|
|
107
|
+
export {
|
|
108
|
+
getRelatedCnsts
|
|
109
|
+
};
|
package/src/index.js
CHANGED
|
@@ -1,34 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
__reExport(src_exports, require("./getCredentials"), module.exports);
|
|
20
|
-
__reExport(src_exports, require("./getDependencies"), module.exports);
|
|
21
|
-
__reExport(src_exports, require("./uploadRelease"), module.exports);
|
|
22
|
-
__reExport(src_exports, require("./getModelFileData"), module.exports);
|
|
23
|
-
__reExport(src_exports, require("./getRelatedCnsts"), module.exports);
|
|
24
|
-
__reExport(src_exports, require("./selectModel"), module.exports);
|
|
25
|
-
__reExport(src_exports, require("./streamAi"), module.exports);
|
|
26
|
-
__reExport(src_exports, require("./executors"), module.exports);
|
|
27
|
-
__reExport(src_exports, require("./dependencyScanner"), module.exports);
|
|
28
|
-
__reExport(src_exports, require("./constants"), module.exports);
|
|
29
|
-
__reExport(src_exports, require("./auth"), module.exports);
|
|
30
|
-
__reExport(src_exports, require("./types"), module.exports);
|
|
31
|
-
__reExport(src_exports, require("./capacitorApp"), module.exports);
|
|
32
|
-
__reExport(src_exports, require("./extractDeps"), module.exports);
|
|
33
|
-
__reExport(src_exports, require("./commandDecorators"), module.exports);
|
|
34
|
-
__reExport(src_exports, require("./installExternalLib"), module.exports);
|
|
1
|
+
export * from "./baseDevEnv";
|
|
2
|
+
export * from "./createTunnel";
|
|
3
|
+
export * from "./getCredentials";
|
|
4
|
+
export * from "./getDependencies";
|
|
5
|
+
export * from "./uploadRelease";
|
|
6
|
+
export * from "./getModelFileData";
|
|
7
|
+
export * from "./getRelatedCnsts";
|
|
8
|
+
export * from "./selectModel";
|
|
9
|
+
export * from "./streamAi";
|
|
10
|
+
export * from "./executors";
|
|
11
|
+
export * from "./dependencyScanner";
|
|
12
|
+
export * from "./constants";
|
|
13
|
+
export * from "./auth";
|
|
14
|
+
export * from "./types";
|
|
15
|
+
export * from "./capacitorApp";
|
|
16
|
+
export * from "./extractDeps";
|
|
17
|
+
export * from "./commandDecorators";
|
|
18
|
+
export * from "./installExternalLib";
|
|
@@ -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 installExternalLib_exports = {};
|
|
19
|
-
__export(installExternalLib_exports, {
|
|
20
|
-
installExternalLib: () => installExternalLib
|
|
21
|
-
});
|
|
22
|
-
module.exports = __toCommonJS(installExternalLib_exports);
|
|
23
1
|
const utilGitRepo = "git@github.com:akan-team/util.git";
|
|
24
2
|
const sharedGitRepo = "git@github.com:akan-team/shared.git";
|
|
25
3
|
const installExternalLib = async (libName, workspace) => {
|
|
@@ -27,3 +5,6 @@ const installExternalLib = async (libName, workspace) => {
|
|
|
27
5
|
await workspace.exec(`git remote add ${libName} git@github.com:akan-team/${libName}.git`);
|
|
28
6
|
await workspace.exec(`git subtree add --prefix=libs/${libName} ${libName} main`);
|
|
29
7
|
};
|
|
8
|
+
export {
|
|
9
|
+
installExternalLib
|
|
10
|
+
};
|
package/src/selectModel.js
CHANGED
|
@@ -1,42 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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"));
|
|
1
|
+
import { select } from "@inquirer/prompts";
|
|
2
|
+
import fs from "fs";
|
|
35
3
|
const selectModel = async (modulePath) => {
|
|
36
|
-
const modelNames =
|
|
37
|
-
const modelName = await
|
|
4
|
+
const modelNames = fs.readdirSync(`${modulePath}/lib`).filter((dir) => !dir.includes(".") && !dir.startsWith("_"));
|
|
5
|
+
const modelName = await select({
|
|
38
6
|
message: "Select the model to create the unit for",
|
|
39
7
|
choices: modelNames.map((name) => ({ name, value: name }))
|
|
40
8
|
});
|
|
41
9
|
return modelName;
|
|
42
10
|
};
|
|
11
|
+
export {
|
|
12
|
+
selectModel
|
|
13
|
+
};
|
package/src/streamAi.js
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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");
|
|
1
|
+
import { PromptTemplate } from "@langchain/core/prompts";
|
|
2
|
+
import { RunnableSequence } from "@langchain/core/runnables";
|
|
3
|
+
import { ChatOpenAI } from "@langchain/openai";
|
|
26
4
|
const streamAi = async (question, callback) => {
|
|
27
5
|
const createStreamingModel = (apiKey = process.env.DEEPSEEK_API_KEY) => {
|
|
28
6
|
if (!apiKey)
|
|
29
7
|
throw new Error(`process.env.DEEPSEEK_API_KEY is not set`);
|
|
30
|
-
return new
|
|
8
|
+
return new ChatOpenAI({
|
|
31
9
|
modelName: "deepseek-reasoner",
|
|
32
10
|
temperature: 0.7,
|
|
33
11
|
streaming: true,
|
|
@@ -36,7 +14,7 @@ const streamAi = async (question, callback) => {
|
|
|
36
14
|
});
|
|
37
15
|
};
|
|
38
16
|
const createProcessingChain = () => {
|
|
39
|
-
return
|
|
17
|
+
return RunnableSequence.from([PromptTemplate.fromTemplate(`Answer concisely: {question}`), createStreamingModel()]);
|
|
40
18
|
};
|
|
41
19
|
try {
|
|
42
20
|
const chain = createProcessingChain();
|
|
@@ -54,3 +32,6 @@ const streamAi = async (question, callback) => {
|
|
|
54
32
|
throw new Error("Failed to stream response");
|
|
55
33
|
}
|
|
56
34
|
};
|
|
35
|
+
export {
|
|
36
|
+
streamAi
|
|
37
|
+
};
|
package/src/types.d.ts
CHANGED
package/src/types.js
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
-
var types_exports = {};
|
|
15
|
-
module.exports = __toCommonJS(types_exports);
|
package/src/uploadRelease.js
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 uploadRelease_exports = {};
|
|
29
|
-
__export(uploadRelease_exports, {
|
|
30
|
-
uploadRelease: () => uploadRelease
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(uploadRelease_exports);
|
|
33
|
-
var import_axios = __toESM(require("axios"));
|
|
34
|
-
var import_form_data = __toESM(require("form-data"));
|
|
35
|
-
var import_fs = __toESM(require("fs"));
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import FormData from "form-data";
|
|
3
|
+
import fs from "fs";
|
|
36
4
|
const uploadRelease = async (projectName, {
|
|
37
5
|
workspaceRoot,
|
|
38
6
|
environment,
|
|
@@ -44,13 +12,13 @@ const uploadRelease = async (projectName, {
|
|
|
44
12
|
const buildPath = `${workspaceRoot}/releases/builds/${projectName}-release.tar.gz`;
|
|
45
13
|
const appBuildPath = `${workspaceRoot}/releases/builds/${projectName}-appBuild.zip`;
|
|
46
14
|
const sourcePath = `${workspaceRoot}/releases/sources/${projectName}-source.tar.gz`;
|
|
47
|
-
const formData = new
|
|
48
|
-
const build =
|
|
49
|
-
const source =
|
|
50
|
-
const appBuild =
|
|
51
|
-
const buildStat =
|
|
52
|
-
const sourceStat =
|
|
53
|
-
const appBuildStat =
|
|
15
|
+
const formData = new FormData();
|
|
16
|
+
const build = fs.readFileSync(buildPath);
|
|
17
|
+
const source = fs.readFileSync(sourcePath);
|
|
18
|
+
const appBuild = fs.readFileSync(appBuildPath);
|
|
19
|
+
const buildStat = fs.statSync(buildPath);
|
|
20
|
+
const sourceStat = fs.statSync(sourcePath);
|
|
21
|
+
const appBuildStat = fs.statSync(appBuildPath);
|
|
54
22
|
formData.append("files", build, `${projectName}-release.tar.gz`);
|
|
55
23
|
formData.append("files", source, `${projectName}-source.tar.gz`);
|
|
56
24
|
formData.append("files", appBuild, `${projectName}-appBuild.zip`);
|
|
@@ -64,14 +32,14 @@ const uploadRelease = async (projectName, {
|
|
|
64
32
|
);
|
|
65
33
|
formData.append("type", "release");
|
|
66
34
|
try {
|
|
67
|
-
const [buildFile, sourceFile, appBuildFile] = (await
|
|
35
|
+
const [buildFile, sourceFile, appBuildFile] = (await axios.post(`${basePath}/file/addFilesRestApi`, formData)).data;
|
|
68
36
|
const major = platformVersion ? parseInt(platformVersion.split(".")[0]) : 1;
|
|
69
37
|
const minor = platformVersion ? parseInt(platformVersion.split(".")[1]) : 0;
|
|
70
38
|
const patch = platformVersion ? parseInt(platformVersion.split(".")[2]) : 0;
|
|
71
|
-
const latestRelease = await
|
|
39
|
+
const latestRelease = await axios.get(
|
|
72
40
|
`${basePath}/release/findVersionRelease?appName=${projectName}&branch=${environment}&major=${major}&minor=${minor}`
|
|
73
41
|
);
|
|
74
|
-
const release = (await
|
|
42
|
+
const release = (await axios.post(
|
|
75
43
|
`${basePath}/release/pushRelease/${projectName}/${environment}/${major}/${minor}/${sourceFile.id}/${buildFile.id}/${appBuildFile.id}`
|
|
76
44
|
)).data;
|
|
77
45
|
return release;
|
|
@@ -79,3 +47,6 @@ const uploadRelease = async (projectName, {
|
|
|
79
47
|
return null;
|
|
80
48
|
}
|
|
81
49
|
};
|
|
50
|
+
export {
|
|
51
|
+
uploadRelease
|
|
52
|
+
};
|