Skip to content

Commit

Permalink
feat: add auto API generation support
Browse files Browse the repository at this point in the history
  • Loading branch information
blackfalcon committed Aug 5, 2020
1 parent d3d902a commit 6a74e63
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions bin/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const getVersionData = async () => {
versions['stylelint'] = await latestVersion('stylelint');
versions['stylelintConfig'] = await latestVersion('stylelint-config-standard');
versions['wcSassRender'] = await latestVersion('wc-sass-render');
versions['wca'] = await latestVersion('web-component-analyzer');
versions['webpack'] = await latestVersion('webpack');
versions['webpackBundleAnalyzer'] = await latestVersion('webpack-bundle-analyzer');
versions['webpackMerge'] = await latestVersion('webpack-merge');
Expand Down Expand Up @@ -190,6 +191,7 @@ const formatTemplateFileContents = (data, content, { name, namespace, npm }) =>
{ regex: /\[stylelint\]/g, value: data.stylelint },
{ regex: /\[stylelintConfig\]/g, value: data.stylelintConfig },
{ regex: /\[wcSassRender\]/g, value: data.wcSassRender },
{ regex: /\[wca\]/g, value: data.wca },
{ regex: /\[webpackMerge\]/g, value: data.webpackMerge },
{ regex: /\[webpack\]/g, value: data.webpack },
{ regex: /\[webpackDevServer\]/g, value: data.webpackDevServer },
Expand Down
5 changes: 0 additions & 5 deletions template/docs/api.md

This file was deleted.

5 changes: 3 additions & 2 deletions template/package.temp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"stylelint": "^[stylelint]",
"stylelint-config-standard": "^[stylelintConfig]",
"wc-sass-render": "^[wcSassRender]",
"web-component-analyzer": "^[wca]",
"webpack": "^[webpack]",
"webpack-bundle-analyzer": "^[webpackBundleAnalyzer]",
"webpack-cli": "^[webpackCli]",
Expand All @@ -87,10 +88,10 @@
],
"scripts": {
"build": "npm run ciBuild",
"apiBuild": "wca analyze 'src/[namespace]-[name].js' --outFiles docs/api.md",
"bundler": "webpack --mode=production",
"bundle:test": "webpack-dev-server --host 0.0.0.0",
"postinstall": "node packageScripts/postinstall.js",
"postinstall:lit": "node scripts/postinstall.js",
"cssLint": "stylelint './src/*.css'",
"dev": "npm run sassBuild:watch",
"distJS": "copyfiles -u 1 -V './src/**/*.js' ./dist",
Expand All @@ -102,7 +103,7 @@
"test:watch": "karma start --auto-watch=true --single-run=false",
"test:ci": "npm-run-all test lint",
"test:yaml": "yamllint .travis.yml",
"ciBuild": "npm-run-all sassBuild sassRender cssLint distJS bundler postinstall",
"ciBuild": "npm-run-all sassBuild sassRender cssLint distJS bundler postinstall apiBuild",
"sassBuild": "npm-run-all sassBuild:demo sassBuild:component postCss:component sassRender",
"sassBuild:dev": "npm-run-all sassBuild:demo sassBuild:component postCss:component sassRender",
"sassBuild:demo": "node-sass ./demo/sass/ --output ./demo/css/",
Expand Down
7 changes: 7 additions & 0 deletions template/src/[namespace]-[name].js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import { LitElement, html, css } from "lit-element";
import "focus-visible/dist/focus-visible.min.js";
import styleCss from "./style-css.js";

// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
/**
* [namespace]-[name] provides users a way to ...
*
* @attr {String} cssClass - Applies designated CSS class to DOM element.
*/

// build the component class
class [Namespace][Name] extends LitElement {
// constructor() {
Expand Down

0 comments on commit 6a74e63

Please sign in to comment.