简体   繁体   中英

How does “npm run build” run the scripts in jquery github repo?

Here is the jQuery repo on github . There is a "build" folder in jQuery repo. As the readme.md says the npm command:

npm run build

will trigger the execution of script in build folder and finish building process from many sub modules, which lots of js files. Is this correct?

There is also a command:

npm run test

It will run the test under the /test folder. I can understand from npm document here , that "npm run" is short for "npm run-script".

Question : There are many .js file under /test folder. How does "npm run test" invoke the lots of *.js files under "test" folder? What are the rules? Which file is the entry point? There is no "index.js"

I am asking this, because I also like to use "npm run test" on my project.

Thanks!

All the npm commands are defined in package.json file at the root of any project. Check this part (lines 56-60):

"scripts": {
    "build": "npm install && grunt",
    "start": "grunt watch",
    "test": "grunt && grunt test"
},

So for the test script node will execute in

$ grunt && grunt test

Actually you can run that directly in CLI without npm run test :

$ grunt && grunt test

To see what that command does you need to learn about GruntJS and then check file Gruntfile.js to see what exactly jQuery does register the test task .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM