mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
delete components.json
This commit is contained in:
parent
17779384ee
commit
f44ee614f1
@ -1,4 +1,4 @@
|
||||
var Components = require('../../components.json');
|
||||
var Components = require('./get-components')();
|
||||
var fs = require('fs');
|
||||
var render = require('json-templater/string');
|
||||
var uppercamelcase = require('uppercamelcase');
|
||||
@ -40,13 +40,11 @@ export default {
|
||||
|
||||
delete Components.font;
|
||||
|
||||
var ComponentNames = Object.keys(Components);
|
||||
|
||||
var includeComponentTemplate = [];
|
||||
var installTemplate = [];
|
||||
var listTemplate = [];
|
||||
|
||||
ComponentNames.forEach(name => {
|
||||
Components.forEach(name => {
|
||||
var componentName = uppercamelcase(name);
|
||||
|
||||
includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const components = require('../../components.json');
|
||||
const components = require('./get-components')();
|
||||
const chalk = require('chalk');
|
||||
require('shelljs/global');
|
||||
|
||||
@ -38,7 +38,7 @@ log('Finished', 'build:vant-css');
|
||||
|
||||
// 5. build style entrys
|
||||
log('Starting', 'build:style-entries');
|
||||
Object.keys(components).forEach((componentName) => {
|
||||
components.forEach((componentName) => {
|
||||
const dir = path.join(__dirname, '../../lib/', componentName, '/style');
|
||||
const file = path.join(dir, 'index.js');
|
||||
const cssPath = path.join(__dirname, '../../lib/vant-css/', `${componentName}.css`);
|
||||
|
8
build/bin/get-components.js
Normal file
8
build/bin/get-components.js
Normal file
@ -0,0 +1,8 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = function() {
|
||||
const dirs = fs.readdirSync(path.resolve(__dirname, '../../packages'));
|
||||
const excludes = ['index.js', 'vant-css', 'mixins', 'utils'];
|
||||
return dirs.filter(dirName => excludes.indexOf(dirName) === -1)
|
||||
}
|
@ -28,21 +28,5 @@ gulp.task('copy', function(callback) {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// 添加到 components.json
|
||||
gulp.task('addComponents', function(callback) {
|
||||
const componentsFile = require('../../components.json');
|
||||
if (componentsFile[name]) {
|
||||
console.error(`${name} 已存在.`);
|
||||
process.exit(1);
|
||||
}
|
||||
componentsFile[name] = `./packages/${name}/index.js`;
|
||||
fileSave(path.join(__dirname, '../../components.json'))
|
||||
.write(JSON.stringify(componentsFile, null, ' '), 'utf8')
|
||||
.end('\n');
|
||||
gutil.log('-------> components.json文件更新成功');
|
||||
gutil.log(gutil.colors.yellow('-------> 请无视下面的make报错'));
|
||||
});
|
||||
|
||||
runSequence('copy', 'addComponents');
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
const path = require('path');
|
||||
const docConfig = require('../docs/src/doc.config');
|
||||
const { extractExample } = require('zan-doc/src/helper');
|
||||
|
||||
function extract(watch = false) {
|
||||
extractExample({
|
||||
src: path.resolve(__dirname, '../docs/examples-docs'),
|
||||
dist: path.resolve(__dirname, '../docs/examples-dist'),
|
||||
nav: docConfig['zh-CN'].nav,
|
||||
watch
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = function watch(isProduction) {
|
||||
extract(!isProduction);
|
||||
};
|
@ -6,11 +6,20 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
const docConfig = require('../docs/src/doc.config');
|
||||
const { extractExample } = require('zan-doc/src/helper');
|
||||
const styleLoaders = [
|
||||
{ loader: 'css-loader' },
|
||||
{ loader: 'postcss-loader', options: { sourceMap: true } }
|
||||
];
|
||||
require('./genExamples')(isProduction);
|
||||
|
||||
// extract [components].vue from [components].md
|
||||
extractExample({
|
||||
src: path.resolve(__dirname, '../docs/examples-docs'),
|
||||
dist: path.resolve(__dirname, '../docs/examples-dist'),
|
||||
nav: docConfig['zh-CN'].nav,
|
||||
watch: !isProduction
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
|
@ -1,41 +0,0 @@
|
||||
{
|
||||
"button": "./packages/button/index.js",
|
||||
"switch": "./packages/switch/index.js",
|
||||
"field": "./packages/field/index.js",
|
||||
"radio": "./packages/radio/index.js",
|
||||
"cell": "./packages/cell/index.js",
|
||||
"icon": "./packages/icon/index.js",
|
||||
"cell-group": "./packages/cell-group/index.js",
|
||||
"cell-swipe": "./packages/cell-swipe/index.js",
|
||||
"popup": "./packages/popup/index.js",
|
||||
"dialog": "./packages/dialog/index.js",
|
||||
"picker": "./packages/picker/index.js",
|
||||
"radio-group": "./packages/radio-group/index.js",
|
||||
"waterfall": "./packages/waterfall/index.js",
|
||||
"loading": "./packages/loading/index.js",
|
||||
"panel": "./packages/panel/index.js",
|
||||
"card": "./packages/card/index.js",
|
||||
"steps": "./packages/steps/index.js",
|
||||
"tag": "./packages/tag/index.js",
|
||||
"checkbox": "./packages/checkbox/index.js",
|
||||
"checkbox-group": "./packages/checkbox-group/index.js",
|
||||
"badge-group": "./packages/badge-group/index.js",
|
||||
"badge": "./packages/badge/index.js",
|
||||
"search": "./packages/search/index.js",
|
||||
"step": "./packages/step/index.js",
|
||||
"tabs": "./packages/tabs/index.js",
|
||||
"tab": "./packages/tab/index.js",
|
||||
"lazyload": "./packages/lazyload/index.js",
|
||||
"image-preview": "./packages/image-preview/index.js",
|
||||
"col": "./packages/col/index.js",
|
||||
"row": "./packages/row/index.js",
|
||||
"actionsheet": "./packages/actionsheet/index.js",
|
||||
"quantity": "./packages/quantity/index.js",
|
||||
"progress": "./packages/progress/index.js",
|
||||
"toast": "./packages/toast/index.js",
|
||||
"uploader": "./packages/uploader/index.js",
|
||||
"swipe": "./packages/swipe/index.js",
|
||||
"swipe-item": "./packages/swipe-item/index.js",
|
||||
"datetime-picker": "./packages/datetime-picker/index.js",
|
||||
"notice-bar": "./packages/notice-bar/index.js"
|
||||
}
|
@ -1,79 +1,81 @@
|
||||
import Actionsheet from './actionsheet';
|
||||
import Badge from './badge';
|
||||
import BadgeGroup from './badge-group';
|
||||
import Button from './button';
|
||||
import Switch from './switch';
|
||||
import Field from './field';
|
||||
import Radio from './radio';
|
||||
import Card from './card';
|
||||
import Cell from './cell';
|
||||
import Icon from './icon';
|
||||
import CellGroup from './cell-group';
|
||||
import CellSwipe from './cell-swipe';
|
||||
import Popup from './popup';
|
||||
import Dialog from './dialog';
|
||||
import Picker from './picker';
|
||||
import RadioGroup from './radio-group';
|
||||
import Waterfall from './waterfall';
|
||||
import Loading from './loading';
|
||||
import Panel from './panel';
|
||||
import Card from './card';
|
||||
import Steps from './steps';
|
||||
import Tag from './tag';
|
||||
import Checkbox from './checkbox';
|
||||
import CheckboxGroup from './checkbox-group';
|
||||
import BadgeGroup from './badge-group';
|
||||
import Badge from './badge';
|
||||
import Col from './col';
|
||||
import Collapse from './collapse';
|
||||
import DatetimePicker from './datetime-picker';
|
||||
import Dialog from './dialog';
|
||||
import Field from './field';
|
||||
import Icon from './icon';
|
||||
import ImagePreview from './image-preview';
|
||||
import Lazyload from './lazyload';
|
||||
import Loading from './loading';
|
||||
import NoticeBar from './notice-bar';
|
||||
import Panel from './panel';
|
||||
import Picker from './picker';
|
||||
import Popup from './popup';
|
||||
import Progress from './progress';
|
||||
import Quantity from './quantity';
|
||||
import Radio from './radio';
|
||||
import RadioGroup from './radio-group';
|
||||
import Row from './row';
|
||||
import Search from './search';
|
||||
import Step from './step';
|
||||
import Tabs from './tabs';
|
||||
import Tab from './tab';
|
||||
import Lazyload from './lazyload';
|
||||
import ImagePreview from './image-preview';
|
||||
import Col from './col';
|
||||
import Row from './row';
|
||||
import Actionsheet from './actionsheet';
|
||||
import Quantity from './quantity';
|
||||
import Progress from './progress';
|
||||
import Toast from './toast';
|
||||
import Uploader from './uploader';
|
||||
import Steps from './steps';
|
||||
import Swipe from './swipe';
|
||||
import SwipeItem from './swipe-item';
|
||||
import DatetimePicker from './datetime-picker';
|
||||
import NoticeBar from './notice-bar';
|
||||
import Switch from './switch';
|
||||
import Tab from './tab';
|
||||
import Tabs from './tabs';
|
||||
import Tag from './tag';
|
||||
import Toast from './toast';
|
||||
import Uploader from './uploader';
|
||||
import Waterfall from './waterfall';
|
||||
|
||||
const version = '0.8.6';
|
||||
const components = [
|
||||
Actionsheet,
|
||||
Badge,
|
||||
BadgeGroup,
|
||||
Button,
|
||||
Switch,
|
||||
Field,
|
||||
Radio,
|
||||
Card,
|
||||
Cell,
|
||||
Icon,
|
||||
CellGroup,
|
||||
CellSwipe,
|
||||
Popup,
|
||||
Picker,
|
||||
RadioGroup,
|
||||
Loading,
|
||||
Panel,
|
||||
Card,
|
||||
Steps,
|
||||
Tag,
|
||||
Checkbox,
|
||||
CheckboxGroup,
|
||||
BadgeGroup,
|
||||
Badge,
|
||||
Col,
|
||||
Collapse,
|
||||
DatetimePicker,
|
||||
Field,
|
||||
Icon,
|
||||
Loading,
|
||||
NoticeBar,
|
||||
Panel,
|
||||
Picker,
|
||||
Popup,
|
||||
Progress,
|
||||
Quantity,
|
||||
Radio,
|
||||
RadioGroup,
|
||||
Row,
|
||||
Search,
|
||||
Step,
|
||||
Tabs,
|
||||
Tab,
|
||||
Col,
|
||||
Row,
|
||||
Actionsheet,
|
||||
Quantity,
|
||||
Progress,
|
||||
Uploader,
|
||||
Steps,
|
||||
Swipe,
|
||||
SwipeItem,
|
||||
DatetimePicker,
|
||||
NoticeBar
|
||||
Switch,
|
||||
Tab,
|
||||
Tabs,
|
||||
Tag,
|
||||
Uploader
|
||||
];
|
||||
|
||||
const install = function(Vue) {
|
||||
@ -92,45 +94,46 @@ if (typeof window !== 'undefined' && window.Vue) {
|
||||
export {
|
||||
install,
|
||||
version,
|
||||
Actionsheet,
|
||||
Badge,
|
||||
BadgeGroup,
|
||||
Button,
|
||||
Switch,
|
||||
Field,
|
||||
Radio,
|
||||
Card,
|
||||
Cell,
|
||||
Icon,
|
||||
CellGroup,
|
||||
CellSwipe,
|
||||
Popup,
|
||||
Dialog,
|
||||
Picker,
|
||||
RadioGroup,
|
||||
Waterfall,
|
||||
Loading,
|
||||
Panel,
|
||||
Card,
|
||||
Steps,
|
||||
Tag,
|
||||
Checkbox,
|
||||
CheckboxGroup,
|
||||
BadgeGroup,
|
||||
Badge,
|
||||
Col,
|
||||
Collapse,
|
||||
DatetimePicker,
|
||||
Dialog,
|
||||
Field,
|
||||
Icon,
|
||||
ImagePreview,
|
||||
Lazyload,
|
||||
Loading,
|
||||
NoticeBar,
|
||||
Panel,
|
||||
Picker,
|
||||
Popup,
|
||||
Progress,
|
||||
Quantity,
|
||||
Radio,
|
||||
RadioGroup,
|
||||
Row,
|
||||
Search,
|
||||
Step,
|
||||
Tabs,
|
||||
Tab,
|
||||
Lazyload,
|
||||
ImagePreview,
|
||||
Col,
|
||||
Row,
|
||||
Actionsheet,
|
||||
Quantity,
|
||||
Progress,
|
||||
Toast,
|
||||
Uploader,
|
||||
Steps,
|
||||
Swipe,
|
||||
SwipeItem,
|
||||
DatetimePicker,
|
||||
NoticeBar
|
||||
Switch,
|
||||
Tab,
|
||||
Tabs,
|
||||
Tag,
|
||||
Toast,
|
||||
Uploader,
|
||||
Waterfall
|
||||
};
|
||||
export default {
|
||||
install,
|
||||
|
Loading…
x
Reference in New Issue
Block a user