Skip to content

Commit

Permalink
Merge pull request #24453 from storybookjs/valentin/setup-sandboxes
Browse files Browse the repository at this point in the history
Sandbox: Add new sandboxes
  • Loading branch information
valentinpalkovic authored Oct 12, 2023
2 parents e9f2e1f + 74bd3b0 commit 6b2150c
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 112 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -609,30 +609,30 @@ workflows:
requires:
- build
- create-sandboxes:
parallelism: 34
parallelism: 36
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 34
parallelism: 36
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 31
parallelism: 33
requires:
- build-sandboxes
- e2e-production:
parallelism: 31
parallelism: 33
requires:
- build-sandboxes
- e2e-dev:
parallelism: 4
requires:
- create-sandboxes
- test-runner-production:
parallelism: 31
parallelism: 33
requires:
- build-sandboxes
# TODO: reenable once we find out the source of flakyness
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-sandboxes-main.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
working-directory: ./code
- name: Publish
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=main
Expand Down
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 --debug
run: yarn generate-sandboxes --local-registry --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
2 changes: 1 addition & 1 deletion code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"@types/babel__core": "^7",
"@types/babel__plugin-transform-runtime": "^7",
"@types/babel__preset-env": "^7",
"next": "13.4.19",
"next": "13.5.4",
"typescript": "^4.9.3",
"webpack": "^5.65.0"
},
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/nextjs/src/config/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const setupRuntimeConfig = (baseConfig: WebpackConfig, nextConfig: NextConfig):
}),
};

const newNextLinkBehavior = nextConfig.experimental?.newNextLinkBehavior;
const newNextLinkBehavior = (nextConfig.experimental as any)?.newNextLinkBehavior;

/**
* In Next 13.0.0 - 13.0.5, the `newNextLinkBehavior` option now defaults to truthy (still
Expand Down
20 changes: 11 additions & 9 deletions code/frameworks/nextjs/src/dependency-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ const mapping: Record<string, Record<string, string>> = {
'<11.1.0': {
'next/dist/next-server/lib/router-context': 'next/dist/next-server/lib/router-context',
},
'>=11.1.0': {
'>=11.1.0 <13.5.0': {
'next/dist/shared/lib/router-context': 'next/dist/shared/lib/router-context',
},
'>=13.5.0': {
'next/dist/shared/lib/router-context': 'next/dist/shared/lib/router-context.shared-runtime',
'next/dist/shared/lib/head-manager-context':
'next/dist/shared/lib/head-manager-context.shared-runtime',
'next/dist/shared/lib/app-router-context':
'next/dist/shared/lib/app-router-context.shared-runtime',
'next/dist/shared/lib/hooks-client-context':
'next/dist/shared/lib/hooks-client-context.shared-runtime',
'>=13.0.2 <13.5.0': {
'next/dist/shared/lib/hooks-client-context.shared-runtime':
'next/dist/shared/lib/hooks-client-context',
},
'<13.5.0': {
'next/dist/shared/lib/router-context.shared-runtime': 'next/dist/shared/lib/router-context',
'next/dist/shared/lib/head-manager-context.shared-runtime':
'next/dist/shared/lib/head-manager-context',
'next/dist/shared/lib/app-router-context.shared-runtime':
'next/dist/shared/lib/app-router-context',
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useMemo } from 'react';
import { HeadManagerContext } from 'next/dist/shared/lib/head-manager-context';
import { HeadManagerContext } from 'next/dist/shared/lib/head-manager-context.shared-runtime';
import initHeadManager from 'next/dist/client/head-manager';

type HeadManagerValue = {
Expand Down
18 changes: 11 additions & 7 deletions code/frameworks/nextjs/src/routing/app-router-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import type {
LayoutRouterContext as TLayoutRouterContext,
AppRouterContext as TAppRouterContext,
GlobalLayoutRouterContext as TGlobalLayoutRouterContext,
} from 'next/dist/shared/lib/app-router-context';
} from 'next/dist/shared/lib/app-router-context.shared-runtime';
import type {
PathnameContext as TPathnameContext,
SearchParamsContext as TSearchParamsContext,
} from 'next/dist/shared/lib/hooks-client-context';
} from 'next/dist/shared/lib/hooks-client-context.shared-runtime';
import type { FlightRouterState } from 'next/dist/server/app-render/types';
import type { RouteParams } from './types';

Expand All @@ -25,12 +25,16 @@ let SearchParamsContext: typeof TSearchParamsContext;
let GlobalLayoutRouterContext: typeof TGlobalLayoutRouterContext;

try {
AppRouterContext = require('next/dist/shared/lib/app-router-context').AppRouterContext;
LayoutRouterContext = require('next/dist/shared/lib/app-router-context').LayoutRouterContext;
PathnameContext = require('next/dist/shared/lib/hooks-client-context').PathnameContext;
SearchParamsContext = require('next/dist/shared/lib/hooks-client-context').SearchParamsContext;
AppRouterContext =
require('next/dist/shared/lib/app-router-context.shared-runtime').AppRouterContext;
LayoutRouterContext =
require('next/dist/shared/lib/app-router-context.shared-runtime').LayoutRouterContext;
PathnameContext =
require('next/dist/shared/lib/hooks-client-context.shared-runtime').PathnameContext;
SearchParamsContext =
require('next/dist/shared/lib/hooks-client-context.shared-runtime').SearchParamsContext;
GlobalLayoutRouterContext =
require('next/dist/shared/lib/app-router-context').GlobalLayoutRouterContext;
require('next/dist/shared/lib/app-router-context.shared-runtime').GlobalLayoutRouterContext;
} catch {
AppRouterContext = React.Fragment as any;
LayoutRouterContext = React.Fragment as any;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Globals } from '@storybook/csf';
import { RouterContext } from 'next/dist/shared/lib/router-context';
import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime';
import React from 'react';
import type { RouteParams } from './types';

Expand Down
17 changes: 13 additions & 4 deletions code/lib/cli/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ const baseTemplates = {
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'nextjs/prerelease': {
name: 'Next.js Prerelease (Webpack | TypeScript)',
script:
'npx create-next-app@canary {{beforeDir}} --typescript --eslint --tailwind --app --import-alias="@/*" --src-dir',
expected: {
framework: '@storybook/nextjs',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'react-vite/default-js': {
name: 'React Latest (Vite | JavaScript)',
script: 'npm create vite@latest --yes {{beforeDir}} -- --template react',
Expand Down Expand Up @@ -296,8 +307,6 @@ const baseTemplates = {
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
// TODO: Should be removed after we merge this PR: https://github.com/storybookjs/storybook/pull/24188
inDevelopment: true,
},
'angular-cli/default-ts': {
name: 'Angular CLI Latest (Webpack | TypeScript)',
Expand Down Expand Up @@ -586,8 +595,7 @@ export const merged: TemplateKey[] = [
];
export const daily: TemplateKey[] = [
...merged,
// TODO: Should be re-added after we merge this PR: https://github.com/storybookjs/storybook/pull/24188
// 'angular-cli/prerelease',
'angular-cli/prerelease',
'cra/default-js',
'react-vite/default-js',
'vue3-vite/default-js',
Expand All @@ -598,6 +606,7 @@ export const daily: TemplateKey[] = [
'svelte-vite/default-js',
'nextjs/12-js',
'nextjs/default-js',
'nextjs/prerelease',
'qwik-vite/default-ts',
'preact-webpack5/default-js',
'preact-vite/default-js',
Expand Down
Loading

0 comments on commit 6b2150c

Please sign in to comment.