This repository was archived by the owner on May 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
use configurable functionsDir and publishDir throughout NoN #89
Merged
lindsaylevine
merged 2 commits into
netlify:main
from
lindsaylevine:ll/configurable-dirs
Nov 17, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Get next.config.js | ||
const { PHASE_PRODUCTION_BUILD } = require("next/constants"); | ||
const { default: loadConfig } = require("next/dist/next-server/server/config"); | ||
const { resolve } = require("path"); | ||
|
||
const getNextConfig = () => { | ||
// Load next.config.js | ||
// Use same code as https://github.com/vercel/next.js/blob/25488f4a03db30cade4d086ba49cd9a50a2ac02e/packages/next/build/index.ts#L114 | ||
return loadConfig(PHASE_PRODUCTION_BUILD, resolve(".")); | ||
}; | ||
|
||
module.exports = getNextConfig; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
const { existsSync, copySync } = require("fs-extra"); | ||
const { logTitle } = require("../helpers/logger"); | ||
const { NETLIFY_PUBLISH_PATH, PUBLIC_PATH } = require("../config"); | ||
const { PUBLIC_PATH } = require("../config"); | ||
|
||
// Copy files from public folder to Netlify publish folder | ||
const copyPublicFiles = () => { | ||
const copyPublicFiles = (publishPath) => { | ||
// Abort if no public/ folder | ||
if (!existsSync(PUBLIC_PATH)) return; | ||
|
||
// Perform copy operation | ||
logTitle("🌍️ Copying", PUBLIC_PATH, "folder to", NETLIFY_PUBLISH_PATH); | ||
copySync(PUBLIC_PATH, NETLIFY_PUBLISH_PATH); | ||
logTitle("🌍️ Copying", PUBLIC_PATH, "folder to", publishPath); | ||
copySync(PUBLIC_PATH, publishPath); | ||
}; | ||
|
||
module.exports = copyPublicFiles; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
const { emptyDirSync } = require("fs-extra"); | ||
const { logTitle, log } = require("../helpers/logger"); | ||
const { NETLIFY_PUBLISH_PATH, NETLIFY_FUNCTIONS_PATH } = require("../config"); | ||
|
||
// Empty existing publish and functions folders | ||
const prepareFolders = () => { | ||
const prepareFolders = ({ functionsPath, publishPath }) => { | ||
logTitle("🚀 Next on Netlify 🚀"); | ||
log(" ", "Functions directory:", NETLIFY_FUNCTIONS_PATH); | ||
log(" ", "Publish directory: ", NETLIFY_PUBLISH_PATH); | ||
log(" ", "Functions directory: ", functionsPath); | ||
log(" ", "Publish directory: ", publishPath); | ||
log(" ", "Make sure these are set in your netlify.toml file."); | ||
|
||
emptyDirSync(NETLIFY_PUBLISH_PATH); | ||
emptyDirSync(NETLIFY_FUNCTIONS_PATH); | ||
emptyDirSync(publishPath); | ||
emptyDirSync(functionsPath); | ||
}; | ||
|
||
module.exports = prepareFolders; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// Set up all our NextJS pages according to the recipes defined in pages/ | ||
const setupPages = () => { | ||
require("../pages/api/setup")(); | ||
require("../pages/getInitialProps/setup")(); | ||
require("../pages/getServerSideProps/setup")(); | ||
require("../pages/getStaticProps/setup")(); | ||
require("../pages/getStaticPropsWithFallback/setup")(); | ||
require("../pages/getStaticPropsWithRevalidate/setup")(); | ||
require("../pages/withoutProps/setup")(); | ||
const setupPages = ({ functionsPath, publishPath }) => { | ||
require("../pages/api/setup")(functionsPath); | ||
require("../pages/getInitialProps/setup")(functionsPath); | ||
require("../pages/getServerSideProps/setup")(functionsPath); | ||
require("../pages/getStaticProps/setup")({ functionsPath, publishPath }); | ||
require("../pages/getStaticPropsWithFallback/setup")(functionsPath); | ||
require("../pages/getStaticPropsWithRevalidate/setup")(functionsPath); | ||
require("../pages/withoutProps/setup")(publishPath); | ||
}; | ||
|
||
module.exports = setupPages; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thought i'd want and need this file in another part but ended up not using it here (except calling from getNextDistDir). this is a function i'm also adding in the i18n work so we can leave it :)