如何运行像“npm install"这样的 bash 命令符合 [英] How to run bash commands like "npm install" on complie
问题描述
我需要运行 npm install &&gulp build
在我的 static/semantic-ui
文件夹中,因此它会创建所需的 css
文件.
I need to run npm install && gulp build
inside my static/semantic-ui
folder, so it creates the needed css
file.
我在 Setup 中看到了这个例子,但是在我的脚手架项目中我没有它,所以我的问题是在哪里放置代码来运行这些 bash 命令的正确位置.
I saw this example with Setup.hs, however on my scaffolded project I don't have it, so my question where is the right place to put the code to run those bash commands.
推荐答案
如果您使用的是默认的 Yesod 脚手架(由 stack
工具生成),那么它确实不包含 Setup.hs
(这有点奇怪,作为他们自己的指南 - https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md - 建议将其作为一种好的做法)
If you're using the default Yesod scaffolding (generated by stack
tool), then it indeed doesn't contain Setup.hs
(which is a bit weird, as their own guide - https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md - recommends having it as a good practice)
Setup.hs
应该位于主项目目录中(与 stack.yml
和 yourproject.cabal
所在的位置相同)并且内容应该与包含的示例大致相同(defaultMainWithHooks
是关键部分).
Setup.hs
should be located in main project directory (same where stack.yml
and yourproject.cabal
are located) and content should be roughly the same as in your included example (defaultMainWithHooks
is the key part).
钩子的使用细节在https://www.haskell.org/cabal/users-guide/developing-packages.html 和 cabal
规范:https://hackage.haskell.org/package/Cabal-1.24.0.0/docs/Distribution-Simple.html
Details of hooks usage are specified in https://www.haskell.org/cabal/users-guide/developing-packages.html and in cabal
spec: https://hackage.haskell.org/package/Cabal-1.24.0.0/docs/Distribution-Simple.html
顺便说一句,目前 stack
本身不支持预构建钩子(有关详细信息,请参阅:https://github.com/commercialhaskell/stack/issues/503),所以你必须坚持使用 cabal
提供的 - 这就是 Setup.hs
来自.
BTW, for now stack
doesn't support pre-build hooks on its own (for details see: https://github.com/commercialhaskell/stack/issues/503), so you have to stick to ones provided by cabal
- that's where Setup.hs
comes from.
这篇关于如何运行像“npm install"这样的 bash 命令符合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!