Skip to content

Conversation

matthargett
Copy link
Contributor

Summary

Right now, a fresh clone of this repository does not work on Windows under either PowerShell or cmd prompts. This is due to some simple reasons (OS-specific path concatenation), and some tricky ones (Windows filesystems' "junction points" are incompatible with how current eslint walks symlinks). This pull request addresses critical issues that prevented the project from being built and tested on Windows environments. The primary goal was to ensure cross-platform compatibility for the build scripts and resolve related test failures, thereby unblocking contributions from developers on Windows platforms.

Details

The core of this PR is fixing the build process on Windows. Previously, running yarn build would fail due to a combination of non-portable code in build scripts and issues with how the TypeScript composite build handled incremental builds on Windows. Additionally, several snapshot tests were failing due to differences in filesystem ordering between inode-derived file systems and Windows.

This PR introduces the following fixes:

  • Cross-Platform Build Scripts: The main build script (build.js) has been updated to normalize file paths, allowing it to correctly find and transpile TypeScript files on Windows.
  • Stable TypeScript Builds: the build-clean-all script now properly cleans out stale TypeScript build information (.tsbuildinfo files) along with build artifacts. This resolves persistent issues with the composite build failing incorrectly even when making fixes to the build script/infra.
  • Stabilized Snapshot Tests: Tests that rely on reading directory contents now explicitly sort the results. This ensures that Jest snapshots are consistent across all operating systems, regardless of the underlying filesystem's default ordering.
  • Upgraded execa for Security and Compatibility: The execa package was upgraded to the latest version. This not only improves cross-platform command execution, particularly on Windows, but highlighted a latent typo (utf-8 versus utf8), and also resolves latent security vulnerabilities related to command injection.

A Note on Remaining Test Failures

While this PR fixes the build and a specific class of test failures, a number of unrelated unit and end-to-end tests are still failing. These failures appear to be pre-existing and are not further regressions on Windows caused by these changes.

On Windows, we disable a lint error that relates to workspace resolution. These failures appear to be an issue with how eslint processes project files when they are symbolic links (junction points on Windows file system). This led to incorrect file resolution during linting. This appears to be a known issue within the ecosystem, with developers reporting similar behavior in other contexts.

To keep this pull request focused on the critical task of unblocking the build, I'm deferrinf the fix for the few remaining test failures in a separate, follow-up effort. This allows us to merge the foundational build fixes quickly and enables developers on all platforms to contribute to fixing the remaining issues. Until all relevant tests are passing and Windows CI is introduced, I don't know that we should advertise Windows support in the docs. I'm open to feedback on this aspect.

Test Plan

On Windows:
yarn lint
yarn build
yarn test (still some failures, but starting point was zero tests passing)

Checklist

  • Documentation is up to date.
  • Follows commit message convention described in CONTRIBUTING.md.
  • For functional changes, my test plan has linked these CLI changes into a local react-native checkout (instructions).

… 'dom' types not being present, I'm not sure why this works on other platforms
…) working differently, we have to loosen one lint rule that won't work due to to way typescript-eslint walks symbolic links in a non-agnostic way. building and resolution still seems to work properly.
…m shell support, and 2) fixes some critical holes that can lead to remote code execution. nice side effect, the new types pointed out a typo (utf-8 instead of utf8 for a param).
… explicit help to propertly root the test discovery
…mock getEnvironmentInfo(), which is necessary on Windows and makes the test run LOT faster.
…perating systems and filesystems (eg on linux/bsd).
…-fix the build. powershell emits an extra CR after process terminates, so trim() the stderr output to make the snapshot fulfill its intent in an OS-agnostic way
…stem combinations. it looks like there's a latent race in e2e tests where sometimes a directory doesn't exist yet, or was already removed. this isn't a new issue, so check for directory before removal. trim stdout/stderr in the test helpers, not just in one test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant