chore: move deps to cli

This commit is contained in:
陈嘉涵
2019-11-21 14:13:36 +08:00
parent 56ea702dee
commit aaa453730d
3 changed files with 69 additions and 130 deletions

View File

@@ -1,9 +1,22 @@
const fs = require('fs-extra');
const path = require('path');
const uppercamelize = require('uppercamelcase');
const Components = require('./get-components')();
const packageJson = require('../package.json');
const camelizeRE = /-(\w)/g;
const pascalizeRE = /(\w)(\w*)/g;
function camelize(str) {
return str.replace(camelizeRE, (_, c) => c.toUpperCase());
}
function pascalize(str) {
return camelize(str).replace(
pascalizeRE,
(_, c1, c2) => c1.toUpperCase() + c2
);
}
const version = process.env.VERSION || packageJson.version;
const tips = '// This file is auto generated by build/build-entry.js';
@@ -14,9 +27,9 @@ function buildEntry() {
'Waterfall'
];
const importList = Components.map(name => `import ${uppercamelize(name)} from './${name}';`);
const exportList = Components.map(name => `${uppercamelize(name)}`);
const installList = exportList.filter(name => !~uninstallComponents.indexOf(uppercamelize(name)));
const importList = Components.map(name => `import ${pascalize(name)} from './${name}';`);
const exportList = Components.map(name => `${pascalize(name)}`);
const installList = exportList.filter(name => !~uninstallComponents.indexOf(pascalize(name)));
const content = `${tips}
import { VueConstructor } from 'vue/types';
${importList.join('\n')}