-
Notifications
You must be signed in to change notification settings - Fork 278
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
PlopJS 3 #293
PlopJS 3 #293
Conversation
Switching the import of ora from require to import as the only version with the ansi-regex update requires ESM. I didn't want to impose that on plop, but the async-await should be OK for all supported versions of node, I think.
# Conflicts: # package-lock.json # src/plop.js
@@ -470,32 +477,26 @@ Your `index.js` file should look like the following: | |||
|
|||
```javascript | |||
#!/usr/bin/env node | |||
const path = require('path'); | |||
import path from "node:path"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should narrow your engines support to node versions that support the node protocol if not changing this on build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I already have narrowed this properly, but will make sure to double-check :)
Looks great, just one comment to check but you may have that narrowed right |
|
This is the changelog that will be present for Plop 3 in the
releases
tab.I am extremely confident in the changes we've made here, but I'm waiting until the weekend to launch, given holidays around this time in the US.
This version is already published under the
alpha
tag on NPM, if you'd like to test (let us know!):https://www.npmjs.com/package/plop/v/3.0.0-alpha.1
The first major release of
plop
since 2018 is here!We've got a massive feature in this release: ESM Support. Read further to find out more!
Breaking Changes
^12.20.0
and^14.13.1
respectivelyWrapper CLI Breaking Changes
plop
(see below to learn more)Plop
object API has changed. Instead of:You need to do:
Features
ESM Support
The major feature of this release is support for ESM modules (#260)
This means that instead of:
You can now have the following code in your plopfile:
Going forward, plopfiles must either be:
.mjs
file withtype: "module"
inpackage.json
.js
file withtype: "module"
inpackage.json
.cjs
file withtype: "module"
inpackage.json
.js
file withtype: "commonjs"
inpackage.json
Any of these file extensions will be recognized and accepted with the default
plopfile
name, just like before.If you want to learn more about ESM usage in a library, here's some further reading provided by Sindre Sorhus.
These limitations will also be present for plop wrapper CLIs, so it's encouraged to read the above if you're doing so.
Bug Fixes
Internal Changes
The plop CLI itself now has a solid end-to-end tests. While this isn't done, it is very functional today. These tests have enabled us to be confident that this release should work for 99% of users without having to change much if anything at all on their end.
We even wrote our own testing library to support this
Admittedly, we have a low coverage rate, but are testing against most of the big stuff today. We welcome and encourage pull requests adding more tests to increase that rate.
We've also added CI to run those end-to-end tests against every PR against the main branch.
Looking Ahead
While this release is fun, there's more that we want to do internally sometime in the near future.
Namely:
node-plop
testsnode-plop
to usejest
instead ofava
node-plop
to monorepo in theplop
reponode-plop
andplop
master
tomain
plop