Skip to content

Commit

Permalink
Merge pull request #24346 from storybookjs/yann/fix-nightly
Browse files Browse the repository at this point in the history
CLI: Fix Nextjs project detection
(cherry picked from commit 5c308f7)
  • Loading branch information
yannbf authored and storybook-bot committed Oct 3, 2023
1 parent 8b47f90 commit e3e9e83
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate-sandboxes-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
run: yarn wait-on http://localhost:6001
working-directory: ./code
- name: Generate
run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease
run: yarn generate-sandboxes --local-registry --exclude=angular-cli/prerelease --debug
working-directory: ./code
- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=next
Expand Down
9 changes: 1 addition & 8 deletions code/lib/cli/src/project_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ function ltMajor(versionRange: string, major: number) {
return validRange(versionRange) && minVersion(versionRange).major < major;
}

function gtMajor(versionRange: string, major: number) {
// Uses validRange to avoid a throw from minVersion if an invalid range gets passed
return validRange(versionRange) && minVersion(versionRange).major > major;
}

function eqMajor(versionRange: string, major: number) {
// Uses validRange to avoid a throw from minVersion if an invalid range gets passed
return validRange(versionRange) && minVersion(versionRange).major === major;
Expand Down Expand Up @@ -162,9 +157,7 @@ export const supportedTemplates: TemplateConfiguration[] = [
},
{
preset: ProjectType.NEXTJS,
dependencies: {
next: (versionRange) => eqMajor(versionRange, 9) || gtMajor(versionRange, 9),
},
dependencies: ['next'],
matcherFunction: ({ dependencies }) => {
return dependencies.every(Boolean);
},
Expand Down
4 changes: 4 additions & 0 deletions scripts/sandbox/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ const runGenerators = async (
localRegistry = true,
debug = false
) => {
if (debug) {
console.log('Debug mode enabled. Verbose logs will be printed to the console.');
}

console.log(`🤹‍♂️ Generating sandboxes with a concurrency of ${maxConcurrentTasks}`);

const limit = pLimit(maxConcurrentTasks);
Expand Down

0 comments on commit e3e9e83

Please sign in to comment.