Skip to content

Commit

Permalink
Allow Next.js project not having a next.config file
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Dec 14, 2022
1 parent 4318e85 commit 5bf5a31
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 32 deletions.
50 changes: 25 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ parameters:
workflow:
description: Which workflow to run
type: enum
enum: ["ci", "pr", "merged", "daily"]
default: "ci"
enum: ['ci', 'pr', 'merged', 'daily']
default: 'ci'

executors:
sb_node_16_classic:
parameters:
class:
description: The Resource class
type: enum
enum: ["small", "medium", "medium+", "large", "xlarge"]
default: "small"
enum: ['small', 'medium', 'medium+', 'large', 'xlarge']
default: 'small'
working_directory: /tmp/storybook
docker:
- image: cimg/node:16.17.1
Expand All @@ -26,8 +26,8 @@ executors:
class:
description: The Resource class
type: enum
enum: ["small", "medium", "medium+", "large", "xlarge"]
default: "small"
enum: ['small', 'medium', 'medium+', 'large', 'xlarge']
default: 'small'
working_directory: /tmp/storybook
docker:
- image: cimg/node:16.17.1-browsers
Expand All @@ -39,8 +39,8 @@ executors:
class:
description: The Resource class
type: enum
enum: ["small", "medium", "medium+", "large", "xlarge"]
default: "small"
enum: ['small', 'medium', 'medium+', 'large', 'xlarge']
default: 'small'
working_directory: /tmp/storybook
docker:
- image: mcr.microsoft.com/playwright:v1.28.0-focal
Expand All @@ -55,7 +55,7 @@ orbs:

commands:
cancel-workflow-on-failure:
description: "Cancels the entire workflow in case the previous step has failed"
description: 'Cancels the entire workflow in case the previous step has failed'
steps:
- run:
name: Cancel current workflow
Expand All @@ -65,13 +65,13 @@ commands:
echo "To execute all checks locally, please run yarn ci-tests"
curl -X POST --header "Content-Type: application/json" "https://circleci.com/api/v2/workflow/${CIRCLE_WORKFLOW_ID}/cancel?circle-token=${WORKFLOW_CANCELER}"
report-workflow-on-failure:
description: "Reports failures to discord"
description: 'Reports failures to discord'
parameters:
template:
description: |
Which template to report in discord. Applicable for parallel sandbox jobs
type: string
default: "none"
default: 'none'
steps:
- run:
when: on_fail
Expand All @@ -87,7 +87,7 @@ jobs:
name: sb_node_16_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- run:
name: Prettier
command: |
Expand All @@ -100,7 +100,7 @@ jobs:
name: sb_node_16_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- restore_cache:
name: Restore Yarn cache
keys:
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
working_directory: /tmp/storybook
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
working_directory: /tmp/storybook
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand Down Expand Up @@ -223,7 +223,7 @@ jobs:
name: sb_node_16_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand All @@ -239,7 +239,7 @@ jobs:
name: sb_node_16_classic
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand All @@ -253,7 +253,7 @@ jobs:
executor: sb_node_16_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand All @@ -271,7 +271,7 @@ jobs:
name: sb_node_16_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand All @@ -293,7 +293,7 @@ jobs:
name: sb_node_16_browsers
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand Down Expand Up @@ -334,7 +334,7 @@ jobs:
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand All @@ -359,7 +359,7 @@ jobs:
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand All @@ -380,7 +380,7 @@ jobs:
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand Down Expand Up @@ -414,7 +414,7 @@ jobs:
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand Down Expand Up @@ -455,7 +455,7 @@ jobs:
parallelism: << parameters.parallelism >>
steps:
- git-shallow-clone/checkout_advanced:
clone_options: "--depth 1 --verbose"
clone_options: '--depth 1 --verbose'
- attach_workspace:
at: .
- run:
Expand Down
8 changes: 1 addition & 7 deletions code/frameworks/nextjs/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,7 @@ export const resolveNextConfig = async ({
const nextConfigFile = nextConfigPath || (await findNextConfigFile(configDir));

if (!nextConfigFile || (await pathExists(nextConfigFile)) === false) {
throw new Error(
dedent`
Could not find or resolve your Next config file. Please provide the next config file path as a framework option.
More info: https://github.com/storybookjs/storybook/blob/next/code/frameworks/nextjs/README.md#options
`
);
return {};
}

const nextConfigExport = await import(pathToFileURL(nextConfigFile).href);
Expand Down

0 comments on commit 5bf5a31

Please sign in to comment.