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

[core] Fix build on Windows #24187

Merged
merged 5 commits into from Dec 30, 2020
Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Dec 30, 2020

The build on Windows currently fails in

  • types: cp
  • envinfo npm pack. I have no idea why it fails, the error message doesn't seem to tell much. Considering we already had an issue with macOS and this very script, we might prefer the simplest approach even if not as elegant.
  • codemod: cp

@mnajdova Could you run lerna run --parallel --no-bail --scope \"@material-ui/*\" build to test that it works?

full log of the errors

yarn run v1.22.4erial-ui-release>lerna run --parallel --no-bail --scope "@material-ui/" build
$ D:\workspace\material-ui-release\node_modules.bin\lerna run --parallel --no-bail --scope ^"^"@material-ui/
^"^" builderable program or batch file.
lerna notice cli v3.22.1
lerna info versioning independentyarn lerna run --parallel --no-bail --scope "@material-ui/" build
lerna notice filter including "@material-ui/
"
lerna info filter [ '@material-ui/*' ]
lerna info Executing command in 13 packages: "yarn run build"
@material-ui/docs: $ rimraf build
@material-ui/envinfo: $ node scripts/build
@material-ui/codemod: $ rimraf build
@material-ui/icons: $ rimraf material-design-icons && rimraf build
@material-ui/lab: $ rimraf build
@material-ui/styled-engine-sc: $ rimraf build
@material-ui/styled-engine: $ rimraf build
@material-ui/styles: $ rimraf build
@material-ui/types: $ rimraf build
@material-ui/system: $ rimraf build
@material-ui/unstyled: $ rimraf build
@material-ui/envinfo: Error: spawn npm ENOENT
@material-ui/envinfo: at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
@material-ui/envinfo: at onErrorNT (internal/child_process.js:469:16)
@material-ui/envinfo: at processTicksAndRejections (internal/process/task_queues.js:84:21) {
@material-ui/envinfo: errno: 'ENOENT',
@material-ui/envinfo: code: 'ENOENT',
@material-ui/envinfo: syscall: 'spawn npm',
@material-ui/envinfo: path: 'npm',
@material-ui/envinfo: spawnargs: [ 'pack' ],
@material-ui/envinfo: cmd: 'npm pack',
@material-ui/envinfo: stdout: '',
@material-ui/envinfo: stderr: ''
@material-ui/envinfo: }
@material-ui/codemod: $ node ../../scripts/build node --out-dir ./build && cp README.md build && cp package.json build
@material-ui/docs: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:copy-files
@material-ui/envinfo: error Command failed with exit code 1.
@material-ui/envinfo: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@material-ui/styled-engine-sc: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:copy-files
@material-ui/styled-engine: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:copy-files
@material-ui/types: $ mkdir build && cp index.d.ts build/ && yarn build:copy-files
@material-ui/lab: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:types && yarn build:copy-files
@material-ui/styles: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:copy-files
@material-ui/utils: $ rimraf build
@material-ui/types: 'cp' is not recognized as an internal or external command,
@material-ui/types: operable program or batch file.
@material-ui/icons: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:typings && yarn build:copy-files
@material-ui/core: $ rimraf build tsconfig.build.tsbuildinfo
@material-ui/types: error Command failed with exit code 1.
@material-ui/types: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@material-ui/system: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:copy-files
@material-ui/unstyled: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:copy-files
@material-ui/utils: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:copy-files && yarn build:types
@material-ui/styled-engine-sc: $ node ../../scripts/build legacy
@material-ui/docs: $ node ../../scripts/build legacy
@material-ui/styled-engine: $ node ../../scripts/build legacy
@material-ui/icons: $ echo 'Skip legacy build'
@material-ui/styles: $ node ../../scripts/build legacy
@material-ui/lab: $ node ../../scripts/build legacy
@material-ui/core: $ yarn build:legacy && yarn build:modern && yarn build:node && yarn build:stable && yarn build:umd && yarn build:types && yarn build:copy-files
@material-ui/system: $ node ../../scripts/build legacy
@material-ui/icons: 'Skip legacy build'
@material-ui/unstyled: $ node ../../scripts/build legacy
@material-ui/utils: $ node ../../scripts/build legacy
@material-ui/core: $ node ../../scripts/build legacy
@material-ui/icons: $ echo 'Skip modern build'
@material-ui/icons: 'Skip modern build'
@material-ui/icons: $ node ../../scripts/build node
@material-ui/codemod: 'cp' is not recognized as an internal or external command,
@material-ui/codemod: operable program or batch file.
@material-ui/codemod: error Command failed with exit code 1.
@material-ui/codemod: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@material-ui/styled-engine-sc: $ node ../../scripts/build modern
@material-ui/styled-engine: $ node ../../scripts/build modern
@material-ui/docs: $ echo 'Skip modern build'
@material-ui/docs: 'Skip modern build'
@material-ui/system: $ node ../../scripts/build modern
@material-ui/docs: $ node ../../scripts/build node
@material-ui/styles: $ node ../../scripts/build modern
@material-ui/unstyled: $ node ../../scripts/build modern
@material-ui/utils: $ node ../../scripts/build modern
@material-ui/styled-engine-sc: $ node ../../scripts/build node
@material-ui/styled-engine: $ node ../../scripts/build node
@material-ui/docs: $ node ../../scripts/build stable
@material-ui/system: $ node ../../scripts/build node
@material-ui/styles: $ node ../../scripts/build node
@material-ui/unstyled: $ node ../../scripts/build node
@material-ui/utils: $ node ../../scripts/build node
@material-ui/styled-engine: $ node ../../scripts/build stable
@material-ui/styled-engine-sc: $ node ../../scripts/build stable
@material-ui/lab: $ node ../../scripts/build modern
@material-ui/docs: $ node ../../scripts/copy-files.js
@material-ui/docs: Created package.json in D:\workspace\material-ui-release\packages\material-ui-docs\build\package.json
@material-ui/docs: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-docs\build\LICENSE
@material-ui/docs: Copied D:\workspace\material-ui-release\packages\material-ui-docs\README.md to D:\workspace\material-ui-release\packages\material-ui-docs\build\README.md
@material-ui/docs: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-docs\build\CHANGELOG.md
@material-ui/docs: Skipped license for ./modern/index.js
@material-ui/docs: Skipped license for ./umd/material-ui.development.js
@material-ui/docs: Skipped license for ./umd/material-ui.production.min.js
@material-ui/system: $ node ../../scripts/build stable
@material-ui/styled-engine-sc: $ node ../../scripts/copy-files.js
@material-ui/styled-engine: $ node ../../scripts/copy-files.js
@material-ui/utils: $ node ../../scripts/build stable
@material-ui/styled-engine-sc: Created package.json in D:\workspace\material-ui-release\packages\material-ui-styled-engine-sc\build\package.json
@material-ui/styled-engine-sc: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-styled-engine-sc\build\LICENSE
@material-ui/styled-engine-sc: Copied D:\workspace\material-ui-release\packages\material-ui-styled-engine-sc\README.md to D:\workspace\material-ui-release\packages\material-ui-styled-engine-sc\build\README.md
@material-ui/styled-engine-sc: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-styled-engine-sc\build\CHANGELOG.md
@material-ui/styled-engine-sc: Skipped license for ./umd/material-ui.development.js
@material-ui/styled-engine-sc: Skipped license for ./umd/material-ui.production.min.js
@material-ui/unstyled: $ node ../../scripts/build stable
@material-ui/styled-engine: Created package.json in D:\workspace\material-ui-release\packages\material-ui-styled-engine\build\package.json
@material-ui/styled-engine: Copied D:\workspace\material-ui-release\packages\material-ui-styled-engine\README.md to D:\workspace\material-ui-release\packages\material-ui-styled-engine\build\README.md
@material-ui/styled-engine: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-styled-engine\build\LICENSE
@material-ui/styled-engine: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-styled-engine\build\CHANGELOG.md
@material-ui/styled-engine: Skipped license for ./umd/material-ui.development.js
@material-ui/styled-engine: Skipped license for ./umd/material-ui.production.min.js
@material-ui/styles: $ node ../../scripts/build stable
@material-ui/system: $ node ../../scripts/copy-files.js
@material-ui/system: Created package.json in D:\workspace\material-ui-release\packages\material-ui-system\build\package.json
@material-ui/system: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-system\build\LICENSE
@material-ui/system: Copied D:\workspace\material-ui-release\packages\material-ui-system\README.md to D:\workspace\material-ui-release\packages\material-ui-system\build\README.md
@material-ui/system: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-system\build\CHANGELOG.md
@material-ui/system: Skipped license for ./node/index.js
@material-ui/system: Skipped license for ./umd/material-ui.development.js
@material-ui/system: Skipped license for ./umd/material-ui.production.min.js
@material-ui/utils: $ node ../../scripts/copy-files.js
@material-ui/unstyled: $ node ../../scripts/copy-files.js
@material-ui/utils: Created package.json in D:\workspace\material-ui-release\packages\material-ui-utils\build\package.json
@material-ui/utils: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-utils\build\LICENSE
@material-ui/utils: Copied D:\workspace\material-ui-release\packages\material-ui-utils\README.md to D:\workspace\material-ui-release\packages\material-ui-utils\build\README.md
@material-ui/utils: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-utils\build\CHANGELOG.md
@material-ui/utils: Skipped license for ./node/index.js
@material-ui/utils: Skipped license for ./umd/material-ui.development.js
@material-ui/utils: Skipped license for ./umd/material-ui.production.min.js
@material-ui/unstyled: Created package.json in D:\workspace\material-ui-release\packages\material-ui-unstyled\build\package.json
@material-ui/unstyled: Copied D:\workspace\material-ui-release\packages\material-ui-unstyled\README.md to D:\workspace\material-ui-release\packages\material-ui-unstyled\build\README.md
@material-ui/unstyled: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-unstyled\build\LICENSE
@material-ui/unstyled: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-unstyled\build\CHANGELOG.md
@material-ui/unstyled: Skipped license for ./umd/material-ui.development.js
@material-ui/unstyled: Skipped license for ./umd/material-ui.production.min.js
@material-ui/styles: $ node ../../scripts/copy-files.js
@material-ui/styles: Created package.json in D:\workspace\material-ui-release\packages\material-ui-styles\build\package.json
@material-ui/utils: $ tsc -p tsconfig.build.json
@material-ui/styles: Copied D:\workspace\material-ui-release\packages\material-ui-styles\README.md to D:\workspace\material-ui-release\packages\material-ui-styles\build\README.md
@material-ui/styles: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-styles\build\LICENSE
@material-ui/styles: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-styles\build\CHANGELOG.md
@material-ui/styles: Skipped license for ./umd/material-ui.development.js
@material-ui/styles: Skipped license for ./umd/material-ui.production.min.js
@material-ui/core: $ node ../../scripts/build modern
@material-ui/lab: $ node ../../scripts/build node
@material-ui/lab: $ node ../../scripts/build stable
@material-ui/core: $ node ../../scripts/build node
@material-ui/lab: $ tsc -p tsconfig.build.json
@material-ui/core: $ node ../../scripts/build stable
@material-ui/lab: $ node ../../scripts/copy-files.js
@material-ui/lab: Created package.json in D:\workspace\material-ui-release\packages\material-ui-lab\build\package.json
@material-ui/lab: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-lab\build\LICENSE
@material-ui/lab: Copied D:\workspace\material-ui-release\packages\material-ui-lab\README.md to D:\workspace\material-ui-release\packages\material-ui-lab\build\README.md
@material-ui/lab: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-lab\build\CHANGELOG.md
@material-ui/lab: Skipped license for ./umd/material-ui.development.js
@material-ui/lab: Skipped license for ./umd/material-ui.production.min.js
@material-ui/core: $ cross-env BABEL_ENV=stable rollup -c scripts/rollup.config.js
@material-ui/core:
@material-ui/core: ./src/index.js → build/umd/material-ui.development.js...
@material-ui/core: created build/umd/material-ui.development.js in 12.2s
@material-ui/core:
@material-ui/core: ./src/index.js → build/umd/material-ui.production.min.js...
@material-ui/icons: $ node ../../scripts/build stable
@material-ui/core: 'useDebugValue' is imported from external module 'react' but never used
@material-ui/core: Computed sizes of "material-ui.production.min.js" with "umd" format
@material-ui/core: bundler parsing size: 1,304,443 B
@material-ui/core: browser parsing size (minified with terser): 437,151 B
@material-ui/core: download size (minified and gzipped): 126,280 B
@material-ui/core: created build/umd/material-ui.production.min.js in 17.1s
@material-ui/core: $ tsc -p tsconfig.build.json
@material-ui/core: $ node ../../scripts/copy-files.js
@material-ui/core: Created package.json in D:\workspace\material-ui-release\packages\material-ui\build\package.json
@material-ui/core: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui\build\LICENSE
@material-ui/core: Copied D:\workspace\material-ui-release\README.md to D:\workspace\material-ui-release\packages\material-ui\build\README.md
@material-ui/core: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui\build\CHANGELOG.md
@material-ui/icons: $ babel-node --config-file ../../babel.config.js ./scripts/create-typings.js
@material-ui/icons: � Searching for modules inside "D:\workspace\material-ui-release\packages\material-ui-icons\src".
@material-ui/icons: � Written typings to D:\workspace\material-ui-release\packages\material-ui-icons\build.
@material-ui/icons: $ node ../../scripts/copy-files.js
@material-ui/icons: Created package.json in D:\workspace\material-ui-release\packages\material-ui-icons\build\package.json
@material-ui/icons: Copied D:\workspace\material-ui-release\LICENSE to D:\workspace\material-ui-release\packages\material-ui-icons\build\LICENSE
@material-ui/icons: Copied D:\workspace\material-ui-release\packages\material-ui-icons\README.md to D:\workspace\material-ui-release\packages\material-ui-icons\build\README.md
@material-ui/icons: Copied D:\workspace\material-ui-release\CHANGELOG.md to D:\workspace\material-ui-release\packages\material-ui-icons\build\CHANGELOG.md
@material-ui/icons: Skipped license for ./legacy/index.js
@material-ui/icons: Skipped license for ./modern/index.js
@material-ui/icons: Skipped license for ./node/index.js
@material-ui/icons: Skipped license for ./umd/material-ui.development.js
@material-ui/icons: Skipped license for ./umd/material-ui.production.min.js
lerna ERR! Received non-zero exit code 1 during execution
lerna success run Ran npm script 'build' in 13 packages in 113.5s:
lerna success - @material-ui/codemod
lerna success - @material-ui/docs
lerna success - @material-ui/envinfo
lerna success - @material-ui/icons
lerna success - @material-ui/lab
lerna success - @material-ui/styled-engine-sc
lerna success - @material-ui/styled-engine
lerna success - @material-ui/styles
lerna success - @material-ui/system
lerna success - @material-ui/types
lerna success - @material-ui/unstyled
lerna success - @material-ui/utils
lerna success - @material-ui/core
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

