npm-post-install
v0.0.2
Published
Configure a npm git repo
Downloads
2,777
Maintainers
Readme
npm-post-install
Help configuring a boilerplate git repo to fit custom npm modules.
Boiler plate repos are an excellent tool to get started quickly. It's however tedious to remember to do all the things that reconfigure the repo to specific projects.
This script is meant as a post-install binary that will reset package.json and the git repo to the boiler plate as the initial commit.
What this script does:
- Seeks user input for:
- new name & description for new npm module
- picks a gitprofile from ~/.gitprofile (see below for format)
- alternatively, seeks a username and email to configure the git repo
- a git url to initialize the repo with
- Rejiggers the package.json
- Deletes previous git repository
- Reinitializes the git repo
- Configures a local username and email on the git repo.
- Commits current state as the 'Initial commit'
- Optionally (if a remote url is available), sets this up and pushes the changes to remote.
Installation
npm install npm-post-install
Usage
./node_modules/.bin/npm-post-install
.gitprofiles
It's common to have multiple git accounts and a constant pain to remember to set specific repos with proper username and emails. The ~/.gitprofiles is meant to provide a simple mechanism to store these. This module uses values in there to ease the typing.
The .gitprofiles has a simple json format, an example shown below:
{
"profile1": {
"username": "username1",
"email": "[email protected]"
},
"profile2": {
"username": "username2",
"email": "[email protected]"
}
}
The .gitprofiles can have any number of these profiles, though realistically, only about 3 have been tested. YMMV.