-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docs): merge together style docs from multiple CSS files
This fixes a bug where although multiple stylesheets were being processed by the `ext-transforms-plugin` we were not properly merging the style documentation for all of those stylesheets, leading to a race condition where whichever file was processed last would set the style docs for the whole component. Not good! To fix the issue we just need to merge the style docs for the various stylesheets together (de-duping on the `name` property). This also adds a test project in `test/docs-readme` which exercises this functionality. STENCIL-1271
- Loading branch information
1 parent
2082368
commit 6a486da
Showing
17 changed files
with
254 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,7 @@ stenciljs | |
stnl | ||
stringification | ||
stringified | ||
styleurls | ||
subdir | ||
templating | ||
timespan | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "docs-readme-testbed", | ||
"version": "1.0.0", | ||
"description": "A test app for the docs-readme output target", | ||
"files": [ | ||
"dist/" | ||
], | ||
"scripts": { | ||
"build": "node ../../bin/stencil build", | ||
"build.dev": "node ../../bin/stencil build --dev", | ||
"start": "node ../../bin/stencil build --dev --watch --serve", | ||
"test": "node ../../bin/stencil test --spec --e2e", | ||
"test.watch": "node ../../bin/stencil test --spec --e2e --watch", | ||
"generate": "node ../../bin/stencil generate" | ||
}, | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# docs-readme test app | ||
|
||
This directory contains a test application which exercises the `docs-readme` | ||
output target. This provides us with an end-to-end test of this functionality. | ||
|
||
## Components | ||
|
||
The components in here and what they test! | ||
|
||
### `<styleurls-component>` | ||
|
||
This tests that the docs from multiple `styleUrls` in the `@Component` | ||
decorator are pulled in to the docs output correctly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable */ | ||
/* tslint:disable */ | ||
/** | ||
* This is an autogenerated file created by the Stencil compiler. | ||
* It contains typing information for all components that exist in this project. | ||
*/ | ||
import { HTMLStencilElement, JSXBase } from "@stencil/core/internal"; | ||
export namespace Components { | ||
interface StyleurlsComponent { | ||
} | ||
} | ||
declare global { | ||
interface HTMLStyleurlsComponentElement extends Components.StyleurlsComponent, HTMLStencilElement { | ||
} | ||
var HTMLStyleurlsComponentElement: { | ||
prototype: HTMLStyleurlsComponentElement; | ||
new (): HTMLStyleurlsComponentElement; | ||
}; | ||
interface HTMLElementTagNameMap { | ||
"styleurls-component": HTMLStyleurlsComponentElement; | ||
} | ||
} | ||
declare namespace LocalJSX { | ||
interface StyleurlsComponent { | ||
} | ||
interface IntrinsicElements { | ||
"styleurls-component": StyleurlsComponent; | ||
} | ||
} | ||
export { LocalJSX as JSX }; | ||
declare module "@stencil/core" { | ||
export namespace JSX { | ||
interface IntrinsicElements { | ||
"styleurls-component": LocalJSX.StyleurlsComponent & JSXBase.HTMLAttributes<HTMLStyleurlsComponentElement>; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
:host { | ||
/** | ||
* @prop --one: Property One | ||
*/ | ||
display: block; | ||
} |
18 changes: 18 additions & 0 deletions
18
test/docs-readme/src/components/styleurls-component/readme.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# styleurls-component | ||
|
||
|
||
|
||
<!-- Auto Generated Below --> | ||
|
||
|
||
## CSS Custom Properties | ||
|
||
| Name | Description | | ||
| ------- | ------------ | | ||
| `--one` | Property One | | ||
| `--two` | Property Two | | ||
|
||
|
||
---------------------------------------------- | ||
|
||
*Built with [StencilJS](https://stenciljs.com/)* |
17 changes: 17 additions & 0 deletions
17
test/docs-readme/src/components/styleurls-component/styleurls-component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Component, h } from '@stencil/core'; | ||
|
||
@Component({ | ||
tag: 'styleurls-component', | ||
shadow: true, | ||
// CSS properties documented in both of these files should | ||
// show up in this component's README | ||
styleUrls: { | ||
one: 'one.scss', | ||
two: 'two.scss', | ||
}, | ||
}) | ||
export class StyleUrlsComponent { | ||
render() { | ||
return <div>Hello, World! I have multiple style URLs!</div>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
:host { | ||
/** | ||
* @prop --two: Property Two | ||
*/ | ||
display: block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html dir="ltr" lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" /> | ||
<title>Stencil Component Starter</title> | ||
|
||
<script type="module" src="/build/json-docs-testbed.esm.js"></script> | ||
<script nomodule src="/build/json-docs-testbed.js"></script> | ||
</head> | ||
<body> | ||
<my-component first="Stencil" last="'Don't call me a framework' JS"></my-component> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './components'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Config } from '@stencil/core'; | ||
|
||
export const config: Config = { | ||
namespace: 'docs-readme-testbed', | ||
outputTargets: [ | ||
{ | ||
type: 'docs-readme', | ||
}, | ||
{ | ||
type: 'dist', | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"allowUnreachableCode": false, | ||
"declaration": false, | ||
"experimentalDecorators": true, | ||
"lib": [ | ||
"dom", | ||
"es2017" | ||
], | ||
"moduleResolution": "node", | ||
"module": "esnext", | ||
"target": "es2017", | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"jsx": "react", | ||
"jsxFactory": "h", | ||
"paths": { | ||
"@stencil/core/testing": [ | ||
"../../src/testing/index.ts" | ||
], | ||
"@stencil/core": [ | ||
"../../internal" | ||
], | ||
"@stencil/core/compiler": [ | ||
"../../compiler" | ||
], | ||
"@stencil/core/internal": [ | ||
"../../internal" | ||
] | ||
} | ||
}, | ||
"include": [ | ||
"src" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters