Skip to content

fix: match package.json to workspace definition - #2332

Merged
lili2311 merged 1 commit into
masterfrom
fix/yarn-workspaces-windows
Nov 2, 2021
Merged

fix: match package.json to workspace definition#2332
lili2311 merged 1 commit into
masterfrom
fix/yarn-workspaces-windows

Conversation

@lili2311

@lili2311 lili2311 commented Nov 1, 2021

Copy link
Copy Markdown
Contributor

What does this PR do?

Re-enable windows tests as they have been hiding the fact that the
feature broke on Windows.

Update the file matching logic to support both Windows & Linux file names
as well as different glob types.
e.g. 'package/*' is an example given in Yarn docs

Where should the reviewer start?

https://github.com/snyk/snyk/compare/fix/yarn-workspaces-windows?expand=1#diff-58a7b63707ecc3959ab8c5f5ec8cfb77660fc185f22cb4c2677b5af04180bba4R165

How should this be manually tested?

Any background context you want to provide?

Disabled tests did not catch that Windows support had a bug

What are the relevant tickets?

https://github.com/snyk/snyk/issues/1560

Screenshots

Additional questions

Re-enable windows tests as they have been hiding the fact that the
feature broke on Windows.

Update the file matching logic to support both Windows & Linux file names
as well as different glob types.
e.g. 'package/*' is an example given in Yarn docs
@lili2311
lili2311 force-pushed the fix/yarn-workspaces-windows branch from 7f39200 to a2dcfdc Compare November 1, 2021 16:03
// the order of folders is important
// the order of yarnTargetFiles folders is important
// must have the root level most folders at the top
// const yarnTargetFiles: {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

deleting commented out code

const match = micromatch.isMatch(
filePath,
workspacesGlobs.map((p) => (p.endsWith('/**') ? p : p + '/**')),
packageJsonFileName.replace(/\\/g, '/'),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

normalize all paths to / as \\ does not allow path.parse to identify the folder correctly

@github-actions

github-actions Bot commented Nov 1, 2021

Copy link
Copy Markdown
Contributor
Warnings
⚠️

Since the CLI is unifying on a standard and improved tooling, we're starting to migrate old-style imports and exports to ES6 ones.
A file you've modified is using either module.exports or require(). If you can, please update them to ES6 import syntax and export syntax.
Files found:

  • src/lib/plugins/nodejs-plugin/yarn-workspaces-parser.ts

Generated by 🚫 dangerJS against a2dcfdc

- Jakub
*/

const isWindows =

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

enable Windows tests again, every test run was successful with no flakes.

@jan-stehlik jan-stehlik 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.

thanks @lili2311 ❤️

@lili2311
lili2311 merged commit 860e89c into master Nov 2, 2021
@lili2311
lili2311 deleted the fix/yarn-workspaces-windows branch November 2, 2021 10:26
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.

2 participants