mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(cli): gen vetur config
This commit is contained in:
parent
adbaf9b69e
commit
8fc7e6e611
@ -1,6 +1,8 @@
|
|||||||
import { join, relative } from 'path';
|
import { join, relative } from 'path';
|
||||||
import { clean } from './clean';
|
|
||||||
import { remove, copy, readdirSync } from 'fs-extra';
|
import { remove, copy, readdirSync } from 'fs-extra';
|
||||||
|
import { clean } from './clean';
|
||||||
|
import { CSS_LANG } from '../common/css';
|
||||||
|
import { getStepper } from '../common/logger';
|
||||||
import { compileJs } from '../compiler/compile-js';
|
import { compileJs } from '../compiler/compile-js';
|
||||||
import { compileSfc } from '../compiler/compile-sfc';
|
import { compileSfc } from '../compiler/compile-sfc';
|
||||||
import { compileStyle } from '../compiler/compile-style';
|
import { compileStyle } from '../compiler/compile-style';
|
||||||
@ -9,7 +11,8 @@ import { genPackageEntry } from '../compiler/gen-package-entry';
|
|||||||
import { genStyleDepsMap } from '../compiler/gen-style-deps-map';
|
import { genStyleDepsMap } from '../compiler/gen-style-deps-map';
|
||||||
import { genComponentStyle } from '../compiler/gen-component-style';
|
import { genComponentStyle } from '../compiler/gen-component-style';
|
||||||
import { SRC_DIR, LIB_DIR, ES_DIR } from '../common/constant';
|
import { SRC_DIR, LIB_DIR, ES_DIR } from '../common/constant';
|
||||||
import { getStepper } from '../common/logger';
|
import { genPacakgeStyle } from '../compiler/gen-package-style';
|
||||||
|
import { genVeturConfig } from '../compiler/gen-vetur-config';
|
||||||
import {
|
import {
|
||||||
isDir,
|
isDir,
|
||||||
isSfc,
|
isSfc,
|
||||||
@ -20,8 +23,6 @@ import {
|
|||||||
setNodeEnv,
|
setNodeEnv,
|
||||||
setModuleEnv
|
setModuleEnv
|
||||||
} from '../common';
|
} from '../common';
|
||||||
import { genPacakgeStyle } from '../compiler/gen-package-style';
|
|
||||||
import { CSS_LANG } from '../common/css';
|
|
||||||
|
|
||||||
const stepper = getStepper(10);
|
const stepper = getStepper(10);
|
||||||
|
|
||||||
@ -102,6 +103,7 @@ async function buildPackedOutputs() {
|
|||||||
setModuleEnv('esmodule');
|
setModuleEnv('esmodule');
|
||||||
await compilePackage(false);
|
await compilePackage(false);
|
||||||
await compilePackage(true);
|
await compilePackage(true);
|
||||||
|
genVeturConfig();
|
||||||
stepper.success('Build Packed Outputs');
|
stepper.success('Build Packed Outputs');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
stepper.error('Build Packed Outputs', err);
|
stepper.error('Build Packed Outputs', err);
|
||||||
|
20
packages/vant-cli/src/compiler/gen-vetur-config.ts
Normal file
20
packages/vant-cli/src/compiler/gen-vetur-config.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// @ts-ignore
|
||||||
|
import markdownVetur from '@vant/markdown-vetur';
|
||||||
|
import { join } from 'path';
|
||||||
|
import { get } from 'lodash';
|
||||||
|
import { SRC_DIR, getVantConfig, ROOT } from '../common/constant';
|
||||||
|
|
||||||
|
// generate vetur tags & attributes
|
||||||
|
export function genVeturConfig() {
|
||||||
|
const vantCongig = getVantConfig();
|
||||||
|
const options = get(vantCongig, 'build.vetur');
|
||||||
|
|
||||||
|
if (options) {
|
||||||
|
markdownVetur.parseAndWrite({
|
||||||
|
path: SRC_DIR,
|
||||||
|
test: /zh-CN\.md/,
|
||||||
|
outputDir: join(ROOT, 'vetur'),
|
||||||
|
...options
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,9 @@ module.exports = {
|
|||||||
skipInstall: ['lazyload'],
|
skipInstall: ['lazyload'],
|
||||||
site: {
|
site: {
|
||||||
publicPath: 'vant/'
|
publicPath: 'vant/'
|
||||||
|
},
|
||||||
|
vetur: {
|
||||||
|
tagPrefix: 'van-'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
site: {
|
site: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user