From dc715fd94d5f95a4f0a261d02fd1de1881f6fa99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Sol=C3=A1r?= Date: Thu, 8 Oct 2026 21:23:19 +0200 Subject: [PATCH] chore: remove dead code, unused fixtures and dev dependencies Found with knip and verified by grep and git history: - getNpmCmd, mapGroupBy, consoleDatasetUrl and link have no callers - badUserClient and three dataset schema fixtures are unused in tests - @types/adm-zip (adm-zip ships its own types) and cross-env are unused - stale TODO about migrating to yargs Co-Authored-By: Claude Opus 5.5 --- package.json | 2 -- pnpm-lock.yaml | 22 -------------- src/commands/init.ts | 1 - src/lib/commands/agent-output.ts | 4 --- src/lib/outputs.ts | 10 ------- src/lib/utils.ts | 29 ------------------- test/__setup__/config.ts | 2 -- .../dataset-schemas/empty-fields.json | 17 ----------- test/__setup__/dataset-schemas/no-fields.json | 16 ---------- test/__setup__/dataset-schemas/no-type.json | 11 ------- test/__setup__/dataset-schemas/paths.ts | 6 ---- 11 files changed, 120 deletions(-) delete mode 100644 test/__setup__/dataset-schemas/empty-fields.json delete mode 100644 test/__setup__/dataset-schemas/no-fields.json delete mode 100644 test/__setup__/dataset-schemas/no-type.json diff --git a/package.json b/package.json index 691e8fb11..eddf3fa69 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,6 @@ "@apify/oxlint-config": "^0.3.0", "@apify/tsconfig": "^0.2.0", "@crawlee/types": "^3.18.1", - "@types/adm-zip": "^0.5.8", "@types/archiver": "^8.0.0", "@types/bun": "^1.4.2", "@types/execa": "^2.0.2", @@ -129,7 +128,6 @@ "@types/semver": "^7.8.0", "@types/which": "^3.0.4", "apify": "^3.7.2", - "cross-env": "^10.1.0", "husky": "^9.1.7", "lint-staged": "^17.5.1", "mock-stdin": "^1.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b5e0524a9..53e5c1a5e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -320,9 +320,6 @@ importers: '@crawlee/types': specifier: ^3.18.1 version: 3.18.1 - '@types/adm-zip': - specifier: ^0.5.8 - version: 0.5.8 '@types/archiver': specifier: ^8.0.0 version: 8.0.0 @@ -353,9 +350,6 @@ importers: apify: specifier: ^3.7.2 version: 3.7.2(debug@4.4.3(supports-color@8.1.1))(supports-color@8.1.1) - cross-env: - specifier: ^10.1.0 - version: 10.1.0 husky: specifier: ^9.1.7 version: 9.1.7 @@ -2217,8 +2211,6 @@ packages: '@emotion/weak-memoize@0.4.0': resolution: {integrity: sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg==} - '@epic-web/invariant@1.0.0': - resolution: {integrity: sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==} '@esbuild/aix-ppc64@0.28.2': resolution: {integrity: sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==} @@ -3930,8 +3922,6 @@ packages: '@tybys/wasm-util@0.10.4': resolution: {integrity: sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==} - '@types/adm-zip@0.5.8': - resolution: {integrity: sha512-RVVH7QvZYbN+ihqZ4kX/dMiowf6o+Jk1fNwiSdx0NahBJLU787zkULhGhJM8mf/obmLGmgdMM0bXsQTmyfbR7Q==} '@types/archiver@8.0.0': resolution: {integrity: sha512-YpXPbEuv9+eUIPPQWUPahj3cvs9isWRuF+J4z+KbdYVDO3rWorWQFxUVHnwPu2AgKwvgpki5F2VMX0Xx+mX45A==} @@ -5153,10 +5143,6 @@ packages: resolution: {integrity: sha512-IBWsY8xznyQrcHn8h4bC8/4ErNke5elzgG8GcqF4RFPw6aHkWWRc7Tgw6upjaTX/CT/yQgqYENkxYsTYN+hW2g==} engines: {node: '>=18'} - cross-env@10.1.0: - resolution: {integrity: sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==} - engines: {node: '>=20'} - hasBin: true cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} @@ -12609,7 +12595,6 @@ snapshots: '@emotion/weak-memoize@0.4.0': {} - '@epic-web/invariant@1.0.0': {} '@esbuild/aix-ppc64@0.28.2': optional: true @@ -14017,9 +14002,6 @@ snapshots: tslib: 2.8.1 optional: true - '@types/adm-zip@0.5.8': - dependencies: - '@types/node': 24.13.6 '@types/archiver@8.0.0': dependencies: @@ -15207,10 +15189,6 @@ snapshots: crc-32: 1.2.2 readable-stream: 4.7.0 - cross-env@10.1.0: - dependencies: - '@epic-web/invariant': 1.0.0 - cross-spawn: 7.0.6 cross-spawn@7.0.6: dependencies: diff --git a/src/commands/init.ts b/src/commands/init.ts index 87f02ceb0..5d02f9d6a 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -68,7 +68,6 @@ export class InitCommand extends ApifyCommand { const projectResult = await useCwdProject(); - // TODO: use direct .unwrap() once we migrate to yargs if (projectResult.isErr()) { error({ message: projectResult.unwrapErr().message }); process.exit(1); diff --git a/src/lib/commands/agent-output.ts b/src/lib/commands/agent-output.ts index 07dd5e1cb..c313e522a 100644 --- a/src/lib/commands/agent-output.ts +++ b/src/lib/commands/agent-output.ts @@ -104,10 +104,6 @@ export function consoleBuildUrl(actorId: string, buildNumber: string): string { return `${getConsoleUrl()}/actors/${actorId}#/builds/${buildNumber}`; } -export function consoleDatasetUrl(datasetId: string): string { - return `${getConsoleUrl()}/storage/datasets/${datasetId}`; -} - function statusColor(status: string): string { if (status === 'SUCCEEDED') return chalk.green(status); if (status === 'RUNNING' || status === 'READY') return chalk.blue(status); diff --git a/src/lib/outputs.ts b/src/lib/outputs.ts index 33e58cbbb..7115aa2d7 100644 --- a/src/lib/outputs.ts +++ b/src/lib/outputs.ts @@ -55,13 +55,3 @@ export function info(options: SimpleLogOptions) { [options.stdout ? 'stdoutOutput' : 'stderrOutput']: [chalk.white('Info:'), options.message], }); } - -export interface SimpleLinkOptions extends SimpleLogOptions { - url: string; -} - -export function link(options: SimpleLinkOptions) { - internalLog({ - [options.stdout ? 'stdoutOutput' : 'stderrOutput']: [chalk.blue(options.message), options.url], - }); -} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index a5bcade11..946963eed 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -631,14 +631,6 @@ export const outputJobLog = async ({ }); }; -/** - * Returns npm command for current os - * NOTE: For window we have to returns npm.cmd instead of npm, otherwise it doesn't work - */ -export const getNpmCmd = (): string => { - return process.platform.startsWith('win') ? 'npm.cmd' : 'npm'; -}; - /** * Returns true if the local storage holds nothing but the input record, either * the user's own `` / `.*` or the temporary copy the CLI writes next to it. @@ -794,27 +786,6 @@ export function objectGroupBy( return result; } -/** - * A "polyfill" for Map.groupBy - */ -export function mapGroupBy(items: Iterable, keySelector: (item: T, index: number) => K): Map { - const map = new Map(); - let index = 0; - - for (const value of items) { - const key = keySelector(value, index++); - const list = map.get(key); - - if (list) { - list.push(value); - } else { - map.set(key, [value]); - } - } - - return map; -} - export function printJsonToStdout(object: unknown) { console.log(JSON.stringify(object, null, 2)); } diff --git a/test/__setup__/config.ts b/test/__setup__/config.ts index bf2e84b5b..39fdc01e4 100644 --- a/test/__setup__/config.ts +++ b/test/__setup__/config.ts @@ -15,8 +15,6 @@ if (!ENV_TEST_USER_TOKEN) { export const testUserClient = new ApifyClient(getApifyClientOptionsForToken(ENV_TEST_USER_TOKEN)); -export const badUserClient = new ApifyClient(getApifyClientOptionsForToken(TEST_USER_BAD_TOKEN)); - export const TEST_USER_TOKEN = ENV_TEST_USER_TOKEN; if (isCI) { diff --git a/test/__setup__/dataset-schemas/empty-fields.json b/test/__setup__/dataset-schemas/empty-fields.json deleted file mode 100644 index ff5a5ea32..000000000 --- a/test/__setup__/dataset-schemas/empty-fields.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "actorSpecification": 1, - "fields": {}, - "views": { - "overview": { - "title": "Overview", - "transformation": { "fields": ["title", "url"] }, - "display": { - "component": "table", - "properties": { - "title": { "label": "Title", "format": "text" }, - "url": { "label": "URL", "format": "link" } - } - } - } - } -} diff --git a/test/__setup__/dataset-schemas/no-fields.json b/test/__setup__/dataset-schemas/no-fields.json deleted file mode 100644 index a6f09f4ca..000000000 --- a/test/__setup__/dataset-schemas/no-fields.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "actorSpecification": 1, - "views": { - "overview": { - "title": "Overview", - "transformation": { "fields": ["title", "url"] }, - "display": { - "component": "table", - "properties": { - "title": { "label": "Title", "format": "text" }, - "url": { "label": "URL", "format": "link" } - } - } - } - } -} diff --git a/test/__setup__/dataset-schemas/no-type.json b/test/__setup__/dataset-schemas/no-type.json deleted file mode 100644 index 5edc42ee5..000000000 --- a/test/__setup__/dataset-schemas/no-type.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "actorSpecification": 1, - "fields": { - "properties": { - "name": { "type": "string" }, - "count": { "type": "integer" } - }, - "required": ["name"] - }, - "views": {} -} diff --git a/test/__setup__/dataset-schemas/paths.ts b/test/__setup__/dataset-schemas/paths.ts index fef20f343..ca01e9a37 100644 --- a/test/__setup__/dataset-schemas/paths.ts +++ b/test/__setup__/dataset-schemas/paths.ts @@ -1,9 +1,3 @@ import { fileURLToPath } from 'node:url'; export const validDatasetSchemaPath = fileURLToPath(new URL('./valid.json', import.meta.url)); - -export const emptyFieldsDatasetSchemaPath = fileURLToPath(new URL('./empty-fields.json', import.meta.url)); - -export const noTypeDatasetSchemaPath = fileURLToPath(new URL('./no-type.json', import.meta.url)); - -export const noFieldsDatasetSchemaPath = fileURLToPath(new URL('./no-fields.json', import.meta.url));