Skip to content

chore(esm): convert @redwoodjs/cli-helpers to ESM#9872

Merged
Josh-Walker-GM merged 6 commits intomainfrom
ds-esm/cli-helpers
Jan 24, 2024
Merged

chore(esm): convert @redwoodjs/cli-helpers to ESM#9872
Josh-Walker-GM merged 6 commits intomainfrom
ds-esm/cli-helpers

Conversation

@jtoar
Copy link
Contributor

@jtoar jtoar commented Jan 23, 2024

This PR converts @redwoodjs/cli-helpers to a dual ESM/CJS package like #9870 did for @redwoodjs/project-config. I didn't do anything differently so see that PR for details.

As soon as I converted it, the Jest tests stopped working so @Josh-Walker-GM and I bundled both changes into one PR here.

With this PR, we should be able to get all the tests in #9863 passing (about ~15 (out of 1000+) are skipped right now) because Vitest will be able to mock fs since it's imported instead of required. That'll be really nice since converting the CLI to ESM will then be possible. I'll confirm that after making this PR. Even if they don't this'll still have been worthwhile.

@jtoar jtoar added the release:breaking This PR is a breaking change label Jan 23, 2024
@jtoar jtoar added this to the v7.0.0 milestone Jan 23, 2024
@jtoar jtoar force-pushed the ds-esm/cli-helpers branch from dda4f42 to 965709b Compare January 23, 2024 00:10
@jtoar
Copy link
Contributor Author

jtoar commented Jan 23, 2024

Looks like one of the tests isn't handling paths well on Windows. TBD

@jtoar jtoar marked this pull request as draft January 23, 2024 00:49
@Josh-Walker-GM Josh-Walker-GM marked this pull request as ready for review January 24, 2024 12:58
@Josh-Walker-GM Josh-Walker-GM requested a review from Tobbe January 24, 2024 12:58
const mockListrRun = vi.fn()

;(Listr as jest.MockedFunction<jest.Mock>).mockImplementation(() => {
;(Listr as vi.MockedFunction<vi.Mock>).mockImplementation(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future, when someone cleans up our testing, this should be fixed. There are much better solutions than type-casting to use here.

Nothing to do now

@Josh-Walker-GM Josh-Walker-GM merged commit e94dbf5 into main Jan 24, 2024
@Josh-Walker-GM Josh-Walker-GM deleted the ds-esm/cli-helpers branch January 24, 2024 13:36
dac09 added a commit to dac09/redwood that referenced this pull request Jan 25, 2024
…dleware

* 'main' of github.com:redwoodjs/redwood:
  chore(structure): switch to vitest (redwoodjs#9878)
  chore(cli): switch to vitest (redwoodjs#9863)
  feat(dbAuth): Refactor dbAuthHandler to support WebAPI Request events (redwoodjs#9835)
  fix(crwa): remove yarn-install option for yarn 1 (redwoodjs#9881)
  chore(esbuild): dedupe esbuild config (redwoodjs#9875)
  chore(esm): convert `@redwoodjs/cli-helpers` to ESM (redwoodjs#9872)
  fix(studio): Add version checks when first running Studio (redwoodjs#9876)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:breaking This PR is a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants