有关问题的前提是否是一个坏主意的XY问题讨论的注释,请参见此处:Git repo containing BackEnd and FrontEnd
我的git repo看起来像这样:
root
|
|- .git\
|
|- JSFrontEnd\
| |- package.json
| |- tsconfig.json
| |- .cache\
| |- node_modules\
| |- public\
| |- src\
| |- static\
|
|- C#BackEnd\
|
\_ .gitignore
JSFrontEnd
文件夹的内容是标准的Gatsby / Netlify项目结构,它不在仓库根目录中。
Netlify似乎不喜欢这样-它想在回购根目录上运行gatsby build
,但是当然不起作用-gatsby
不知道该怎么办,因为没有package.json
。
我该如何告诉Gatsby / Netlify如何使用此存储库结构?
我对方法的最初想法包括:
答案 0 :(得分:1)
您可以使用netlify.toml
文件来指定构建设置。对于您的情况,请尝试:
# Global settings applied to the whole site.
#
# “publish” is the directory to publish (relative to root of your repo),
# “command” is your build command,
# “base” is directory to change to before starting build. if you set base:
# that is where we will look for package.json/.nvmrc/etc not repo root!
[build]
base = "JSFrontEnd"
publish = "JSFrontEnd/public"
command = "gatsby build"