我已经看过了ASP.NET 5团队 wiki 条目项目.json, 来识别哪个脚本命令可用,目前列出以下内容:
{
"scripts": {
"prebuild": "echo before building",
"postbuild": "echo after building",
"prepack": "echo before packing",
"postpack": "echo after packing",
"prerestore": "echo before restoring packages",
"postrestore": "echo after restoring packages"
}
}
这些都是简单易懂的;然而,在 Visual Studio 中,似乎只有预恢复和后恢复事件才会真正触发。预构建和后构建则不然。
默认(beta 6) 视觉工作室 2015模板添加以下内容脚本命令,不在官方列表中:
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
此外,似乎还有其他未记录的命令,我从同事创建的示例项目继承了这些命令:
"scripts": {
"first-run": "npm install -g gulp bower && npm run update",
"prepare": [ "npm install && npm prune && bower install && bower prune && gulp default" ],
"prepublish": [ "npm install", "bower install", "gulp default" ],
"update": "npm install && npm prune && bower install && bower prune"
}
这些似乎有效(它们执行),但我和我的同事无法找到文档来解释:
- 它们是否有效或已弃用。
- 如果它们特定于 Visual Studio(我相信预发布仅适用于 Visual Studio)
- 它们的确切执行时间以及 Visual Studio 如何识别它们(名称似乎很明显,但我更愿意确定)。
更令人困惑的是,Visual Studio 2015 智能感知还显示了官方列表中没有的其他命令:
有有效名单吗项目.json 脚本命令、它们的用法等,特别是对于 Visual Studio 2015?