-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: (#516) adding a next config, moving nextConfig to withFaust * fix: removing try/catch from getProps and adding beforeEach to getProps.test for creating config * feat: (#516) configuration is separate per package * feat: (#516) updating tests, docs, exports, and examples to use config instead of headlessConfig * doc: (#516) adding changeset for ISR timing configuration
- Loading branch information
Showing
27 changed files
with
287 additions
and
134 deletions.
There are no files selected for viewing
This file contains 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,55 @@ | ||
--- | ||
'@faustjs/core': minor | ||
'@faustjs/next': minor | ||
'@faustjs/react': minor | ||
--- | ||
|
||
`headlessConfig` from `@faustjs/core` is now just `config`, and `@faustjs/next` has its own `config` with a global revalidate option. | ||
|
||
Your `faust.config.js` needs to change to look like this: | ||
|
||
```ts | ||
import { config as coreConfig } from '@faustjs/core'; | ||
|
||
if (!process.env.NEXT_PUBLIC_WORDPRESS_URL) { | ||
console.error( | ||
'You must provide a NEXT_PUBLIC_WORDPRESS_URL environment variable, did you forget to load your .env.local file?', | ||
); | ||
} | ||
|
||
/** | ||
* @type {import("@faustjs/core").Config} | ||
*/ | ||
export default coreConfig({ | ||
wpUrl: process.env.NEXT_PUBLIC_WORDPRESS_URL, | ||
apiClientSecret: process.env.WP_HEADLESS_SECRET, | ||
}); | ||
``` | ||
|
||
Or, to configure the global `revalidate` option in `@faustjs/next`: | ||
|
||
|
||
```ts | ||
import { config as coreConfig } from '@faustjs/core'; | ||
import { config as nextConfig } from '@faustjs/next'; | ||
|
||
if (!process.env.NEXT_PUBLIC_WORDPRESS_URL) { | ||
console.error( | ||
'You must provide a NEXT_PUBLIC_WORDPRESS_URL environment variable, did you forget to load your .env.local file?', | ||
); | ||
} | ||
|
||
nextConfig({ | ||
revalidate: 60, // 1 minute | ||
}); | ||
|
||
/** | ||
* @type {import("@faustjs/core").Config} | ||
*/ | ||
export default coreConfig({ | ||
wpUrl: process.env.NEXT_PUBLIC_WORDPRESS_URL, | ||
apiClientSecret: process.env.WP_HEADLESS_SECRET, | ||
}); | ||
``` | ||
|
||
> **NOTE**: `@faustjs/next` defaults to `revalidate: 900` (15 minutes). |
This file contains 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 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 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 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 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 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 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 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 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 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 +1 @@ | ||
export { HeadlessConfig, headlessConfig, getGqlUrl } from './config'; | ||
export { Config, config, getGqlUrl } from './config'; |
This file contains 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
Oops, something went wrong.