diff --git a/.eslintrc.js b/.eslintrc.js index e560aa1d0..99189100f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,7 +18,7 @@ module.exports = { Promise: false, }, extends: ['plugin:@bitrise/config'], - plugins: ['jasmine', 'lodash'], + plugins: ['jasmine'], rules: { /** * Import related rules ** */ 'import/no-extraneous-dependencies': [ diff --git a/package-lock.json b/package-lock.json index 71c7cefaf..cb5cb6fb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,13 +37,13 @@ "angular-route": "^1.8.3", "angular-sanitize": "^1.8.3", "classnames": "^2.5.1", + "es-toolkit": "^1.27.0", "esprima": "^4.0.1", "fuse.js": "^7.0.0", "http-method-enum": "^1.0.0", "jquery": "^3.7.1", "json-schema-to-ts": "^3.1.1", "launchdarkly-js-client-sdk": "^3.5.0", - "lodash": "^4.17.21", "monaco-editor": "^0.52.0", "monaco-yaml": "^5.2.3", "ng-showdown": "^1.1.0", @@ -107,7 +107,6 @@ "eslint": "^8.57.1", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-jasmine": "^4.2.2", - "eslint-plugin-lodash": "^7.4.0", "file-loader": "^6.2.0", "glob": "^11.0.0", "husky": "^9.1.6", @@ -7101,16 +7100,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.12.2.tgz", - "integrity": "sha512-UTTuDIX3fkfAz6iSVa5rTuSfWIYZ6ATtEocQ/umkRSyC9O919lbZ8dcH7mysshrCdrAM03skJOEYaBugxN+M6A==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.14.0.tgz", + "integrity": "sha512-OGqj6uB8THhrHj0Fk27DcHPojW7zKwKkPmHXHvQ58pLYp4hy8CSUdTKykKeh+5vFqTTVmjz0zCOOPKRovdsgHA==", "dev": true, - "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.12.2", - "@typescript-eslint/types": "8.12.2", - "@typescript-eslint/typescript-estree": "8.12.2" + "@typescript-eslint/scope-manager": "8.14.0", + "@typescript-eslint/types": "8.14.0", + "@typescript-eslint/typescript-estree": "8.14.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -7124,14 +7122,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.12.2.tgz", - "integrity": "sha512-gPLpLtrj9aMHOvxJkSbDBmbRuYdtiEbnvO25bCMza3DhMjTQw0u7Y1M+YR5JPbMsXXnSPuCf5hfq0nEkQDL/JQ==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.14.0.tgz", + "integrity": "sha512-aBbBrnW9ARIDn92Zbo7rguLnqQ/pOrUguVpbUwzOhkFg2npFDwTgPGqFqE0H5feXcOoJOfX3SxlJaKEVtq54dw==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.12.2", - "@typescript-eslint/visitor-keys": "8.12.2" + "@typescript-eslint/types": "8.14.0", + "@typescript-eslint/visitor-keys": "8.14.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -7142,11 +7139,10 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.12.2.tgz", - "integrity": "sha512-VwDwMF1SZ7wPBUZwmMdnDJ6sIFk4K4s+ALKLP6aIQsISkPv8jhiw65sAK6SuWODN/ix+m+HgbYDkH+zLjrzvOA==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.14.0.tgz", + "integrity": "sha512-yjeB9fnO/opvLJFAsPNYlKPnEM8+z4og09Pk504dkqonT02AyL5Z9SSqlE0XqezS93v6CXn49VHvB2G7XSsl0g==", "dev": true, - "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -7156,14 +7152,13 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.12.2.tgz", - "integrity": "sha512-mME5MDwGe30Pq9zKPvyduyU86PH7aixwqYR2grTglAdB+AN8xXQ1vFGpYaUSJ5o5P/5znsSBeNcs5g5/2aQwow==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.14.0.tgz", + "integrity": "sha512-OPXPLYKGZi9XS/49rdaCbR5j/S14HazviBlUQFvSKz3npr3NikF+mrgK7CFVur6XEt95DZp/cmke9d5i3vtVnQ==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "8.12.2", - "@typescript-eslint/visitor-keys": "8.12.2", + "@typescript-eslint/types": "8.14.0", + "@typescript-eslint/visitor-keys": "8.14.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -7185,13 +7180,12 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.12.2.tgz", - "integrity": "sha512-PChz8UaKQAVNHghsHcPyx1OMHoFRUEA7rJSK/mDhdq85bk+PLsUHUBqTQTFt18VJZbmxBovM65fezlheQRsSDA==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.14.0.tgz", + "integrity": "sha512-vG0XZo8AdTH9OE6VFRwAZldNc7qtJ/6NLGWak+BtENuEUXGZgFpihILPiBvKXvJ2nFu27XNGC6rKiwuaoMbYzQ==", "dev": true, - "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.12.2", + "@typescript-eslint/types": "8.14.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -8292,11 +8286,10 @@ } }, "node_modules/asn1.js/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "license": "MIT" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", + "dev": true }, "node_modules/assert": { "version": "1.5.1", @@ -10959,11 +10952,10 @@ } }, "node_modules/create-ecdh/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "license": "MIT" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", + "dev": true }, "node_modules/create-hash": { "version": "1.2.0", @@ -12405,11 +12397,10 @@ } }, "node_modules/diffie-hellman/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "license": "MIT" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", + "dev": true }, "node_modules/dir-glob": { "version": "3.0.1", @@ -12727,11 +12718,10 @@ } }, "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "license": "MIT" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", + "dev": true }, "node_modules/emittery": { "version": "0.13.1", @@ -13167,6 +13157,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-toolkit": { + "version": "1.27.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.27.0.tgz", + "integrity": "sha512-ETSFA+ZJArcuSCpzD2TjAy6UHpx4E4uqFsoDg9F/nTLogrLmVVZQ+zNxco5h7cWnA1nNak07IXsLcaSMih+ZPQ==", + "workspaces": [ + "docs", + "benchmarks" + ] + }, "node_modules/es5-ext": { "version": "0.10.64", "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.64.tgz", @@ -13860,22 +13859,6 @@ "node": "*" } }, - "node_modules/eslint-plugin-lodash": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-lodash/-/eslint-plugin-lodash-7.4.0.tgz", - "integrity": "sha512-Tl83UwVXqe1OVeBRKUeWcfg6/pCW1GTRObbdnbEJgYwjxp5Q92MEWQaH9+dmzbRt6kvYU1Mp893E79nJiCSM8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "eslint": ">=2" - } - }, "node_modules/eslint-plugin-prettier": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", @@ -15579,12 +15562,11 @@ "license": "ISC" }, "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, "hasInstallScript": true, - "license": "MIT", "optional": true, "os": [ "darwin" @@ -21860,11 +21842,10 @@ } }, "node_modules/miller-rabin/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "license": "MIT" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", + "dev": true }, "node_modules/mime": { "version": "3.0.0", @@ -24627,20 +24608,6 @@ "node": ">=18" } }, - "node_modules/playwright/node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/polished": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/polished/-/polished-4.3.1.tgz", @@ -25044,11 +25011,10 @@ } }, "node_modules/public-encrypt/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true, - "license": "MIT" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", + "dev": true }, "node_modules/pump": { "version": "3.0.2", @@ -29134,10 +29100,9 @@ } }, "node_modules/type-fest": { - "version": "4.26.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.26.1.tgz", - "integrity": "sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==", - "license": "(MIT OR CC0-1.0)", + "version": "4.27.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.27.0.tgz", + "integrity": "sha512-3IMSWgP7C5KSQqmo1wjhKrwsvXAtF33jO3QY+Uy++ia7hqvgSK6iXbbg5PbDBc1P2ZbNEDgejOrN4YooXvhwCw==", "engines": { "node": ">=16" }, diff --git a/package.json b/package.json index 23732f385..31ad5e7b0 100644 --- a/package.json +++ b/package.json @@ -82,13 +82,13 @@ "angular-route": "^1.8.3", "angular-sanitize": "^1.8.3", "classnames": "^2.5.1", + "es-toolkit": "^1.27.0", "esprima": "^4.0.1", "fuse.js": "^7.0.0", "http-method-enum": "^1.0.0", "jquery": "^3.7.1", "json-schema-to-ts": "^3.1.1", "launchdarkly-js-client-sdk": "^3.5.0", - "lodash": "^4.17.21", "monaco-editor": "^0.52.0", "monaco-yaml": "^5.2.3", "ng-showdown": "^1.1.0", @@ -152,7 +152,6 @@ "eslint": "^8.57.1", "eslint-import-resolver-alias": "^1.1.2", "eslint-plugin-jasmine": "^4.2.2", - "eslint-plugin-lodash": "^7.4.0", "file-loader": "^6.2.0", "glob": "^11.0.0", "husky": "^9.1.6", diff --git a/source/javascripts/components/unified-editor/StepConfigDrawer/components/FilterInput/FilterInput.tsx b/source/javascripts/components/unified-editor/StepConfigDrawer/components/FilterInput/FilterInput.tsx index c61b13707..1943ee3e0 100644 --- a/source/javascripts/components/unified-editor/StepConfigDrawer/components/FilterInput/FilterInput.tsx +++ b/source/javascripts/components/unified-editor/StepConfigDrawer/components/FilterInput/FilterInput.tsx @@ -1,5 +1,5 @@ import { forwardRef, useCallback, useState } from 'react'; -import debounce from 'lodash/debounce'; +import { debounce } from 'es-toolkit'; import { SearchInput, SearchInputProps } from '@bitrise/bitkit'; const DEBOUNCE_TIME = 300; diff --git a/source/javascripts/components/unified-editor/StepSelectorDrawer/StepSelectorDrawer.utils.ts b/source/javascripts/components/unified-editor/StepSelectorDrawer/StepSelectorDrawer.utils.ts index 9053b2a9a..f63a04baf 100644 --- a/source/javascripts/components/unified-editor/StepSelectorDrawer/StepSelectorDrawer.utils.ts +++ b/source/javascripts/components/unified-editor/StepSelectorDrawer/StepSelectorDrawer.utils.ts @@ -1,4 +1,4 @@ -import capitalize from 'lodash/capitalize'; +import { capitalize } from 'es-toolkit'; import { Step } from '@/core/models/Step'; import { StepApiResult } from '@/core/api/StepApi'; import { CategoryRowItem, StepsRowItem, VirtualizedListItem } from './StepSelectorDrawer.types'; diff --git a/source/javascripts/components/unified-editor/WorkflowConfig/components/EnvVarsCard.tsx b/source/javascripts/components/unified-editor/WorkflowConfig/components/EnvVarsCard.tsx index 8c5b60209..2674e6af7 100644 --- a/source/javascripts/components/unified-editor/WorkflowConfig/components/EnvVarsCard.tsx +++ b/source/javascripts/components/unified-editor/WorkflowConfig/components/EnvVarsCard.tsx @@ -4,7 +4,7 @@ import { DndContext, DragEndEvent, DragOverlay, DragStartEvent } from '@dnd-kit/ import { arrayMove, SortableContext, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable'; import { restrictToParentElement, restrictToVerticalAxis } from '@dnd-kit/modifiers'; import { CSS } from '@dnd-kit/utilities'; -import omit from 'lodash/omit'; +import { omit } from 'es-toolkit'; import { useDebounceCallback } from 'usehooks-ts'; import AutoGrowableInput from '@/components/AutoGrowableInput'; import DragHandle from '@/components/DragHandle/DragHandle'; @@ -146,7 +146,7 @@ const EnvVarCard = ({ env, isDragging, onRemove, onChange }: EnvVarCardProps) => isChecked={env.isExpand !== false} onChange={(e) => { if (e.target.checked) { - onChange?.(omit(env, 'isExpand')); + onChange?.(omit(env, ['isExpand'])); } else { onChange?.({ ...env, isExpand: false }); } diff --git a/source/javascripts/components/unified-editor/WorkflowConfig/hooks/useRenameWorkflow.ts b/source/javascripts/components/unified-editor/WorkflowConfig/hooks/useRenameWorkflow.ts index a6be05b95..58f4d4a84 100644 --- a/source/javascripts/components/unified-editor/WorkflowConfig/hooks/useRenameWorkflow.ts +++ b/source/javascripts/components/unified-editor/WorkflowConfig/hooks/useRenameWorkflow.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef } from 'react'; -import uniq from 'lodash/uniq'; +import { uniq } from 'es-toolkit'; import { useDebounceCallback } from 'usehooks-ts'; import useBitriseYmlStore from '@/hooks/useBitriseYmlStore'; import { useWorkflowConfigContext } from '../WorkflowConfig.context'; diff --git a/source/javascripts/controllers/_MainController.js.erb b/source/javascripts/controllers/_MainController.js.erb index b75875a94..8e2e1282e 100644 --- a/source/javascripts/controllers/_MainController.js.erb +++ b/source/javascripts/controllers/_MainController.js.erb @@ -1,5 +1,5 @@ import _ from "underscore"; -import isEqual from "lodash/isEqual"; +import {isEqual} from "es-toolkit"; import datadogRumCustomTiming from "../utils/datadogCustomRumTiming.ts"; import {getSearchParamsFromLocationHash} from "@/hooks/useSearchParams"; import {safeDigest} from "@/services/react-compat"; @@ -573,76 +573,73 @@ import {segmentTrack} from "@/utils/segmentTracking"; }); } - var promise = $q - .all([ - $q(function (resolve, reject) { - switch (viewModel.currentMenu.id) { - case "workflows": - case "pipelines": - case "env-vars": - case "triggers": - case "licenses": - viewModel.dataToSave = appService.appConfig; - return appService - .saveAppConfig(viewModel.deferredUserSavedYmlToRepository, viewModel.currentMenu.id) - .then(function () { - return requestService.isWebsiteMode() && appService.pipelineConfig.usesRepositoryYml - ? reloadAppConfig() - : $q.when(); - }) - .then(resolve, reject); - case "secrets": - resolve(); - break; - case "stack": - viewModel.dataToSave = appService.appConfig; - var machineTypeUpdated = appService.defaultMachineTypeHasUnsavedChanges(); - - return appService - .saveStackAndDockerImage(viewModel.deferredUserSavedYmlToRepository, viewModel.currentMenu.id) - .then(function () { - - return requestService.isWebsiteMode() && appService.pipelineConfig.usesRepositoryYml - ? reloadStack() - : $q.when(); - }) - .then(resolve, reject); - case "yml": - viewModel.appConfigYML = appService.appConfigYML; - return appService - .saveAppConfigYML(viewModel.deferredUserSavedYmlToRepository) - .then(function () { - return requestService.isWebsiteMode() && appService.pipelineConfig.usesRepositoryYml - ? reloadAppConfigYML() - : $q.when(); - }) - .then(resolve, reject); - } - }), - $timeout(function () { - }, dateService.defaultSaveDelayDurationInMilliseconds) - ]) - .then( - function () { - viewModel.saveProgress.reset(); - $rootScope.$emit("MainController::savedFinishedWithSuccess"); - updateLastWorkflowMetadata(); - }, - function (error) { - viewModel.saveProgress.reset(); - $rootScope.$emit("MainController::savedFinishedWithError"); - segmentTrack('Workflow Editor Invalid Yml Popup Shown', { - tab_name: viewModel.currentMenu.id, - source: 'save' - }); - Popup.showErrorPopup("<%= data[:strings][:main][:load_progress][:save_error] %>", error.message); + var promise = $q.all([ + $q(function (resolve, reject) { + switch (viewModel.currentMenu.id) { + case "workflows": + case "pipelines": + case "env-vars": + case "triggers": + case "licenses": + viewModel.dataToSave = appService.appConfig; + return appService + .saveAppConfig(viewModel.deferredUserSavedYmlToRepository, viewModel.currentMenu.id) + .then(function () { + return requestService.isWebsiteMode() && appService.pipelineConfig.usesRepositoryYml + ? reloadAppConfig() + : $q.when(); + }) + .then(resolve, reject); + case "secrets": + resolve(); + break; + case "stack": + viewModel.dataToSave = appService.appConfig; + var machineTypeUpdated = appService.defaultMachineTypeHasUnsavedChanges(); + + return appService + .saveStackAndDockerImage(viewModel.deferredUserSavedYmlToRepository, viewModel.currentMenu.id) + .then(function () { + + return requestService.isWebsiteMode() && appService.pipelineConfig.usesRepositoryYml + ? reloadStack() + : $q.when(); + }) + .then(resolve, reject); + case "yml": + viewModel.appConfigYML = appService.appConfigYML; + return appService + .saveAppConfigYML(viewModel.deferredUserSavedYmlToRepository) + .then(function () { + return requestService.isWebsiteMode() && appService.pipelineConfig.usesRepositoryYml + ? reloadAppConfigYML() + : $q.when(); + }) + .then(resolve, reject); + } + }), + $timeout(function () { + }, dateService.defaultSaveDelayDurationInMilliseconds) + ]).then( + function () { + viewModel.saveProgress.reset(); + $rootScope.$emit("MainController::savedFinishedWithSuccess"); + updateLastWorkflowMetadata(); + }, + function (error) { + viewModel.saveProgress.reset(); + $rootScope.$emit("MainController::savedFinishedWithError"); + segmentTrack('Workflow Editor Invalid Yml Popup Shown', { + tab_name: viewModel.currentMenu.id, + source: 'save' + }); + Popup.showErrorPopup("<%= data[:strings][:main][:load_progress][:save_error] %>", error.message); - if (shouldReturnPromise) { - return $q.reject(error); - } + if (shouldReturnPromise) { + return $q.reject(error); } - ) - ; + } + ); if (shouldReturnPromise) { return promise; diff --git a/source/javascripts/core/api/StacksAndMachinesApi.ts b/source/javascripts/core/api/StacksAndMachinesApi.ts index 576a04422..4bc30666d 100644 --- a/source/javascripts/core/api/StacksAndMachinesApi.ts +++ b/source/javascripts/core/api/StacksAndMachinesApi.ts @@ -1,4 +1,4 @@ -import mapValues from 'lodash/mapValues'; +import { mapValues } from 'es-toolkit'; import { Stack } from '../models/Stack'; import { MachineType } from '../models/MachineType'; import Client from './client'; @@ -48,7 +48,7 @@ async function getStacksAndMachines({ appSlug, signal }: { appSlug: string; sign mapValues(response.available_stacks, ({ title, available_machines = [] }, id) => { availableStacks.push({ - id, + id: String(id), name: title, machineTypes: available_machines, }); @@ -59,7 +59,7 @@ async function getStacksAndMachines({ appSlug, signal }: { appSlug: string; sign mapValues(machine_types, (machine, id) => { availableMachineTypes.push({ - id, + id: String(id), name: machine.name, creditCost: machine.credit_per_min, specs: { diff --git a/source/javascripts/core/api/StepApi.ts b/source/javascripts/core/api/StepApi.ts index 5ac571d05..7e302b5a0 100644 --- a/source/javascripts/core/api/StepApi.ts +++ b/source/javascripts/core/api/StepApi.ts @@ -1,6 +1,5 @@ import algoliasearch from 'algoliasearch'; -import uniqBy from 'lodash/uniqBy'; -import sortBy from 'lodash/sortBy'; +import { sortBy, uniqBy } from 'es-toolkit'; import { parse } from 'yaml'; import { BITRISE_STEP_LIBRARY_SSH_URL, @@ -141,7 +140,7 @@ async function getAlgoliaSteps(defaultStepLibrary: string): Promise results.push(...objects), filters: 'is_latest:true AND is_deprecated:false', }); - return uniqBy(results, 'id') + return uniqBy(results, (r) => r.id) .map((step) => toStep(step.cvs, defaultStepLibrary, step)) .filter(Boolean) as StepApiResult[]; } @@ -303,7 +302,9 @@ async function getAlgoliaStepInputsByCvs(cvs: string): Promise r.order]) + .map(toStepVariable) + .filter(Boolean) as StepInputVariable[]; } export { AlgoliaStepResponse, AlgoliaStepInputResponse, StepInfo, StepApiResult }; diff --git a/source/javascripts/core/api/client.ts b/source/javascripts/core/api/client.ts index 0896a12c8..8621e53ca 100644 --- a/source/javascripts/core/api/client.ts +++ b/source/javascripts/core/api/client.ts @@ -1,4 +1,4 @@ -import merge from 'lodash/merge'; +import { toMerged } from 'es-toolkit'; import getCookie from '@/utils/cookies'; const DEFAULT_TIMEOUT = 60_000; @@ -21,12 +21,10 @@ class NetworkError extends Error { } async function client(url: string, options?: ClientOpts) { - const headers = merge( - {}, - DEFAULT_HEADERS, - options?.headers, - !options?.excludeCSRF && { 'X-CSRF-TOKEN': getCookie('CSRF-TOKEN') }, - ); + const headers = toMerged(DEFAULT_HEADERS, { + ...options?.headers, + ...(options?.excludeCSRF ? {} : { 'X-CSRF-TOKEN': getCookie('CSRF-TOKEN') }), + }); const controller = new AbortController(); const timeoutId = setTimeout(() => controller.abort('TimeoutError'), options?.timeout ?? DEFAULT_TIMEOUT); diff --git a/source/javascripts/core/models/BitriseYmlService.ts b/source/javascripts/core/models/BitriseYmlService.ts index 3996b90a6..3ce3ee0da 100644 --- a/source/javascripts/core/models/BitriseYmlService.ts +++ b/source/javascripts/core/models/BitriseYmlService.ts @@ -1,12 +1,5 @@ -import omit from 'lodash/omit'; -import omitBy from 'lodash/omitBy'; -import isNull from 'lodash/isNull'; -import mapKeys from 'lodash/mapKeys'; -import isEmpty from 'lodash/isEmpty'; -import isEqual from 'lodash/isEqual'; -import isNumber from 'lodash/isNumber'; -import isBoolean from 'lodash/isBoolean'; -import mapValues from 'lodash/mapValues'; +import { isBoolean, isEqual, isNull, mapKeys, mapValues, omit, omitBy } from 'es-toolkit'; +import { isEmpty, isNumber } from 'es-toolkit/compat'; import deepCloneSimpleObject from '@/utils/deepCloneSimpleObject'; import StepService from '@/core/models/StepService'; import { TargetBasedTriggers } from '@/pages/TriggersPage/components/TriggersPage/TriggersPage.utils'; @@ -99,12 +92,9 @@ function changeStepVersion(workflowId: string, stepIndex: number, version: strin return copy; } - copy.workflows[workflowId].steps[stepIndex] = mapKeys( - copy.workflows[workflowId].steps[stepIndex], - (_, cvs: string) => { - return StepService.updateVersion(cvs, defaultStepLibrary, version); - }, - ); + copy.workflows[workflowId].steps[stepIndex] = mapKeys(copy.workflows[workflowId].steps[stepIndex], (_, cvs) => { + return StepService.updateVersion(String(cvs), defaultStepLibrary, version); + }); return copy; } @@ -133,7 +123,7 @@ function updateStepInputs( stepYmlObject.inputs = []; } - const [key, defaultValue] = Object.entries(omit(input, 'opts'))[0]; + const [key, defaultValue] = Object.entries(omit(input, ['opts']))[0]; const newValue = newInputs.find((i) => Object.keys(i).includes(key))?.[key]; const inputIndexInYml = stepYmlObject.inputs.findIndex((i) => Object.keys(i).includes(key)); const isInputExistsInTheYml = inputIndexInYml > -1; @@ -736,21 +726,21 @@ function getUniqueStepIds(yml: BitriseYml) { const ids = new Set(); const defaultStepLibrary = yml.default_step_lib_source || BITRISE_STEP_LIBRARY_URL; - mapValues(yml.workflows, (workflow) => { + mapValues(yml.workflows || {}, (workflow) => { workflow.steps?.forEach((stepLikeObject) => { mapValues(stepLikeObject, (stepLike, cvsLike) => { - if (StepService.isStep(cvsLike, defaultStepLibrary, stepLike)) { - const { id } = StepService.parseStepCVS(cvsLike, defaultStepLibrary); + if (StepService.isStep(String(cvsLike), defaultStepLibrary, stepLike)) { + const { id } = StepService.parseStepCVS(String(cvsLike), defaultStepLibrary); ids.add(id); } if ( - StepService.isStepBundle(cvsLike, defaultStepLibrary, stepLike) || - StepService.isWithGroup(cvsLike, defaultStepLibrary, stepLike) + StepService.isStepBundle(String(cvsLike), defaultStepLibrary, stepLike) || + StepService.isWithGroup(String(cvsLike), defaultStepLibrary, stepLike) ) { stepLike.steps?.forEach((stepObj) => { mapValues(stepObj, (_, cvs) => { - const { id } = StepService.parseStepCVS(cvs, defaultStepLibrary); + const { id } = StepService.parseStepCVS(String(cvs), defaultStepLibrary); ids.add(id); }); }); @@ -806,11 +796,11 @@ function isNotEmpty(v: T) { } function omitEmpty(o: Record) { - return omitBy(o, isEmpty); + return omitBy(o, isEmpty) as Record; } function omitEmptyIfKeyNotExistsIn(o: Record, keys: string[]) { - return omitBy(o, (v, k) => isEmpty(v) && !keys.includes(k)); + return omitBy(o, (v, k) => isEmpty(v) && !keys.includes(k)) as Record; } function shouldRemoveField(modified: T, original: T) { @@ -916,7 +906,7 @@ function deleteWorkflowFromStages(workflowId: string, stages: StagesYml = {}): S return mapValues(stages, (stage) => { const stageCopy = deepCloneSimpleObject(stage); - stageCopy.workflows = stageCopy.workflows?.map((workflowsObj) => omit(workflowsObj, workflowId)); + stageCopy.workflows = stageCopy.workflows?.map((workflowsObj) => omit(workflowsObj, [workflowId])); stageCopy.workflows = stageCopy.workflows?.filter(isNotEmpty); if (shouldRemoveField(stageCopy.workflows, stage.workflows)) { diff --git a/source/javascripts/core/models/StackAndMachineService.ts b/source/javascripts/core/models/StackAndMachineService.ts index e5edd9146..ce3373ac3 100644 --- a/source/javascripts/core/models/StackAndMachineService.ts +++ b/source/javascripts/core/models/StackAndMachineService.ts @@ -1,5 +1,5 @@ import { PartialDeep } from 'type-fest'; -import merge from 'lodash/merge'; +import { toMerged } from 'es-toolkit'; import StacksAndMachinesApi from '../api/StacksAndMachinesApi'; import { MachineType, MachineTypeOption } from './MachineType'; import { Stack, StackOption } from './Stack'; @@ -30,7 +30,7 @@ function createStack(override?: PartialDeep): Stack { machineTypes: [], }; - return merge({}, base, override); + return toMerged(base, override || {}); } function createMachineType(override?: PartialDeep): MachineType { @@ -41,7 +41,7 @@ function createMachineType(override?: PartialDeep): MachineType { specs: { cpu: { chip: '', cpuCount: '', cpuDescription: '' }, ram: '' }, }; - return merge({}, base, override); + return toMerged(base, override || {}) as MachineType; } function selectStackAndMachine(props: SelectStackAndMachineProps): SelectStackAndMachineResult { @@ -76,9 +76,15 @@ function selectStackAndMachine(props: SelectStackAndMachineProps): SelectStackAn const isInvalidInitialStack = !!initialStackId && !initialStack && !isAnotherStackSelected; if (isInvalidInitialStack) { - result.selectedStack = createStack({ id: initialStackId, name: initialStackId }); + result.selectedStack = createStack({ + id: initialStackId, + name: initialStackId, + }); result.isInvalidInitialStack = isInvalidInitialStack; - result.availableStackOptions.push({ label: initialStackId, value: initialStackId }); + result.availableStackOptions.push({ + label: initialStackId, + value: initialStackId, + }); } else if (selectedStack) { result.selectedStack = selectedStack; } else if (defaultStack) { @@ -86,7 +92,10 @@ function selectStackAndMachine(props: SelectStackAndMachineProps): SelectStackAn } if (defaultStack) { - const defaultStackOption = { label: `Default (${defaultStack.name})`, value: '' }; + const defaultStackOption = { + label: `Default (${defaultStack.name})`, + value: '', + }; result.availableStackOptions = [defaultStackOption, ...result.availableStackOptions]; } @@ -116,9 +125,15 @@ function selectStackAndMachine(props: SelectStackAndMachineProps): SelectStackAn : selectableMachines.map(MachineTypeService.toMachineOption); if (isInvalidInitialMachineType) { - result.selectedMachineType = createMachineType({ id: initialMachineTypeId, name: initialMachineTypeId }); + result.selectedMachineType = createMachineType({ + id: initialMachineTypeId, + name: initialMachineTypeId, + }); result.isInvalidInitialMachineType = isInvalidInitialMachineType; - result.availableMachineTypeOptions.push({ label: initialMachineTypeId, value: initialMachineTypeId }); + result.availableMachineTypeOptions.push({ + label: initialMachineTypeId, + value: initialMachineTypeId, + }); } else if (selectedMachineType) { result.selectedMachineType = selectedMachineType; } else if (defaultMachineType) { @@ -128,10 +143,16 @@ function selectStackAndMachine(props: SelectStackAndMachineProps): SelectStackAn } if (defaultMachineType) { - const defaultMachineTypeOption = { label: `Default (${defaultMachineType.name})`, value: '' }; + const defaultMachineTypeOption = { + label: `Default (${defaultMachineType.name})`, + value: '', + }; result.availableMachineTypeOptions = [defaultMachineTypeOption, ...result.availableMachineTypeOptions]; } else if (defaultMachineTypeOfOS) { - const defaultMachineTypeOption = { label: `Default (${defaultMachineTypeOfOS.name})`, value: '' }; + const defaultMachineTypeOption = { + label: `Default (${defaultMachineTypeOfOS.name})`, + value: '', + }; result.availableMachineTypeOptions = [defaultMachineTypeOption, ...result.availableMachineTypeOptions]; } } diff --git a/source/javascripts/core/models/StepService.ts b/source/javascripts/core/models/StepService.ts index b1e3f93a7..78fe32c26 100644 --- a/source/javascripts/core/models/StepService.ts +++ b/source/javascripts/core/models/StepService.ts @@ -1,8 +1,5 @@ -import uniq from 'lodash/uniq'; -import isEmpty from 'lodash/isEmpty'; -import find from 'lodash/find'; -import keys from 'lodash/keys'; -import compact from 'lodash/compact'; +import { compact, uniq } from 'es-toolkit'; +import { isEmpty } from 'es-toolkit/compat'; import semver from 'semver'; import { BITRISE_STEP_LIBRARY_SSH_URL, @@ -308,7 +305,7 @@ function getInputNames(step?: StepApiResult): string[] { return []; } - return compact(step.defaultValues.inputs.map((inputObj) => find(keys(inputObj), (k) => k !== 'opts'))); + return compact(step.defaultValues.inputs.map((inputObj) => Object.keys(inputObj).find((k) => k !== 'opts'))); } function calculateChange( diff --git a/source/javascripts/hooks/useSelectedWorkflow.ts b/source/javascripts/hooks/useSelectedWorkflow.ts index 308888f41..2f0b87bff 100644 --- a/source/javascripts/hooks/useSelectedWorkflow.ts +++ b/source/javascripts/hooks/useSelectedWorkflow.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useMemo } from 'react'; -import omit from 'lodash/omit'; +import { omit } from 'es-toolkit'; import { Workflow } from '@/core/models/Workflow'; import { useWorkflows } from '@/hooks/useWorkflows'; import useSearchParams from './useSearchParams'; @@ -34,7 +34,7 @@ const useSelectedWorkflow = (): UseSelectedWorkflowResult => { (workflowId?: string | null) => { setSearchParams((oldSearchParams) => { if (!workflowId) { - return omit(oldSearchParams, 'workflow_id'); + return omit(oldSearchParams, ['workflow_id']); } return { ...oldSearchParams, workflow_id: workflowId }; diff --git a/source/javascripts/hooks/useStep.ts b/source/javascripts/hooks/useStep.ts index 4c849e93a..e6d82bb32 100644 --- a/source/javascripts/hooks/useStep.ts +++ b/source/javascripts/hooks/useStep.ts @@ -1,6 +1,6 @@ import { useMemo } from 'react'; import { useQuery } from '@tanstack/react-query'; -import merge from 'lodash/merge'; +import { toMerged } from 'es-toolkit'; import useBitriseYmlStore from '@/hooks/useBitriseYmlStore'; import { Step, StepBundle, StepLike, WithGroup } from '@/core/models/Step'; import StepService from '@/core/models/StepService'; @@ -153,7 +153,7 @@ const useStep = (workflowId: string, stepIndex: number): UseStepResult => { icon: icon || defaultIcon || '', defaultValues, userValues, - mergedValues: merge({}, defaultValues, userValues, { inputs }), + mergedValues: toMerged(defaultValues || {}, toMerged(userValues || {}, { inputs })), resolvedInfo, } as Step, error, diff --git a/source/javascripts/hooks/useWorkflow.ts b/source/javascripts/hooks/useWorkflow.ts index 1eabe1478..adba1f6bc 100644 --- a/source/javascripts/hooks/useWorkflow.ts +++ b/source/javascripts/hooks/useWorkflow.ts @@ -1,4 +1,4 @@ -import merge from 'lodash/merge'; +import { toMerged } from 'es-toolkit'; import useBitriseYmlStore from '@/hooks/useBitriseYmlStore'; import { Workflow } from '@/core/models/Workflow'; @@ -11,7 +11,7 @@ const useWorkflow = (id: string): Workflow | undefined => { } if (defaultMeta || workflow.meta) { - workflow.meta = merge({}, defaultMeta, workflow.meta); + workflow.meta = toMerged(defaultMeta || {}, workflow.meta || {}); } return { id, userValues: workflow }; diff --git a/source/javascripts/pages/PipelinesPage/components/PipelineCanvas/StagedPipelineCanvas/hooks/usePipelineStages.ts b/source/javascripts/pages/PipelinesPage/components/PipelineCanvas/StagedPipelineCanvas/hooks/usePipelineStages.ts index d0ab8730a..91f1a0afa 100644 --- a/source/javascripts/pages/PipelinesPage/components/PipelineCanvas/StagedPipelineCanvas/hooks/usePipelineStages.ts +++ b/source/javascripts/pages/PipelinesPage/components/PipelineCanvas/StagedPipelineCanvas/hooks/usePipelineStages.ts @@ -1,4 +1,4 @@ -import merge from 'lodash/merge'; +import { toMerged } from 'es-toolkit'; import useBitriseYmlStore from '@/hooks/useBitriseYmlStore'; import { PipelinesStages, Stage } from '@/core/models/Stage'; import usePipelineSelector from '../../../../hooks/usePipelineSelector'; @@ -17,7 +17,7 @@ const usePipelineStages = (): Stage[] => { return { id: stageId, - userValues: merge({}, yml.stages?.[stageId], { + userValues: toMerged(yml.stages?.[stageId] || {}, { abort_on_fail, should_always_run, }), diff --git a/source/javascripts/pages/PipelinesPage/hooks/usePipelineSelector.ts b/source/javascripts/pages/PipelinesPage/hooks/usePipelineSelector.ts index ace2881c9..6a18d255f 100644 --- a/source/javascripts/pages/PipelinesPage/hooks/usePipelineSelector.ts +++ b/source/javascripts/pages/PipelinesPage/hooks/usePipelineSelector.ts @@ -1,5 +1,5 @@ import { useCallback } from 'react'; -import omit from 'lodash/omit'; +import { omit } from 'es-toolkit'; import useBitriseYmlStore from '@/hooks/useBitriseYmlStore'; import { PipelineYmlObject } from '@/core/models/Pipeline'; import useSearchParams from '@/hooks/useSearchParams'; @@ -24,7 +24,7 @@ const usePipelineSelector = () => { if (key) { setSearchParams((prev) => ({ ...prev, pipeline: key })); } else { - setSearchParams((prev) => omit(prev, 'pipeline')); + setSearchParams((prev) => omit(prev, ['pipeline'])); } }, [setSearchParams], diff --git a/source/javascripts/pages/PipelinesPage/hooks/useRenamePipeline.ts b/source/javascripts/pages/PipelinesPage/hooks/useRenamePipeline.ts index 8a3a25b47..acabf37b8 100644 --- a/source/javascripts/pages/PipelinesPage/hooks/useRenamePipeline.ts +++ b/source/javascripts/pages/PipelinesPage/hooks/useRenamePipeline.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef } from 'react'; -import uniq from 'lodash/uniq'; +import { uniq } from 'es-toolkit'; import { useDebounceCallback } from 'usehooks-ts'; import useBitriseYmlStore from '@/hooks/useBitriseYmlStore'; import usePipelineSelector from './usePipelineSelector'; diff --git a/source/javascripts/pages/SecretsPage/SecretsPage.stories.tsx b/source/javascripts/pages/SecretsPage/SecretsPage.stories.tsx index a429c3860..fc1e19a21 100644 --- a/source/javascripts/pages/SecretsPage/SecretsPage.stories.tsx +++ b/source/javascripts/pages/SecretsPage/SecretsPage.stories.tsx @@ -1,5 +1,4 @@ import { Meta, StoryObj } from '@storybook/react'; -import noop from 'lodash/noop'; import { getSecrets, getSecretsFromLocal } from '@/core/api/SecretApi.mswMocks'; import SecretsPage from './SecretsPage'; @@ -7,7 +6,6 @@ export default { component: SecretsPage, args: { appSlug: 'app-slug', - onSecretsChange: noop, sharedSecretsAvailable: false, }, parameters: { diff --git a/source/javascripts/pages/TriggersPage/components/TargetBasedTriggers/AddTrigger.tsx b/source/javascripts/pages/TriggersPage/components/TargetBasedTriggers/AddTrigger.tsx index a163dc1e9..203760834 100644 --- a/source/javascripts/pages/TriggersPage/components/TargetBasedTriggers/AddTrigger.tsx +++ b/source/javascripts/pages/TriggersPage/components/TargetBasedTriggers/AddTrigger.tsx @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { Box, Button, ButtonGroup, Checkbox, Link, Text, Tooltip } from '@bitrise/bitkit'; import { FormProvider, useFieldArray, useForm } from 'react-hook-form'; -import isEqual from 'lodash/isEqual'; +import { isEqual } from 'es-toolkit'; import { segmentTrack } from '@/utils/segmentTracking'; import { Condition, ConditionType, FormItems, TriggerType } from '../TriggersPage/TriggersPage.types'; import { getConditionList, TargetBasedTriggerItem } from '../TriggersPage/TriggersPage.utils'; diff --git a/source/javascripts/pages/TriggersPage/components/TriggersPage/TriggersPage.utils.ts b/source/javascripts/pages/TriggersPage/components/TriggersPage/TriggersPage.utils.ts index 811ee1fa5..b5d35bbac 100644 --- a/source/javascripts/pages/TriggersPage/components/TriggersPage/TriggersPage.utils.ts +++ b/source/javascripts/pages/TriggersPage/components/TriggersPage/TriggersPage.utils.ts @@ -1,7 +1,7 @@ -import isEqual from 'lodash/isEqual'; -import isObject from 'lodash/isObject'; +import { isEqual } from 'es-toolkit'; +import { isObject } from 'es-toolkit/compat'; import { BitriseYml } from '@/core/models/BitriseYml'; -import { TriggerItem, Condition, ConditionType, TriggerType } from './TriggersPage.types'; +import { Condition, ConditionType, TriggerItem, TriggerType } from './TriggersPage.types'; export const checkIsConditionsUsed = (currentTriggers: TriggerItem[], newTrigger: TriggerItem) => { let isUsed = false; @@ -46,6 +46,7 @@ export type TargetBasedTriggerItem = { }; export type TargetBasedTriggers = Record & { enabled?: boolean }; + export interface DecoratedPipelineableTriggerItem extends TargetBasedTriggerItem { pipelineableId: string; pipelineableType: 'pipeline' | 'workflow'; diff --git a/source/javascripts/pages/TriggersPage/components/TriggersPage/TriggersPageFunctions.ts b/source/javascripts/pages/TriggersPage/components/TriggersPage/TriggersPageFunctions.ts index 6dd93f39d..f9a408a80 100644 --- a/source/javascripts/pages/TriggersPage/components/TriggersPage/TriggersPageFunctions.ts +++ b/source/javascripts/pages/TriggersPage/components/TriggersPage/TriggersPageFunctions.ts @@ -1,6 +1,6 @@ -import isObject from 'lodash/isObject'; +import { isObject } from 'es-toolkit/compat'; import { TriggerMapYml, TriggerYmlObject } from '@/core/models/TriggerMap'; -import { TriggerType, TriggerItem, LegacyConditionType, ConditionType } from './TriggersPage.types'; +import { ConditionType, LegacyConditionType, TriggerItem, TriggerType } from './TriggersPage.types'; const convertItemsToTriggerMap = (triggers: Record): TriggerMapYml => { const triggerMap: TriggerMapYml = Object.values(triggers) diff --git a/source/javascripts/pages/WorkflowsPage/components/StepConfigPanel/components/FilterInput/FilterInput.tsx b/source/javascripts/pages/WorkflowsPage/components/StepConfigPanel/components/FilterInput/FilterInput.tsx index c61b13707..1943ee3e0 100644 --- a/source/javascripts/pages/WorkflowsPage/components/StepConfigPanel/components/FilterInput/FilterInput.tsx +++ b/source/javascripts/pages/WorkflowsPage/components/StepConfigPanel/components/FilterInput/FilterInput.tsx @@ -1,5 +1,5 @@ import { forwardRef, useCallback, useState } from 'react'; -import debounce from 'lodash/debounce'; +import { debounce } from 'es-toolkit'; import { SearchInput, SearchInputProps } from '@bitrise/bitkit'; const DEBOUNCE_TIME = 300; diff --git a/source/javascripts/pages/WorkflowsPage/components/WorkflowConfigPanel/components/TriggersTabPanel.tsx b/source/javascripts/pages/WorkflowsPage/components/WorkflowConfigPanel/components/TriggersTabPanel.tsx index f8ed93ede..71193d14f 100644 --- a/source/javascripts/pages/WorkflowsPage/components/WorkflowConfigPanel/components/TriggersTabPanel.tsx +++ b/source/javascripts/pages/WorkflowsPage/components/WorkflowConfigPanel/components/TriggersTabPanel.tsx @@ -11,7 +11,7 @@ import { Text, Toggle, } from '@bitrise/bitkit'; -import isEqual from 'lodash/isEqual'; +import { isEqual } from 'es-toolkit'; import useBitriseYmlStore from '@/hooks/useBitriseYmlStore'; import { useWorkflowConfigContext } from '@/components/unified-editor/WorkflowConfig/WorkflowConfig.context'; import RuntimeUtils from '@/core/utils/RuntimeUtils'; diff --git a/source/javascripts/utils/segmentTracking.ts b/source/javascripts/utils/segmentTracking.ts index 34c190c12..cfb919157 100644 --- a/source/javascripts/utils/segmentTracking.ts +++ b/source/javascripts/utils/segmentTracking.ts @@ -1,4 +1,4 @@ -import merge from 'lodash/merge'; +import { toMerged } from 'es-toolkit'; import { AnalyticsBrowser } from '@segment/analytics-next'; import WindowUtils from '@/core/utils/WindowUtils'; import RuntimeUtils from '@/core/utils/RuntimeUtils'; @@ -76,8 +76,8 @@ export const segmentTrack = ( eventProps?: Partial, eventContext?: Partial, ) => { - const mergedProps = merge({}, baseProperties, eventProps || {}); - const mergedContext = merge({}, baseContext, eventContext || {}); + const mergedProps = toMerged(baseProperties, eventProps || {}); + const mergedContext = toMerged(baseContext, eventContext || {}); console.debug('Tracking event:', eventName, mergedProps, mergedContext); if (RuntimeUtils.isWebsiteMode() && segmentAnalytics) {