I'm trying very hard to understand the Node ecosystem and how npm and its packages work together and I find it very odd that npm init
initializes a "grunt project" and adds a package.json file to your directory.
Since the node package manager manages many different "packages", I would expect something more like npm grunt init
Can anyone fill me in on what's going on here and what makes grunt so special that it gets to be the main npm init
command?
** IMPORTANT NOTE ** after studying and understanding all this a lot better, I would strongly recommend you use neither Grunt NOR Gulp and instead take out the middle man and use npm scripts for your front-end build needs. See this great article by Cory House for more information
The “npm init” command will initialize a project and create the package. json file. There are a few questions asked by NPM each time the “init” command is run so Kent demonstrates how to update the . npmrc file with pre-populated default values.
It is not required. You can install packages without, and everything will work. npm init can do basically two things: ask for basic project info to include in packages.
The npm init command is a step-by-step tool to scaffold out your project. It will prompt you for input for a few aspects of the project in the following order: The project's name. The project's initial version. The project's description.
--save-dev saves the name and version of the package being installed in the dev-dependency object.
All npm init
does is give you prompts (see below) to create a package.json, there's nothing grunt-related that comes with it.
name: (test)
version: (0.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (BSD)
Grunt can certainly (and probably should be) installed with npm but it's definitely not part of initializing your package.json.
You can read more about package.json here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With