D:\workspace\material-ui-release>

Context

I'm trying to empower Marija do the next release. I hope to setup a round-robin as we do for material-ui-x. The objective is so that we can all "do it all".

@mui-pr-bot
Copy link

mui-pr-bot commented Dec 30, 2020

No bundle size changes

Generated by 🚫 dangerJS against ae9e4f7

@mnajdova
Copy link
Member

I can confirm that lerna run --parallel --no-bail --scope \"@material-ui/*\" build is now successful on Windows 🚀

@oliviertassinari oliviertassinari marked this pull request as ready for review December 30, 2020 12:02
@oliviertassinari oliviertassinari added the core Infrastructure work going on behind the scenes label Dec 30, 2020
Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

Please keep the envinfo build script, thanks. Seems like you started using cpy instead of copy-cli so I don't know why this doesn't work for envinfo

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Dec 30, 2020

Seems like you started using cpy instead of copy-cli

@eps1lon What do you mean by using copy-cli? Are you saying there is already a dependency installed that solved the same problem? I can't find it. Do you have more information on it?

I don't know why this doesn't work for envinfo

You can access the full fail log report Marija had on her machine in the pull requests description. I don't understand the error. It doesn't seem to be cp related.

@mnajdova Do you think that you could get more information on why the build of the envinfo package fail on Windows ?

