Skip to content

Commit

Permalink
Merge pull request #6 from storybookjs/shilman/update-to-storybook-next
Browse files Browse the repository at this point in the history
Changes to use SB@next instead of canary
shilman authored Dec 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 9381412 + d5b0e65 commit 3f1963d
Showing 7 changed files with 46 additions and 118 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ jobs:
uses: BerniWittmann/background-server-action@v1
with:
cwd: scripts
start: pnpm ts-node test.ts
start: pnpm tsx test.ts
wait-on: 'http://localhost:3000'
wait-on-timeout: 300
command: pnpm playwright test
@@ -39,7 +39,7 @@ jobs:
uses: BerniWittmann/background-server-action@v1
with:
cwd: scripts
start: pnpm ts-node test.ts
start: pnpm tsx test.ts
wait-on: 'http://localhost:3000'
wait-on-timeout: 300
command: pnpm playwright test
12 changes: 6 additions & 6 deletions packages/create-nextjs-storybook/src/index.ts
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import { codeLog } from './cli/helpers.js';
const logger = console;

const DIRNAME = new URL('.', import.meta.url).pathname;
const VERSION = '0.0.0-pr-24447-sha-c98bddd2';
const VERSION = 'next';

const ensureDirShallow = async (path: string) => mkdir(path).catch(() => {});

@@ -162,7 +162,7 @@ const init = async () => {
const language = await detectLanguage(packageManager);

const appDir = isAppDir(process.cwd());
const corePackages = ['storybook', '@storybook/react', '@storybook/nextjs-server'];
const corePackages = ['storybook', '@storybook/react'];
const addons = appDir
? ['@storybook/addon-controls']
: [
@@ -185,10 +185,10 @@ const init = async () => {
await createRoutes(options);
await updateNextConfig();
status('Installing package dependencies', 1500);
await packageManager.addDependencies(
{ installAsDevDependencies: true },
_version([...corePackages, ...addons])
);
await packageManager.addDependencies({ installAsDevDependencies: true }, [
'@storybook/nextjs-server',
..._version([...corePackages, ...addons]),
]);

done = true;
spinner.succeed('Done!');
2 changes: 1 addition & 1 deletion packages/nextjs-server/package.json
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"next": "^14",
"next": "^14.0.4",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
4 changes: 2 additions & 2 deletions packages/nextjs-server/src/indexers.ts
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ export const appIndexer = (

const pageTsx = dedent`
import React from 'react';
import { composeStory } from '@storybook/react/testing-api';
import { composeStory } from '@storybook/react';
import { getArgs } from '../components/args';
import { Prepare, StoryAnnotations } from '../components/Prepare';
import { Args } from '@storybook/react';
@@ -68,7 +68,7 @@ export const appIndexer = (
const Composed = composeStory(stories.${exportName}, stories.default, projectAnnotations?.default || {}, '${exportName}');
const extraArgs = await getArgs(Composed.id);
const { id, parameters, argTypes, initialArgs } = Composed;
const { id, parameters, argTypes, args: initialArgs } = Composed;
const args = { ...initialArgs, ...extraArgs };
const storyAnnotations: StoryAnnotations<Args> = {
131 changes: 30 additions & 101 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions scripts/package.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
"private": true,
"license": "MIT",
"type": "module",
"dependencies": {},
"devDependencies": {
"@playwright/test": "^1.40.0",
"@types/fs-extra": "^11.0.4",
@@ -19,10 +18,10 @@
"playwright": "^1.40.0",
"slash": "^3.0.0",
"tempy": "^3.1.0",
"type-fest": "~2.19",
"ts-dedent": "^2.2.0",
"ts-node": "^10.9.1",
"tsup": "^6.7.0",
"tsx": "^4.6.2",
"type-fest": "~2.19",
"typescript": "^5.3.2"
}
}
6 changes: 3 additions & 3 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -2,12 +2,12 @@
"compilerOptions": {
"target": "es2020",
"module": "esnext",
"module": "ESNext",
"lib": ["es2020"],
"esModuleInterop": true,
"strict": true,
"moduleResolution": "node"
},
"ts-node": {
"esm": true
}
"include": ["/**/*.ts"],
"exclude": ["node_modules"]
}

0 comments on commit 3f1963d

Please sign in to comment.