tego 1.3.44 → 1.3.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/lib/constants.d.ts +0 -1
- package/lib/constants.js +5 -6
- package/lib/index.js +6 -1
- package/lib/prepare.js +5 -6
- package/lib/utils.js +9 -10
- package/package.json +15 -15
- package/src/constants.ts +8 -4
- package/src/index.ts +8 -4
- package/src/prepare.ts +6 -7
- package/src/utils.ts +9 -10
package/lib/constants.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const DEFAULT_DEV_PLUGINS_PATH: string;
|
|
2
2
|
export declare const DEFAULT_REMOTE_PLUGINS_PATH: string;
|
|
3
3
|
export declare const DEFAULT_BUILTIN_PLUGINS_PATH: string;
|
|
4
|
-
export declare const DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH: string;
|
|
5
4
|
export declare const DEFAULT_WEB_PACKAGE_NAME = "@tego/web";
|
package/lib/constants.js
CHANGED
|
@@ -28,22 +28,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var constants_exports = {};
|
|
29
29
|
__export(constants_exports, {
|
|
30
30
|
DEFAULT_BUILTIN_PLUGINS_PATH: () => DEFAULT_BUILTIN_PLUGINS_PATH,
|
|
31
|
-
DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH: () => DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH,
|
|
32
31
|
DEFAULT_DEV_PLUGINS_PATH: () => DEFAULT_DEV_PLUGINS_PATH,
|
|
33
32
|
DEFAULT_REMOTE_PLUGINS_PATH: () => DEFAULT_REMOTE_PLUGINS_PATH,
|
|
34
33
|
DEFAULT_WEB_PACKAGE_NAME: () => DEFAULT_WEB_PACKAGE_NAME
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(constants_exports);
|
|
37
36
|
var import_node_path = __toESM(require("node:path"));
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const
|
|
37
|
+
var import_utils = require("./utils");
|
|
38
|
+
(0, import_utils.parseEnvironment)();
|
|
39
|
+
const DEFAULT_DEV_PLUGINS_PATH = import_node_path.default.join(process.env.TEGO_RUNTIME_HOME, "plugins", "dev");
|
|
40
|
+
const DEFAULT_REMOTE_PLUGINS_PATH = import_node_path.default.join(process.env.TEGO_RUNTIME_HOME, "plugins", "remote");
|
|
41
|
+
const DEFAULT_BUILTIN_PLUGINS_PATH = import_node_path.default.join(process.env.TEGO_RUNTIME_HOME, "plugins", "builtin");
|
|
42
42
|
const DEFAULT_WEB_PACKAGE_NAME = "@tego/web";
|
|
43
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
44
|
0 && (module.exports = {
|
|
45
45
|
DEFAULT_BUILTIN_PLUGINS_PATH,
|
|
46
|
-
DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH,
|
|
47
46
|
DEFAULT_DEV_PLUGINS_PATH,
|
|
48
47
|
DEFAULT_REMOTE_PLUGINS_PATH,
|
|
49
48
|
DEFAULT_WEB_PACKAGE_NAME
|
package/lib/index.js
CHANGED
|
@@ -31,7 +31,12 @@ var import_config = require("./config");
|
|
|
31
31
|
var import_plugin_presets = __toESM(require("./plugin-presets"));
|
|
32
32
|
var import_prepare = require("./prepare");
|
|
33
33
|
var import_utils2 = require("./utils");
|
|
34
|
-
(
|
|
34
|
+
if (!process.env.SERVE_PATH) {
|
|
35
|
+
const servePath = (0, import_utils2.guessServePath)();
|
|
36
|
+
if (servePath) {
|
|
37
|
+
process.env.SERVE_PATH = servePath;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
35
40
|
const program = new import_commander.Command();
|
|
36
41
|
program.name("tego").version(require("../package.json").version);
|
|
37
42
|
const run = /* @__PURE__ */ __name(async () => {
|
package/lib/prepare.js
CHANGED
|
@@ -62,10 +62,9 @@ async function prepare({
|
|
|
62
62
|
} catch {
|
|
63
63
|
npmExist = false;
|
|
64
64
|
}
|
|
65
|
-
const prefix = import_node_path.default.join(name, import_constants.DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH);
|
|
66
65
|
console.log("\u{1F680} ~ start download ~ front end files");
|
|
67
66
|
const spinner = (0, import_yocto_spinner.default)({ text: `Loading ${import_constants.DEFAULT_WEB_PACKAGE_NAME}` }).start();
|
|
68
|
-
await (0, import_utils.downloadTar)(import_constants.DEFAULT_WEB_PACKAGE_NAME, `${
|
|
67
|
+
await (0, import_utils.downloadTar)(import_constants.DEFAULT_WEB_PACKAGE_NAME, `${import_constants.DEFAULT_BUILTIN_PLUGINS_PATH}/${import_constants.DEFAULT_WEB_PACKAGE_NAME}`);
|
|
69
68
|
spinner.success();
|
|
70
69
|
console.log();
|
|
71
70
|
console.log("\u{1F680} ~ start download ~ required modules");
|
|
@@ -73,9 +72,9 @@ async function prepare({
|
|
|
73
72
|
let index = 1;
|
|
74
73
|
for (const moduleName of moduleNames) {
|
|
75
74
|
const spinner2 = (0, import_yocto_spinner.default)({ text: `[${index++}/${moduleNames.length}] Loading ${moduleName}` }).start();
|
|
76
|
-
await (0, import_utils.downloadTar)(moduleName, `${
|
|
75
|
+
await (0, import_utils.downloadTar)(moduleName, `${import_constants.DEFAULT_BUILTIN_PLUGINS_PATH}/${moduleName}`);
|
|
77
76
|
if (npmExist) {
|
|
78
|
-
await npmInstall(`${
|
|
77
|
+
await npmInstall(`${import_constants.DEFAULT_BUILTIN_PLUGINS_PATH}/${moduleName}`, spinner2);
|
|
79
78
|
}
|
|
80
79
|
spinner2.success();
|
|
81
80
|
}
|
|
@@ -85,9 +84,9 @@ async function prepare({
|
|
|
85
84
|
const pluginNames = plugins.map((pluginName) => `@tachybase/plugin-${pluginName}`);
|
|
86
85
|
for (const pluginName of pluginNames) {
|
|
87
86
|
const spinner2 = (0, import_yocto_spinner.default)({ text: `[${index++}/${pluginNames.length}] Loading ${pluginName}` }).start();
|
|
88
|
-
await (0, import_utils.downloadTar)(pluginName, `${
|
|
87
|
+
await (0, import_utils.downloadTar)(pluginName, `${import_constants.DEFAULT_BUILTIN_PLUGINS_PATH}/${pluginName}`);
|
|
89
88
|
if (npmExist) {
|
|
90
|
-
await npmInstall(`${
|
|
89
|
+
await npmInstall(`${import_constants.DEFAULT_BUILTIN_PLUGINS_PATH}/${pluginName}`, spinner2);
|
|
91
90
|
}
|
|
92
91
|
spinner2.success();
|
|
93
92
|
}
|
package/lib/utils.js
CHANGED
|
@@ -37,6 +37,7 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
37
37
|
var import_node_crypto = require("node:crypto");
|
|
38
38
|
var import_node_fs = __toESM(require("node:fs"));
|
|
39
39
|
var import_promises = require("node:fs/promises");
|
|
40
|
+
var import_node_os = __toESM(require("node:os"));
|
|
40
41
|
var import_node_path = require("node:path");
|
|
41
42
|
var import_promises2 = require("node:stream/promises");
|
|
42
43
|
var import_globals = __toESM(require("@tachybase/globals"));
|
|
@@ -79,20 +80,21 @@ function parseEnvironment() {
|
|
|
79
80
|
DEFAULT_STORAGE_TYPE: "local",
|
|
80
81
|
RUN_MODE: "engine",
|
|
81
82
|
LOCAL_STORAGE_DEST: "storage/uploads",
|
|
82
|
-
PLUGIN_STORAGE_PATH:
|
|
83
|
+
PLUGIN_STORAGE_PATH: "storage/plugins",
|
|
83
84
|
MFSU_AD: "none",
|
|
84
85
|
WS_PATH: "/ws",
|
|
85
86
|
SOCKET_PATH: "storage/gateway.sock",
|
|
86
|
-
PM2_HOME: (0, import_node_path.resolve)(process.cwd(), "./storage/.pm2"),
|
|
87
87
|
PLUGIN_PACKAGE_PREFIX: "@tachybase/plugin-,@tachybase/module-",
|
|
88
88
|
SERVER_TSCONFIG_PATH: "./tsconfig.server.json",
|
|
89
|
-
PLAYWRIGHT_AUTH_FILE:
|
|
89
|
+
PLAYWRIGHT_AUTH_FILE: "storage/playwright/.auth/admin.json",
|
|
90
90
|
CACHE_DEFAULT_STORE: "memory",
|
|
91
91
|
CACHE_MEMORY_MAX: 2e3,
|
|
92
92
|
PLUGIN_STATICS_PATH: "/static/plugins/",
|
|
93
93
|
LOGGER_BASE_PATH: "storage/logs",
|
|
94
94
|
APP_SERVER_BASE_URL: "",
|
|
95
|
-
APP_PUBLIC_PATH: "/"
|
|
95
|
+
APP_PUBLIC_PATH: "/",
|
|
96
|
+
TEGO_HOME: (0, import_node_path.join)(import_node_os.default.homedir(), ".tego"),
|
|
97
|
+
TEGO_RUNTIME_NAME: "current"
|
|
96
98
|
};
|
|
97
99
|
(0, import_dotenv.config)({
|
|
98
100
|
path: (0, import_node_path.resolve)(process.cwd(), process.env.APP_ENV_PATH || ".env")
|
|
@@ -102,6 +104,9 @@ function parseEnvironment() {
|
|
|
102
104
|
process.env[key] = env[key];
|
|
103
105
|
}
|
|
104
106
|
}
|
|
107
|
+
if (!process.env.TEGO_RUNTIME_HOME) {
|
|
108
|
+
process.env.TEGO_RUNTIME_HOME = (0, import_node_path.join)(process.env.TEGO_HOME, process.env.TEGO_RUNTIME_NAME);
|
|
109
|
+
}
|
|
105
110
|
if (!process.env.__env_modified__ && process.env.APP_PUBLIC_PATH) {
|
|
106
111
|
const publicPath = process.env.APP_PUBLIC_PATH.replace(/\/$/g, "");
|
|
107
112
|
const keys = ["API_BASE_PATH", "WS_PATH", "PLUGIN_STATICS_PATH"];
|
|
@@ -114,12 +119,6 @@ function parseEnvironment() {
|
|
|
114
119
|
process.env.API_BASE_URL = process.env.APP_SERVER_BASE_URL + process.env.API_BASE_PATH;
|
|
115
120
|
process.env.__env_modified__ = "1";
|
|
116
121
|
}
|
|
117
|
-
if (!process.env.SERVE_PATH) {
|
|
118
|
-
const servePath = guessServePath();
|
|
119
|
-
if (servePath) {
|
|
120
|
-
process.env.SERVE_PATH = servePath;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
122
|
}
|
|
124
123
|
__name(parseEnvironment, "parseEnvironment");
|
|
125
124
|
function guessServePath() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tego",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.46",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tego",
|
|
@@ -49,20 +49,20 @@
|
|
|
49
49
|
"umzug": "3.8.2",
|
|
50
50
|
"winston": "3.17.0",
|
|
51
51
|
"winston-daily-rotate-file": "^5.0.0",
|
|
52
|
-
"@tachybase/acl": "1.3.
|
|
53
|
-
"@tachybase/
|
|
54
|
-
"@tachybase/
|
|
55
|
-
"@tachybase/
|
|
56
|
-
"@tachybase/data-source": "1.3.
|
|
57
|
-
"@tachybase/evaluators": "1.3.
|
|
58
|
-
"@tachybase/globals": "1.3.
|
|
59
|
-
"@tachybase/
|
|
60
|
-
"@tachybase/
|
|
61
|
-
"@tachybase/logger": "1.3.
|
|
62
|
-
"@tachybase/resourcer": "1.3.
|
|
63
|
-
"@tachybase/schema": "1.3.
|
|
64
|
-
"@tachybase/utils": "1.3.
|
|
65
|
-
"@tego/core": "1.3.
|
|
52
|
+
"@tachybase/acl": "1.3.46",
|
|
53
|
+
"@tachybase/auth": "1.3.46",
|
|
54
|
+
"@tachybase/cache": "1.3.46",
|
|
55
|
+
"@tachybase/database": "1.3.46",
|
|
56
|
+
"@tachybase/data-source": "1.3.46",
|
|
57
|
+
"@tachybase/evaluators": "1.3.46",
|
|
58
|
+
"@tachybase/globals": "1.3.46",
|
|
59
|
+
"@tachybase/actions": "1.3.46",
|
|
60
|
+
"@tachybase/loader": "1.3.46",
|
|
61
|
+
"@tachybase/logger": "1.3.46",
|
|
62
|
+
"@tachybase/resourcer": "1.3.46",
|
|
63
|
+
"@tachybase/schema": "1.3.46",
|
|
64
|
+
"@tachybase/utils": "1.3.46",
|
|
65
|
+
"@tego/core": "1.3.46"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/lodash": "4.17.20",
|
package/src/constants.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { parseEnvironment } from './utils';
|
|
4
|
+
|
|
5
|
+
// 解析环境变量
|
|
6
|
+
parseEnvironment();
|
|
7
|
+
|
|
8
|
+
export const DEFAULT_DEV_PLUGINS_PATH = path.join(process.env.TEGO_RUNTIME_HOME, 'plugins', 'dev');
|
|
9
|
+
export const DEFAULT_REMOTE_PLUGINS_PATH = path.join(process.env.TEGO_RUNTIME_HOME, 'plugins', 'remote');
|
|
10
|
+
export const DEFAULT_BUILTIN_PLUGINS_PATH = path.join(process.env.TEGO_RUNTIME_HOME, 'plugins', 'builtin');
|
|
7
11
|
export const DEFAULT_WEB_PACKAGE_NAME = '@tego/web';
|
package/src/index.ts
CHANGED
|
@@ -3,17 +3,21 @@ import './preload';
|
|
|
3
3
|
import { performance } from 'node:perf_hooks';
|
|
4
4
|
import TachybaseGlobal from '@tachybase/globals';
|
|
5
5
|
import { createDevPluginsSymlink, createStoragePluginsSymlink } from '@tachybase/utils';
|
|
6
|
-
|
|
7
6
|
import { Gateway } from '@tego/core';
|
|
7
|
+
|
|
8
8
|
import { Command } from 'commander';
|
|
9
9
|
|
|
10
10
|
import { getConfig } from './config';
|
|
11
11
|
import PluginPresets from './plugin-presets';
|
|
12
12
|
import { prepare } from './prepare';
|
|
13
|
-
import {
|
|
13
|
+
import { guessServePath } from './utils';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
if (!process.env.SERVE_PATH) {
|
|
16
|
+
const servePath = guessServePath();
|
|
17
|
+
if (servePath) {
|
|
18
|
+
process.env.SERVE_PATH = servePath;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
17
21
|
|
|
18
22
|
const program = new Command();
|
|
19
23
|
program.name('tego').version(require('../package.json').version);
|
package/src/prepare.ts
CHANGED
|
@@ -5,7 +5,7 @@ import process from 'node:process';
|
|
|
5
5
|
import yoctoSpinner from '@socketregistry/yocto-spinner/index.cjs';
|
|
6
6
|
import execa from 'execa';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { DEFAULT_BUILTIN_PLUGINS_PATH, DEFAULT_WEB_PACKAGE_NAME } from './constants';
|
|
9
9
|
import { defaultModules } from './default-modules';
|
|
10
10
|
import { defaultPlugins } from './default-plugins';
|
|
11
11
|
import { downloadTar, initEnvFile } from './utils';
|
|
@@ -38,11 +38,10 @@ export async function prepare({
|
|
|
38
38
|
npmExist = false;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const prefix = path.join(name, DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH);
|
|
42
41
|
// 安装前端代码
|
|
43
42
|
console.log('🚀 ~ start download ~ front end files');
|
|
44
43
|
const spinner = yoctoSpinner({ text: `Loading ${DEFAULT_WEB_PACKAGE_NAME}` }).start();
|
|
45
|
-
await downloadTar(DEFAULT_WEB_PACKAGE_NAME, `${
|
|
44
|
+
await downloadTar(DEFAULT_WEB_PACKAGE_NAME, `${DEFAULT_BUILTIN_PLUGINS_PATH}/${DEFAULT_WEB_PACKAGE_NAME}`);
|
|
46
45
|
spinner.success();
|
|
47
46
|
console.log();
|
|
48
47
|
|
|
@@ -52,9 +51,9 @@ export async function prepare({
|
|
|
52
51
|
let index = 1;
|
|
53
52
|
for (const moduleName of moduleNames) {
|
|
54
53
|
const spinner = yoctoSpinner({ text: `[${index++}/${moduleNames.length}] Loading ${moduleName}` }).start();
|
|
55
|
-
await downloadTar(moduleName, `${
|
|
54
|
+
await downloadTar(moduleName, `${DEFAULT_BUILTIN_PLUGINS_PATH}/${moduleName}`);
|
|
56
55
|
if (npmExist) {
|
|
57
|
-
await npmInstall(`${
|
|
56
|
+
await npmInstall(`${DEFAULT_BUILTIN_PLUGINS_PATH}/${moduleName}`, spinner);
|
|
58
57
|
}
|
|
59
58
|
spinner.success();
|
|
60
59
|
}
|
|
@@ -66,9 +65,9 @@ export async function prepare({
|
|
|
66
65
|
const pluginNames = plugins.map((pluginName: string) => `@tachybase/plugin-${pluginName}`);
|
|
67
66
|
for (const pluginName of pluginNames) {
|
|
68
67
|
const spinner = yoctoSpinner({ text: `[${index++}/${pluginNames.length}] Loading ${pluginName}` }).start();
|
|
69
|
-
await downloadTar(pluginName, `${
|
|
68
|
+
await downloadTar(pluginName, `${DEFAULT_BUILTIN_PLUGINS_PATH}/${pluginName}`);
|
|
70
69
|
if (npmExist) {
|
|
71
|
-
await npmInstall(`${
|
|
70
|
+
await npmInstall(`${DEFAULT_BUILTIN_PLUGINS_PATH}/${pluginName}`, spinner);
|
|
72
71
|
}
|
|
73
72
|
spinner.success();
|
|
74
73
|
}
|
package/src/utils.ts
CHANGED
|
@@ -6,6 +6,7 @@ import fs, {
|
|
|
6
6
|
createWriteStream,
|
|
7
7
|
} from 'node:fs';
|
|
8
8
|
import { mkdir, unlink } from 'node:fs/promises';
|
|
9
|
+
import os from 'node:os';
|
|
9
10
|
import { dirname, join, resolve } from 'node:path';
|
|
10
11
|
import { pipeline } from 'node:stream/promises';
|
|
11
12
|
import TachybaseGlobal from '@tachybase/globals';
|
|
@@ -51,20 +52,21 @@ export function parseEnvironment() {
|
|
|
51
52
|
DEFAULT_STORAGE_TYPE: 'local',
|
|
52
53
|
RUN_MODE: 'engine',
|
|
53
54
|
LOCAL_STORAGE_DEST: 'storage/uploads',
|
|
54
|
-
PLUGIN_STORAGE_PATH:
|
|
55
|
+
PLUGIN_STORAGE_PATH: 'storage/plugins',
|
|
55
56
|
MFSU_AD: 'none',
|
|
56
57
|
WS_PATH: '/ws',
|
|
57
58
|
SOCKET_PATH: 'storage/gateway.sock',
|
|
58
|
-
PM2_HOME: resolve(process.cwd(), './storage/.pm2'),
|
|
59
59
|
PLUGIN_PACKAGE_PREFIX: '@tachybase/plugin-,@tachybase/module-',
|
|
60
60
|
SERVER_TSCONFIG_PATH: './tsconfig.server.json',
|
|
61
|
-
PLAYWRIGHT_AUTH_FILE:
|
|
61
|
+
PLAYWRIGHT_AUTH_FILE: 'storage/playwright/.auth/admin.json',
|
|
62
62
|
CACHE_DEFAULT_STORE: 'memory',
|
|
63
63
|
CACHE_MEMORY_MAX: 2000,
|
|
64
64
|
PLUGIN_STATICS_PATH: '/static/plugins/',
|
|
65
65
|
LOGGER_BASE_PATH: 'storage/logs',
|
|
66
66
|
APP_SERVER_BASE_URL: '',
|
|
67
67
|
APP_PUBLIC_PATH: '/',
|
|
68
|
+
TEGO_HOME: join(os.homedir(), '.tego'),
|
|
69
|
+
TEGO_RUNTIME_NAME: 'current',
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
config({
|
|
@@ -77,6 +79,10 @@ export function parseEnvironment() {
|
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
|
|
82
|
+
if (!process.env.TEGO_RUNTIME_HOME) {
|
|
83
|
+
process.env.TEGO_RUNTIME_HOME = join(process.env.TEGO_HOME!, process.env.TEGO_RUNTIME_NAME!);
|
|
84
|
+
}
|
|
85
|
+
|
|
80
86
|
if (!process.env.__env_modified__ && process.env.APP_PUBLIC_PATH) {
|
|
81
87
|
const publicPath = process.env.APP_PUBLIC_PATH.replace(/\/$/g, '');
|
|
82
88
|
const keys = ['API_BASE_PATH', 'WS_PATH', 'PLUGIN_STATICS_PATH'];
|
|
@@ -90,13 +96,6 @@ export function parseEnvironment() {
|
|
|
90
96
|
process.env.API_BASE_URL = process.env.APP_SERVER_BASE_URL + process.env.API_BASE_PATH;
|
|
91
97
|
process.env.__env_modified__ = '1';
|
|
92
98
|
}
|
|
93
|
-
|
|
94
|
-
if (!process.env.SERVE_PATH) {
|
|
95
|
-
const servePath = guessServePath();
|
|
96
|
-
if (servePath) {
|
|
97
|
-
process.env.SERVE_PATH = servePath;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
export function guessServePath() {
|