chore(@vant/cli): remove lodash-es from deps (#10206)

This commit is contained in:
neverland 2022-01-17 15:43:54 +08:00 committed by GitHub
parent 2892f44af7
commit d4aebef89c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 38 deletions

View File

@ -41,7 +41,6 @@
"devDependencies": {
"@types/fs-extra": "^9.0.13",
"@types/less": "^3.0.3",
"@types/lodash-es": "^4.17.5",
"@types/markdown-it": "^12.2.3",
"vue": "^3.2.27"
},
@ -77,7 +76,6 @@
"jest-serializer-html": "^7.1.0",
"less": "^4.1.2",
"lint-staged": "^12.1.2",
"lodash-es": "^4.17.21",
"markdown-it": "^12.2.0",
"markdown-it-anchor": "^8.4.1",
"ora": "^6.0.1",

View File

@ -1,4 +1,3 @@
import { get } from 'lodash-es';
import { existsSync, readFileSync } from 'fs';
import { fileURLToPath, pathToFileURL } from 'url';
import { join, dirname, isAbsolute } from 'path';
@ -74,7 +73,7 @@ export function getVantConfig() {
function getSrcDir() {
const vantConfig = getVantConfig();
const srcDir = get(vantConfig, 'build.srcDir');
const srcDir = vantConfig.build?.srcDir;
if (srcDir) {
if (isAbsolute(srcDir)) {

View File

@ -1,4 +1,3 @@
import { get } from 'lodash-es';
import { existsSync } from 'fs';
import { join, isAbsolute } from 'path';
import { getVantConfig } from '../common/index.js';
@ -8,7 +7,7 @@ type CSS_LANG = 'css' | 'less' | 'scss';
function getCssLang(): CSS_LANG {
const vantConfig = getVantConfig();
const preprocessor = get(vantConfig, 'build.css.preprocessor', 'less');
const preprocessor = vantConfig.build?.css?.preprocessor || 'less';
if (preprocessor === 'sass') {
return 'scss';
@ -23,7 +22,7 @@ export function getCssBaseFile() {
const vantConfig = getVantConfig();
let path = join(STYLE_DIR, `base.${CSS_LANG}`);
const baseFile = get(vantConfig, 'build.css.base', '');
const baseFile = vantConfig.build?.css?.base || '';
if (baseFile) {
path = isAbsolute(baseFile) ? baseFile : join(SRC_DIR, baseFile);
}

View File

@ -1,5 +1,4 @@
import fse from 'fs-extra';
import { get } from 'lodash-es';
import { sep, join } from 'path';
import { SRC_DIR, getVantConfig } from './constant.js';
import type { InlineConfig } from 'vite';
@ -117,7 +116,7 @@ export function smartOutputFile(filePath: string, content: string) {
export function mergeCustomViteConfig(config: InlineConfig) {
const vantConfig = getVantConfig();
const configureVite = get(vantConfig, 'build.configureVite');
const configureVite = vantConfig.build?.configureVite;
if (configureVite) {
return configureVite(config);

View File

@ -1,4 +1,3 @@
import { get } from 'lodash-es';
import { join } from 'path';
import {
pascalize,
@ -72,8 +71,8 @@ export function genPackageEntry({
const names = getComponents();
const vantConfig = getVantConfig();
const namedExport = get(vantConfig, 'build.namedExport', false);
const skipInstall = get(vantConfig, 'build.skipInstall', []).map(pascalize);
const namedExport = vantConfig.build?.namedExport || false;
const skipInstall = (vantConfig.build?.skipInstall || []).map(pascalize);
const version = process.env.PACKAGE_VERSION || getPackageJson().version;

View File

@ -1,5 +1,4 @@
import markdownVetur from '@vant/markdown-vetur';
import { get } from 'lodash-es';
import {
SRC_DIR,
VETUR_DIR,
@ -11,7 +10,7 @@ import {
export function genVeturConfig() {
const pkgJson = getPackageJson();
const vantConfig = getVantConfig();
const options = get(vantConfig, 'build.vetur');
const options = vantConfig.build?.vetur;
if (options) {
markdownVetur.parseAndWrite({

View File

@ -1,5 +1,4 @@
import { join } from 'path';
import { get } from 'lodash-es';
import { createRequire } from 'module';
import hljs from 'highlight.js';
import vitePluginMd from 'vite-plugin-md';
@ -82,7 +81,7 @@ function getTitle(config: { title: string; description?: string }) {
}
function getHTMLMeta(vantConfig: any) {
const meta = get(vantConfig, 'site.htmlMeta');
const meta = vantConfig.site?.htmlMeta;
if (meta) {
return Object.keys(meta)
@ -99,8 +98,8 @@ export function getViteConfigForSiteDev(): InlineConfig {
const vantConfig = getVantConfig();
const siteConfig = getSiteConfig(vantConfig);
const title = getTitle(siteConfig);
const baiduAnalytics = get(vantConfig, 'site.baiduAnalytics');
const enableVConsole = isDev() && get(vantConfig, 'site.enableVConsole');
const baiduAnalytics = vantConfig.site?.baiduAnalytics;
const enableVConsole = isDev() && vantConfig.site?.enableVConsole;
return {
root: SITE_SRC_DIR,
@ -162,8 +161,8 @@ export function getViteConfigForSiteDev(): InlineConfig {
export function getViteConfigForSiteProd(): InlineConfig {
const devConfig = getViteConfigForSiteDev();
const vantConfig = getVantConfig();
const outDir = get(vantConfig, 'build.site.outputDir', SITE_DIST_DIR);
const publicPath = get(vantConfig, 'build.site.publicPath', '/');
const outDir = vantConfig.build?.site?.outputDir || SITE_DIST_DIR;
const publicPath = vantConfig.build?.site?.publicPath || '/';
return {
...devConfig,

18
pnpm-lock.yaml generated
View File

@ -93,7 +93,6 @@ importers:
'@types/fs-extra': ^9.0.13
'@types/jest': ^27.0.3
'@types/less': ^3.0.3
'@types/lodash-es': ^4.17.5
'@types/markdown-it': ^12.2.3
'@vant/eslint-config': ^3.3.2
'@vant/markdown-vetur': ^2.2.0
@ -121,7 +120,6 @@ importers:
jest-serializer-html: ^7.1.0
less: ^4.1.2
lint-staged: ^12.1.2
lodash-es: ^4.17.21
markdown-it: ^12.2.0
markdown-it-anchor: ^8.4.1
ora: ^6.0.1
@ -169,7 +167,6 @@ importers:
jest-serializer-html: 7.1.0
less: 4.1.2
lint-staged: 12.1.2
lodash-es: 4.17.21
markdown-it: 12.2.0
markdown-it-anchor: 8.4.1_b5b6ac618dbcb305e9dd9bd86fa4e841
ora: 6.0.1
@ -187,7 +184,6 @@ importers:
devDependencies:
'@types/fs-extra': 9.0.13
'@types/less': 3.0.3
'@types/lodash-es': 4.17.5
'@types/markdown-it': 12.2.3
vue: 3.2.27
@ -1585,16 +1581,6 @@ packages:
/@types/linkify-it/3.0.2:
resolution: {integrity: sha1-/SzS7bqn6qx+fzwXSLUqGRQ4Rsk=, tarball: '@types/linkify-it/download/@types/linkify-it-3.0.2.tgz'}
/@types/lodash-es/4.17.5:
resolution: {integrity: sha1-HD/dFoSdhK6kOJCxxg2jeftQE1M=, tarball: '@types/lodash-es/download/@types/lodash-es-4.17.5.tgz'}
dependencies:
'@types/lodash': 4.14.176
dev: true
/@types/lodash/4.14.176:
resolution: {integrity: sha1-ZBFQ/BzaNvv6Mp3mA7uxddfuIMA=, tarball: '@types/lodash/download/@types/lodash-4.14.176.tgz'}
dev: true
/@types/markdown-it/12.2.3:
resolution: {integrity: sha1-DW9uXkE/jaqiZSKQRZe+PWzZO1E=, tarball: '@types/markdown-it/download/@types/markdown-it-12.2.3.tgz'}
dependencies:
@ -5508,10 +5494,6 @@ packages:
dependencies:
p-locate: 4.1.0
/lodash-es/4.17.21:
resolution: {integrity: sha1-Q+YmxG5lkbd1C+srUBFzkMYJ4+4=, tarball: lodash-es/download/lodash-es-4.17.21.tgz?cache=0&sync_timestamp=1632822762695&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Flodash-es%2Fdownload%2Flodash-es-4.17.21.tgz}
dev: false
/lodash.ismatch/4.4.0:
resolution: {integrity: sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=, tarball: lodash.ismatch/download/lodash.ismatch-4.4.0.tgz}
dev: false