-
Notifications
You must be signed in to change notification settings - Fork 69
Add Web-Types generation support #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jpradelle
wants to merge
24
commits into
runem:master
Choose a base branch
from
jpradelle:webtypes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
3e9501b
initial work on web-types transformer
marcobeierer 9009b12
WebTypes in progress
jpradelle a738188
WebTypes: Add configuration, add CSS properties
jpradelle cf41546
web-types transformation improvements
jpradelle 22b1505
Add web-types documentation
jpradelle 11f1b32
Fix readme webtype section position
jpradelle b654d69
webtypes: add priority, fix boolean attributes
jpradelle 30d4582
Add web-types package keyword
jpradelle 71869be
Code cleanup
jpradelle f6ab6cf
Update webtypes configuration to support package.json configuration.
jpradelle 92427fe
Webtypes PR fixes
jpradelle fc64397
webtypes: fix boolean value requirement issue
jpradelle d92fc8b
Webtypes: move pathAsAbsolute configuration from global configuration…
jpradelle 61a3515
Webtypes: add tests
jpradelle eb95198
Merge branch 'master' of https://github.com/runem/web-component-analy…
jpradelle 3c2b4c8
webtypes: add enum support
jpradelle 420be56
webtypes: update documentation to use '@web-types/lit' package for li…
jpradelle d687d81
Fix README.md
jpradelle 3480a94
Webtypes: add source field for component properties and attributes
jpradelle aed0927
Merge branch 'master' of https://github.com/runem/web-component-analy…
jpradelle 67cd427
webtypes: add slots support
jpradelle d483b1a
webtypes: add css parts support
jpradelle ae6c302
Webtypes: add default value of CSS properties in description
jpradelle 1a83102
webtypes: fix CSS test
jpradelle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -5,4 +5,5 @@ node_modules | |
| dist | ||
| lib | ||
| *.tgz | ||
| yarn.lock | ||
|
|
||
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,152 @@ | ||
| # Web-types | ||
|
|
||
| ## web-component-analyzer usage | ||
|
|
||
| ### With package.json configuration | ||
|
|
||
| You can add a `wca` section in your `package.json` to configure wca for web-types build. | ||
|
|
||
| ```json | ||
| "wca": { | ||
| "webtypesConfig": { | ||
| "name": "your-project-name", | ||
| "version": "0.0.1", | ||
| "framework": "lit", | ||
| "description-markup": "markdown" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| To run wca then use command: | ||
|
|
||
| ```bash | ||
| wca analyze src --format webtypes --outFile web-types-custom.json | ||
| ``` | ||
|
|
||
| If you run `wca` from project npm `scripts` section of `package.json`, you can omit `name` and `version` property | ||
| in `webtypesConfig`, this will take package `name` and `version` by default. | ||
|
|
||
| ### With command line only | ||
|
|
||
| You can also avoid updating `package.json` `wca` section and use only command line by providing a json configuration to `--webtypesConfig` argument: | ||
|
|
||
| ```bash | ||
| wca analyze src --format webtypes --outFile web-types-custom.json --webtypesConfig='{"name": "your-project-name", "version": "0.0.1", "framework": "lit", "description-markup": "markdown"}' | ||
| ``` | ||
|
|
||
| If you run `wca` from project npm `scripts` section of `package.json`, you can omit `name` and `version` property | ||
| in `webtypesConfig`, this will take package `name` and `version` by default. | ||
|
|
||
| ## Project setup | ||
|
|
||
| ### For Lit | ||
|
|
||
| Generated web-types are working with the generic `lit-web-types` library. You need to add it on your project. | ||
|
|
||
| <!-- prettier-ignore --> | ||
| ```bash | ||
| npm i lit-web-types -D | ||
| ``` | ||
|
|
||
| Add `wca` section in your `package.json`: | ||
|
|
||
| ```json | ||
| "wca": { | ||
| "webtypesConfig": { | ||
| "framework": "lit", | ||
| "description-markup": "markdown" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Working with lit, `framework` must have `lit` value. See [Web types config parameters](#web-types-config-parameters) documentation section for more info. | ||
|
|
||
| Add `scripts` section in your `package.json`: | ||
|
|
||
| ```json | ||
| "scripts": { | ||
| "web-types": "wca analyze src --format webtypes --outFile web-types.json" | ||
| } | ||
| ``` | ||
|
|
||
| Generate your components descriptions with wca | ||
|
|
||
| <!-- prettier-ignore --> | ||
| ```bash | ||
| npm web-types | ||
| ``` | ||
|
|
||
| If your web-types is not named `web-types.json` and placed at root of your project, you need to declare it in your `package.json` | ||
|
|
||
| ```json | ||
| "web-types": [ | ||
| "..../web-types-custom.json" | ||
| ] | ||
| ``` | ||
|
|
||
| After the first setup on Intellij, IDE restart might be needed to enable components completion. | ||
|
|
||
| ### For Polymer | ||
|
|
||
| Generated web-types are working with the generic `polymer-web-types` library. You need to add it on your project. | ||
|
|
||
| <!-- prettier-ignore --> | ||
| ```bash | ||
| npm i polymer-web-types -D | ||
| ``` | ||
|
|
||
| Add `wca` section in your `package.json`: | ||
|
|
||
| ```json | ||
| "wca": { | ||
| "webtypesConfig": { | ||
| "framework": "@polymer/polymer", | ||
| "description-markup": "markdown" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Working with lit, `framework` must have `@polymer/polymer` value. See [Web types config parameters](#web-types-config-parameters) documentation section for more info. | ||
|
|
||
| Add `scripts` section in your `package.json`: | ||
|
|
||
| ```json | ||
| "scripts": { | ||
| "web-types": "wca analyze src --format webtypes --outFile web-types.json" | ||
| } | ||
| ``` | ||
|
|
||
| Generate your components descriptions with wca | ||
|
|
||
| <!-- prettier-ignore --> | ||
| ```bash | ||
| npm web-types | ||
| ``` | ||
|
|
||
| If your web-types is not named `web-types.json` and placed at root of your project, you need to declare it in your `package.json` | ||
|
|
||
| ```json | ||
| "web-types": [ | ||
| "..../web-types-custom.json" | ||
| ] | ||
| ``` | ||
|
|
||
| After the first setup on Intellij, IDE restart might be needed to enable components completion. | ||
|
|
||
| ## Web types config parameters | ||
|
|
||
| `webtypesConfig` parameter is a json object containing web-types file root parameter. | ||
|
|
||
| Available parameters: | ||
|
|
||
| | Name | Description | | ||
| | ------------------ | ------------------------------------------------------------------------------------------------------------- | | ||
| | name | Name of library | | ||
| | version | Version of the library, for which Web-Types are provided | | ||
| | framework | See [http://json.schemastore.org/web-types](http://json.schemastore.org/web-types) framework section | | ||
| | js-types-syntax | See [http://json.schemastore.org/web-types](http://json.schemastore.org/web-types) js-types-syntax section | | ||
| | description-markup | See [http://json.schemastore.org/web-types](http://json.schemastore.org/web-types) description-markup section | | ||
| | framework-config | See [http://json.schemastore.org/web-types](http://json.schemastore.org/web-types) framework-config section | | ||
| | default-icon | See [http://json.schemastore.org/web-types](http://json.schemastore.org/web-types) default-icon section | | ||
|
|
||
| See [web-types project:](https://github.com/JetBrains/web-types) for more info. | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,11 +1,28 @@ | ||
| import { VisibilityKind } from "../analyze/types/visibility-kind"; | ||
| import { GenericContributions } from "./webtypes/webtypes-schema"; | ||
|
|
||
| export interface TransformerConfig { | ||
| cwd?: string; | ||
| pathAsAbsolute?: boolean; | ||
| visibility?: VisibilityKind; | ||
| markdown?: { | ||
| titleLevel?: number; // deprecated | ||
| headerLevel?: number; | ||
| }; | ||
| inlineTypes?: boolean; | ||
| webTypes?: WebTypesTransformerConfig; | ||
| } | ||
|
|
||
| export interface WebTypesTransformerConfig { | ||
| name: string; | ||
| version: string; | ||
| "default-icon"?: string; | ||
| "js-types-syntax"?: "typescript"; | ||
| framework?: string; | ||
| "framework-config"?: WebTypesFrameworkConfig; | ||
| "description-markup"?: "html" | "markdown" | "none"; | ||
| } | ||
|
|
||
| export interface WebTypesFrameworkConfig { | ||
| [k: string]: GenericContributions; | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| export type TransformerKind = "md" | "markdown" | "json" | "vscode" | "debug" | "json2"; | ||
| export type TransformerKind = "md" | "markdown" | "json" | "vscode" | "debug" | "json2" | "webtypes"; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.