Pārlūkot izejas kodu

chore(deps): remove lodash from create-tauri-app (#1532)

SneakyFish5 4 gadi atpakaļ
vecāks
revīzija
edab7a6686

+ 5 - 0
.changes/cta-remove-lodash.md

@@ -0,0 +1,5 @@
+---
+"create-tauri-app": patch
+---
+
+Remove `lodash` dependency and replace with es6 builtins

+ 0 - 2
tooling/create-tauri-app/package.json

@@ -29,7 +29,6 @@
   "dependencies": {
     "execa": "^5.0.0",
     "inquirer": "^8.0.0",
-    "lodash": "4.17.21",
     "minimist": "^1.2.5",
     "scaffe": "1.0.0"
   },
@@ -39,7 +38,6 @@
     "@rollup/plugin-typescript": "^8.2.1",
     "@types/cross-spawn": "6.0.2",
     "@types/inquirer": "7.3.1",
-    "@types/lodash": "4.14.168",
     "@types/semver": "7.3.4",
     "prettier": "^2.2.1",
     "rollup": "^2.45.1",

+ 5 - 17
tooling/create-tauri-app/src/index.ts

@@ -2,7 +2,6 @@
 // SPDX-License-Identifier: Apache-2.0
 // SPDX-License-Identifier: MIT
 
-import { map, find } from "lodash";
 import { TauriBuildConfig } from "./types/config";
 import { reactjs, reactts } from "./recipes/react";
 import { vuecli } from "./recipes/vue-cli";
@@ -47,23 +46,12 @@ export interface Recipe {
 
 export const allRecipes: Recipe[] = [vanillajs, reactjs, reactts, vite, vuecli];
 
-export const recipeNames: Array<[string, string]> = map(
-  allRecipes,
-  (r: Recipe) => [r.shortName, r.descriptiveName]
-);
+export const recipeNames: Array<[string, string]> = allRecipes.map(r => [r.shortName, r.descriptiveName]);
 
-export const recipeByShortName = (name: string): Recipe | undefined =>
-  find(allRecipes, (r: Recipe) => r.shortName === name);
+export const recipeByShortName = (name: string) => allRecipes.find(r => r.shortName === name);
 
-export const recipeByDescriptiveName = (name: string): Recipe | undefined =>
-  find(allRecipes, (r: Recipe) => r.descriptiveName === name);
+export const recipeByDescriptiveName = (name: string) => allRecipes.find(r => r.descriptiveName === name);
 
-export const recipeShortNames: string[] = map(
-  allRecipes,
-  (r: Recipe) => r.shortName
-);
+export const recipeShortNames = allRecipes.map(r => r.shortName);
 
-export const recipeDescriptiveNames: string[] = map(
-  allRecipes,
-  (r: Recipe) => r.descriptiveName
-);
+export const recipeDescriptiveNames = allRecipes.map(r => r.descriptiveName);