@tego/devkit 1.3.43 → 1.3.45
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/builder/build/constant.mjs +2 -0
- package/lib/builder/buildable-packages/lib-package.mjs +2 -2
- package/lib/builder/buildable-packages/plugin-package.mjs +1 -1
- package/lib/commands/create-nginx-conf.mjs +1 -1
- package/lib/commands/p-test.mjs +2 -3
- package/lib/util.mjs +10 -5
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@ var PACKAGES_PATH = path.join(ROOT_PATH, "packages");
|
|
|
33
33
|
var getPluginPackages = (packages) => packages.filter((item) => !!item.manifest.name?.match(PATTERN_PLUGIN) || !!item.manifest.name?.match(PATTERN_MODULE));
|
|
34
34
|
var CORE_APP = path.join(ROOT_PATH, "apps/web");
|
|
35
35
|
var CORE_CLIENT = path.join(PACKAGES_PATH, "client");
|
|
36
|
+
var PACKAGE_CLIENT = "@tachybase/client";
|
|
36
37
|
var ESM_PACKAGES = ["@tachybase/test"];
|
|
37
38
|
var CJS_EXCLUDE_PACKAGES = [path.join(ROOT_PATH, "apps/devkit"), CORE_CLIENT, CORE_APP];
|
|
38
39
|
var getCjsPackages = (packages) => packages.filter((item) => !item.manifest.name?.match(PATTERN_PLUGIN)).filter((item) => !item.manifest.name?.match(PATTERN_MODULE)).filter((item) => !CJS_EXCLUDE_PACKAGES.includes(item.dir));
|
|
@@ -46,6 +47,7 @@ export {
|
|
|
46
47
|
EsbuildSupportExts,
|
|
47
48
|
NODE_MODULES,
|
|
48
49
|
PACKAGES_PATH,
|
|
50
|
+
PACKAGE_CLIENT,
|
|
49
51
|
PATTERN_MODULE,
|
|
50
52
|
PATTERN_PLUGIN,
|
|
51
53
|
PLUGIN_PATTRN,
|
|
@@ -3,7 +3,7 @@ import { buildCjs } from "../build/buildCjs.mjs";
|
|
|
3
3
|
import { buildClient } from "../build/buildClient.mjs";
|
|
4
4
|
import { buildDeclaration } from "../build/buildDeclaration.mjs";
|
|
5
5
|
import { buildEsm } from "../build/buildEsm.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { ESM_PACKAGES, PACKAGE_CLIENT } from "../build/constant.mjs";
|
|
7
7
|
import { tarPlugin } from "../build/tarPlugin.mjs";
|
|
8
8
|
import { getPkgLog, getUserConfig } from "../build/utils/index.mjs";
|
|
9
9
|
var LibPackage = class {
|
|
@@ -18,7 +18,7 @@ var LibPackage = class {
|
|
|
18
18
|
this.dir = dir;
|
|
19
19
|
this.context = context;
|
|
20
20
|
this.isEsm = ESM_PACKAGES.includes(this.name);
|
|
21
|
-
this.isClient = this.
|
|
21
|
+
this.isClient = this.name === PACKAGE_CLIENT;
|
|
22
22
|
}
|
|
23
23
|
async build() {
|
|
24
24
|
const log = getPkgLog(this.name);
|
|
@@ -8,7 +8,7 @@ var create_nginx_conf_default = (cli) => {
|
|
|
8
8
|
const file = resolve(__dirname, "../../tachybase.conf.tpl");
|
|
9
9
|
const data = readFileSync(file, "utf-8");
|
|
10
10
|
const replaced = data.replace(/\{\{cwd\}\}/g, "/app/tachybase").replace(/\{\{publicPath\}\}/g, process.env.APP_PUBLIC_PATH).replace(/\{\{apiPort\}\}/g, process.env.APP_PORT);
|
|
11
|
-
const targetFile = resolve(process.
|
|
11
|
+
const targetFile = resolve(process.env.TEGO_RUNTIME_HOME, "storage", "tachybase.conf");
|
|
12
12
|
writeFileSync(targetFile, replaced);
|
|
13
13
|
});
|
|
14
14
|
};
|
package/lib/commands/p-test.mjs
CHANGED
|
@@ -50,13 +50,12 @@ async function runApp(dir, index = 0) {
|
|
|
50
50
|
APP_PORT: 2e4 + index + "",
|
|
51
51
|
DB_DATABASE: `tachybase${index}`,
|
|
52
52
|
SOCKET_PATH: `storage/e2e/gateway-e2e-${index}.sock`,
|
|
53
|
-
|
|
54
|
-
PLAYWRIGHT_AUTH_FILE: resolve(process.cwd(), `storage/playwright/.auth/admin-${index}.json`)
|
|
53
|
+
PLAYWRIGHT_AUTH_FILE: `storage/playwright/.auth/admin-${index}.json`
|
|
55
54
|
}
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
async function pTest(options) {
|
|
59
|
-
const dir = resolve(process.
|
|
58
|
+
const dir = resolve(process.env.TEGO_RUNTIME_HOME, "storage/e2e");
|
|
60
59
|
if (!existsSync(dir)) {
|
|
61
60
|
mkdirSync(dir, { recursive: true });
|
|
62
61
|
}
|
package/lib/util.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { mkdir, readFile, stat, unlink, writeFile } from "fs/promises";
|
|
16
16
|
import { createRequire } from "module";
|
|
17
17
|
import { Socket } from "net";
|
|
18
|
+
import os from "os";
|
|
18
19
|
import { dirname, join, resolve, sep } from "path";
|
|
19
20
|
import { pipeline } from "stream/promises";
|
|
20
21
|
import chalk from "chalk";
|
|
@@ -239,7 +240,7 @@ async function genTsConfigPaths() {
|
|
|
239
240
|
}
|
|
240
241
|
function generatePlaywrightPath(clean = false) {
|
|
241
242
|
try {
|
|
242
|
-
const playwright = resolve(process.
|
|
243
|
+
const playwright = resolve(process.env.TEGO_RUNTIME_HOME, "storage/playwright/tests");
|
|
243
244
|
if (clean && _existsSync(playwright)) {
|
|
244
245
|
rmSync(dirname(playwright), { force: true, recursive: true });
|
|
245
246
|
}
|
|
@@ -273,20 +274,21 @@ function initEnv() {
|
|
|
273
274
|
DB_UNDERSCORED: parseEnv("DB_UNDERSCORED"),
|
|
274
275
|
DEFAULT_STORAGE_TYPE: "local",
|
|
275
276
|
LOCAL_STORAGE_DEST: "storage/uploads",
|
|
276
|
-
PLUGIN_STORAGE_PATH:
|
|
277
|
+
PLUGIN_STORAGE_PATH: "storage/plugins",
|
|
277
278
|
MFSU_AD: "none",
|
|
278
279
|
WS_PATH: "/ws",
|
|
279
280
|
SOCKET_PATH: "storage/gateway.sock",
|
|
280
|
-
PM2_HOME: resolve(process.cwd(), "./storage/.pm2"),
|
|
281
281
|
PLUGIN_PACKAGE_PREFIX: "@tachybase/plugin-,@tachybase/module-",
|
|
282
282
|
SERVER_TSCONFIG_PATH: "./tsconfig.server.json",
|
|
283
|
-
PLAYWRIGHT_AUTH_FILE:
|
|
283
|
+
PLAYWRIGHT_AUTH_FILE: "storage/playwright/.auth/admin.json",
|
|
284
284
|
CACHE_DEFAULT_STORE: "memory",
|
|
285
285
|
CACHE_MEMORY_MAX: 2e3,
|
|
286
286
|
PLUGIN_STATICS_PATH: "/static/plugins/",
|
|
287
287
|
LOGGER_BASE_PATH: "storage/logs",
|
|
288
288
|
APP_SERVER_BASE_URL: "",
|
|
289
|
-
APP_PUBLIC_PATH: "/"
|
|
289
|
+
APP_PUBLIC_PATH: "/",
|
|
290
|
+
TEGO_HOME: join(os.homedir(), ".tego"),
|
|
291
|
+
TEGO_RUNTIME_NAME: "current"
|
|
290
292
|
};
|
|
291
293
|
if (!process.env.APP_ENV_PATH && process.argv[2] && ["test", "test:client", "test:server"].includes(process.argv[2])) {
|
|
292
294
|
if (_existsSync(resolve(process.cwd(), ".env.test"))) {
|
|
@@ -315,6 +317,9 @@ function initEnv() {
|
|
|
315
317
|
process.env[key] = env[key];
|
|
316
318
|
}
|
|
317
319
|
}
|
|
320
|
+
if (!process.env.TEGO_RUNTIME_HOME) {
|
|
321
|
+
process.env.TEGO_RUNTIME_HOME = join(process.env.TEGO_HOME, process.env.TEGO_RUNTIME_NAME);
|
|
322
|
+
}
|
|
318
323
|
if (!process.env.__env_modified__ && process.env.APP_PUBLIC_PATH) {
|
|
319
324
|
const publicPath = process.env.APP_PUBLIC_PATH.replace(/\/$/g, "");
|
|
320
325
|
const keys = ["API_BASE_PATH", "WS_PATH", "PLUGIN_STATICS_PATH"];
|