chore(cli): remove decamelize pkg for compatiblity issues

This commit is contained in:
陈嘉涵
2019-12-30 15:14:13 +08:00
parent 16cbfd2c85
commit 2b438f84cd
8 changed files with 23 additions and 39 deletions

View File

@@ -1,4 +1,3 @@
import decamelize from 'decamelize';
import { join } from 'path';
import { execSync } from 'child_process';
import {
@@ -85,6 +84,13 @@ export function pascalize(str: string): string {
);
}
export function decamelize(str: string, sep = '-') {
return str
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
.toLowerCase();
}
export function getWebpackConfig(): object {
if (existsSync(WEBPACK_CONFIG_FILE)) {
const config = require(WEBPACK_CONFIG_FILE);
@@ -148,4 +154,4 @@ export function hasYarn() {
return hasYarnCache;
}
export { decamelize, getVantConfig };
export { getVantConfig };

View File

@@ -42,7 +42,7 @@ function getSetName(demos: DemoItem[]) {
function genConfig(demos: DemoItem[]) {
const vantConfig = getVantConfig();
const demoNames = demos.map(item => decamelize(item.name, '-'));
const demoNames = demos.map(item => decamelize(item.name));
function demoFilter(nav: any[]) {
return nav.filter(group => {