mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-22 06:31:45 +08:00
feat(cli): add BUILD_TARGET env
This commit is contained in:
parent
d933ae00fd
commit
2fd09f52b0
@ -96,6 +96,7 @@ export function getWebpackConfig(): object {
|
|||||||
|
|
||||||
export type ModuleEnv = 'esmodule' | 'commonjs';
|
export type ModuleEnv = 'esmodule' | 'commonjs';
|
||||||
export type NodeEnv = 'production' | 'development' | 'test';
|
export type NodeEnv = 'production' | 'development' | 'test';
|
||||||
|
export type BuildTarget = 'site' | 'package';
|
||||||
|
|
||||||
export function setModuleEnv(value: ModuleEnv) {
|
export function setModuleEnv(value: ModuleEnv) {
|
||||||
process.env.BABEL_MODULE = value;
|
process.env.BABEL_MODULE = value;
|
||||||
@ -105,6 +106,10 @@ export function setNodeEnv(value: NodeEnv) {
|
|||||||
process.env.NODE_ENV = value;
|
process.env.NODE_ENV = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setBuildTarget(value: BuildTarget) {
|
||||||
|
process.env.BUILD_TARGET = value;
|
||||||
|
}
|
||||||
|
|
||||||
export function isDev() {
|
export function isDev() {
|
||||||
return process.env.NODE_ENV === 'development';
|
return process.env.NODE_ENV === 'development';
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import merge from 'webpack-merge';
|
import merge from 'webpack-merge';
|
||||||
import { baseConfig } from './webpack.base';
|
import { baseConfig } from './webpack.base';
|
||||||
import { getVantConfig, getWebpackConfig } from '../common';
|
import { getVantConfig, getWebpackConfig, setBuildTarget } from '../common';
|
||||||
import { LIB_DIR, PACKAGE_ENTRY_FILE } from '../common/constant';
|
import { LIB_DIR, PACKAGE_ENTRY_FILE } from '../common/constant';
|
||||||
|
|
||||||
export function packageConfig(isMinify: boolean) {
|
export function packageConfig(isMinify: boolean) {
|
||||||
const { name } = getVantConfig();
|
const { name } = getVantConfig();
|
||||||
|
|
||||||
|
setBuildTarget('package');
|
||||||
|
|
||||||
return merge(
|
return merge(
|
||||||
baseConfig as any,
|
baseConfig as any,
|
||||||
{
|
{
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
/**
|
|
||||||
* Entry of all component's style
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* base */
|
|
||||||
@import './style/base';
|
|
||||||
|
|
||||||
/* common components */
|
|
||||||
@import './col/index';
|
|
||||||
@import './row/index';
|
|
||||||
@import './grid/index';
|
|
||||||
@import './grid-item/index';
|
|
||||||
@import './image/index';
|
|
||||||
@import './circle/index';
|
|
||||||
@import './collapse-item/index';
|
|
||||||
@import './count-down/index';
|
|
||||||
@import './divider/index';
|
|
||||||
@import './list/index';
|
|
||||||
@import './nav-bar/index';
|
|
||||||
@import './notice-bar/index';
|
|
||||||
@import './overlay/index';
|
|
||||||
@import './popup/index';
|
|
||||||
@import './search/index';
|
|
||||||
@import './pagination/index';
|
|
||||||
@import './panel/index';
|
|
||||||
@import './rate/index';
|
|
||||||
@import './steps/index';
|
|
||||||
@import './step/index';
|
|
||||||
@import './sticky/index';
|
|
||||||
@import './tag/index';
|
|
||||||
@import './tab/index';
|
|
||||||
@import './tabs/index';
|
|
||||||
@import './tabbar/index';
|
|
||||||
@import './tabbar-item/index';
|
|
||||||
@import './image-preview/index';
|
|
||||||
@import './progress/index';
|
|
||||||
@import './sidebar/index';
|
|
||||||
@import './sidebar-item/index';
|
|
||||||
@import './skeleton/index';
|
|
||||||
@import './slider/index';
|
|
||||||
@import './stepper/index';
|
|
||||||
@import './swipe/index';
|
|
||||||
@import './swipe-item/index';
|
|
||||||
@import './index-anchor/index';
|
|
||||||
@import './index-bar/index';
|
|
||||||
|
|
||||||
/* form components */
|
|
||||||
@import './checkbox/index';
|
|
||||||
@import './field/index';
|
|
||||||
@import './radio/index';
|
|
||||||
@import './switch/index';
|
|
||||||
@import './uploader/index';
|
|
||||||
@import './password-input/index';
|
|
||||||
@import './number-keyboard/index';
|
|
||||||
|
|
||||||
/* action components */
|
|
||||||
@import './action-sheet/index';
|
|
||||||
@import './dialog/index';
|
|
||||||
@import './dropdown-item/index';
|
|
||||||
@import './dropdown-menu/index';
|
|
||||||
@import './picker/index';
|
|
||||||
@import './pull-refresh/index';
|
|
||||||
@import './notify/index';
|
|
||||||
@import './toast/index';
|
|
||||||
|
|
||||||
/* high order components */
|
|
||||||
@import './swipe-cell/index';
|
|
||||||
@import './switch-cell/index';
|
|
||||||
@import './tree-select/index';
|
|
||||||
|
|
||||||
/* business components */
|
|
||||||
@import './address-edit/index';
|
|
||||||
@import './address-list/index';
|
|
||||||
@import './card/index';
|
|
||||||
@import './contact-card/index';
|
|
||||||
@import './contact-list/index';
|
|
||||||
@import './contact-edit/index';
|
|
||||||
@import './coupon/index';
|
|
||||||
@import './coupon-cell/index';
|
|
||||||
@import './coupon-list/index';
|
|
||||||
@import './goods-action/index';
|
|
||||||
@import './goods-action-button/index';
|
|
||||||
@import './goods-action-icon/index';
|
|
||||||
@import './submit-bar/index';
|
|
||||||
@import './sku/index';
|
|
277
src/index.ts
277
src/index.ts
@ -1,277 +0,0 @@
|
|||||||
// This file is auto generated by build/build-entry.js
|
|
||||||
import { VueConstructor } from 'vue/types';
|
|
||||||
import ActionSheet from './action-sheet';
|
|
||||||
import AddressEdit from './address-edit';
|
|
||||||
import AddressList from './address-list';
|
|
||||||
import Area from './area';
|
|
||||||
import Button from './button';
|
|
||||||
import Card from './card';
|
|
||||||
import Cell from './cell';
|
|
||||||
import CellGroup from './cell-group';
|
|
||||||
import Checkbox from './checkbox';
|
|
||||||
import CheckboxGroup from './checkbox-group';
|
|
||||||
import Circle from './circle';
|
|
||||||
import Col from './col';
|
|
||||||
import Collapse from './collapse';
|
|
||||||
import CollapseItem from './collapse-item';
|
|
||||||
import ContactCard from './contact-card';
|
|
||||||
import ContactEdit from './contact-edit';
|
|
||||||
import ContactList from './contact-list';
|
|
||||||
import CountDown from './count-down';
|
|
||||||
import Coupon from './coupon';
|
|
||||||
import CouponCell from './coupon-cell';
|
|
||||||
import CouponList from './coupon-list';
|
|
||||||
import DatetimePicker from './datetime-picker';
|
|
||||||
import Dialog from './dialog';
|
|
||||||
import Divider from './divider';
|
|
||||||
import DropdownItem from './dropdown-item';
|
|
||||||
import DropdownMenu from './dropdown-menu';
|
|
||||||
import Field from './field';
|
|
||||||
import GoodsAction from './goods-action';
|
|
||||||
import GoodsActionButton from './goods-action-button';
|
|
||||||
import GoodsActionIcon from './goods-action-icon';
|
|
||||||
import Grid from './grid';
|
|
||||||
import GridItem from './grid-item';
|
|
||||||
import Icon from './icon';
|
|
||||||
import Image from './image';
|
|
||||||
import ImagePreview from './image-preview';
|
|
||||||
import IndexAnchor from './index-anchor';
|
|
||||||
import IndexBar from './index-bar';
|
|
||||||
import Info from './info';
|
|
||||||
import Lazyload from './lazyload';
|
|
||||||
import List from './list';
|
|
||||||
import Loading from './loading';
|
|
||||||
import Locale from './locale';
|
|
||||||
import NavBar from './nav-bar';
|
|
||||||
import NoticeBar from './notice-bar';
|
|
||||||
import Notify from './notify';
|
|
||||||
import NumberKeyboard from './number-keyboard';
|
|
||||||
import Overlay from './overlay';
|
|
||||||
import Pagination from './pagination';
|
|
||||||
import Panel from './panel';
|
|
||||||
import PasswordInput from './password-input';
|
|
||||||
import Picker from './picker';
|
|
||||||
import Popup from './popup';
|
|
||||||
import Progress from './progress';
|
|
||||||
import PullRefresh from './pull-refresh';
|
|
||||||
import Radio from './radio';
|
|
||||||
import RadioGroup from './radio-group';
|
|
||||||
import Rate from './rate';
|
|
||||||
import Row from './row';
|
|
||||||
import Search from './search';
|
|
||||||
import Sidebar from './sidebar';
|
|
||||||
import SidebarItem from './sidebar-item';
|
|
||||||
import Skeleton from './skeleton';
|
|
||||||
import Sku from './sku';
|
|
||||||
import Slider from './slider';
|
|
||||||
import Step from './step';
|
|
||||||
import Stepper from './stepper';
|
|
||||||
import Steps from './steps';
|
|
||||||
import Sticky from './sticky';
|
|
||||||
import SubmitBar from './submit-bar';
|
|
||||||
import Swipe from './swipe';
|
|
||||||
import SwipeCell from './swipe-cell';
|
|
||||||
import SwipeItem from './swipe-item';
|
|
||||||
import Switch from './switch';
|
|
||||||
import SwitchCell from './switch-cell';
|
|
||||||
import Tab from './tab';
|
|
||||||
import Tabbar from './tabbar';
|
|
||||||
import TabbarItem from './tabbar-item';
|
|
||||||
import Tabs from './tabs';
|
|
||||||
import Tag from './tag';
|
|
||||||
import Toast from './toast';
|
|
||||||
import TreeSelect from './tree-select';
|
|
||||||
import Uploader from './uploader';
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
interface Window {
|
|
||||||
Vue?: VueConstructor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const version = '2.3.0-beta.3';
|
|
||||||
const components = [
|
|
||||||
ActionSheet,
|
|
||||||
AddressEdit,
|
|
||||||
AddressList,
|
|
||||||
Area,
|
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Cell,
|
|
||||||
CellGroup,
|
|
||||||
Checkbox,
|
|
||||||
CheckboxGroup,
|
|
||||||
Circle,
|
|
||||||
Col,
|
|
||||||
Collapse,
|
|
||||||
CollapseItem,
|
|
||||||
ContactCard,
|
|
||||||
ContactEdit,
|
|
||||||
ContactList,
|
|
||||||
CountDown,
|
|
||||||
Coupon,
|
|
||||||
CouponCell,
|
|
||||||
CouponList,
|
|
||||||
DatetimePicker,
|
|
||||||
Dialog,
|
|
||||||
Divider,
|
|
||||||
DropdownItem,
|
|
||||||
DropdownMenu,
|
|
||||||
Field,
|
|
||||||
GoodsAction,
|
|
||||||
GoodsActionButton,
|
|
||||||
GoodsActionIcon,
|
|
||||||
Grid,
|
|
||||||
GridItem,
|
|
||||||
Icon,
|
|
||||||
Image,
|
|
||||||
ImagePreview,
|
|
||||||
IndexAnchor,
|
|
||||||
IndexBar,
|
|
||||||
Info,
|
|
||||||
List,
|
|
||||||
Loading,
|
|
||||||
NavBar,
|
|
||||||
NoticeBar,
|
|
||||||
Notify,
|
|
||||||
NumberKeyboard,
|
|
||||||
Overlay,
|
|
||||||
Pagination,
|
|
||||||
Panel,
|
|
||||||
PasswordInput,
|
|
||||||
Picker,
|
|
||||||
Popup,
|
|
||||||
Progress,
|
|
||||||
PullRefresh,
|
|
||||||
Radio,
|
|
||||||
RadioGroup,
|
|
||||||
Rate,
|
|
||||||
Row,
|
|
||||||
Search,
|
|
||||||
Sidebar,
|
|
||||||
SidebarItem,
|
|
||||||
Skeleton,
|
|
||||||
Sku,
|
|
||||||
Slider,
|
|
||||||
Step,
|
|
||||||
Stepper,
|
|
||||||
Steps,
|
|
||||||
Sticky,
|
|
||||||
SubmitBar,
|
|
||||||
Swipe,
|
|
||||||
SwipeCell,
|
|
||||||
SwipeItem,
|
|
||||||
Switch,
|
|
||||||
SwitchCell,
|
|
||||||
Tab,
|
|
||||||
Tabbar,
|
|
||||||
TabbarItem,
|
|
||||||
Tabs,
|
|
||||||
Tag,
|
|
||||||
Toast,
|
|
||||||
TreeSelect,
|
|
||||||
Uploader
|
|
||||||
];
|
|
||||||
|
|
||||||
const install = (Vue: VueConstructor) => {
|
|
||||||
components.forEach(Component => {
|
|
||||||
Vue.use(Component);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/* istanbul ignore if */
|
|
||||||
if (typeof window !== 'undefined' && window.Vue) {
|
|
||||||
install(window.Vue);
|
|
||||||
}
|
|
||||||
|
|
||||||
export {
|
|
||||||
install,
|
|
||||||
version,
|
|
||||||
ActionSheet,
|
|
||||||
AddressEdit,
|
|
||||||
AddressList,
|
|
||||||
Area,
|
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Cell,
|
|
||||||
CellGroup,
|
|
||||||
Checkbox,
|
|
||||||
CheckboxGroup,
|
|
||||||
Circle,
|
|
||||||
Col,
|
|
||||||
Collapse,
|
|
||||||
CollapseItem,
|
|
||||||
ContactCard,
|
|
||||||
ContactEdit,
|
|
||||||
ContactList,
|
|
||||||
CountDown,
|
|
||||||
Coupon,
|
|
||||||
CouponCell,
|
|
||||||
CouponList,
|
|
||||||
DatetimePicker,
|
|
||||||
Dialog,
|
|
||||||
Divider,
|
|
||||||
DropdownItem,
|
|
||||||
DropdownMenu,
|
|
||||||
Field,
|
|
||||||
GoodsAction,
|
|
||||||
GoodsActionButton,
|
|
||||||
GoodsActionIcon,
|
|
||||||
Grid,
|
|
||||||
GridItem,
|
|
||||||
Icon,
|
|
||||||
Image,
|
|
||||||
ImagePreview,
|
|
||||||
IndexAnchor,
|
|
||||||
IndexBar,
|
|
||||||
Info,
|
|
||||||
Lazyload,
|
|
||||||
List,
|
|
||||||
Loading,
|
|
||||||
Locale,
|
|
||||||
NavBar,
|
|
||||||
NoticeBar,
|
|
||||||
Notify,
|
|
||||||
NumberKeyboard,
|
|
||||||
Overlay,
|
|
||||||
Pagination,
|
|
||||||
Panel,
|
|
||||||
PasswordInput,
|
|
||||||
Picker,
|
|
||||||
Popup,
|
|
||||||
Progress,
|
|
||||||
PullRefresh,
|
|
||||||
Radio,
|
|
||||||
RadioGroup,
|
|
||||||
Rate,
|
|
||||||
Row,
|
|
||||||
Search,
|
|
||||||
Sidebar,
|
|
||||||
SidebarItem,
|
|
||||||
Skeleton,
|
|
||||||
Sku,
|
|
||||||
Slider,
|
|
||||||
Step,
|
|
||||||
Stepper,
|
|
||||||
Steps,
|
|
||||||
Sticky,
|
|
||||||
SubmitBar,
|
|
||||||
Swipe,
|
|
||||||
SwipeCell,
|
|
||||||
SwipeItem,
|
|
||||||
Switch,
|
|
||||||
SwitchCell,
|
|
||||||
Tab,
|
|
||||||
Tabbar,
|
|
||||||
TabbarItem,
|
|
||||||
Tabs,
|
|
||||||
Tag,
|
|
||||||
Toast,
|
|
||||||
TreeSelect,
|
|
||||||
Uploader
|
|
||||||
};
|
|
||||||
|
|
||||||
export default {
|
|
||||||
install,
|
|
||||||
version
|
|
||||||
};
|
|
@ -1,5 +1,11 @@
|
|||||||
module.exports = {
|
module.exports = function() {
|
||||||
entry: {
|
if (process.env.BUILD_TARGET === 'package') {
|
||||||
'site-mobile': ['./docs/site/mobile']
|
return {};
|
||||||
},
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
entry: {
|
||||||
|
'site-mobile': ['./docs/site/mobile']
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user