Skip to content

Commit

Permalink
PDE-4678 fix(cli): add comments and fix a path issue in utils/build.js (
Browse files Browse the repository at this point in the history
  • Loading branch information
eliangcs authored Feb 2, 2024
1 parent 3878106 commit 95680f6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/cli/src/utils/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ const maybeRunBuildScript = async (options = {}) => {
}
};

// Get `workspaces` from root package.json and convert them to absolute paths.
// Returns an empty array if package.json can't be found.
const listWorkspaces = (workspaceRoot) => {
const packageJsonPath = path.join(workspaceRoot, 'package.json');
if (!fs.existsSync(packageJsonPath)) {
Expand All @@ -333,7 +335,7 @@ const listWorkspaces = (workspaceRoot) => {
}

return (packageJson.workspaces || []).map((relpath) =>
path.join(workspaceRoot, relpath)
path.resolve(workspaceRoot, relpath)
);
};

Expand Down Expand Up @@ -395,6 +397,8 @@ const _buildFunc = async ({
fse.readlinkSync(src)
);
for (const workspace of workspaces) {
// Use minimatch to do glob pattern match. If match, it means the
// symlink points to a workspace package, so we don't copy it.
if (minimatch(realPath, workspace)) {
return false;
}
Expand Down

0 comments on commit 95680f6

Please sign in to comment.