mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(cli): remove decamelize pkg for compatiblity issues
This commit is contained in:
parent
16cbfd2c85
commit
2b438f84cd
@ -72,7 +72,6 @@
|
|||||||
"cross-env": "^6.0.3",
|
"cross-env": "^6.0.3",
|
||||||
"css-loader": "^3.4.0",
|
"css-loader": "^3.4.0",
|
||||||
"csso": "^4.0.2",
|
"csso": "^4.0.2",
|
||||||
"decamelize": "^3.2.0",
|
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.7.2",
|
||||||
"find-babel-config": "^1.2.0",
|
"find-babel-config": "^1.2.0",
|
||||||
"gh-pages": "2.0.1",
|
"gh-pages": "2.0.1",
|
||||||
|
@ -20,6 +20,13 @@ function iframeReady(iframe, callback) {
|
|||||||
const ua = navigator.userAgent.toLowerCase();
|
const ua = navigator.userAgent.toLowerCase();
|
||||||
const isMobile = /ios|iphone|ipod|ipad|android/.test(ua);
|
const isMobile = /ios|iphone|ipod|ipad|android/.test(ua);
|
||||||
|
|
||||||
|
export function decamelize(str, 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 {
|
export {
|
||||||
isMobile,
|
isMobile,
|
||||||
iframeReady
|
iframeReady
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import VueRouter from 'vue-router';
|
import VueRouter from 'vue-router';
|
||||||
import decamelize from 'decamelize';
|
import { isMobile, decamelize } from '../common';
|
||||||
import { isMobile } from '../common';
|
|
||||||
import { config, documents } from 'site-desktop-shared';
|
import { config, documents } from 'site-desktop-shared';
|
||||||
import { getLang, setDefaultLang } from '../common/locales';
|
import { getLang, setDefaultLang } from '../common/locales';
|
||||||
import '../common/iframe-router';
|
import '../common/iframe-router';
|
||||||
@ -20,13 +19,13 @@ function parseName(name) {
|
|||||||
const component = pairs.shift();
|
const component = pairs.shift();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
component: `${decamelize(component, '-')}`,
|
component: `${decamelize(component)}`,
|
||||||
lang: pairs.join('-')
|
lang: pairs.join('-')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
component: `${decamelize(name, '-')}`,
|
component: `${decamelize(name)}`,
|
||||||
lang: ''
|
lang: ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import decamelize from 'decamelize';
|
import { decamelize } from '../../common';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'demo-section',
|
name: 'demo-section',
|
||||||
@ -14,7 +14,7 @@ export default {
|
|||||||
demoName() {
|
demoName() {
|
||||||
const { meta } = this.$route || {};
|
const { meta } = this.$route || {};
|
||||||
if (meta && meta.name) {
|
if (meta && meta.name) {
|
||||||
return `demo-${decamelize(meta.name, '-')}`;
|
return `demo-${decamelize(meta.name)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import VueRouter from 'vue-router';
|
import VueRouter from 'vue-router';
|
||||||
import decamelize from 'decamelize';
|
|
||||||
import DemoHome from './components/DemoHome';
|
import DemoHome from './components/DemoHome';
|
||||||
|
import { decamelize } from '../common';
|
||||||
import { demos, config } from 'site-mobile-shared';
|
import { demos, config } from 'site-mobile-shared';
|
||||||
import { getLang, setDefaultLang } from '../common/locales';
|
import { getLang, setDefaultLang } from '../common/locales';
|
||||||
import '../common/iframe-router';
|
import '../common/iframe-router';
|
||||||
@ -52,7 +52,7 @@ function getRoutes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
names.forEach(name => {
|
names.forEach(name => {
|
||||||
const component = decamelize(name, '-');
|
const component = decamelize(name);
|
||||||
|
|
||||||
if (langs.length) {
|
if (langs.length) {
|
||||||
langs.forEach(lang => {
|
langs.forEach(lang => {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import decamelize from 'decamelize';
|
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import {
|
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 {
|
export function getWebpackConfig(): object {
|
||||||
if (existsSync(WEBPACK_CONFIG_FILE)) {
|
if (existsSync(WEBPACK_CONFIG_FILE)) {
|
||||||
const config = require(WEBPACK_CONFIG_FILE);
|
const config = require(WEBPACK_CONFIG_FILE);
|
||||||
@ -148,4 +154,4 @@ export function hasYarn() {
|
|||||||
return hasYarnCache;
|
return hasYarnCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { decamelize, getVantConfig };
|
export { getVantConfig };
|
||||||
|
@ -42,7 +42,7 @@ function getSetName(demos: DemoItem[]) {
|
|||||||
|
|
||||||
function genConfig(demos: DemoItem[]) {
|
function genConfig(demos: DemoItem[]) {
|
||||||
const vantConfig = getVantConfig();
|
const vantConfig = getVantConfig();
|
||||||
const demoNames = demos.map(item => decamelize(item.name, '-'));
|
const demoNames = demos.map(item => decamelize(item.name));
|
||||||
|
|
||||||
function demoFilter(nav: any[]) {
|
function demoFilter(nav: any[]) {
|
||||||
return nav.filter(group => {
|
return nav.filter(group => {
|
||||||
|
@ -842,14 +842,6 @@
|
|||||||
"@babel/helper-plugin-utils" "^7.0.0"
|
"@babel/helper-plugin-utils" "^7.0.0"
|
||||||
"@babel/plugin-transform-typescript" "^7.7.4"
|
"@babel/plugin-transform-typescript" "^7.7.4"
|
||||||
|
|
||||||
"@babel/runtime-corejs2@^7.2.0":
|
|
||||||
version "7.7.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs2/-/runtime-corejs2-7.7.2.tgz#5a8c4e2f8688ce58adc9eb1d8320b6e7341f96ce"
|
|
||||||
integrity sha512-GfVnHchOBvIMsweQ13l4jd9lT4brkevnavnVOej5g2y7PpTRY+R4pcQlCjWMZoUla5rMLFzaS/Ll2s59cB1TqQ==
|
|
||||||
dependencies:
|
|
||||||
core-js "^2.6.5"
|
|
||||||
regenerator-runtime "^0.13.2"
|
|
||||||
|
|
||||||
"@babel/runtime@^7.0.0":
|
"@babel/runtime@^7.0.0":
|
||||||
version "7.7.4"
|
version "7.7.4"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.4.tgz#b23a856751e4bf099262f867767889c0e3fe175b"
|
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.4.tgz#b23a856751e4bf099262f867767889c0e3fe175b"
|
||||||
@ -3555,11 +3547,6 @@ core-js-compat@^3.4.7:
|
|||||||
browserslist "^4.8.2"
|
browserslist "^4.8.2"
|
||||||
semver "^6.3.0"
|
semver "^6.3.0"
|
||||||
|
|
||||||
core-js@^2.6.5:
|
|
||||||
version "2.6.10"
|
|
||||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.10.tgz#8a5b8391f8cc7013da703411ce5b585706300d7f"
|
|
||||||
integrity sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA==
|
|
||||||
|
|
||||||
core-util-is@1.0.2, core-util-is@~1.0.0:
|
core-util-is@1.0.2, core-util-is@~1.0.0:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
resolved "https://registry.npm.taobao.org/core-util-is/download/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||||
@ -3839,13 +3826,6 @@ decamelize@^1.1.0, decamelize@^1.1.2, decamelize@^1.2.0:
|
|||||||
resolved "https://registry.npm.taobao.org/decamelize/download/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
resolved "https://registry.npm.taobao.org/decamelize/download/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||||
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||||
|
|
||||||
decamelize@^3.2.0:
|
|
||||||
version "3.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-3.2.0.tgz#84b8e8f4f8c579f938e35e2cc7024907e0090851"
|
|
||||||
integrity sha512-4TgkVUsmmu7oCSyGBm5FvfMoACuoh9EOidm7V5/J2X2djAwwt57qb3F2KMP2ITqODTCSwb+YRV+0Zqrv18k/hw==
|
|
||||||
dependencies:
|
|
||||||
xregexp "^4.2.4"
|
|
||||||
|
|
||||||
decode-uri-component@^0.2.0:
|
decode-uri-component@^0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
|
resolved "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
|
||||||
@ -11904,13 +11884,6 @@ xml-name-validator@^3.0.0:
|
|||||||
resolved "https://registry.npm.taobao.org/xml-name-validator/download/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
|
resolved "https://registry.npm.taobao.org/xml-name-validator/download/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
|
||||||
integrity sha1-auc+Bt5NjG5H+fsYH3jWSK1FfGo=
|
integrity sha1-auc+Bt5NjG5H+fsYH3jWSK1FfGo=
|
||||||
|
|
||||||
xregexp@^4.2.4:
|
|
||||||
version "4.2.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.2.4.tgz#02a4aea056d65a42632c02f0233eab8e4d7e57ed"
|
|
||||||
integrity sha512-sO0bYdYeJAJBcJA8g7MJJX7UrOZIfJPd8U2SC7B2Dd/J24U0aQNoGp33shCaBSWeb0rD5rh6VBUIXOkGal1TZA==
|
|
||||||
dependencies:
|
|
||||||
"@babel/runtime-corejs2" "^7.2.0"
|
|
||||||
|
|
||||||
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1:
|
xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1:
|
||||||
version "4.0.2"
|
version "4.0.2"
|
||||||
resolved "https://registry.npm.taobao.org/xtend/download/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
|
resolved "https://registry.npm.taobao.org/xtend/download/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user