-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Topics/output dir #4756
Topics/output dir #4756
Conversation
Deploy preview for using-drupal ready! Built with commit 5090a7b |
Deploy preview for gatsbygram ready! Built with commit 5090a7b |
When I pulled master my code remove code done in previous commit (10a1faf) |
Hey the code looks good! I do have a slightly annoying request — I really don't like calling the folder we build to the "output" folder. Could we use |
Alright! I'm on it ! |
Done. Just one test that seems not to pass |
Yeah, appveyor is failing when building gatsbygram for some reason (on all PRs recently). The tests are passing though. |
So one problem with this is that there could be community plugins that also hard-code public. I guess people who care about using a folder other than Also, output is still being used in a number of places including the cli flag name. |
you mean replacing |
Yes and other places that say output |
Ready to make change if required :) |
@Calderis It seems like there is conflict in |
Solved ! |
docs/docs/environment-variables.md
Outdated
@@ -71,3 +71,4 @@ Reserved environment variables: | |||
|
|||
* `NODE_ENV` | |||
* `PUBLIC_DIR` | |||
* `GATSBY_BUILD_DIR` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this line be removed? As people can override GATSBY_BUILD_DIR
to set their preferred build directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you right, but in an other hand they could override node_env as well. In this case it mean that we use GATSBY_BUILD_DIR
in gatsby and so it would create conflict to use it in an other way.
Thanks @Calderis! This is looking good, I've added one question. And have one more request: Gatsby recently added a requirement that contributors sign-off commits. Could you do Check out the new Developer Certificate of Origin docs or comment here if you've any questions. Thanks for seeing through these changes :) |
8e4b1aa
to
fe121f5
Compare
@m-allanson I think it should be good (hope I did the sign stuff in the right way) |
8bd1522
to
b674df3
Compare
Signed-off-by: Wetteren Rémi <remi.wetteren@hetic.net>
b674df3
to
8523d16
Compare
💪 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff, thanks @Calderis!
}), | ||
handler: handlerP( | ||
getCommandHandler(`build`, (args, cmd) => { | ||
process.env.NODE_ENV = `production` | ||
process.env.GATSBY_BUILD_DIR = args.buildDirectory || `public` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should validate that the build directory is a valid one. Someone could do ../../../../../
or whatever. Perhaps we should insist that the build directory is a simple directory name at the same level as public would be? Or would people want to do nested build directories e.g. build1/test-1
or whatever?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should give the possibility to people to d nested build directories
Signed-off-by: Wetteren Rémi <remi.wetteren@hetic.net>
34a68f7
to
9cf06df
Compare
If the folder doesn't exist, we create it first |
I wonder if we should add more checks to the path of the build directory. e.g. if I set the path to |
I think we shouldn't be too involved in what user want to do. If we setup constraint it will be a pain for developer to do it their own way. If for some reason the guy want to point a folder out of gatsby, he should be able to do it (imo). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 🎉 🙏
Merged! I've added an issue for creating docs for this feature: #5623 |
💪👨💻✌️ |
Awesome! Just published this PR so feel free to give it a go for realz. |
This reverts commit 9fa8cd3.
This PR broke both develop and builds so reverting... :-( Just a note — webpack requires have to be static — you can't do string interpolation. |
Coming over from #5636, see also #5639 & #5640 One can find a more verbose version of bug report below at The …but in combination with the Same error, this is probably a result of the string interpolated webpack require Kyle mentions above. Maybe it will help to have an example, let me know if I can help test fix please, and thanks for all the work everyone.
Update |
is there someone to guide me a little to resolve the webpack stuff ? |
@KyleAMathews a configurable output path (public + .cache) would be useful in readonly filesystems (lambda) to. so whats the state of this? |
@Calderis I'm actually not too sure, maybe we can figure it out during a pairing session? If you sign up for a time slot at https://calendly.com/gatsbyjs, that'll hook you up with a Gatsby team member. |
@m-allanson Gatsby 2 is coming, Is it worth to ? |
It even doesnt work in gatsby2
Wetteren Rémi <notifications@github.com> schrieb am Fr., 3. Aug. 2018,
22:45:
… @m-allanson <https://github.com/m-allanson> Gatsby 2 is coming, Is it
worth to ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4756 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAR613vaFi8KD0afw8hzedcfvj1EFemHks5uNGIEgaJpZM4TAQ-N>
.
|
Hiya @Calderis! 👋 This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here. Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! 💪💜 |
I'd like to echo what @digitalkaoz mentioned above. The configurable output path is necessary for building static sites using AWS Lambda. Here's the use case I'd like to have: We current use gatsby to build medical reports for clinic members. Our input to the build process is a directory containing files with arrays of JSON objects and images/movies. We use gatsby-source-filesystem to ingest these files and then build a unique static site for each member who visits our facility that summarizes their medical data from a visit. Gatsby is great for this! I'm starting to build a more serious pipeline for automating gatsby site generation. Using AWS Lambda to build gatsby sites would be ideal (ingest this asset package from S3, build report on Lambda, publish to a new bucket that serves the static site securely to members); however, since AWS Lambda only allows writes to the /tmp/ directory, I can't build our reports on this service. Lambda seems like an ideal infrastructure piece for building and publishing sites in this situation where I'd need to build thousands of sites each from a unique data input package. Additionally, the solution of writing files to /public and then copying them over using some other tool isn't as option since AWS Lambda's filesystem is read-only except for the /tmp/ directory. In short--using AWS Lambda for building gatsby sites is not an option. Being able to build to a specific directory would make this a possibility and it would be a great way for us to build thousands of gatsby sites programatically. |
"postbuild": "rm -rf build/* && cp -r public/* build/", --> you can have any name intead of build folder ofcourse.
I use this command (The main reason of needing this , i put public folder into .gitignore and i only push build code on github/gitlab) |
Hi @MpMeetPatel. That would not work for the use case I've specified. AWS lambda is a read-only file system with the only allowed writes being to the /tmp/ directory. So if you want to use AWS lambda for building gatsby sites--in our case thousands of them--we'd need the ability to build directly to the /tmp/ directory. Building to ./public and then copying the files to another directory is not possible on Lambda. |
Sorry everyone to revive this very old thread but @coltonbh, was there ever a solution to deploying via an AWS Lambda using |
Hi @davidrhoderick. I haven't been working Gatsby since my original post. However it looks like #4756 added this feature to Gatsby maybe? |
* Give the possibility to add a --output website for build and develop Signed-off-by: Wetteren Rémi <remi.wetteren@hetic.net> * create folder is build directory doesn't exist Signed-off-by: Wetteren Rémi <remi.wetteren@hetic.net> * checking process env first * Trigger netlify rebuild
This reverts commit 9fa8cd3.
Based on issue #1878
What ?
I suggest adding option
--output-dir html
to setup the output directory ofbuild
anddevelop
command.How ?
The path is set to environment
GATSBY_OUTPUT_DIR
and replace the hardcodedpublic
value every where.Since the env
GATSBY_OUTPUT_DIR
is set, it means we can configure it in a .env file with dotenv or start child process with env option.Why ?
In that way we'll be able to run multiple instances of the same Gastby in parallel (if☺️
--output-dir
is set dynamically) without conflicts in the output folderExamples
Option 1
In your site folder, do
And you will have everything statically compiled below /mywebsite folder
Option 2
Install node package dotenv then create a .env file. Still in your site folder at the root
and your
.env
fileOption 3
Managed by a distant node process (with a node child_process for example) you start your program by specifying your environment