Please keep the envinfo build script, thanks.

Is there a specific downside with doing a full copy of the folder into the build one that we should care about? I'm not aware of it. Could we document why a simper cp isn't enough?

@mnajdova
Copy link
Member

mnajdova commented Dec 30, 2020

@mnajdova Do you think that you could get more information on why the build of the envinfo package fail on Windows ?

I reverted the build.js script locally and tried yarn build inside /packages/material-ui-envinfo and it finished successfully. Also, lerna run --parallel --no-bail --scope \"@material-ui/*\" build finished successfully after this change, so I believe we can revert that change.

EDIT:

Needed this change bca5f05 to fix the build for material-ui-envinfo on Windows

@mnajdova mnajdova dismissed eps1lon’s stale review December 30, 2020 17:00

We reverted back the build for envinfo, just fixed the windows issue

@mnajdova mnajdova merged commit 5906db5 into mui:next Dec 30, 2020
@eps1lon
Copy link
Member

eps1lon commented Dec 30, 2020

Is there a specific downside with doing a full copy of the folder into the build one that we should care about? I'm not aware of it. Could we document why a simper cp isn't enough?

I don't intend to document every single script. I don't know why this would only apply to me and the usual "there must a be a reason this code exists so let's ask first" is not extended to my code. Any reason why that is?

I told you a few weeks ago why we need it but let me repeat that: envinfo needs to be as small as possible. A simple cp does not guarantee it. Unless you want to setup install size tracking for particular packages, the script is important.

even if not as elegant.

The script does not intend to be elegant. I do not care about elegance at all. My code tries to solve problems. Nothing more, nothing less.

You can access the full fail log report Marija had on her machine in the pull requests description. I don't understand the error. It doesn't seem to be cp related.

That log does not contain errors in @material-ui/envinfo.

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Dec 30, 2020

envinfo needs to be as small as possible

@eps1lon Ohh, I see, so developers can get a fast answer when using npx, makes sense. Thanks for sharing the rationale :). It looks like I forgot the first time. I think that it's worth explaining for the next person that will come and will wonder why it can't be simplified to one line cp. It's indeed very small: https://packagephobia.com/result?p=@material-ui/envinfo.

The error reported is:

Capture d’écran 2020-12-30 à 20 25 46

which is confusing.

@oliviertassinari oliviertassinari deleted the fix-build-on-windows branch December 30, 2020 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants