抖动依赖node_modules目录
Shake depending on on node_modules directory
我在基于 npm 的项目中使用 Shake,但对如何处理 node_modules
文件夹感到困惑。据我所知,流程应该很简单:
- 对
package.json
的任何更改都会导致 node_modules
重新填充。
- 对
node_modules
and/or main.ts
的所有更改都会导致与 typescript 相关的脚本被触发。在这种情况下,整个更改集合只会 运行 一次。
如何对这些依赖项进行编码?
问题是node_modules
是目录而不是文件,而你can't depend on directories。解决方案是按照以下行创建一个假文件:
"node_modules/.stamp" %> \out -> do
need ["package.json"]
cmd_ "npm update"
copyFile' "package.json" out
"main.ts.out" %> \out -> do
need ["node_modules/.stamp","main.ts"]
cmd_ "whatever"
上面唯一的 "weird" 位是我们 copyFile'
package.json
我们的邮票文件。这是一个技巧,所以如果我们对
files 然后 .stamp
文件改变,而如果我们总是写 ""
到
那就不行了。
我在基于 npm 的项目中使用 Shake,但对如何处理 node_modules
文件夹感到困惑。据我所知,流程应该很简单:
- 对
package.json
的任何更改都会导致node_modules
重新填充。 - 对
node_modules
and/ormain.ts
的所有更改都会导致与 typescript 相关的脚本被触发。在这种情况下,整个更改集合只会 运行 一次。
如何对这些依赖项进行编码?
问题是node_modules
是目录而不是文件,而你can't depend on directories。解决方案是按照以下行创建一个假文件:
"node_modules/.stamp" %> \out -> do
need ["package.json"]
cmd_ "npm update"
copyFile' "package.json" out
"main.ts.out" %> \out -> do
need ["node_modules/.stamp","main.ts"]
cmd_ "whatever"
上面唯一的 "weird" 位是我们 copyFile'
package.json
我们的邮票文件。这是一个技巧,所以如果我们对
files 然后 .stamp
文件改变,而如果我们总是写 ""
到
那就不行了。