Skip to content

Commit

Permalink
Merge pull request #18089 from storybookjs/future/remove-app-apis
Browse files Browse the repository at this point in the history
Core: Remove standalone node APIs
  • Loading branch information
shilman authored Jun 19, 2022
2 parents a46a450 + 033235f commit 8cc4e6c
Show file tree
Hide file tree
Showing 25 changed files with 32 additions and 127 deletions.
21 changes: 21 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Modern ESM / IE11 support discontinued](#modern-esm--ie11-support-discontinued)
- [Framework field mandatory](#framework-field-mandatory)
- [frameworkOptions renamed](#frameworkoptions-renamed)
- [Framework standalone build moved](#framework-standalone-build-moved)
- [Docs modern inline rendering by default](#docs-modern-inline-rendering-by-default)
- [Babel mode v7 by default](#babel-mode-v7-by-default)
- [7.0 feature flags removed](#70-feature-flags-removed)
Expand Down Expand Up @@ -329,6 +330,26 @@ module.exports = {
}
```

#### Framework standalone build moved

In 7.0 the location of the standalone node API has moved to `@storybook/core-server`.

If you used the React standalone API, for example, you might have written:

```js
const { buildStandalone } = require('@storybook/react/standalone');
const options = {};
buildStandalone(options).then(() => console.log('done'));
```

In 7.0, you would now use:

```js
const build = require('@storybook/core-server/standalone');
const options = {};
build(options).then(() => console.log('done'));
```

#### Docs modern inline rendering by default

Storybook docs has a new rendering mode called "modern inline rendering" which unifies the way stories are rendered in Docs mode and in the canvas (aka story mode). It is still being stabilized in 7.0 dev cycle. If you run into trouble with inline rendering in docs, you can opt out of modern inline rendering in your `.storybook/main.js`:
Expand Down
8 changes: 5 additions & 3 deletions frameworks/angular/src/builders/build-storybook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import { from, Observable, of, throwError } from 'rxjs';
import type { CLIOptions } from '@storybook/core-common';
import { catchError, map, mapTo, switchMap } from 'rxjs/operators';
import { sync as findUpSync } from 'find-up';
import { sync as readUpSync } from 'read-pkg-up';
import {
BrowserBuilderOptions,
ExtraEntryPoint,
StylePreprocessorOptions,
} from '@angular-devkit/build-angular';

// eslint-disable-next-line import/no-extraneous-dependencies
import buildStandalone, { StandaloneOptions } from '@storybook/angular/standalone';
import { buildStaticStandalone } from '@storybook/core-server';
import type { StandaloneOptions } from '../utils/standalone-options';
import { runCompodoc } from '../utils/run-compodoc';
import { buildStandaloneErrorHandler } from '../utils/build-standalone-errors-handler';

Expand Down Expand Up @@ -66,6 +67,7 @@ function commandBuilder(
} = options;

const standaloneOptions: StandaloneOptions = {
packageJson: readUpSync({ cwd: __dirname }).packageJson,
configDir,
docs,
loglevel,
Expand Down Expand Up @@ -110,7 +112,7 @@ async function setup(options: StorybookBuilderOptions, context: BuilderContext)
}

function runInstance(options: StandaloneOptions) {
return from(buildStandalone(options)).pipe(
return from(buildStaticStandalone(options as any)).pipe(
catchError((error: any) => throwError(buildStandaloneErrorHandler(error)))
);
}
8 changes: 5 additions & 3 deletions frameworks/angular/src/builders/start-storybook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import { from, Observable, of } from 'rxjs';
import type { CLIOptions } from '@storybook/core-common';
import { map, switchMap, mapTo } from 'rxjs/operators';
import { sync as findUpSync } from 'find-up';
import { sync as readUpSync } from 'read-pkg-up';

// eslint-disable-next-line import/no-extraneous-dependencies
import buildStandalone, { StandaloneOptions } from '@storybook/angular/standalone';
import { buildDevStandalone } from '@storybook/core-server';
import type { StandaloneOptions } from '../utils/standalone-options';
import { runCompodoc } from '../utils/run-compodoc';
import { buildStandaloneErrorHandler } from '../utils/build-standalone-errors-handler';

Expand Down Expand Up @@ -81,6 +82,7 @@ function commandBuilder(
} = options;

const standaloneOptions: StandaloneOptions = {
packageJson: readUpSync({ cwd: __dirname }).packageJson,
ci,
configDir,
docs,
Expand Down Expand Up @@ -132,7 +134,7 @@ async function setup(options: StorybookBuilderOptions, context: BuilderContext)
function runInstance(options: StandaloneOptions) {
return new Observable<void>((observer) => {
// This Observable intentionally never complete, leaving the process running ;)
buildStandalone(options).then(
buildDevStandalone(options as any).then(
() => observer.next(),
(error) => observer.error(buildStandaloneErrorHandler(error))
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CLIOptions, LoadOptions, BuilderOptions } from '@storybook/core-common';
import type { BuilderContext } from '@angular-devkit/architect';
import type { LoadOptions, CLIOptions, BuilderOptions } from '@storybook/core-common';

export type StandaloneOptions = Partial<
CLIOptions &
Expand All @@ -15,7 +15,3 @@ export type StandaloneOptions = Partial<
tsConfig?: string;
}
>;

declare module '@storybook/angular/standalone' {
export default function buildStandalone(options: StandaloneOptions): Promise<unknown>;
}
7 changes: 0 additions & 7 deletions frameworks/angular/standalone.js

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/ember/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-client": "7.0.0-alpha.3",
"@storybook/core-common": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/docs-tools": "7.0.0-alpha.3",
"@storybook/store": "7.0.0-alpha.3",
"core-js": "^3.8.2",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/ember/standalone.js

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/html-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-common": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/html": "7.0.0-alpha.3",
"@storybook/preset-html-webpack": "7.0.0-alpha.3",
"@types/node": "^14.14.20 || ^16.0.0",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/html-webpack5/standalone.js

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/preact-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-common": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/preact": "7.0.0-alpha.3",
"@storybook/preset-preact-webpack": "7.0.0-alpha.3",
"@types/node": "^14.14.20 || ^16.0.0",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/preact-webpack5/standalone.js

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/react-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
},
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/preset-react-webpack": "7.0.0-alpha.3",
"@storybook/react": "7.0.0-alpha.3",
"@types/node": "^14.14.20 || ^16.0.0",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/react-webpack5/standalone.js

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/server-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-common": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/preset-server-webpack": "7.0.0-alpha.3",
"@storybook/server": "7.0.0-alpha.3",
"@types/node": "^14.14.20 || ^16.0.0",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/server-webpack5/standalone.js

This file was deleted.

28 changes: 0 additions & 28 deletions frameworks/standalone.test.ts

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/svelte-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-common": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/preset-svelte-webpack": "7.0.0-alpha.3",
"@storybook/svelte": "7.0.0-alpha.3",
"core-js": "^3.8.2",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/svelte-webpack5/standalone.js

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/vue-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-common": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/preset-vue-webpack": "7.0.0-alpha.3",
"@storybook/vue": "7.0.0-alpha.3",
"@types/node": "^14.14.20 || ^16.0.0",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/vue-webpack5/standalone.js

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/vue3-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"dependencies": {
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-common": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/preset-vue3-webpack": "7.0.0-alpha.3",
"@storybook/vue3": "7.0.0-alpha.3",
"@types/node": "^14.14.20 || ^16.0.0",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/vue3-webpack5/standalone.js

This file was deleted.

1 change: 0 additions & 1 deletion frameworks/web-components-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@babel/preset-env": "^7.12.11",
"@storybook/builder-webpack5": "7.0.0-alpha.3",
"@storybook/core-common": "7.0.0-alpha.3",
"@storybook/core-server": "7.0.0-alpha.3",
"@storybook/preset-web-components-webpack": "7.0.0-alpha.3",
"@storybook/web-components": "7.0.0-alpha.3",
"@types/node": "^14.14.20 || ^16.0.0",
Expand Down
7 changes: 0 additions & 7 deletions frameworks/web-components-webpack5/standalone.js

This file was deleted.

9 changes: 0 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7956,7 +7956,6 @@ __metadata:
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-client": 7.0.0-alpha.3
"@storybook/core-common": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/docs-tools": 7.0.0-alpha.3
"@storybook/store": 7.0.0-alpha.3
core-js: ^3.8.2
Expand Down Expand Up @@ -8063,7 +8062,6 @@ __metadata:
dependencies:
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-common": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/html": 7.0.0-alpha.3
"@storybook/preset-html-webpack": 7.0.0-alpha.3
"@types/node": ^14.14.20 || ^16.0.0
Expand Down Expand Up @@ -8296,7 +8294,6 @@ __metadata:
dependencies:
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-common": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/preact": 7.0.0-alpha.3
"@storybook/preset-preact-webpack": 7.0.0-alpha.3
"@types/node": ^14.14.20 || ^16.0.0
Expand Down Expand Up @@ -8586,7 +8583,6 @@ __metadata:
resolution: "@storybook/react-webpack5@workspace:frameworks/react-webpack5"
dependencies:
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/preset-react-webpack": 7.0.0-alpha.3
"@storybook/react": 7.0.0-alpha.3
"@types/node": ^14.14.20 || ^16.0.0
Expand Down Expand Up @@ -8983,7 +8979,6 @@ __metadata:
dependencies:
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-common": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/preset-server-webpack": 7.0.0-alpha.3
"@storybook/server": 7.0.0-alpha.3
"@types/node": ^14.14.20 || ^16.0.0
Expand Down Expand Up @@ -9058,7 +9053,6 @@ __metadata:
dependencies:
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-common": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/preset-svelte-webpack": 7.0.0-alpha.3
"@storybook/svelte": 7.0.0-alpha.3
core-js: ^3.8.2
Expand Down Expand Up @@ -9258,7 +9252,6 @@ __metadata:
dependencies:
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-common": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/preset-vue-webpack": 7.0.0-alpha.3
"@storybook/vue": 7.0.0-alpha.3
"@types/node": ^14.14.20 || ^16.0.0
Expand All @@ -9284,7 +9277,6 @@ __metadata:
dependencies:
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-common": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/preset-vue3-webpack": 7.0.0-alpha.3
"@storybook/vue3": 7.0.0-alpha.3
"@types/node": ^14.14.20 || ^16.0.0
Expand Down Expand Up @@ -9354,7 +9346,6 @@ __metadata:
"@babel/preset-env": ^7.12.11
"@storybook/builder-webpack5": 7.0.0-alpha.3
"@storybook/core-common": 7.0.0-alpha.3
"@storybook/core-server": 7.0.0-alpha.3
"@storybook/preset-web-components-webpack": 7.0.0-alpha.3
"@storybook/web-components": 7.0.0-alpha.3
"@types/node": ^14.14.20 || ^16.0.0
Expand Down

0 comments on commit 8cc4e6c

Please sign in to comment.