mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 10:07:07 +00:00
chore(cli): remove decamelize pkg for compatiblity issues
This commit is contained in:
@@ -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 };
|
||||
|
@@ -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 => {
|
||||
|
Reference in New Issue
Block a user