feat!: switch from CJS to ESM and bump Yeoman packages
Purpose of this pull request?
Fixes #265.
- [ ] Documentation update
- [ ] Bug fix
- [ ] Enhancement
- [x] Other, please explain: package dependencies and module update
What changes did you make?
- Adds
"type": "module"to the package.json - Bumps all Yeoman dependencies to the latest: in particular the production deps
yeoman-generatorandyosay - Bumps the
package.jsonandbuild.ymlNode.js versions to 18+ - WIP: Bumps Jest and switches it to its experimental ESM support
Is there anything you'd like reviewers to focus on?
I opted not to update other dependencies such as Chalk to keep the change minimal. I'd suggest we hold off releasing a new major version with these changes until those come in too.
BREAKING CHANGE: Updates the Node.js engine minimum to ^18.17.0 || >=20.5.0 to align with the current "yeoman-generator" minimums.
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
| Diff | Package | Supply Chain Security |
Vulnerability | Quality | Maintenance | License |
|---|---|---|---|---|---|---|
| @jest/globals@26.6.2 ⏵ 29.7.0 | ||||||
| cross-env@7.0.3 |
Partially blocked by #270 -> #271.
All alerts resolved. Learn more about Socket for GitHub.
This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.
● generator:app › scoped name › fills the README with project data
TypeError: (intermediate value).resolve is not a function
65 | const readmeTpl = _.template(this.fs.read(this.templatePath('README.md')));
66 |
> 67 | this.composeWith(import.meta.resolve('generator-node/generators/app'), {
https://github.com/jestjs/jest/issues/14923, which is now newly available in Jest 30 (still in alpha). Fun timing.
@mshima I'm having a hard time here. Could I ask for your help, please?
What I'm trying to do is get generator-generator onto the latest yeoman-generator version, to fix #265. I've tried a few strategies and each has test issues I haven't been able to debug:
- This PR: generally switching the package to full ESM, including
"type": "module". - #274
- #275
- #276
Looks like jest doesn’t support 'node:test' module.
Looks like jest doesn’t support 'node:test' module.
Interesting. For visibility, looking at the error in the CI logs:
FAIL __tests__/app.test.js
● Test suite failed to run
Cannot find module 'test' from 'node_modules/yeoman-test/dist/helpers.js'
at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/index.js:863:11)
That's in yeoman-test's src/helpers.ts:
import { mock } from 'node:test';
...which comes from https://github.com/yeoman/yeoman-test/pull/232: "switch to mock from node:test". Which I'm in the dark on. What was the context there? Should we be switching all tests from Jest to node:test?