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

fix: handle paths containing spaces #3232

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

paul-soporan
Copy link
Member

@paul-soporan paul-soporan commented Aug 5, 2021

What's the problem this PR addresses?

  • @yarnpkg/plugin-pnp's setupScriptEnvironment was doing an unnecessary Node version check
  • A few --require arguments in our boot-cli-devs / tests / docs were missing double quotes
  • @yarnpkg/plugin-pnp's setupScriptEnvironment was doing a quotePathIfNeeded which isn't consistent with the way pnpify does it (always adding double quotes)
  • Edit: Apparently pnpRegularExpression was broken with double-quoted paths or paths that include whitespace

How did you fix it?

  • Removed it
  • Added double quotes
  • Always add double quotes
  • Fixed it

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

merceyz
merceyz previously approved these changes Aug 5, 2021

if (xfs.existsSync(pnpPath)) {
let nodeOptions = env.NODE_OPTIONS || ``;

// We still support .pnp.js files to improve multi-project compatibility.
// TODO: Drop the question mark in the RegExp after .pnp.js files stop being used.
const pnpRegularExpression = /\s*--require\s+\S*\.pnp\.c?js\s*/g;
const pnpRegularExpression = /\s*--require\s+"?.*\.pnp\.c?js"?\s*/g;
Copy link
Member

@merceyz merceyz Aug 5, 2021

Choose a reason for hiding this comment

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

This deletes everything between the first and last --require flag

--require "C:/foo/.pnp.cjs" --foo="true" --require foo.bar.pnp.cjs

Seems neither of them handle a path with a space in it as well

@merceyz merceyz changed the title refactor: remove outdated check and quote more --require arguments fix: handle paths containing spaces Aug 5, 2021
@paul-soporan paul-soporan marked this pull request as draft August 5, 2021 21:22
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