@storybook/angular 7.0.0-beta.11 → 7.0.0-beta.13
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.
- package/dist/builders/utils/run-compodoc.js +2 -2
- package/dist/builders/utils/run-compodoc.spec.js +42 -0
- package/dist/client/angular/helpers.js +2 -5
- package/dist/client/docs/compodoc.js +5 -7
- package/dist/client/globals.js +2 -6
- package/package.json +15 -15
- package/template/components/index.js +2 -2
- package/template/stories/angular-mdx.stories.mdx +1 -1
|
@@ -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 =
|
|
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.
|
|
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
|
-
|
|
13
|
-
window.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
|
|
12
|
+
global_1.global.__STORYBOOK_COMPODOC_JSON__ = compodocJson;
|
|
14
13
|
};
|
|
15
14
|
exports.setCompodocJson = setCompodocJson;
|
|
16
|
-
|
|
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
|
|
168
|
+
const dom = new global_1.global.DOMParser().parseFromString(tag.comment, 'text/html');
|
|
171
169
|
commentValue = dom.body.textContent;
|
|
172
170
|
}
|
|
173
171
|
});
|
package/dist/client/globals.js
CHANGED
|
@@ -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 =
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "7.0.0-beta.13",
|
|
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.
|
|
38
|
-
"@storybook/client-logger": "7.0.0-beta.
|
|
39
|
-
"@storybook/core-client": "7.0.0-beta.
|
|
40
|
-
"@storybook/core-common": "7.0.0-beta.
|
|
41
|
-
"@storybook/core-events": "7.0.0-beta.
|
|
42
|
-
"@storybook/core-server": "7.0.0-beta.
|
|
43
|
-
"@storybook/core-webpack": "7.0.0-beta.
|
|
44
|
-
"@storybook/docs-tools": "7.0.0-beta.
|
|
45
|
-
"@storybook/
|
|
46
|
-
"@storybook/
|
|
47
|
-
"@storybook/
|
|
48
|
-
"@storybook/
|
|
37
|
+
"@storybook/builder-webpack5": "7.0.0-beta.13",
|
|
38
|
+
"@storybook/client-logger": "7.0.0-beta.13",
|
|
39
|
+
"@storybook/core-client": "7.0.0-beta.13",
|
|
40
|
+
"@storybook/core-common": "7.0.0-beta.13",
|
|
41
|
+
"@storybook/core-events": "7.0.0-beta.13",
|
|
42
|
+
"@storybook/core-server": "7.0.0-beta.13",
|
|
43
|
+
"@storybook/core-webpack": "7.0.0-beta.13",
|
|
44
|
+
"@storybook/docs-tools": "7.0.0-beta.13",
|
|
45
|
+
"@storybook/global": "^5.0.0",
|
|
46
|
+
"@storybook/manager-api": "7.0.0-beta.13",
|
|
47
|
+
"@storybook/node-logger": "7.0.0-beta.13",
|
|
48
|
+
"@storybook/preview-api": "7.0.0-beta.13",
|
|
49
|
+
"@storybook/types": "7.0.0-beta.13",
|
|
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": "
|
|
125
|
+
"gitHead": "ddf86bd126ede0c019d7c9494f99f24a5cad9908"
|
|
126
126
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
8
|
+
global.Components = { Button, Html, Pre, Form };
|