@storybook/angular 7.0.0-beta.12 → 7.0.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,6 +28,7 @@ const child_process_1 = require("child_process");
28
28
  const rxjs_1 = require("rxjs");
29
29
  const path = __importStar(require("path"));
30
30
  const hasTsConfigArg = (args) => args.indexOf('-p') !== -1;
31
+ const hasOutputArg = (args) => args.indexOf('-d') !== -1 || args.indexOf('--output') !== -1;
31
32
  // path.relative is necessary to workaround a compodoc issue with
32
33
  // absolute paths on windows machines
33
34
  const toRelativePath = (pathToTsConfig) => {
@@ -40,8 +41,7 @@ const runCompodoc = ({ compodocArgs, tsconfig }, context) => {
40
41
  'compodoc',
41
42
  // Default options
42
43
  ...(hasTsConfigArg(compodocArgs) ? [] : ['-p', tsConfigPath]),
43
- '-d',
44
- `${context.workspaceRoot}`,
44
+ ...(hasOutputArg(compodocArgs) ? [] : ['-d', `${context.workspaceRoot}`]),
45
45
  ...compodocArgs,
46
46
  ];
47
47
  try {
@@ -56,4 +56,46 @@ describe('runCompodoc', () => {
56
56
  shell: true,
57
57
  });
58
58
  });
59
+ it('should run compodoc with default output folder.', async () => {
60
+ runCompodoc({
61
+ compodocArgs: [],
62
+ tsconfig: 'path/to/tsconfig.json',
63
+ }, {
64
+ workspaceRoot: 'path/to/project',
65
+ logger: builderContextLoggerMock,
66
+ })
67
+ .pipe((0, operators_1.take)(1))
68
+ .subscribe();
69
+ expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', 'path/to/tsconfig.json', '-d', 'path/to/project'], {
70
+ cwd: 'path/to/project',
71
+ });
72
+ });
73
+ it('should run with custom output folder specified with --output compodocArgs', async () => {
74
+ runCompodoc({
75
+ compodocArgs: ['--output', 'path/to/customFolder'],
76
+ tsconfig: 'path/to/tsconfig.json',
77
+ }, {
78
+ workspaceRoot: 'path/to/project',
79
+ logger: builderContextLoggerMock,
80
+ })
81
+ .pipe((0, operators_1.take)(1))
82
+ .subscribe();
83
+ expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', 'path/to/tsconfig.json', '--output', 'path/to/customFolder'], {
84
+ cwd: 'path/to/project',
85
+ });
86
+ });
87
+ it('should run with custom output folder specified with -d compodocArgs', async () => {
88
+ runCompodoc({
89
+ compodocArgs: ['-d', 'path/to/customFolder'],
90
+ tsconfig: 'path/to/tsconfig.json',
91
+ }, {
92
+ workspaceRoot: 'path/to/project',
93
+ logger: builderContextLoggerMock,
94
+ })
95
+ .pipe((0, operators_1.take)(1))
96
+ .subscribe();
97
+ expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', 'path/to/tsconfig.json', '-d', 'path/to/customFolder'], {
98
+ cwd: 'path/to/project',
99
+ });
100
+ });
59
101
  });
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.renderNgApp = void 0;
7
- const global_1 = __importDefault(require("global"));
4
+ const global_1 = require("@storybook/global");
8
5
  const core_1 = require("@angular/core");
9
6
  const forms_1 = require("@angular/forms");
10
7
  const platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
@@ -12,7 +9,7 @@ const platform_browser_1 = require("@angular/platform-browser");
12
9
  const rxjs_1 = require("rxjs");
13
10
  const app_component_1 = require("./app.component");
14
11
  const app_token_1 = require("./app.token");
15
- const { document } = global_1.default;
12
+ const { document } = global_1.global;
16
13
  let platform = null;
17
14
  let promises = [];
18
15
  let storyData = new rxjs_1.ReplaySubject(1);
