Skip to content

node --init spec proposalΒ #57623

@AugustinMauroy

Description

@AugustinMauroy

What is the problem this feature will solve?

Currently npm cli does not set the ESM as default when initiating a project.

The --init allows you to build the basis of a node project without complicating your life.

What is the feature you are proposing to solve the problem?

Having a --init that crate a package.json that look like that

{
    "type": "module",
    "scripts": {
        "start": "node script.js",
        "test": "node --test",
        "watch": "node --watch script.js"
    }
}
index.js

import { styleText } from 'node:util';

console.log(
Hello from ${styleText(['bgGreenBright', 'black'], ' node.js ')} 🐒!
)

we should just add json key undersatand by node

REF: https://nodejs.org/en/blog/events/collab-summit-2024-dublin#node---init

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.stale

    Type

    No type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions