[英]Which are the js files that are being run when I run “npm start”?
I am trying to pick up angularjs v2 using the official documentation provided. 我正在尝试使用提供的官方文档来获取angularjs v2。
I followed the instructions on this page. 我按照本页上的说明进行操作。
https://angular.io/docs/ts/latest/guide/setup.html https://angular.io/docs/ts/latest/guide/setup.html
After I run npm start
, I see a webpage http://localhost:3000/ being launched automatically on my default browser. 运行
npm start
,我会看到一个网页http:// localhost:3000 /在默认浏览器上自动启动。
I see several js files in the quickstart folder. 我在quickstart文件夹中看到了几个js文件。 Which are the js files that are being run and in what sequence?
哪些js文件正在运行,按什么顺序运行? Is there a main file that tells npm which files to run for
npm start
? 是否有一个主文件告诉npm为
npm start
运行哪些文件? How does npm knows which files to run? npm如何知道要运行哪些文件?
In your package.json file there will be a "script" named "start". 在package.json文件中,将有一个名为“ start”的“脚本”。 The one you are running from is found here: https://github.com/angular/quickstart/blob/master/package.json
您可以在此处找到正在运行的程序: https : //github.com/angular/quickstart/blob/master/package.json
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
It is executing the command tsc && concurrently "tsc -w" "lite-server"
它正在同时执行命令
tsc && concurrently "tsc -w" "lite-server"
For usage of the tsc
and concurrently
node packages check out npmjs.com: 有关
tsc
和concurrently
节点程序包的用法,请访问npmjs.com:
您可以在每个文件上发出一个alert(“ file name”)来查看哪个文件最先运行或console.log(“ file name”);
From npm help start
从
npm help start
This runs an arbitrary command specified in the package's "start" property of its "scripts" object.
这将运行在程序包的“脚本”对象的“开始”属性中指定的任意命令。 If no "start" property is specified on the "scripts" object, it will run node server.js.
如果未在“脚本”对象上指定“开始”属性,它将运行节点server.js。
So open package.json 所以打开package.json
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Just add something to it. 只需添加一些即可。
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "arbitrary command"
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.