@@ -1,20 +1,18 @@
1
1
  "use strict";
2
- /* eslint-disable no-underscore-dangle */
3
- /* global window */
4
2
  Object.defineProperty(exports, "__esModule", { value: true });
5
3
  exports.extractComponentDescription = exports.extractArgTypes = exports.extractArgTypesFromData = exports.extractType = exports.findComponentByName = exports.checkValidCompodocJson = exports.checkValidComponentOrDirective = exports.getCompodocJson = exports.setCompodocJson = exports.isMethod = void 0;
4
+ /* eslint-disable no-underscore-dangle */
5
+ const global_1 = require("@storybook/global");
6
6
  const client_logger_1 = require("@storybook/client-logger");
7
7
  const isMethod = (methodOrProp) => {
8
8
  return methodOrProp.args !== undefined;
9
9
  };
10
10
  exports.isMethod = isMethod;
11
11
  const setCompodocJson = (compodocJson) => {
12
- // @ts-expect-error (Converted from ts-ignore)
13
- window.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
12
+ global_1.global.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
14
13
  };
15
14
  exports.setCompodocJson = setCompodocJson;
16
- // @ts-expect-error (Converted from ts-ignore)
17
- const getCompodocJson = () => window.__STORYBOOK_COMPODOC_JSON__;
15
+ const getCompodocJson = () => global_1.global.__STORYBOOK_COMPODOC_JSON__;
18
16
  exports.getCompodocJson = getCompodocJson;
