Skip to content
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

chore: migrate to Plop v3 #573

Merged
merged 41 commits into from
Dec 1, 2021
Merged

chore: migrate to Plop v3 #573

merged 41 commits into from
Dec 1, 2021

Conversation

ThibodeauJF
Copy link
Contributor

ThibodeauJF and others added 30 commits November 25, 2021 15:09
Co-authored-by: Louis Bompart <lbompart@coveo.com>
Co-authored-by: jpmarceau <39384459+jpmarceau@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2021

Thanks for your contribution @ThibodeauJF !
When your pull-request is ready to be merged, check the box below to merge it

  • Merge! :shipit:

@@ -1,6 +1,6 @@
import {NodePlopAPI} from 'plop';
import {spawn} from 'child_process';
import {getPackageManager} from './utils';
import {getPackageManager} from './utils.js';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not translate utils to TypeScript?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is in TS, but we need to set it properly to the output with a .js in order for it to work with ES2020, like the links indicate. I'll try with nodenext, though

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2021

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Copy link
Collaborator

@louis-bompart louis-bompart left a comment

Choose a reason for hiding this comment

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

iirc, sindresorhus guide to ESM was made prior to TS 4.5 and Node 16, which bring 'real' support for ESM. Some tweaks here and there and we should be good to go

packages/create-atomic/index.js Show resolved Hide resolved
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "ES2020",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you try with nodenext ? would require typescript 4.5 but it should be the best way now I reckon.

https://www.typescriptlang.org/docs/handbook/esm-node.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean 4.6? Doesn't appear to work with 4.5. What's the issue with ES2020 ?

@@ -1,6 +1,6 @@
import {NodePlopAPI} from 'plop';
import {spawn} from 'child_process';
import {getPackageManager} from './utils';
import {getPackageManager} from './utils.js';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not translate utils to TypeScript?

@@ -0,0 +1,29 @@
#!/usr/bin/env node
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need the shebang? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just copied from their docs too

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm curious abt it, because shebang does not work on windows soo...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like a good thing to keep https://stackoverflow.com/a/33510581

This way, maybe when i install npm i -g @coveo/create-atomic and then run create-atomic myproject it will invoke node correctly 🤷 I haven't tested, just thinking out loud

Base automatically changed from CDX-697 to master December 1, 2021 19:25
@ThibodeauJF
Copy link
Contributor Author

Node 16

That's a harsh requirement, I wasn't on it until recently

@louis-bompart
Copy link
Collaborator

louis-bompart commented Dec 1, 2021

Node 16

That's a harsh requirement, I wasn't on it until recently

True, it is more stringent, however, because NodeJS and ECMA as a whole is turning their back on CJS and moving toward ESM modules, I think that I would prefer to limit support on Node 16 on the command, and not have to rework it next year

Overall, my two cents:

  • For existing and released features, we should maintain support on the latest Active and Maintenance LTS version of Node.js (so, for example, I'll drop support for Node 14 in 11 months, or just about 6 months before its official EoL)
  • For new features, we should support the Active LTS version of Node.js. Support of the Maintenance LTS is encouraged but is not mandatory.

This position is motivated by the rising number of packages that we cannot use because we're stuck with CJS module and engine. I prefer for us to be a step in advance than having to do the work twice.

@olamothe , @y-lakhdar, what do you think?

Copy link
Collaborator

@louis-bompart louis-bompart left a comment

Choose a reason for hiding this comment

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

I misread TypeScript release notes, thought nodenext for module was included, but it's only on the nightly builds for now.
So, as it stands in the current situation, LGTM!

@ThibodeauJF ThibodeauJF merged commit 275e764 into master Dec 1, 2021
@ThibodeauJF ThibodeauJF deleted the CDX-716 branch December 1, 2021 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants