delete components.json
This commit is contained in:
@@ -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`);
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user