github-pewpew: a CLI tool to clean up and remove unnecessary GitHub repositories. š« Pew pew!
Why?
Have you ever had too much fun with the GitHub API and ended up creating too many dummy repos? Me too š !
I made this little CLI tool to clean up repositories quickly. Iām planning to add some flags and regexp to delete in bulk in the future. Let me know if that sounds interesting to you.
Get the latest version published in npm. Itās open-sourced on GitHub under MIT license.
š¦ github-pewpew v1.2.2 on April 5, 2022
A new version 1.2.2 has been published to npm. Itās a minor update, but itās a special one: we are launching a brand new website and logo.
š¦ github-pewpew v1.2.0 on August 24, 2021
I published version github-pewpew v 1.2.0 to npm. A much-needed refactor after v1.1.0 that improves the overall stability of the app. You can now get more than 100 results, as there was no pagination in prior versions.
Many bugs have been fixed, and the authentication process is now more robust when tokens get invalidated in different scenarios. Iāve also added some testing using Mocha to cover the authentication flow.
Next, Iām porting everything to TypeScript. I hope you like it, and thanks for the feedback!
š¦ github-pewpew v1.1.3 on August 14, 2021
A new version github-pewpew v 1.1.3 is published in npm. Itās an important update as itās making it way easier to use than before. Itās also lighter in size.
The auth solution wasnāt too friendly, so I re-implemented it using OAuth, and itās working like a charm. Plus, it doesnāt need to ask for the username. You automatically get a validation code copied to your clipboard, paste it, and you are good to go! Kudos to @mamuso for suggesting me this mechanism I never used before.
I also added persistent configuration. Thereās no more need to sign in every time you run the command. During this implementation, I learned about os.homedir()
, the differences between operating systems, and how they store user configuration files.
Hereās how it works:
function getConfigDir(homeDir) {
const configDir = path.join(
homeDir,
process.platform === 'win32'
? path.join('AppData', 'Roaming', PACKAGE_AUTHOR, PACKAGE.name)
: path.join('Library', `com.${PACKAGE_AUTHOR}.${PACKAGE.name}`)
);
return configDir;
}
// Windows: adrianmg\AppData\Roaming\adrianmg\github-pewpew
// macOS/UNIX: /Users/adrianmg/Library/com.adrianmg.github-pewpew
The win32 solution wonāt work for systems older than Windows Vista. I guess thatās OK in 2021? Some npm packages provide a robust solution covering all the different platforms, but it felt like a waste of weight for such a small tool. Plus, Iām learning a few things along the way.
š¦ github-pewpew v1.0.0 on August 11, 2021
The first public version, github-pewpew v 1.0.0 released on npm. The authentification is relying on both e-mail and PAT (Personal Acess Token) with a repo_delete
scope. Although it works, itās adding too much friction as the user must constantly copy and paste the value to get permissions to delete repositories.
Iām planning to reduce friction via a refactor that will use OAuth as the mechanism to get permissions.
Questions? Ideas? Bugs?
If you run into any issues or youād like to share your thoughts, feel free to open an issue in this repository or hit me up on Twitter.