$ cnpm install module
Generate the minimal skeleton for a new node.js module/package.
For example, to create a module in the current working directory:
$ npx module
To create a module in another directory, specify a relative or absolute path:
$ npx module foo
The --system flag can be provided to control whether the module system is ESM (the default if flag not specified) or CommonJS:
$ npx module foo --system esm
$ npx module foo --system cjs
And the --identifier flag can be provided to control whether the module system is identified by file extension (the default if flag not specified), package.json type field, or implicitly from code syntax:
$ npx module foo --system esm --identifier file-ext
$ npx module foo --system cjs --identifier package-type
$ npx module foo --system esm --identifier syntax
To understand these flags better, see Determining module system in the node.js docs.
Copyright 2013 - present © cnpmjs.org | Home |