From b5835d4b582038709e4a4239852af4e587d2721f Mon Sep 17 00:00:00 2001 From: honey32 Date: Fri, 22 May 2026 15:26:34 +0900 Subject: [PATCH] build(deps): Replace `lodash` with `just-camel-case` `just-kebab-case` `just-split` --- cli/just-modules.d.ts | 24 ++++++++++++++++++++++++ cli/npm_catalog.toml | 7 +++---- cli/package.json | 5 +++-- cli/src/connect/create_template.ts | 2 +- cli/src/connect/validation.ts | 4 ++-- cli/src/html/create.ts | 2 +- cli/src/react/create.ts | 2 +- 7 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 cli/just-modules.d.ts diff --git a/cli/just-modules.d.ts b/cli/just-modules.d.ts new file mode 100644 index 0000000..5de0799 --- /dev/null +++ b/cli/just-modules.d.ts @@ -0,0 +1,24 @@ +/** + * Type overrides for just-* packages. + * + * just-* ships CJS entry points (exports.require), but its types use export default + * and "type": "module", so, in this repository (where `compilerOptions.module` is `node16`), + * TS1479 error happens. + * + * In this file, we add `export =` for these packages to fill the gap. + */ + +declare module 'just-camel-case' { + function camelCase(value: string): string + export = camelCase +} + +declare module 'just-kebab-case' { + function kebabCase(value: string): string + export = kebabCase +} + +declare module 'just-split' { + function split(arr: T[], n?: number): T[][] + export = split +} diff --git a/cli/npm_catalog.toml b/cli/npm_catalog.toml index 171ab86..ea4eabd 100755 --- a/cli/npm_catalog.toml +++ b/cli/npm_catalog.toml @@ -154,10 +154,9 @@ "@lexical/selection" = "0.21.0" "@lexical/utils" = "0.21.0" "lexical" = "0.21.0" -"@types/lodash" = "4.17.20" -"@types/lodash-es" = "4.17.12" -"lodash" = "4.18.1" -"lodash-es" = "4.18.1" +"just-camel-case" = "6.2.0" +"just-kebab-case" = "4.2.0" +"just-split" = "3.2.0" "@oclif/core" = "3.27.0" "@statsig/statsig-node-core" = "0.19.1" "@storybook/addon-actions" = "8.5.1" diff --git a/cli/package.json b/cli/package.json index efc68e0..bd20148 100644 --- a/cli/package.json +++ b/cli/package.json @@ -80,7 +80,6 @@ "@types/cross-spawn": "^6.0.6", "@types/jest": "^29.5.13", "@types/jsdom": "^21.1.7", - "@types/lodash": "4.17.20", "@types/node": "22.17.2", "@types/prettier": "2.7.3", "@types/prompts": "^2.4.9", @@ -110,7 +109,9 @@ "find-up": "^5.0.0", "glob": "^11.0.4", "jsdom": "^24.1.1", - "lodash": "4.18.1", + "just-camel-case": "6.2.0", + "just-kebab-case": "4.2.0", + "just-split": "3.2.0", "minimatch": "^9.0.3", "ora": "^5.4.1", "parse5": "^7.1.2", diff --git a/cli/src/connect/create_template.ts b/cli/src/connect/create_template.ts index d138a8a..ec943f6 100644 --- a/cli/src/connect/create_template.ts +++ b/cli/src/connect/create_template.ts @@ -1,4 +1,4 @@ -import { camelCase } from 'lodash' +import camelCase from 'just-camel-case' import fs from 'fs' import { type ComponentPropertyDefinition, diff --git a/cli/src/connect/validation.ts b/cli/src/connect/validation.ts index cabd1be..4e95dbf 100644 --- a/cli/src/connect/validation.ts +++ b/cli/src/connect/validation.ts @@ -1,5 +1,5 @@ import * as url from 'url' -import { chunk } from 'lodash' +import split from 'just-split' import { CodeConnectJSON } from '../connect/figma_connect' import { logger } from '../common/logging' @@ -298,7 +298,7 @@ export async function validateDocs( const nodeMap = fileKeyToNodeIds[fileKey] const nodeIds = Object.keys(nodeMap) logger.debug(`Validating ${nodeIds.length} nodes`) - const chunks = chunk(nodeIds, 400) + const chunks = split(nodeIds, 400) for (let batch = 0; batch < chunks.length; batch++) { const nodeIdsChunk = chunks[batch] diff --git a/cli/src/html/create.ts b/cli/src/html/create.ts index 60fd32b..8856942 100644 --- a/cli/src/html/create.ts +++ b/cli/src/html/create.ts @@ -7,7 +7,7 @@ import path from 'path' import fs from 'fs' import { generateProps } from '../react/create' import * as prettier from 'prettier' -import { kebabCase } from 'lodash' +import kebabCase from 'just-kebab-case' import { getOutFileName } from '../connect/create_common' export async function createHtmlCodeConnect( diff --git a/cli/src/react/create.ts b/cli/src/react/create.ts index 79fa5a0..6b6a3b6 100644 --- a/cli/src/react/create.ts +++ b/cli/src/react/create.ts @@ -1,4 +1,4 @@ -import { camelCase } from 'lodash' +import camelCase from 'just-camel-case' import * as prettier from 'prettier' import fs from 'fs' import z from 'zod'