@nocobase/build 0.16.0-alpha.4 → 0.16.0-alpha.6

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.
@@ -38,18 +38,24 @@ var import_constant = require("../constant");
38
38
  var import_project = require("@lerna/project");
39
39
  var import_utils = require("./utils");
40
40
  function getPackagesPath(pkgs) {
41
- if (pkgs.length === 0) {
42
- return import_fast_glob.default.sync(["*/*/package.json", "*/*/*/package.json"], {
43
- cwd: import_constant.PACKAGES_PATH,
44
- absolute: true,
45
- onlyFiles: true
46
- }).map(import_utils.toUnixPath).map((item) => import_path.default.dirname(item));
47
- }
48
- return import_fast_glob.default.sync(pkgs, {
41
+ const allPackageJson = import_fast_glob.default.sync(["*/*/package.json", "*/*/*/package.json"], {
49
42
  cwd: import_constant.PACKAGES_PATH,
50
43
  absolute: true,
51
- onlyDirectories: true
52
- }).map(import_utils.toUnixPath);
44
+ onlyFiles: true
45
+ });
46
+ if (pkgs.length === 0) {
47
+ return allPackageJson.map(import_utils.toUnixPath).map((item) => import_path.default.dirname(item));
48
+ }
49
+ const allPackageInfo = allPackageJson.map((packageJsonPath) => ({ name: require(packageJsonPath).name, path: import_path.default.dirname((0, import_utils.toUnixPath)(packageJsonPath)) })).reduce((acc, cur) => {
50
+ acc[cur.name] = cur.path;
51
+ return acc;
52
+ }, {});
53
+ const allPackagePaths = Object.values(allPackageInfo);
54
+ const pkgNames = pkgs.filter((item) => allPackageInfo[item]);
55
+ const relativePaths = pkgNames.length ? pkgs.filter((item) => !pkgNames.includes(item)) : pkgs;
56
+ const pkgPaths = pkgs.map((item) => allPackageInfo[item]);
57
+ const absPaths = allPackagePaths.filter((absPath) => relativePaths.some((relativePath) => absPath.endsWith(relativePath)));
58
+ return [...pkgPaths, ...absPaths];
53
59
  }
54
60
  function getPackages(pkgs) {
55
61
  const packagePaths = getPackagesPath(pkgs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/build",
3
- "version": "0.16.0-alpha.4",
3
+ "version": "0.16.0-alpha.6",
4
4
  "description": "Library build tool based on rollup.",
5
5
  "main": "lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -36,5 +36,5 @@
36
36
  "scripts": {
37
37
  "build": "tsup"
38
38
  },
39
- "gitHead": "98d65186a22281e59209d11a6756712a62667c07"
39
+ "gitHead": "e8ad2328a8f85289cb19a7994d3fd726c7ae1720"
40
40
  }