From c93366bfd1c77fb667683da5f1c7d1b7498b56de Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Tue, 21 Jan 2025 10:09:49 -0500 Subject: [PATCH] fix: remove unused code and dependencies --- e2e/install.e2e.js | 44 --- e2e/utils.js | 30 --- package-lock.json | 427 ------------------------------ package.json | 3 - src/commands/blobs/index.ts | 1 - src/utils/addons/compare.ts | 36 --- src/utils/addons/diffs/index.ts | 23 -- src/utils/addons/diffs/options.ts | 109 -------- src/utils/addons/prepare.ts | 5 - src/utils/addons/prompts.ts | 98 ------- src/utils/addons/validation.ts | 24 -- src/utils/init/node-version.ts | 34 --- src/utils/shell.ts | 8 - src/utils/telemetry/request.ts | 47 ---- 14 files changed, 889 deletions(-) delete mode 100644 e2e/install.e2e.js delete mode 100644 e2e/utils.js delete mode 100644 src/commands/blobs/index.ts delete mode 100644 src/utils/addons/compare.ts delete mode 100644 src/utils/addons/diffs/index.ts delete mode 100644 src/utils/addons/diffs/options.ts delete mode 100644 src/utils/addons/prompts.ts delete mode 100644 src/utils/addons/validation.ts delete mode 100644 src/utils/init/node-version.ts delete mode 100644 src/utils/telemetry/request.ts diff --git a/e2e/install.e2e.js b/e2e/install.e2e.js deleted file mode 100644 index e5204eac41b..00000000000 --- a/e2e/install.e2e.js +++ /dev/null @@ -1,44 +0,0 @@ -import { readFileSync, existsSync } from 'fs' -import { mkdir } from 'fs/promises' -import { platform } from 'os' -import { join, resolve } from 'path' -import { env } from 'process' -import { fileURLToPath } from 'url' - -import execa from 'execa' -import { expect, test } from 'vitest' - -import { packageManagerConfig, packageManagerExists } from './utils.js' - -const { version } = JSON.parse(readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf-8')) - -/** - * Prepares the workspace for the test suite to run - * @param {string} folderName - */ -const prepare = async (folderName) => { - const folder = join(env.E2E_TEST_WORKSPACE, folderName) - await mkdir(folder, { recursive: true }) - return folder -} - -Object.entries(packageManagerConfig).forEach(([packageManager, { install: installCmd, lockFile }]) => { - test.runIf(packageManagerExists(packageManager))( - `${packageManager} → should install the cli and run the help command`, - async () => { - const cwd = await prepare(`${packageManager}-try-install`) - await execa(...installCmd, { stdio: env.DEBUG ? 'inherit' : 'ignore', cwd }) - - expect(existsSync(join(cwd, lockFile)), `Generated lock file ${lockFile} does not exists in ${cwd}`).toBe(true) - - const binary = resolve(join(cwd, `./node_modules/.bin/netlify${platform() === 'win32' ? '.cmd' : ''}`)) - const { stdout } = await execa(binary, ['help'], { cwd }) - - expect(stdout.trim(), `Help command does not start with 'VERSION':\n\n${stdout}`).toMatch(/^VERSION/) - expect(stdout, `Help command does not include 'netlify-cli/${version}':\n\n${stdout}`).toContain( - `netlify-cli/${version}`, - ) - expect(stdout, `Help command does not include '$ netlify [COMMAND]':\n\n${stdout}`).toMatch('$ netlify [COMMAND]') - }, - ) -}) diff --git a/e2e/utils.js b/e2e/utils.js deleted file mode 100644 index df536000052..00000000000 --- a/e2e/utils.js +++ /dev/null @@ -1,30 +0,0 @@ -import { execSync } from 'child_process' - -/** - * Checks if a package manager exists - * @param {string} packageManager - * @returns {boolean} - */ -export const packageManagerExists = (packageManager) => { - try { - execSync(`${packageManager} --version`) - return true - } catch { - return false - } -} - -export const packageManagerConfig = { - npm: { - install: ['npm', ['install', 'netlify-cli@testing']], - lockFile: 'package-lock.json', - }, - pnpm: { - install: ['pnpm', ['add', 'netlify-cli@testing']], - lockFile: 'pnpm-lock.yaml', - }, - yarn: { - install: ['yarn', ['add', 'netlify-cli@testing']], - lockFile: 'yarn.lock', - }, -} diff --git a/package-lock.json b/package-lock.json index b06de7f543b..eca6f691aff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,6 @@ "@octokit/rest": "20.1.1", "@opentelemetry/api": "1.8.0", "ansi-escapes": "7.0.0", - "ansi-styles": "6.2.1", "ansi-to-html": "0.7.2", "ascii-table": "0.0.9", "backoff": "2.5.0", @@ -37,7 +36,6 @@ "clean-deep": "3.4.0", "commander": "10.0.1", "comment-json": "4.2.5", - "concordance": "5.0.4", "configstore": "6.0.0", "content-type": "1.0.5", "cookie": "0.7.2", @@ -89,7 +87,6 @@ "netlify": "13.2.1", "netlify-redirector": "0.5.0", "node-fetch": "3.3.2", - "node-version-alias": "3.4.1", "ora": "8.1.1", "p-filter": "4.1.0", "p-map": "7.0.3", @@ -7501,44 +7498,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, - "node_modules/all-node-versions": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/all-node-versions/-/all-node-versions-11.3.0.tgz", - "integrity": "sha512-psMkc5s3qpr+QMfires9bC4azRYciPWql1wqZKMsYRh1731qefQDH2X4+O19xSBX6u0Ra/8Y5diG6y/fEmqKsw==", - "dependencies": { - "fetch-node-website": "^7.3.0", - "filter-obj": "^5.1.0", - "get-stream": "^6.0.0", - "global-cache-dir": "^4.3.1", - "is-plain-obj": "^4.1.0", - "path-exists": "^5.0.0", - "semver": "^7.3.7", - "write-file-atomic": "^4.0.1" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/all-node-versions/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/all-node-versions/node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", - "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, "node_modules/ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", @@ -8264,11 +8223,6 @@ "readable-stream": "^3.4.0" } }, - "node_modules/blueimp-md5": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", - "integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==" - }, "node_modules/body-parser": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", @@ -8638,14 +8592,6 @@ "node": ">=14.16" } }, - "node_modules/cachedir": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz", - "integrity": "sha512-A+Fezp4zxnit6FanDmv9EqXNAi3vt9DWp51/71UEhXukb7QUuvtv9344h91dyAxuTLoSYJFU299qzR3tzwPAhw==", - "engines": { - "node": ">=6" - } - }, "node_modules/call-bind": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", @@ -9016,17 +8962,6 @@ "node": ">=4" } }, - "node_modules/cli-progress": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz", - "integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==", - "dependencies": { - "string-width": "^4.2.3" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/cli-spinners": { "version": "2.9.2", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", @@ -9505,24 +9440,6 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, - "node_modules/concordance": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/concordance/-/concordance-5.0.4.tgz", - "integrity": "sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==", - "dependencies": { - "date-time": "^3.1.0", - "esutils": "^2.0.3", - "fast-diff": "^1.2.0", - "js-string-escape": "^1.0.1", - "lodash": "^4.17.15", - "md5-hex": "^3.0.1", - "semver": "^7.3.2", - "well-known-symbols": "^2.0.0" - }, - "engines": { - "node": ">=10.18.0 <11 || >=12.14.0 <13 || >=14" - } - }, "node_modules/config-chain": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", @@ -10195,17 +10112,6 @@ "node": ">= 12" } }, - "node_modules/date-time": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", - "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", - "dependencies": { - "time-zone": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/dayjs": { "version": "1.11.13", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", @@ -12600,11 +12506,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "node_modules/fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==" - }, "node_modules/fast-equals": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-3.0.3.tgz", @@ -12824,59 +12725,6 @@ "node": "^12.20 || >= 14.13" } }, - "node_modules/fetch-node-website": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/fetch-node-website/-/fetch-node-website-7.3.0.tgz", - "integrity": "sha512-/wayUHbdVUWrD72aqRNNrr6+MHnCkumZgNugN0RfiWJpbNJUdAkMk4Z18MGayGZVVqYXR1RWrV+bIFEt5HuBZg==", - "dependencies": { - "cli-progress": "^3.11.2", - "colors-option": "^4.4.0", - "figures": "^5.0.0", - "got": "^12.3.1", - "is-plain-obj": "^4.1.0" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/fetch-node-website/node_modules/colors-option": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/colors-option/-/colors-option-4.5.0.tgz", - "integrity": "sha512-Soe5lerRg3erMRgYC0EC696/8dMCGpBzcQchFfi55Yrkja8F+P7cUt0LVTIg7u5ob5BexLZ/F1kO+ejmv+nq8w==", - "dependencies": { - "chalk": "^5.0.1", - "is-plain-obj": "^4.1.0" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/fetch-node-website/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/fetch-node-website/node_modules/figures": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", - "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", - "dependencies": { - "escape-string-regexp": "^5.0.0", - "is-unicode-supported": "^1.2.0" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -13545,26 +13393,6 @@ "node": ">= 6" } }, - "node_modules/global-cache-dir": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/global-cache-dir/-/global-cache-dir-4.4.0.tgz", - "integrity": "sha512-bk0gI6IbbphRjAaCJJn5H+T/CcEck5B3a5KBO2BXSDzjFSV+API17w8GA7YPJ6IXJiasW8M0VsEIig1PCHdfOQ==", - "dependencies": { - "cachedir": "^2.3.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/global-cache-dir/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, "node_modules/global-directory": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", @@ -15407,14 +15235,6 @@ "jiti": "bin/jiti.js" } }, - "node_modules/js-string-escape": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", - "integrity": "sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8=", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -16430,17 +16250,6 @@ "xtend": "~4.0.1" } }, - "node_modules/md5-hex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-3.0.1.tgz", - "integrity": "sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==", - "dependencies": { - "blueimp-md5": "^2.10.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/mdast-util-from-markdown": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz", @@ -17297,30 +17106,6 @@ "url": "https://github.com/sponsors/antelle" } }, - "node_modules/node-version-alias": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/node-version-alias/-/node-version-alias-3.4.1.tgz", - "integrity": "sha512-Kf3L9spAL6lEHMPyqpwHSTNG3LPkOXBfSUnBMG/YE2TdoC8Qoqf0+qg01nr6K9MFQEcXtWUyTQzLJByRixSBsA==", - "dependencies": { - "all-node-versions": "^11.3.0", - "filter-obj": "^5.1.0", - "is-plain-obj": "^4.1.0", - "normalize-node-version": "^12.4.0", - "path-exists": "^5.0.0", - "semver": "^7.3.8" - }, - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/node-version-alias/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, "node_modules/nopt": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", @@ -17335,19 +17120,6 @@ "node": ">=6" } }, - "node_modules/normalize-node-version": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/normalize-node-version/-/normalize-node-version-12.4.0.tgz", - "integrity": "sha512-0oLZN5xcyKVrSHMk8/9RuNblEe7HEsXAt5Te2xmMiZD9VX7bqWYe0HMyfqSYFD3xv0949lZuXaEwjTqle1uWWQ==", - "dependencies": { - "all-node-versions": "^11.3.0", - "filter-obj": "^5.1.0", - "semver": "^7.3.7" - }, - "engines": { - "node": ">=14.18.0" - } - }, "node_modules/normalize-package-data": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", @@ -21050,14 +20822,6 @@ "node": ">= 6" } }, - "node_modules/time-zone": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", - "integrity": "sha1-mcW/VZWJZq9tBtg73zgA3IL67F0=", - "engines": { - "node": ">=4" - } - }, "node_modules/tiny-glob": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", @@ -22912,14 +22676,6 @@ "node": ">= 8" } }, - "node_modules/well-known-symbols": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", - "integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==", - "engines": { - "node": ">=6" - } - }, "node_modules/whatwg-encoding": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", @@ -28441,37 +28197,6 @@ } } }, - "all-node-versions": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/all-node-versions/-/all-node-versions-11.3.0.tgz", - "integrity": "sha512-psMkc5s3qpr+QMfires9bC4azRYciPWql1wqZKMsYRh1731qefQDH2X4+O19xSBX6u0Ra/8Y5diG6y/fEmqKsw==", - "requires": { - "fetch-node-website": "^7.3.0", - "filter-obj": "^5.1.0", - "get-stream": "^6.0.0", - "global-cache-dir": "^4.3.1", - "is-plain-obj": "^4.1.0", - "path-exists": "^5.0.0", - "semver": "^7.3.7", - "write-file-atomic": "^4.0.1" - }, - "dependencies": { - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==" - }, - "write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", - "requires": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - } - } - } - }, "ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", @@ -28980,11 +28705,6 @@ "readable-stream": "^3.4.0" } }, - "blueimp-md5": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz", - "integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==" - }, "body-parser": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", @@ -29244,11 +28964,6 @@ "responselike": "^3.0.0" } }, - "cachedir": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz", - "integrity": "sha512-A+Fezp4zxnit6FanDmv9EqXNAi3vt9DWp51/71UEhXukb7QUuvtv9344h91dyAxuTLoSYJFU299qzR3tzwPAhw==" - }, "call-bind": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", @@ -29495,14 +29210,6 @@ "restore-cursor": "^2.0.0" } }, - "cli-progress": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz", - "integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==", - "requires": { - "string-width": "^4.2.3" - } - }, "cli-spinners": { "version": "2.9.2", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", @@ -29840,21 +29547,6 @@ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, - "concordance": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/concordance/-/concordance-5.0.4.tgz", - "integrity": "sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==", - "requires": { - "date-time": "^3.1.0", - "esutils": "^2.0.3", - "fast-diff": "^1.2.0", - "js-string-escape": "^1.0.1", - "lodash": "^4.17.15", - "md5-hex": "^3.0.1", - "semver": "^7.3.2", - "well-known-symbols": "^2.0.0" - } - }, "config-chain": { "version": "1.1.13", "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", @@ -30319,14 +30011,6 @@ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz", "integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==" }, - "date-time": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/date-time/-/date-time-3.1.0.tgz", - "integrity": "sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==", - "requires": { - "time-zone": "^1.0.0" - } - }, "dayjs": { "version": "1.11.13", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", @@ -32044,11 +31728,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==" - }, "fast-equals": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-3.0.3.tgz", @@ -32221,43 +31900,6 @@ "web-streams-polyfill": "^3.0.3" } }, - "fetch-node-website": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/fetch-node-website/-/fetch-node-website-7.3.0.tgz", - "integrity": "sha512-/wayUHbdVUWrD72aqRNNrr6+MHnCkumZgNugN0RfiWJpbNJUdAkMk4Z18MGayGZVVqYXR1RWrV+bIFEt5HuBZg==", - "requires": { - "cli-progress": "^3.11.2", - "colors-option": "^4.4.0", - "figures": "^5.0.0", - "got": "^12.3.1", - "is-plain-obj": "^4.1.0" - }, - "dependencies": { - "colors-option": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/colors-option/-/colors-option-4.5.0.tgz", - "integrity": "sha512-Soe5lerRg3erMRgYC0EC696/8dMCGpBzcQchFfi55Yrkja8F+P7cUt0LVTIg7u5ob5BexLZ/F1kO+ejmv+nq8w==", - "requires": { - "chalk": "^5.0.1", - "is-plain-obj": "^4.1.0" - } - }, - "escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==" - }, - "figures": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", - "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", - "requires": { - "escape-string-regexp": "^5.0.0", - "is-unicode-supported": "^1.2.0" - } - } - } - }, "figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -32750,22 +32392,6 @@ "is-glob": "^4.0.1" } }, - "global-cache-dir": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/global-cache-dir/-/global-cache-dir-4.4.0.tgz", - "integrity": "sha512-bk0gI6IbbphRjAaCJJn5H+T/CcEck5B3a5KBO2BXSDzjFSV+API17w8GA7YPJ6IXJiasW8M0VsEIig1PCHdfOQ==", - "requires": { - "cachedir": "^2.3.0", - "path-exists": "^5.0.0" - }, - "dependencies": { - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==" - } - } - }, "global-directory": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", @@ -34002,11 +33628,6 @@ "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==" }, - "js-string-escape": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", - "integrity": "sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8=" - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -34793,14 +34414,6 @@ } } }, - "md5-hex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/md5-hex/-/md5-hex-3.0.1.tgz", - "integrity": "sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==", - "requires": { - "blueimp-md5": "^2.10.0" - } - }, "mdast-util-from-markdown": { "version": "0.8.5", "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz", @@ -35414,26 +35027,6 @@ "resolved": "https://registry.npmjs.org/node-stream-zip/-/node-stream-zip-1.15.0.tgz", "integrity": "sha512-LN4fydt9TqhZhThkZIVQnF9cwjU3qmUH9h78Mx/K7d3VvfRqqwthLwJEUOEL0QPZ0XQmNN7be5Ggit5+4dq3Bw==" }, - "node-version-alias": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/node-version-alias/-/node-version-alias-3.4.1.tgz", - "integrity": "sha512-Kf3L9spAL6lEHMPyqpwHSTNG3LPkOXBfSUnBMG/YE2TdoC8Qoqf0+qg01nr6K9MFQEcXtWUyTQzLJByRixSBsA==", - "requires": { - "all-node-versions": "^11.3.0", - "filter-obj": "^5.1.0", - "is-plain-obj": "^4.1.0", - "normalize-node-version": "^12.4.0", - "path-exists": "^5.0.0", - "semver": "^7.3.8" - }, - "dependencies": { - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==" - } - } - }, "nopt": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", @@ -35442,16 +35035,6 @@ "abbrev": "1" } }, - "normalize-node-version": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/normalize-node-version/-/normalize-node-version-12.4.0.tgz", - "integrity": "sha512-0oLZN5xcyKVrSHMk8/9RuNblEe7HEsXAt5Te2xmMiZD9VX7bqWYe0HMyfqSYFD3xv0949lZuXaEwjTqle1uWWQ==", - "requires": { - "all-node-versions": "^11.3.0", - "filter-obj": "^5.1.0", - "semver": "^7.3.7" - } - }, "normalize-package-data": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", @@ -38163,11 +37746,6 @@ "through2": "^4.0.2" } }, - "time-zone": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/time-zone/-/time-zone-1.0.0.tgz", - "integrity": "sha1-mcW/VZWJZq9tBtg73zgA3IL67F0=" - }, "tiny-glob": { "version": "0.2.9", "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", @@ -39341,11 +38919,6 @@ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.0.tgz", "integrity": "sha512-EqPmREeOzttaLRm5HS7io98goBgZ7IVz79aDvqjD0kYXLtFZTc0T/U6wHTPKyIjb+MdN7DFIIX6hgdBEpWmfPA==" }, - "well-known-symbols": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/well-known-symbols/-/well-known-symbols-2.0.0.tgz", - "integrity": "sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==" - }, "whatwg-encoding": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", diff --git a/package.json b/package.json index 4fb3025bd31..7c68b999065 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,6 @@ "@octokit/rest": "20.1.1", "@opentelemetry/api": "1.8.0", "ansi-escapes": "7.0.0", - "ansi-styles": "6.2.1", "ansi-to-html": "0.7.2", "ascii-table": "0.0.9", "backoff": "2.5.0", @@ -98,7 +97,6 @@ "clean-deep": "3.4.0", "commander": "10.0.1", "comment-json": "4.2.5", - "concordance": "5.0.4", "configstore": "6.0.0", "content-type": "1.0.5", "cookie": "0.7.2", @@ -150,7 +148,6 @@ "netlify": "13.2.1", "netlify-redirector": "0.5.0", "node-fetch": "3.3.2", - "node-version-alias": "3.4.1", "ora": "8.1.1", "p-filter": "4.1.0", "p-map": "7.0.3", diff --git a/src/commands/blobs/index.ts b/src/commands/blobs/index.ts deleted file mode 100644 index 93ffb491ff9..00000000000 --- a/src/commands/blobs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { createBlobsCommand } from './blobs.js' diff --git a/src/utils/addons/compare.ts b/src/utils/addons/compare.ts deleted file mode 100644 index ad768c7ed9e..00000000000 --- a/src/utils/addons/compare.ts +++ /dev/null @@ -1,36 +0,0 @@ -import isEqual from 'lodash/isEqual.js' - -// @ts-expect-error TS(7006) FIXME: Parameter 'oldValues' implicitly has an 'any' type... Remove this comment to see the full error message -export default function compare(oldValues, newValues) { - const initialData = { - // default everything is equal - isEqual: true, - // Keys that are different - keys: [], - // Values of the keys that are different - diffs: {}, - } - - const oldKeys = Object.keys(oldValues) - const newKeys = Object.keys(newValues) - const set = new Set([...newKeys, ...oldKeys]) - - // @ts-expect-error TS(2769) FIXME: No overload matches this call. - return [...set].reduce((acc, current) => { - // if values not deep equal. There are changes - if (!isEqual(newValues[current], oldValues[current])) { - return { - isEqual: false, - keys: [...acc.keys, current], - diffs: { - ...acc.diffs, - [`${current}`]: { - newValue: newValues[current], - oldValue: oldValues[current], - }, - }, - } - } - return acc - }, initialData) -} diff --git a/src/utils/addons/diffs/index.ts b/src/utils/addons/diffs/index.ts deleted file mode 100644 index 4999fb85b17..00000000000 --- a/src/utils/addons/diffs/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -// @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'conc... Remove this comment to see the full error message -import concordance from 'concordance' - -import { concordanceDiffOptions, concordanceOptions } from './options.js' - -// @ts-expect-error TS(7006) FIXME: Parameter 'actualDescriptor' implicitly has an 'an... Remove this comment to see the full error message -const formatDescriptorDiff = function (actualDescriptor, expectedDescriptor, options) { - const diffOptions = { ...options, ...concordanceDiffOptions } - return concordance.diffDescriptors(actualDescriptor, expectedDescriptor, diffOptions) -} - -// @ts-expect-error TS(7006) FIXME: Parameter 'actual' implicitly has an 'any' type. -export default function diffValues(actual, expected) { - const result = concordance.compare(actual, expected, concordanceOptions) - if (result.pass) { - return null - } - const actualDescriptor = result.actual || concordance.describe(actual, concordanceOptions) - const expectedDescriptor = result.expected || concordance.describe(expected, concordanceOptions) - - // @ts-expect-error TS(2554) FIXME: Expected 3 arguments, but got 2. - return formatDescriptorDiff(actualDescriptor, expectedDescriptor) -} diff --git a/src/utils/addons/diffs/options.ts b/src/utils/addons/diffs/options.ts deleted file mode 100644 index f700aac7fbd..00000000000 --- a/src/utils/addons/diffs/options.ts +++ /dev/null @@ -1,109 +0,0 @@ -import ansiStyles from 'ansi-styles' -import { Chalk } from 'chalk' - -const forceColor = new Chalk({ level: 1 }) - -const colorTheme = { - boolean: ansiStyles.yellow, - circular: forceColor.grey('[Circular]'), - date: { - invalid: forceColor.red('invalid'), - value: ansiStyles.blue, - }, - diffGutters: { - actual: `${forceColor.red('-')} `, - expected: `${forceColor.green('+')} `, - padding: ' ', - }, - error: { - ctor: { - open: `${ansiStyles.grey.open}(`, - close: `)${ansiStyles.grey.close}`, - }, - name: ansiStyles.magenta, - }, - function: { - name: ansiStyles.blue, - stringTag: ansiStyles.magenta, - }, - global: ansiStyles.magenta, - item: { - after: forceColor.grey(','), - }, - list: { - openBracket: forceColor.grey('['), - closeBracket: forceColor.grey(']'), - }, - mapEntry: { - after: forceColor.grey(','), - }, - maxDepth: forceColor.grey('…'), - null: ansiStyles.yellow, - number: ansiStyles.yellow, - object: { - openBracket: forceColor.grey('{'), - closeBracket: forceColor.grey('}'), - ctor: ansiStyles.magenta, - stringTag: { - open: `${ansiStyles.magenta.open}@`, - close: ansiStyles.magenta.close, - }, - secondaryStringTag: { - open: `${ansiStyles.grey.open}@`, - close: ansiStyles.grey.close, - }, - }, - property: { - after: forceColor.grey(','), - keyBracket: { open: forceColor.grey('['), close: forceColor.grey(']') }, - valueFallback: forceColor.grey('…'), - }, - regexp: { - source: { - open: `${ansiStyles.blue.open}/`, - close: `/${ansiStyles.blue.close}`, - }, - flags: ansiStyles.yellow, - }, - stats: { separator: forceColor.grey('---') }, - string: { - open: ansiStyles.white.open, - close: ansiStyles.white.close, - line: { open: forceColor.white("'"), close: forceColor.white("'") }, - multiline: { start: forceColor.white('`'), end: forceColor.white('`') }, - controlPicture: ansiStyles.grey, - diff: { - insert: { - open: ansiStyles.bgGreen.open + ansiStyles.black.open, - close: ansiStyles.black.close + ansiStyles.bgGreen.close, - }, - delete: { - open: ansiStyles.bgRed.open + ansiStyles.black.open, - close: ansiStyles.black.close + ansiStyles.bgRed.close, - }, - equal: ansiStyles.white, - insertLine: { - open: ansiStyles.green.open, - close: ansiStyles.green.close, - }, - deleteLine: { - open: ansiStyles.red.open, - close: ansiStyles.red.close, - }, - }, - }, - symbol: ansiStyles.yellow, - typedArray: { - bytes: ansiStyles.yellow, - }, - undefined: ansiStyles.yellow, -} - -// @ts-expect-error TS(7034) FIXME: Variable 'plugins' implicitly has type 'any[]' in ... Remove this comment to see the full error message -const plugins = [] -const theme = colorTheme - -// @ts-expect-error TS(7005) FIXME: Variable 'plugins' implicitly has an 'any[]' type. -export const concordanceOptions = { maxDepth: 3, plugins, theme } -// @ts-expect-error TS(7005) FIXME: Variable 'plugins' implicitly has an 'any[]' type. -export const concordanceDiffOptions = { maxDepth: 1, plugins, theme } diff --git a/src/utils/addons/prepare.ts b/src/utils/addons/prepare.ts index 3f0dac99a8b..737f35be1ed 100644 --- a/src/utils/addons/prepare.ts +++ b/src/utils/addons/prepare.ts @@ -1,10 +1,5 @@ import { APIError, error } from '../command-helpers.js' -export const ADDON_VALIDATION = { - EXISTS: 'EXISTS', - NOT_EXISTS: 'NOT_EXISTS', -} - // @ts-expect-error TS(7031) FIXME: Binding element 'addonName' implicitly has an 'any... Remove this comment to see the full error message export const getCurrentAddon = ({ addonName, addons }) => addons.find((addon) => addon.service_slug === addonName) diff --git a/src/utils/addons/prompts.ts b/src/utils/addons/prompts.ts deleted file mode 100644 index 967aa2aff1e..00000000000 --- a/src/utils/addons/prompts.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { chalk } from '../command-helpers.js' - -/* programmatically generate CLI prompts */ -// @ts-expect-error TS(7006) FIXME: Parameter 'settings' implicitly has an 'any' type. -export default function generatePrompts(settings) { - const { config, configValues } = settings - const configItems = Object.keys(config) - - return configItems - .map((key, index) => { - const setting = config[key] - // const { type, displayName } = setting - let prompt - // Tell user to use types - if (!setting.type) { - console.log(`⚠️ ${chalk.yellowBright(`Warning: no \`type\` is set for config key: ${configItems[index]}`)}`) - console.log( - `It's highly recommended that you type your configuration values. It will help with automatic documentation, sharing of your services, and make your services configurable through a GUI`, - ) - console.log('') - } - - // Handle shorthand config. Probably will be removed. Severely limited + not great UX - if (typeof setting === 'string' || typeof setting === 'boolean') { - if (typeof setting === 'string') { - prompt = { - type: 'input', - name: key, - message: `Enter string value for '${key}':`, - } - // if current stage value set show as default - if (configValues[key]) { - // @ts-expect-error TS(2339) FIXME: Property 'default' does not exist on type '{ type:... Remove this comment to see the full error message - prompt.default = configValues[key] - } - } else if (typeof setting === 'boolean') { - prompt = { - type: 'confirm', - name: key, - message: `Do you want '${key}':`, - } - } - return prompt - } - - // For future use. Once UX is decided - // const defaultValidation = (setting.required) ? validateRequired : noValidate - const defaultValidation = noValidate - const validateFunction = setting.pattern ? validate(setting.pattern) : defaultValidation - const isRequiredText = setting.required ? ` (${chalk.yellow('required')})` : '' - if (setting.type === 'string' || /string/.test(setting.type)) { - prompt = { - type: 'input', - name: key, - message: `${chalk.white(key)}${isRequiredText} - ${setting.displayName}` || `Please enter value for ${key}`, - validate: validateFunction, - } - // if value previously set show it - if (configValues[key]) { - // @ts-expect-error TS(2339) FIXME: Property 'default' does not exist on type '{ type:... Remove this comment to see the full error message - prompt.default = configValues[key] - // else show default value if provided - } else if (setting.default) { - // @ts-expect-error TS(2339) FIXME: Property 'default' does not exist on type '{ type:... Remove this comment to see the full error message - prompt.default = setting.default - } - return prompt - } - - return false - }) - .filter(Boolean) -} - -const noValidate = function () { - return true -} - -// Will use this soon -// function validateRequired(value) { -// // eslint-disable-line -// if (value) { -// return true -// } -// return `Please enter a value this field is required` -// } - -// @ts-expect-error TS(7006) FIXME: Parameter 'pattern' implicitly has an 'any' type. -const validate = function (pattern) { - // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type. - return function validateValue(value) { - const regex = new RegExp(pattern) - if (regex.test(value)) { - return true - } - return `Please enter a value matching regex pattern: /${chalk.yellowBright(pattern)}/` - } -} diff --git a/src/utils/addons/validation.ts b/src/utils/addons/validation.ts deleted file mode 100644 index e023235fa30..00000000000 --- a/src/utils/addons/validation.ts +++ /dev/null @@ -1,24 +0,0 @@ -// @ts-expect-error TS(7006) FIXME: Parameter 'config' implicitly has an 'any' type. -export const requiredConfigValues = function (config) { - return Object.keys(config).filter((key) => config[key].required) -} - -// @ts-expect-error TS(7006) FIXME: Parameter 'requiredConfig' implicitly has an 'any'... Remove this comment to see the full error message -export const missingConfigValues = function (requiredConfig, providedConfig) { - // @ts-expect-error TS(7006) FIXME: Parameter 'key' implicitly has an 'any' type. - return requiredConfig.filter((key) => !providedConfig[key]) -} - -// @ts-expect-error TS(7006) FIXME: Parameter 'allowedConfig' implicitly has an 'any' ... Remove this comment to see the full error message -export const updateConfigValues = function (allowedConfig, currentConfig, newConfig) { - return Object.keys(allowedConfig).reduce((acc, key) => { - if (newConfig[key]) { - // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message - acc[key] = newConfig[key] - return acc - } - // @ts-expect-error TS(7053) FIXME: Element implicitly has an 'any' type because expre... Remove this comment to see the full error message - acc[key] = currentConfig[key] - return acc - }, {}) -} diff --git a/src/utils/init/node-version.ts b/src/utils/init/node-version.ts deleted file mode 100644 index d00a02c8eab..00000000000 --- a/src/utils/init/node-version.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { readFile } from 'fs/promises' - -import { locatePath } from 'locate-path' -import nodeVersionAlias from 'node-version-alias' - -import { warn } from '../command-helpers.js' - -const DEFAULT_NODE_VERSION = '12.18.0' -const NVM_FLAG_PREFIX = '--' - -// to support NODE_VERSION=--lts, etc. -// @ts-expect-error TS(7006) FIXME: Parameter 'version' implicitly has an 'any' type. -const normalizeConfiguredVersion = (version) => - version.startsWith(NVM_FLAG_PREFIX) ? version.slice(NVM_FLAG_PREFIX.length) : version - -// @ts-expect-error TS(7031) FIXME: Binding element 'baseDirectory' implicitly has an ... Remove this comment to see the full error message -export const detectNodeVersion = async ({ baseDirectory, env }) => { - try { - const nodeVersionFile = await locatePath(['.nvmrc', '.node-version'], { cwd: baseDirectory }) - const configuredVersion = - nodeVersionFile === undefined ? env.NODE_VERSION?.value : await readFile(nodeVersionFile, 'utf8') - - const version = - configuredVersion === undefined || configuredVersion === null - ? DEFAULT_NODE_VERSION - : await nodeVersionAlias(normalizeConfiguredVersion(configuredVersion)) - - return version - } catch (error) { - // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'. - warn(`Failed detecting Node.js version: ${error.message}`) - return DEFAULT_NODE_VERSION - } -} diff --git a/src/utils/shell.ts b/src/utils/shell.ts index fbaf2b0869e..2648cea8e93 100644 --- a/src/utils/shell.ts +++ b/src/utils/shell.ts @@ -15,14 +15,6 @@ const cleanupWork = [] let cleanupStarted = false -/** - * @param {() => Promise} job - */ -// @ts-expect-error TS(7006) FIXME: Parameter 'job' implicitly has an 'any' type. -export const addCleanupJob = (job) => { - cleanupWork.push(job) -} - /** * @param {object} input * @param {number=} input.exitCode The exit code to return when exiting the process after cleanup diff --git a/src/utils/telemetry/request.ts b/src/utils/telemetry/request.ts deleted file mode 100644 index f89d0967a65..00000000000 --- a/src/utils/telemetry/request.ts +++ /dev/null @@ -1,47 +0,0 @@ -// This file is being called by `src/utils/telemetry/telemetry.js` as a child process -// to run a s a detached process -import process from 'process' - -import fetch from 'node-fetch' - -import getPackageJson from '../get-package-json.js' - -const { name, version } = await getPackageJson() - -const options = JSON.parse(process.argv[2]) - -const CLIENT_ID = 'NETLIFY_CLI' -const TRACK_URL = process.env.NETLIFY_TEST_TRACK_URL || 'https://cli.netlify.com/telemetry/track' -const IDENTIFY_URL = process.env.NETLIFY_TEST_IDENTIFY_URL || 'https://cli.netlify.com/telemetry/identify' -const REPORT_ERROR_URL = process.env.NETLIFY_TEST_ERROR_REPORT_URL || 'https://cli.netlify.com/report-error' - -const getApiUrl = () => { - switch (options.type) { - case 'track': - return TRACK_URL - case 'error': - return REPORT_ERROR_URL - default: - return IDENTIFY_URL - } -} - -// Make telemetry call -const makeRequest = async function () { - try { - await fetch(getApiUrl(), { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'X-Netlify-Client': CLIENT_ID, - 'User-Agent': `${name}/${version}`, - }, - body: JSON.stringify(options.data), - }) - process.exit() - } catch { - process.exit(1) - } -} - -makeRequest()