feat(cli): add skipInstall option

This commit is contained in:
陈嘉涵 2019-12-12 11:10:19 +08:00
parent 9155a7a491
commit 8e8892b323
4 changed files with 18 additions and 15 deletions

View File

@ -1,8 +1,13 @@
import Vue from 'vue';
import Locale from '../../src/locale';
import Lazyload from '../../src/lazyload';
import { get } from '../../src/utils';
import { camelize } from '../../src/utils/format/string';
Vue.use(Lazyload, {
lazyComponent: true
});
// helper for demo locales
Vue.mixin({
computed: {

View File

@ -1,12 +1,13 @@
import { get } from 'lodash';
import { join } from 'path';
import { pascalize, getComponents, smartOutputFile } from '../common';
import { SRC_DIR, PACKAGE_JSON } from '../common/constant';
import { SRC_DIR, PACKAGE_JSON, getVantConfig } from '../common/constant';
const version = process.env.PACKAGE_VERSION || PACKAGE_JSON.version;
type Options = {
outputPath: string;
pathResolver?: Function
pathResolver?: Function;
};
function genImports(components: string[], options: Options): string {
@ -27,8 +28,13 @@ function genExports(names: string[]): string {
}
export function genPackageEntry(options: Options) {
const vantConfig = getVantConfig();
const components = getComponents();
const names = components.map(item => pascalize(item));
const skipInstall = get(vantConfig, 'build.skipInstall', []);
const names = components
.filter(item => !skipInstall.includes(item))
.map(item => pascalize(item));
const content = `${genImports(components, options)}

View File

@ -1,25 +1,16 @@
<template>
<demo-section>
<demo-block :title="$t('basicUsage')">
<img
v-for="img in imageList"
v-lazy="img"
>
<img v-for="img in imageList" v-lazy="img">
</demo-block>
<demo-block :title="$t('title2')">
<div
v-for="img in backgroundImageList"
v-lazy:background-image="img"
/>
<div v-for="img in backgroundImageList" v-lazy:background-image="img" />
</demo-block>
<demo-block :title="$t('title3')">
<lazy-component>
<img
v-for="img in componentImageList"
v-lazy="img"
>
<img v-for="img in componentImageList" v-lazy="img">
</lazy-component>
</demo-block>
</demo-section>

View File

@ -1,6 +1,7 @@
module.exports = {
name: 'vant',
build: {
skipInstall: ['lazyload'],
site: {
publicPath: 'vant/'
}