tego 1.3.45 → 1.3.47

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.
@@ -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
- const DEFAULT_DEV_PLUGINS_PATH = import_node_path.default.resolve("plugins", "dev");
39
- const DEFAULT_REMOTE_PLUGINS_PATH = import_node_path.default.resolve("plugins", "remote");
40
- const DEFAULT_BUILTIN_PLUGINS_PATH = import_node_path.default.resolve("plugins", "builtin");
41
- const DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH = import_node_path.default.join("plugins", "builtin");
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
- (0, import_utils2.parseEnvironment)();
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, `${prefix}/${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, `${prefix}/${moduleName}`);
75
+ await (0, import_utils.downloadTar)(moduleName, `${import_constants.DEFAULT_BUILTIN_PLUGINS_PATH}/${moduleName}`);
77
76
  if (npmExist) {
78
- await npmInstall(`${prefix}/${moduleName}`, spinner2);
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, `${prefix}/${pluginName}`);
87
+ await (0, import_utils.downloadTar)(pluginName, `${import_constants.DEFAULT_BUILTIN_PLUGINS_PATH}/${pluginName}`);
89
88
  if (npmExist) {
90
- await npmInstall(`${prefix}/${pluginName}`, spinner2);
89
+ await npmInstall(`${import_constants.DEFAULT_BUILTIN_PLUGINS_PATH}/${pluginName}`, spinner2);
91
90
  }
92
91
  spinner2.success();
93
92
  }
package/lib/utils.js CHANGED
@@ -106,6 +106,9 @@ function parseEnvironment() {
106
106
  }
107
107
  if (!process.env.TEGO_RUNTIME_HOME) {
108
108
  process.env.TEGO_RUNTIME_HOME = (0, import_node_path.join)(process.env.TEGO_HOME, process.env.TEGO_RUNTIME_NAME);
109
+ if (!process.env.TEGO_RUNTIME_NAME && import_node_fs.default.existsSync((0, import_node_path.resolve)(process.cwd(), "storage"))) {
110
+ process.env.TEGO_RUNTIME_HOME = (0, import_node_path.resolve)(process.cwd(), "storage");
111
+ }
109
112
  }
110
113
  if (!process.env.__env_modified__ && process.env.APP_PUBLIC_PATH) {
111
114
  const publicPath = process.env.APP_PUBLIC_PATH.replace(/\/$/g, "");
@@ -119,12 +122,6 @@ function parseEnvironment() {
119
122
  process.env.API_BASE_URL = process.env.APP_SERVER_BASE_URL + process.env.API_BASE_PATH;
120
123
  process.env.__env_modified__ = "1";
121
124
  }
122
- if (!process.env.SERVE_PATH) {
123
- const servePath = guessServePath();
124
- if (servePath) {
125
- process.env.SERVE_PATH = servePath;
126
- }
127
- }
128
125
  }
129
126
  __name(parseEnvironment, "parseEnvironment");
130
127
  function guessServePath() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tego",
3
- "version": "1.3.45",
3
+ "version": "1.3.47",
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.45",
53
- "@tachybase/auth": "1.3.45",
54
- "@tachybase/actions": "1.3.45",
55
- "@tachybase/cache": "1.3.45",
56
- "@tachybase/data-source": "1.3.45",
57
- "@tachybase/evaluators": "1.3.45",
58
- "@tachybase/globals": "1.3.45",
59
- "@tachybase/database": "1.3.45",
60
- "@tachybase/loader": "1.3.45",
61
- "@tachybase/schema": "1.3.45",
62
- "@tachybase/resourcer": "1.3.45",
63
- "@tachybase/logger": "1.3.45",
64
- "@tachybase/utils": "1.3.45",
65
- "@tego/core": "1.3.45"
52
+ "@tachybase/acl": "1.3.47",
53
+ "@tachybase/actions": "1.3.47",
54
+ "@tachybase/auth": "1.3.47",
55
+ "@tachybase/cache": "1.3.47",
56
+ "@tachybase/data-source": "1.3.47",
57
+ "@tachybase/evaluators": "1.3.47",
58
+ "@tachybase/globals": "1.3.47",
59
+ "@tachybase/loader": "1.3.47",
60
+ "@tachybase/logger": "1.3.47",
61
+ "@tachybase/resourcer": "1.3.47",
62
+ "@tachybase/schema": "1.3.47",
63
+ "@tachybase/utils": "1.3.47",
64
+ "@tachybase/database": "1.3.47",
65
+ "@tego/core": "1.3.47"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@types/lodash": "4.17.20",
@@ -3,6 +3,13 @@ APP_ENV=development
3
3
  APP_PORT=3000
4
4
  APP_KEY=test-key
5
5
 
6
+ # 默认为 ~/.tego
7
+ TEGO_HOME=
8
+ # 默认为 current
9
+ TEGO_RUNTIME_NAME=
10
+ # 默认为 ~/.tego/current,设置后会覆盖 TEGO_RUNTIME_NAME
11
+ TEGO_RUNTIME_HOME=
12
+
6
13
  # experimental support
7
14
  EXTENSION_UI_BASE_PATH=/adapters/
8
15
 
package/src/constants.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import path from 'node:path';
2
2
 
3
- export const DEFAULT_DEV_PLUGINS_PATH = path.resolve('plugins', 'dev');
4
- export const DEFAULT_REMOTE_PLUGINS_PATH = path.resolve('plugins', 'remote');
5
- export const DEFAULT_BUILTIN_PLUGINS_PATH = path.resolve('plugins', 'builtin');
6
- export const DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH = path.join('plugins', 'builtin');
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 { parseEnvironment } from './utils';
13
+ import { guessServePath } from './utils';
14
14
 
15
- // 解析环境变量
16
- parseEnvironment();
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 { DEFAULT_BUILTIN_PLUGINS_RELATIVE_PATH, DEFAULT_WEB_PACKAGE_NAME } from './constants';
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, `${prefix}/${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, `${prefix}/${moduleName}`);
54
+ await downloadTar(moduleName, `${DEFAULT_BUILTIN_PLUGINS_PATH}/${moduleName}`);
56
55
  if (npmExist) {
57
- await npmInstall(`${prefix}/${moduleName}`, spinner);
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, `${prefix}/${pluginName}`);
68
+ await downloadTar(pluginName, `${DEFAULT_BUILTIN_PLUGINS_PATH}/${pluginName}`);
70
69
  if (npmExist) {
71
- await npmInstall(`${prefix}/${pluginName}`, spinner);
70
+ await npmInstall(`${DEFAULT_BUILTIN_PLUGINS_PATH}/${pluginName}`, spinner);
72
71
  }
