Skip to content

Commit 2bf6477

Browse files
authored
feat: add support for npm/pnpm workspaces [SIM-130] (#1153)
* feat: add supporting code for workspace detection * feat: add workspace support * refactor: remove weird walkUp helper in favor of the lineage helper * fix: make TypeScript happy * fix: use basePath relative paths in the generated PW bundle Otherwise workspace packages/files get included with the wrong path. * fix: pnpm workspace detection used the wrong command, which did not always work * fix: make sure PW script paths are resolved to absolute paths Did not seem to outright breaking anything, but it was wrong and caused confusion in file lists. * refactor: make configDefaultGetter more generic so that it can work with other objects * feat: tie it all together * feat: make it optionally possible to skip bundle cleanup (allows inspection) Also introduces some debug logs so that you can know what the path is. * feat: add debug logging to jiti and ts-node loaders * feat: enable tsx in the jiti loader * feat: allow dependency collection from JSX files * fix: jsx must only be enabled when the extension matches Otherwise type brackets can cause errors. * chore: fix most unit tests by using fixtures in isolation * chore: add a workspace fixture to help debug pnpm related issues * fix: generate a placeholder package.json for unused deps needed during installation * feat: use the new workingDir for playwright checks * feat: add a new internal command that outputs the project structure This is meant to be used in tests which currently suffer from huge import resolution conflicts. Instead of letting fixtures and test code attempt to import the same files (and failing to do so), we should just pack the CLI and let it output the project structure. This makes it possible to test project parsing in real world scenarios, since even the devdeps of the CLI will not be resolvable (which so far has prevented things like proper testing for the file loaders). In order to make project parsing work without authentication, the PW code bundle upload was separated into a different bundle. Both the deploy and test commands were updated to support this. As a result they are now able to report more accurate status since the upload is separate from bundling, and the new project parsing command doesn't need authentication. TODO: Local code bundles are no longer getting cleaned up (deleted) after they have been uploaded. This needs fixing. * fix: resolve a circular dependency between util and api which suddenly became an issue The proxy utility is now in a separate file which gets rid of the circular dep. There may be more but for now this fixes the issue. * fix: workspace package file search must be limited to workspace root Files above the workspace root are not bundleable. * fix: if we find a workspace but we don't belong to it, discard it It's not relevant and it messes up paths. * chore: improve debug message * fix(tests): redo most test suites so that they run the CLI in isolation Instead of relying on memory and dependencies being shared between the CLI and test fixtures, which leads to various issues, we add new debug commands to the CLI that allow us to inspect the state of a fixture or file. We inspect the output of the command instead of relying on shared memory. Various changes were required to make this work. * chore: use more recent pnpm in workspace fixture, no reason other than to keep it fresh * fix(tests): forgot to increase timeouts for some tests * fix: pw-test must also store pw check bundles (mistakenly only added to deploy, test) * fix(tests): slightly refactor the fixture sandbox in a way that makes pw-test e2e tests work * fix(tests): only run e2e tests once, don't watch since it needs the packed archive * fix(tests): update deploy e2e tests * fix(tests): fix test command e2e tests * fix(tests): only try to destroy fixture if we managed to create it * fix(tests): add huge timeouts to anything involving fixture installation * chore(workflows): attempt to make windows tests actually finish by using a larger runner * chore(tests): substantially increase timeouts for things that may run npm install * chore(tests): adjust timeouts * fix(tests): wrong fixture folder name * fix(tests): fix paths for windows * fix(tests): attempt to fix windows tests * fix(tests): properly isolate pw-test --create-check tests * fix(tests): increase trigger test timeout
1 parent 6804373 commit 2bf6477

241 files changed

Lines changed: 9359 additions & 2113 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
os: [ubuntu-latest, windows-latest]
27+
os: [ubuntu-latest, windows-latest-x64]
2828
name: test - ${{ matrix.os }}
2929
runs-on: ${{ matrix.os }}
3030
steps:

package-lock.json

Lines changed: 146 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)