What we need to create a NPM project in a dir is creating package.json file in the root dir.
1.Create package.json by npm init -y
Than a package.json file be created in the root dir.
package.json
{
"name": "testet",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Today is a good day.\""
},
"keywords": [],
"author": "",
"license": "ISC"
}
Note: don't add comment in package.json scripts fragment
run scripts that note in package.json
npm run test
The output:
PS C:\Users\89104\Desktop\testet> npm run test
> testet@1.0.0 test C:\Users\89104\Desktop\testet
> echo "Today is a good day."
"Today is a good day."
2.Write a package.json hand by hand
{
"scripts": {
"test": "echo \"Today is a good day\""
}
}
Top comments (0)