Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDE-4678 fix(cli): add comments and fix a path issue in utils/build.js #742

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading