![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Node.js package scripts helper.
Inscludes commonly used scripts for CI, so
they can be added from one npm
package instead of
being copied among different repos.
npm install npsh
To check semantic version of your project
create a "svc"
script at the package.json
file.
Here is an example with placeholders:
"svc": "npsh.svc github_user_name project_name branch_name"
And a real example which will be checking PR/branch version against master branch:
"svc": "npsh.svc andr-ii nuti master"
For adding pre-commit
and commit-msg
hooks to your project
create a "hooks"
script at the package.json
file.
"hooks": "npsh.hooks"
Then simply run following command to add commit hooks:
npm run hooks
By default pre-commit
hook includes:
npm i --package-lock-only
npm run format
npm run lint
npm run types
npm run spell
npm run svc
git add .
So make sure these scripts are present at the package.json
.
bin
builderIf your project has an executable ./bin/index.js
file and you
would like to avoid to have it in the development (TypeScript for example)
project - npsh.bin
can be used. It generates ./bin/index.js
executable file
which requires your lib
module by default.
Create a "build:bin"
script at the package.json
file.
"build:bin": "npsh.bin"
After execution this script will create a default ./bin/index.js
file
at your project directory:
#!/urs/bin/env node
require('../lib');
If your lib
module exports a function - it can be executed after
require('../lib')
. Change "build:bin"
script as following:
"build:bin": "npsh.bin 'myFunc()'"
After execurion ./bin/index.js
will have following content:
#!/urs/bin/env node
require('../lib').myFunc();
FAQs
Node.js package scripts helper
The npm package npsh receives a total of 0 weekly downloads. As such, npsh popularity was classified as not popular.
We found that npsh demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.