19
17
  const checkValidComponentOrDirective = (component) => {
20
18
  if (!component.name) {
@@ -167,7 +165,7 @@ const extractDefaultValueFromComments = (property, value) => {
167
165
  let commentValue = value;
168
166
  property.jsdoctags.forEach((tag) => {
169
167
  if (['default', 'defaultvalue'].includes(tag.tagName.escapedText)) {
170
- const dom = new window.DOMParser().parseFromString(tag.comment, 'text/html');
168
+ const dom = new global_1.global.DOMParser().parseFromString(tag.comment, 'text/html');
171
169
  commentValue = dom.body.textContent;
172
170
  }
173
171
  });
@@ -6,8 +6,7 @@ const compodoc_1 = require("./compodoc");
6
6
  const sourceDecorator_1 = require("./sourceDecorator");
7
7
  exports.parameters = {
8
8
  docs: {
9
- // probably set this to true by default once it's battle-tested
10
- inlineStories: false,
9
+ inlineStories: true,
11
10
  extractArgTypes: compodoc_1.extractArgTypes,
12
11
  extractComponentDescription: compodoc_1.extractComponentDescription,
13
12
  source: {
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const global_1 = __importDefault(require("global"));
3
+ const global_1 = require("@storybook/global");
7
4
  /**
8
5
  * This file includes polyfills needed by Angular and is loaded before the app.
9
6
  * You can add your own extra polyfills to this file.
@@ -63,5 +60,4 @@ require("zone.js/dist/zone"); // Included with Angular CLI.
63
60
  * Need to import at least one locale-data with intl.
64
61
  */
65
62
  // import 'intl/locale-data/jsonp/en';
66
- const { window: globalWindow } = global_1.default;
67
- globalWindow.STORYBOOK_ENV = 'angular';
63
+ global_1.global.STORYBOOK_ENV = 'angular';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "7.0.0-beta.12",
3
+ "version": "7.0.0-beta.14",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -34,18 +34,19 @@
34
34
  "prep": "rimraf dist && ../../../scripts/node_modules/.bin/tsc --project tsconfig.build.json && echo \"Preventing passing flags to tsc\""
35
35
  },
36
36
  "dependencies": {
37
- "@storybook/builder-webpack5": "7.0.0-beta.12",
38
- "@storybook/client-logger": "7.0.0-beta.12",
39
- "@storybook/core-client": "7.0.0-beta.12",
40
- "@storybook/core-common": "7.0.0-beta.12",
41
- "@storybook/core-events": "7.0.0-beta.12",
42
- "@storybook/core-server": "7.0.0-beta.12",
43
- "@storybook/core-webpack": "7.0.0-beta.12",
44
- "@storybook/docs-tools": "7.0.0-beta.12",
45
- "@storybook/manager-api": "7.0.0-beta.12",
46
- "@storybook/node-logger": "7.0.0-beta.12",
47
- "@storybook/preview-api": "7.0.0-beta.12",
48
- "@storybook/types": "7.0.0-beta.12",
37
+ "@storybook/builder-webpack5": "7.0.0-beta.14",
38
+ "@storybook/client-logger": "7.0.0-beta.14",
39
+ "@storybook/core-client": "7.0.0-beta.14",
40
+ "@storybook/core-common": "7.0.0-beta.14",
41
+ "@storybook/core-events": "7.0.0-beta.14",
42
+ "@storybook/core-server": "7.0.0-beta.14",
43
+ "@storybook/core-webpack": "7.0.0-beta.14",
44
+ "@storybook/docs-tools": "7.0.0-beta.14",
45
+ "@storybook/global": "^5.0.0",
46
+ "@storybook/manager-api": "7.0.0-beta.14",
47
+ "@storybook/node-logger": "7.0.0-beta.14",
48
+ "@storybook/preview-api": "7.0.0-beta.14",
49
+ "@storybook/types": "7.0.0-beta.14",
49
50
  "@types/node": "^16.0.0",
50
51
  "@types/react": "^16.14.34",
51
52
  "@types/react-dom": "^16.9.14",
@@ -53,7 +54,6 @@
53
54
  "@types/webpack-env": "^1.18.0",
54
55
  "core-js": "^3.8.2",
55
56
  "find-up": "^5.0.0",
56
- "global": "^4.4.0",
57
57
  "read-pkg-up": "^7.0.1",
58
58
  "semver": "^7.3.7",
59
59
  "telejson": "^7.0.3",
@@ -122,5 +122,5 @@
122
122
  "access": "public"
123
123
  },
124
124
  "builders": "dist/builders/builders.json",
125
- "gitHead": "dd52c7e8853bc40791deb55e36473c0c18ab5957"
125
+ "gitHead": "c3b2e8fe2517ba2d7630e260de0fd1ad86cafeb6"
126
126
  }
@@ -5,7 +5,7 @@ import Button from './button.component';
5
5
  const meta: Meta<Button> = {
6
6
  title: 'Example/Button',
7
7
  component: Button,
8
- tags: ['docsPage'],
8
+ tags: ['autodocs'],
9
9
  render: (args: Button) => ({
10
10
  props: {
11
11
  backgroundColor: null,
@@ -8,8 +8,8 @@ import Header from './header.component';
8
8
  const meta: Meta<Header> = {
9
9
  title: 'Example/Header',
10
10
  component: Header,
11
- // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/angular/writing-docs/docs-page
12
- tags: ['docsPage'],
11
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/7.0/angular/writing-docs/docs-page
12
+ tags: ['autodocs'],
13
13
  render: (args) => ({ props: args }),
14
14
  decorators: [
15
15
  moduleMetadata({
@@ -1,8 +1,8 @@
1
- import globalThis from 'global';
1
+ import { global } from '@storybook/global';
2
2
 
3
3
  import Button from './button.component';
4
4
  import Html from './html.component';
5
5
  import Pre from './pre.component';
6
6
  import Form from './form.component';
7
7
 
8
- globalThis.Components = { Button, Html, Pre, Form };
8
+ global.Components = { Button, Html, Pre, Form };
@@ -1,4 +1,4 @@
1
- import globalThis from 'global';
1
+ import { global as globalThis } from '@storybook/global';
2
2
  import { moduleMetadata } from '@storybook/angular';
3
3
  import { Meta, Story, Canvas } from '@storybook/addon-docs';
4
4