73
72
  spinner.success();
74
73
  }
package/src/utils.ts CHANGED
@@ -81,6 +81,10 @@ export function parseEnvironment() {
81
81
 
82
82
  if (!process.env.TEGO_RUNTIME_HOME) {
83
83
  process.env.TEGO_RUNTIME_HOME = join(process.env.TEGO_HOME!, process.env.TEGO_RUNTIME_NAME!);
84
+ // 兼容旧版本过的用户
85
+ if (!process.env.TEGO_RUNTIME_NAME && fs.existsSync(resolve(process.cwd(), 'storage'))) {
86
+ process.env.TEGO_RUNTIME_HOME = resolve(process.cwd(), 'storage');
87
+ }
84
88
  }
85
89
 
86
90
  if (!process.env.__env_modified__ && process.env.APP_PUBLIC_PATH) {
@@ -96,13 +100,6 @@ export function parseEnvironment() {
96
100
  process.env.API_BASE_URL = process.env.APP_SERVER_BASE_URL + process.env.API_BASE_PATH;
97
101
  process.env.__env_modified__ = '1';
98
102
  }
99
-
100
- if (!process.env.SERVE_PATH) {
101
- const servePath = guessServePath();
102
- if (servePath) {
103
- process.env.SERVE_PATH = servePath;
104
- }
105
- }
106
103
  }
107
104
 
108
105
  export function guessServePath() {