Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm init command should use the directory name instead of "index.js" as the default main entry point. #19798

Open
restarian opened this issue Feb 11, 2018 · 0 comments

Comments

@restarian
Copy link

The main reason is that the nodejs module.children and require objects use the full path of the module entry point as properties. It is more convenient to see and use this as the module name too.
I believe it will encourage proper usage practice in newcomers as well.

In the ```npm init`` command below the (index.js) should be (example_module) instead.

package name: (example_module)
version: (1.0.0)
description:
entry point: (index.js)   <-- this should be (example_module)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /home/nickali/Restarian/example_module/package.json:

{
  "name": "example_module",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant