Giter Club home page Giter Club logo

web-types's Introduction

GitHub license

Web-types

Welcome to web-types, the JSON standard to document web component libraries.

Web-types is a framework agnostic standard to provide IDEs and other tools with metadata information about contents of a web components library. It also provides extensions for a framework specific content.

You can check out features supported by IDEs here.

Distribution

Library providers are welcome to include detailed web-types JSONs and link them through web-types property in package.json. E.g.:

{
  ...
  "web-types": "./web-types.json"
  ...
}

Currently following libraries are providing this feature:

For the most popular libraries basic information is published under @web-types scope on NPM. Currently following frameworks and libraries are supported in such a way:

  • Vue.js
    • bootstrap-vue
    • quasar
    • quasar-framework
    • vuetify

Published JSONs are checked into repository under packages folder. In case of web-types published to @web-types scope, IDEs are supposed to download required JSONs without any changes to user project structure.

Various IDEs perform optimizations when scanning node_modules directory, so to ensure that web-types for your package are always available, make sure it's listed in packages/registry.json.

Schema

Web-types schema is available in schema folder. Use one of the following URLs to reference it in your JSON files:

http://json.schemastore.org/web-types

or

https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json

Generating web-types

You can use scripts/extract.sh bash script to extract metadata information from a library. So far only vue.js framework extraction is supported. The usage syntax for the script is following:

extract.sh vue <package-name> <sem-version-range> [--production,--discard-same]

Example usage:

extract.sh vue vuetify ">=1.0.0" --production --discard-same

The script will output "#Error:..." strings into JSON in case of syntax it doesn't understand while performing static analysis. This allows to improve script to handle specific syntax used by a library. However, while publishing metadata we don't want to include errors, so one can use --production parameter to exclude errors from the output.

Some versions of libraries contain exactly the same information and with --discard-same parameter we can minimize amount of generated JSONS and produce only those, which are unique.

Local development with web-types

You can use web-types in your local project or library. Just link a generated web-types file in your package.json and IDE will pick up global components from it.

Publishing to @web-types scope

To publish a package to @web-types you need to have permission. Automated publishing is done with script/publish.sh script, which usage syntax is following:

publish.sh <package-name> [--dry-run]

The script will scan folder packages/<package-name> for generated web-types jsons and synchronize contents with NPM.

Versioning and naming of @web-types scope

Versioning and naming rules are as follows:

  • web-types for package pkg-name are available under @web-types/pkg-name
  • web-types for package @scope/pkg-name are available under @web-types/at-scope-pkg-name
  • web-types for version 1.2.3 are published as prerelease 1.2.3-n, e.g. 1.2.3-3
  • web-types for pre-release version 1.2.3-rc.1 are published with additional segment, e.g. 1.2.3-rc.1.3
  • to search for appropriate web-types package use range <pkg-ver and include prerelease versions, e.g. to find web-types for version 1.2.6, query package list with <1.2.6, which can match web-types in version 1.2.4-12
  • all outdated versions are marked as deprecated and should be ignored by an IDE

Contributions

All contributions are welcome! We need your help to improve the web-types standard specification, to support other frameworks and to improve quality of generated metadata through scripts.

web-types's People

Contributors

piotrtomiak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.