srph / npm-scripts-info Goto Github PK
View Code? Open in Web Editor NEWDisplay the description of your npm scripts
Display the description of your npm scripts
IMHO, the descriptions in a different section are a little bit hard to read/edit.
I think it would be nice to add the possibility to write the descriptions in the scripts
property by prefixing the script name with a ?
For example, instead of this
{
"name": "my-project",
"scripts": {
"info": "npm-scripts-info"
},
"scripts-info": {
"info": "Displays information about the scripts.",
"watch:build": "Compiles the scripts and watches for changes.",
"start": "Kickstarts the application."
}
}
This can be written
{
"name": "my-project",
"scripts": {
"info": "npm-scripts-info",
"?info": "Displays information about the scripts.",
"?watch:build": "Compiles the scripts and watches for changes.",
"?start": "Kickstarts the application."
}
}
Furthermore, if the description will start with echo
, it'll be possible to view it through npm run. Thus having this package.json
{
"name": "my-project",
"scripts": {
"info": "npm-scripts-info",
"?info": "echo Displays information about the scripts.",
"?watch:build": "echo Compiles the scripts and watches for changes.",
"?start": "echo Kickstarts the application."
}
}
npm run ?start
will output the description of the start
script to the console. npm-scripts-info
can use the same description and just remove the echo
part.
I can implement this new feature if you like it.
Currently npm-scripts-info automatically loads the package json from the current working directory. This makes the module not reusable.
This change will allow to write a mos plugin for generating scripts documentation sections
I can make a pull request today with this update
This advisory has appeared when running npm audit
on a project with version 0.3.7 of npm-scripts-info:
URL: https://npmjs.com/advisories/1753
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Regular Expression Denial of Service │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ trim-newlines │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=3.0.1 <4.0.0 || >=4.0.1 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ npm-scripts-info [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ npm-scripts-info > meow > trim-newlines │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1753 │
└───────────────┴──────────────────────────────────────────────────────────────┘
First, thank you for making this awesome package! 🙇♂️
Given this package.json
{
"config": {
"reactStorybookPort": "9001"
},
"scripts": {
"info": "npm-scripts-info",
"?storybook": "Runs react-storybook on port $npm_package_config_reactStorybookPort",
"storybook": "start-storybook -p $npm_package_config_reactStorybookPort -c .storybook"
}
}
Running yarn run storybook
interpolates to start-storybook -p 9001 -c .storybook
, while running yarn run info
displays
storybook:
Runs react-storybook on port $npm_package_config_reactStorybookPort
Do you think we should enable config interpolation in descriptions? Would you like me to look into implementing such a PR?
Hi 👋
I was using the typescript starter project and was getting the error env: node\r: No such file or directory
when I tried to run npm-scripts-info
.
You can read that thread for the details so I won't duplicate them here.
I was just wondering if you had seen this error before as it seems to be isolated to npm-scripts-info
.
If you haven't seen this before, feel free to close as I realize this isn't the most helpful bug report 😞.
Thanks!
Configure colors, etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.