Skip to content

fix(npm): support workspace globs#159

Merged
dangreen merged 1 commit into
mainfrom
fix/npm-workspace-globs
Jun 30, 2026
Merged

fix(npm): support workspace globs#159
dangreen merged 1 commit into
mainfrom
fix/npm-workspace-globs

Conversation

@dangreen

Copy link
Copy Markdown
Member

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 28439957933

Coverage increased (+0.1%) to 64.313%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: 10 of 10 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 850
Covered Lines: 608
Line Coverage: 71.53%
Relevant Branches: 467
Covered Branches: 239
Branch Coverage: 51.18%
Branches in Coverage %: Yes
Coverage Strength: 9.87 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes npm workspace glob handling by expanding workspace patterns (e.g. packages/*) into actual package.json manifest paths, preventing attempts to open literal glob paths.

Changes:

  • Use fast-glob in the npm workspaces project implementation to resolve workspace glob patterns to concrete package.json paths.
  • Add a unit test covering glob-based workspace configuration in package.json.
  • Update npm package dependencies and the lockfile accordingly.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
pnpm-lock.yaml Adds fast-glob to the npm package importer and updates lockfile entries.
packages/npm/src/workspacesProject.ts Resolves npm workspace glob patterns via fast-glob instead of treating them as literal paths.
packages/npm/src/workspacesProject.spec.ts Adds a unit test for glob-based npm workspace configuration.
packages/npm/package.json Adds fast-glob as a runtime dependency for glob expansion.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +55 to 80
it('should parse workspace globs from package.json', async () => {
const { cwd } = await forkProject('npm-workspace-globs', packageJsonIndependentMonorepoProject())
const pkgJsonContent = await fs.readFile(join(cwd, 'package.json'), 'utf-8')
const pkgJson = JSON.parse(pkgJsonContent)

pkgJson.workspaces = [
'packages/*'
]

await fs.writeFile(join(cwd, 'package.json'), JSON.stringify(pkgJson))

const project = new NpmWorkspacesProject({
mode: 'independent',
root: cwd
})
const workspaces = await toArray(project.getProjects())
const manifestPaths = workspaces.map(workspace => workspace.manifest.manifestPath)

expect(manifestPaths).toEqual(expect.arrayContaining([
expect.stringContaining('packages/subproject-1/package.json'),
expect.stringContaining('packages/subproject-2/package.json'),
expect.stringContaining('packages/subproject-3/package.json')
]))
})
})
})
@dangreen dangreen merged commit 3ab2381 into main Jun 30, 2026
7 checks passed
@dangreen dangreen deleted the fix/npm-workspace-globs branch June 30, 2026 11:15
@github-actions github-actions Bot mentioned this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Globs are not supported in npm workspace configuration

3 participants