Initior
Initior is a command line tool to initialize your package.json, create some files, install your dependencies and also suggest you some of the most popular npm packages to install.
Some Screenshots Might Be Outdated Since This Package Is Being Frequently Updated
About
Initior will ask you more questions than npm or yarn. Your package.json file will be exactly how you like it and also this will also minimize the manual editing time for your package.json.
Initior will also suggest some of the most popular packages to install and by selecting them, they will be installed automatically in your project.
Initior will also take these selections and if let's say you chose to install gulp, it will ask you if you want Initior to write you a gulpfile.js inside your project. Applies to webpack, babel, grunt, eslint.
Installation
Before you install Initior, make sure to have these installed on your machine.
To check that you have them installed on your machine, simply run these commands.
node --version
if you get some sort of a version, you're good to go
npm --version
same thing here lol
Installing Initior
To install Initior on your machine, simply run the following command in your terminal.
npm:
npm install -g initior
yarn:
yarn global add initior
To check if you have Initior installed or not, simply run the command : init --version
Now you are ready to start using Initior for your projects
Usage
Using Initior is pretty simple and straight forward, you simply run the command init
in your new project folder and you answer the questions given.
cd <project-folder>
init
From v0.6.0 and above, Initior installs your dependencies using yarn by default but if you want to install the dependencies with npm, simply add the --npm option!
NPM:
cd <project-folder>
init --npm
Questions
Here's how to answer every question that Initior asks you.
Name
- The project name should be a valid npm name meaning the following:
- The name cannot have a capital letter
- The name cannot have any kind of spaces
- The name cannot have any url friendly characters such as "/", "&"...etc
- The name can only have these special characters..."-", "_" and "."
Initior
, Initior3
, Initior$$
are wrong and will ask you to correct the name.
Version
- The project version should have the pattern of x.x.x
- The version cannot have any letters or special characters other than "."
Description
The project's description can have anything you want, it is made to describe your package
Entry Point
This question should be answered with a path to your package's main file. It is the file that will be taken when users require() your package.
Test Command
This command is your main testing command for testing your project and can be executed with the command npm test
dev/Development Command
The development command is the command that runs your development environment, for example if you have specific tasks for development. You can set a command to run them all with npm run dev
.
prod/Production Command
The production command is the same as the development command but it should be executed to set your package up for production like minifying files.
git repository url
The git repository url should be the url to your package's git repository, for example the url for this repository is https://github.com/ahmedtarek2134/Initior. So my package.json should have that url in that field so people on npm can find your package on github aswell.
Keywords
The keywords is an array to describe your package basically but in keywords. For example if your package is a plugin for gulp, it should have gulp as a keyword so people on npm can find it easier, it overall helps populate your package a little more.
Author
The author question is self explanatory, just enter the package's author name which most of the time will be you.
Contributors
The package contributors is an array with the people who have contributed on your package, this helps to credit these people and for visitors on npm to see and maybe check the contributor's work. You should answer this question as normal but each time you want to add a new contributor, separate the name with a comma.
Example: Ahmed Tarek, Someone Else
License
Every package should be licensed under some kind of a license to help and prevent any issues. The most popular license is MIT which is btw what Initior is licensed under, but you are free to choose what you want.
Global Package
Some packages like Initior, needs to be installed globally on the user's machine so they can be executed anywhere and with a general command. If you say yes, Initior will set your package as a global package.
Private Package
Maybe you don't want to publish your package to the public, or maybe you're testing a new idea you have. This option will prevent your package from being published to the npm registry when you run npm publish
. This is perfect for these package's where you are still developing and they are not ready as once a package is published on npm, you can't remove it that easily.
Bin Command
The bin command is a command that can be executed without npm run as in the scripts, this is perfect for global packages like Initior having the init
command. Just type the command to be executed :)
Packages Suggestions
This is a list of a couple packages that are very popular on the npm registry, by selecting them, they will be automatically installed to your project and added to the dependencies section in your package.json.
Development Packages Suggestions
This is a list of the most popular development packages on the npm registry, by selecting them they will be automatically installed in your project and also added to the devDependencies section in your package.json file.
Command Line Packages Suggestions
Nodejs can be used as a tool to create command line application like Initior, and there are some packages which makes creating these applications much easier. Initior will suggest you some of the most popular and again you can select them and they will be installed in your project and added to the dependencies section in the package.json file
Additional Development Dependencies
Maybe you want to install other development dependencies, well you will certainly do if you install gulp, webpack or grunt. This is the question to write all of your plugins to install and such like your webpack loaders or gulp plugins. You only need to specify their names like you are running npm install where each package should be separated from the other by a space.
Example of installing the gulp-imagemin and gulp-pug plugins: gulp-imagemin gulp-pug
Additional Dependencies
Maybe you want to install other packages that yours depend on which you will most likely do. This is the question to do so, just do the same as you did in the additional development dependencies
Example of installing normalize-css and font-awesome: normalize-css font-awesome
Creating Additional Files
Aside from creating your package.json, Initior can create you more files!
Initior will ask you if you would like to create a Readme.md file which you probably should.
Initior will also ask you if you want to create a .gitignore and a LICENSE.md file!
LICENSE.md
Initior will fully write an MIT or an Apache-2.0 License for you if you have one of them as your license, more licenses will be supported in the future!
If you chose gulp from the dev. dependencies list, Initior will ask you if you want to create a gulpfile.js
Same goes for webpack and grunt, more to come!
License
MIT License
Copyright (c) 2017 Ahmed Tarek
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.