@tachybase/plugin-devkit 1.5.1 → 1.6.1

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,4 +1,4 @@
1
1
  module.exports = {
2
- "@tachybase/client": "1.5.1",
3
- "@tego/server": "1.3.52"
2
+ "@tachybase/client": "1.6.1",
3
+ "@tego/server": "1.6.0-alpha.9"
4
4
  };
File without changes
@@ -26,7 +26,28 @@ var import_node_fs = require("node:fs");
26
26
  var import_node_path = require("node:path");
27
27
  var import_fast_glob = require("fast-glob");
28
28
  var import_package = require("../../package.json");
29
- const ProjectRoot = process.cwd();
29
+ function detectProjectRoot() {
30
+ let dir = process.cwd();
31
+ const filesystemRoot = (0, import_node_path.parse)(dir).root;
32
+ while (dir && dir !== filesystemRoot) {
33
+ if ((0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "pnpm-workspace.yaml"))) {
34
+ return dir;
35
+ }
36
+ dir = (0, import_node_path.dirname)(dir);
37
+ }
38
+ dir = (0, import_node_path.dirname)((0, import_node_path.dirname)((0, import_node_path.dirname)(__dirname)));
39
+ while (dir && dir !== filesystemRoot) {
40
+ if ((0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "pnpm-workspace.yaml"))) {
41
+ return dir;
42
+ }
43
+ dir = (0, import_node_path.dirname)(dir);
44
+ }
45
+ return process.cwd();
46
+ }
47
+ function getProjectRoot() {
48
+ return detectProjectRoot();
49
+ }
50
+ const ProjectRoot = getProjectRoot();
30
51
  function getUmiConfig() {
31
52
  const { APP_PORT, API_BASE_URL, APP_PUBLIC_PATH } = process.env;
32
53
  const API_BASE_PATH = process.env.API_BASE_PATH || "/api/";
@@ -82,29 +103,31 @@ function getUmiConfig() {
82
103
  };
83
104
  }
84
105
  function getTsconfigPaths() {
85
- const content = (0, import_node_fs.readFileSync)((0, import_node_path.resolve)(ProjectRoot, "tsconfig.paths.json"), "utf-8");
106
+ const root = getProjectRoot();
107
+ const content = (0, import_node_fs.readFileSync)((0, import_node_path.resolve)(root, "tsconfig.paths.json"), "utf-8");
86
108
  const json = JSON.parse(content);
87
109
  return json.compilerOptions.paths;
88
110
  }
89
111
  function getPackagePaths() {
112
+ const root = getProjectRoot();
90
113
  const paths = getTsconfigPaths();
91
114
  const pkgs = [];
92
115
  for (const key in paths) {
93
116
  if (Object.hasOwnProperty.call(paths, key)) {
94
117
  for (let dir of paths[key]) {
95
118
  if (dir.includes("*")) {
96
- const files = (0, import_fast_glob.sync)(dir, { cwd: ProjectRoot, onlyDirectories: true });
119
+ const files = (0, import_fast_glob.sync)(dir, { cwd: root, onlyDirectories: true });
97
120
  for (const file of files) {
98
- const dirname = (0, import_node_path.resolve)(ProjectRoot, file);
121
+ const dirname = (0, import_node_path.resolve)(root, file);
99
122
  if ((0, import_node_fs.existsSync)(dirname)) {
100
123
  const re = new RegExp(dir.replace("*", "(.+)"));
101
- const p = dirname.substring(ProjectRoot.length + 1).split(import_node_path.sep).join("/");
124
+ const p = dirname.substring(root.length + 1).split(import_node_path.sep).join("/");
102
125
  const match = re.exec(p);
103
126
  pkgs.push([key.replace("*", match == null ? void 0 : match[1]), dirname]);
104
127
  }
105
128
  }
106
129
  } else {
107
- const dirname = (0, import_node_path.resolve)(ProjectRoot, dir);
130
+ const dirname = (0, import_node_path.resolve)(root, dir);
108
131
  pkgs.push([key, dirname]);
109
132
  }
110
133
  }
@@ -120,7 +143,8 @@ function resolveTachybasePackagesAlias(config) {
120
143
  }
121
144
  }
122
145
  function getNodeModulesPath(packageDir) {
123
- const node_modules_dir = (0, import_node_path.join)(ProjectRoot, "node_modules");
146
+ const root = getProjectRoot();
147
+ const node_modules_dir = (0, import_node_path.join)(root, "node_modules");
124
148
  return (0, import_node_path.join)(node_modules_dir, packageDir);
125
149
  }
126
150
  class IndexGenerator {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-devkit",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "main": "dist/server/index.js",
5
5
  "dependencies": {
6
6
  "@rsbuild/core": "^1.4.7",
@@ -10,9 +10,9 @@
10
10
  "fast-glob": "^3.3.3"
11
11
  },
12
12
  "devDependencies": {
13
- "@tachybase/test": "1.3.52",
14
- "@tego/client": "1.3.52",
15
- "@tego/server": "1.3.52",
16
- "@tachybase/client": "1.5.1"
13
+ "@tachybase/test": "1.6.0-alpha.9",
14
+ "@tego/client": "1.6.0-alpha.9",
15
+ "@tego/server": "1.6.0-alpha.9",
16
+ "@tachybase/client": "1.6.1"
17
17
  }
18
18
  }