feat(cli): support generate web-types (#5893) (#5903)

This commit is contained in:
neverland 2020-03-25 10:09:27 +08:00 committed by GitHub
parent c74fbf58a4
commit 5f16f1fb6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 13 deletions

View File

@ -78,6 +78,7 @@
"tags": "vetur/tags.json", "tags": "vetur/tags.json",
"attributes": "vetur/attributes.json" "attributes": "vetur/attributes.json"
}, },
"web-types": "vetur/web-types.json",
"eslintConfig": { "eslintConfig": {
"root": true, "root": true,
"extends": [ "extends": [

View File

@ -51,7 +51,7 @@
"@types/jest": "^25.1.3", "@types/jest": "^25.1.3",
"@vant/eslint-config": "^2.0.0", "@vant/eslint-config": "^2.0.0",
"@vant/markdown-loader": "^2.3.0", "@vant/markdown-loader": "^2.3.0",
"@vant/markdown-vetur": "^1.1.0", "@vant/markdown-vetur": "^2.0.0",
"@vant/stylelint-config": "^1.2.0", "@vant/stylelint-config": "^1.2.0",
"@vant/touch-emulator": "^1.2.0", "@vant/touch-emulator": "^1.2.0",
"@vue/babel-preset-jsx": "^1.1.2", "@vue/babel-preset-jsx": "^1.1.2",

View File

@ -1,15 +1,23 @@
import markdownVetur from '@vant/markdown-vetur'; import markdownVetur from '@vant/markdown-vetur';
import { join } from 'path'; import { join } from 'path';
import { get } from 'lodash'; import { get } from 'lodash';
import { SRC_DIR, getVantConfig, ROOT } from '../common/constant'; import {
ROOT,
SRC_DIR,
getVantConfig,
getPackageJson,
} from '../common/constant';
// generate vetur tags & attributes // generate vetur tags & attributes
export function genVeturConfig() { export function genVeturConfig() {
const vantConfig = getVantConfig(); const vantConfig = getVantConfig();
const pkgJson = getPackageJson();
const options = get(vantConfig, 'build.vetur'); const options = get(vantConfig, 'build.vetur');
if (options) { if (options) {
markdownVetur.parseAndWrite({ markdownVetur.parseAndWrite({
name: vantConfig.name,
version: pkgJson.version,
path: SRC_DIR, path: SRC_DIR,
test: /zh-CN\.md/, test: /zh-CN\.md/,
outputDir: join(ROOT, 'vetur'), outputDir: join(ROOT, 'vetur'),

View File

@ -1563,10 +1563,13 @@
markdown-it-anchor "^5.2.5" markdown-it-anchor "^5.2.5"
transliteration "^2.1.7" transliteration "^2.1.7"
"@vant/markdown-vetur@^1.1.0": "@vant/markdown-vetur@^2.0.0":
version "1.1.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/@vant/markdown-vetur/-/markdown-vetur-1.1.0.tgz#e02d29f3180e47dd588d7dcacaa06b66724915c9" resolved "https://registry.yarnpkg.com/@vant/markdown-vetur/-/markdown-vetur-2.0.0.tgz#19cb9b089fbd04dfb2b74c3edb497297086229e0"
integrity sha512-abdWeVzCmVMwYzzFoqKtiLb1SVlWNoF3lgDXE0/gGBxkNXSN3XWeGXSaq7LNReyEjpRmfqqEIuP18NvkhBk4DQ== integrity sha512-XcAcVOIUhuYbD5nmKjv4y9WxuP/YytDJi17xn1SwJe2gjIKNMli/gc2oNN2v8npCaCZAaDWpAUTXYy7XefdH9Q==
dependencies:
fast-glob "^3.2.2"
fs-extra "^9.0.0"
"@vant/stylelint-config@^1.2.0": "@vant/stylelint-config@^1.2.0":
version "1.2.0" version "1.2.0"
@ -2200,6 +2203,11 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
at-least-node@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
atob@^2.1.2: atob@^2.1.2:
version "2.1.2" version "2.1.2"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
@ -4903,6 +4911,16 @@ fs-extra@^7.0.0:
jsonfile "^4.0.0" jsonfile "^4.0.0"
universalify "^0.1.0" universalify "^0.1.0"
fs-extra@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.0.tgz#b6afc31036e247b2466dc99c29ae797d5d4580a3"
integrity sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==
dependencies:
at-least-node "^1.0.0"
graceful-fs "^4.2.0"
jsonfile "^6.0.1"
universalify "^1.0.0"
fs-write-stream-atomic@^1.0.8: fs-write-stream-atomic@^1.0.8:
version "1.0.10" version "1.0.10"
resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9"
@ -5230,7 +5248,7 @@ got@^9.6.0:
to-readable-stream "^1.0.0" to-readable-stream "^1.0.0"
url-parse-lax "^3.0.0" url-parse-lax "^3.0.0"
graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.3: graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.3:
version "4.2.3" version "4.2.3"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==
@ -6797,6 +6815,15 @@ jsonfile@^4.0.0:
optionalDependencies: optionalDependencies:
graceful-fs "^4.1.6" graceful-fs "^4.1.6"
jsonfile@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179"
integrity sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==
dependencies:
universalify "^1.0.0"
optionalDependencies:
graceful-fs "^4.1.6"
jsonparse@^1.2.0: jsonparse@^1.2.0:
version "1.3.1" version "1.3.1"
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
@ -11124,6 +11151,11 @@ universalify@^0.1.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
universalify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"
integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==
unpipe@1.0.0, unpipe@~1.0.0: unpipe@1.0.0, unpipe@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"

View File

@ -1,6 +1,6 @@
{ {
"name": "@vant/markdown-vetur", "name": "@vant/markdown-vetur",
"version": "1.1.0", "version": "2.0.0",
"description": "simple parse markdown to vue component description for vetur auto-completion", "description": "simple parse markdown to vue component description for vetur auto-completion",
"main": "lib/index.js", "main": "lib/index.js",
"license": "MIT", "license": "MIT",

View File

@ -1,9 +1,13 @@
{ {
"extends": "../../tsconfig",
"include": ["src/*"],
"compilerOptions": { "compilerOptions": {
"target": "ES2017",
"outDir": "./lib",
"module": "commonjs", "module": "commonjs",
"outDir": "lib", "strict": true,
"noEmit": false "declaration": true,
} "skipLibCheck": true,
"esModuleInterop": true,
"lib": ["esnext"]
},
"include": ["src/**/*"]
} }