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

Fixes 'yarn start' on Windows - LavaPack is not defined (#13318) #16550

Merged
merged 4 commits into from
Nov 30, 2022

Conversation

HowardBraham
Copy link
Contributor

@HowardBraham HowardBraham commented Nov 17, 2022

Fixes #13318, Fixes #13793, Fixes #14984, and Fixes #15237
Discussed with @kumavis and @danjm
Please let me know if this breaks another system and a more complicated fix is necessary.

Update 11/18/2022: Also adds a getPathInsideNodeModules helper function to end reliance on writing paths that start with ./node_modules/

@github-actions
Copy link
Contributor

github-actions bot commented Nov 17, 2022

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot
Copy link
Collaborator

Builds ready [6dd73eb]
Page Load Metrics (2351 ± 213 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint931105174215103
domContentLoaded169939342314447215
load174039342351444213
domInteractive169939342314447215
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

legobeat
legobeat previously approved these changes Nov 18, 2022
Copy link
Contributor

@legobeat legobeat left a comment

Choose a reason for hiding this comment

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

Can not speak for Windows. Does not break anything on Linux.

@matthewwalsh0
Copy link
Member

Not certain if it's the same issue, but I hit a similar error building on Windows previously and resolved it by updating the copy paths before they reached fast-glob.

async function copyGlob(baseDir, srcGlob, dest) {
    const fixedSrcGlob =
      process.platform === 'win32' ? srcGlob.replace(/\\/gu, '/') : srcGlob;

    const sources = await glob(fixedSrcGlob, { onlyFiles: false });

    await Promise.all(
      sources.map(async (src) => {
        const relativePath = path.relative(baseDir, src);
        await fs.copySync(src, `${dest}${relativePath}`);
      }),
    );
  }

@HowardBraham HowardBraham dismissed stale reviews from legobeat and ghost via 3ac7ae6 November 18, 2022 23:00
@HowardBraham HowardBraham force-pushed the fix/13318-lavapack-is-not-defined branch 2 times, most recently from 3ac7ae6 to 3ed04f1 Compare November 18, 2022 23:15
@metamaskbot
Copy link
Collaborator

Builds ready [3ed04f1]
Page Load Metrics (2352 ± 83 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint962486236517248
domContentLoaded19512580231716579
load19702624235217483
domInteractive19512580231716579
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

targetPath += pathToFiles;

if (process.platform === 'win32') {
targetPath = targetPath.replace(/\\/gu, '/');
Copy link
Contributor

Choose a reason for hiding this comment

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

Would path.normalize be helpful here?

Also path.sep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

path.normalize, or even path.posix.normalize will not work for this. Here's a discussion about it: nodejs/node#12298

I replaced with the following and pushed a new commit
targetPath.split(path.sep).join(path.posix.sep)

@HowardBraham HowardBraham force-pushed the fix/13318-lavapack-is-not-defined branch from da3ea54 to 3b5ec18 Compare November 19, 2022 22:58
Copy link
Contributor

@legobeat legobeat left a comment

Choose a reason for hiding this comment

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

One minor thing, LGTM otherwise!

legobeat
legobeat previously approved these changes Nov 21, 2022
@metamaskbot
Copy link
Collaborator

Builds ready [1313746]
Page Load Metrics (2184 ± 116 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint942401173115
domContentLoaded167725792166241116
load167725792184242116
domInteractive167725792166241116
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

Also adds a getPathInsideNodeModules helper function to end reliance on writing paths that start with './node_modules/'
@HowardBraham HowardBraham force-pushed the fix/13318-lavapack-is-not-defined branch from 1313746 to cbe45ac Compare November 21, 2022 19:08
@metamaskbot
Copy link
Collaborator

Builds ready [cbe45ac]
Page Load Metrics (2222 ± 121 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint962048216420202
domContentLoaded173725652208232112
load173726392222251121
domInteractive173725652208232112
Bundle size diffs
  • background: 0 bytes
  • ui: 0 bytes
  • common: 0 bytes

@metamaskbot
Copy link
Collaborator

Builds ready [f237fb8]
Page Load Metrics (2175 ± 138 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint912211223457219
domContentLoaded159727172146301144
load167427172175288138
domInteractive159727172146301144
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1722 bytes
  • ui: 17 bytes
  • common: 94 bytes

@jpuri
Copy link
Contributor

jpuri commented Nov 30, 2022

I tested the PR on mac and yarn start works well 👍

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@brad-decker brad-decker merged commit b1fd7f7 into develop Nov 30, 2022
@brad-decker brad-decker deleted the fix/13318-lavapack-is-not-defined branch November 30, 2022 15:19
@github-actions github-actions bot locked and limited conversation to collaborators Nov 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
7 participants