Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

fix!: ESM, drop API, drop Node 12 support #611

Merged
merged 2 commits into from
Jul 27, 2022
Merged

Conversation

alexander-fenster
Copy link
Contributor

@alexander-fenster alexander-fenster commented Jul 25, 2022

This package is quite unique compared to other things in googleapis repository. It's a tool and not a library, and it has some dependencies we don't normally mess with, such as chalk, ora, and meow.

Since most of the dependencies dropped Node 12 in their latest versions and became ESM friendly, I'm suggesting this refactor to make this tool ESM compatible. I used ncu -u to bump all the dependencies to their latest versions, and make some code fixes to make it all work together.

BREAKING CHANGE: originally this tool was created (by me!) as a library, providing some API, with an expectation that the users will actually write the code to maintain GitHub repositories. It's not the case anymore, it was converted to a CLI tool long ago, and the main use case now is just use the repo CLI. I'm dropping parts of the API previously exported and the samples showing how to use it, because I don't want to keep that bad code (also, because its tests used proxyquire, which does not play well with ESM).

BREAKING CHANGE: drop Node 12 support.

Other than that, everything should just work!

@alexander-fenster alexander-fenster requested review from bcoe and sofisl July 25, 2022 21:47
@alexander-fenster alexander-fenster requested a review from a team as a code owner July 25, 2022 21:47
@product-auto-label product-auto-label bot added the size: xl Pull request size is extra large. label Jul 25, 2022
Copy link
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

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

For the most part this looks ok to me.

It looks like the only functionality being removing is the "update single file" functionality.

Comment on lines +17 to +18
import {GitHubRepository, Issue} from './lib/github.js';
import {processIssues} from './lib/asyncItemIterator.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not very knowledgeable in ESM/CJS stuff, but it seems weird to need the .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.

Weird indeed, but it cannot resolve imports without it. https://nodejs.org/api/esm.html#esm_mandatory_file_extensions

TypeScript understands these imports during compilation and preserves them, so they turn out just fine in the build folder.

@alexander-fenster
Copy link
Contributor Author

For the most part this looks ok to me.

It looks like the only functionality being removing is the "update single file" functionality.

And something about updating in branches, which I don't even remember what it was doing.

Technically, I could leave those APIs, but I need to remove their unit tests (since they use proxyquire which cannot be used with ESM), and since the APIs are unused, I decided it's better to remove everything unused rather than keep supporting dead code not even covered by tests.

@alexander-fenster
Copy link
Contributor Author

@sofisl @bcoe @chingor13 ping on this :)

@alexander-fenster alexander-fenster merged commit 47834fe into main Jul 27, 2022
@alexander-fenster alexander-fenster deleted the drop-node12 branch July 27, 2022 18:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants