From 9d74cc84237822fc152edb2d37732e1bccfd2fb2 Mon Sep 17 00:00:00 2001 From: Dennis Kigen Date: Mon, 10 Jun 2024 23:20:51 +0300 Subject: [PATCH] (chore) Bump turbo (#291) * (chore) Bump turbo * Set color flag for testing tasks --- .github/workflows/node.js.yml | 6 +- .husky/pre-commit | 2 +- README.md | 15 +- package.json | 9 +- .../edit-question-modal.component.tsx | 261 +++++++++--------- .../interactive-builder.component.tsx | 8 +- turbo.json | 20 +- yarn.lock | 60 ++-- 8 files changed, 202 insertions(+), 179 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 723a81d3..52194c4e 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -49,7 +49,7 @@ jobs: run: yarn verify - name: Run build - run: yarn turbo build + run: yarn turbo run build - name: Upload Artifacts uses: actions/upload-artifact@v4 @@ -88,7 +88,7 @@ jobs: run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}" - name: Build - run: yarn turbo build + run: yarn turbo run build - run: git config user.email "info@openmrs.org" && git config user.name "OpenMRS CI" @@ -150,7 +150,7 @@ jobs: run: yarn install --immutable - name: Build - run: yarn turbo build + run: yarn turbo run build - run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/.husky/pre-commit b/.husky/pre-commit index 667a08d5..4ca8de91 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,4 +2,4 @@ . "$(dirname -- "$0")/_/husky.sh" npx lint-staged -yarn turbo extract-translations +yarn turbo run extract-translations diff --git a/README.md b/README.md index a502c003..6ed53f89 100644 --- a/README.md +++ b/README.md @@ -46,19 +46,19 @@ Once the dev server launches, log in and select a location. You will get redirec To run tests for all packages, run: ```bash -yarn turbo test +yarn turbo run test ``` To run tests in `watch` mode, run: ```bash -yarn turbo test:watch +yarn turbo run test:watch ``` To run a specific test file, run: ```bash -yarn turbo test -- dashboard +yarn turbo run test -- dashboard ``` The above command will only run tests in the file or files that match the provided string. @@ -66,19 +66,19 @@ The above command will only run tests in the file or files that match the provid You can also run the matching tests from above in watch mode by running: ```bash -yarn turbo test:watch -- dashboard +yarn turbo run test:watch -- dashboard ``` To generate a `coverage` report, run: ```bash -yarn turbo coverage +yarn turbo run coverage ``` By default, `turbo` will cache test runs. This means that re-running tests wihout changing any of the related files will return the cached logs from the last run. To bypass the cache, run tests with the `force` flag, as follows: ```bash -yarn turbo test --force +yarn turbo run test --force ``` ### E2E tests @@ -96,8 +96,9 @@ yarn test-e2e --headed ``` Read the [e2e testing guide](/e2e/README.md) to learn more about End-to-End tests in this project. + ## Building ```sh -yarn build +yarn turbo run build ``` diff --git a/package.json b/package.json index 68e92dda..7f991bf0 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,12 @@ "serve": "webpack serve --mode=development", "build": "webpack --mode production", "analyze": "webpack --mode=production --env.analyze=true", - "lint": "TIMING=1 eslint src --ext js,jsx,ts,tsx --max-warnings=0", + "lint": "eslint src --ext js,jsx,ts,tsx --max-warnings=0", "typescript": "tsc", - "test": "jest --config jest.config.js", + "test": "jest --config jest.config.js --color", + "test:watch": "jest --config jest.config.js --watch --color", "test-e2e": "playwright test", - "verify": "turbo lint typescript coverage", + "verify": "turbo run lint typescript coverage --color", "coverage": "yarn test --coverage --passWithNoTests", "postinstall": "husky install", "extract-translations": "i18next 'src/**/*.component.tsx' --config ./i18next-parser.config.js", @@ -104,7 +105,7 @@ "react-i18next": "^11.18.6", "rxjs": "^6.6.7", "swc-loader": "^0.2.6", - "turbo": "^1.13.3", + "turbo": "^2.0.3", "typescript": "^4.9.5", "webpack": "^5.91.0", "webpack-cli": "^5.1.4" diff --git a/src/components/interactive-builder/edit-question-modal.component.tsx b/src/components/interactive-builder/edit-question-modal.component.tsx index bf4c97d9..15ac95a7 100644 --- a/src/components/interactive-builder/edit-question-modal.component.tsx +++ b/src/components/interactive-builder/edit-question-modal.component.tsx @@ -432,7 +432,7 @@ const EditQuestionModal: React.FC = ({ kind="error" lowContrast className={styles.error} - title={t('errorFetchingPersonAttributeTypes', 'Error fetching person attribute types')} + title={t('errorFetchingPersonAttributeTypes', 'Error fetching person attribute types')} subtitle={t('pleaseTryAgain', 'Please try again.')} /> ) : null} @@ -446,7 +446,7 @@ const EditQuestionModal: React.FC = ({ onChange={({ selectedItem }: { selectedItem: PersonAttributeType }) => { handleAttributeTypeSelect(selectedItem); }} - placeholder={t('choosePersonAttributeType', 'Choose a person attribute type')} + placeholder={t('choosePersonAttributeType', 'Choose a person attribute type')} initialSelectedItem={personAttributeTypes.find( (personAttributeType) => personAttributeType?.uuid === questionToEdit.questionOptions?.attributeType, @@ -459,135 +459,142 @@ const EditQuestionModal: React.FC = ({ {fieldType !== 'ui-select-extended' && questionToEdit.type !== 'patientIdentifier' && questionToEdit.type !== 'personAttribute' && ( -
- - {t('searchForBackingConcept', 'Search for a backing concept')} - - {conceptNameLookupError ? ( - - ) : null} - {isLoadingConceptName ? ( - - ) : ( - <> - setSelectedConcept(null)} - onChange={(e: React.ChangeEvent) => handleConceptChange(e.target.value?.trim())} - placeholder={t('searchConcept', 'Search using a concept name or UUID')} - required - size="md" - value={selectedConcept?.display} +
+ + {t('searchForBackingConcept', 'Search for a backing concept')} + + {conceptNameLookupError ? ( + - {(() => { - if (!conceptToLookup) return null; - if (isLoadingConcepts) - return ( - - ); - if (concepts?.length && !isLoadingConcepts) { + ) : null} + {isLoadingConceptName ? ( + + ) : ( + <> + setSelectedConcept(null)} + onChange={(e: React.ChangeEvent) => + handleConceptChange(e.target.value?.trim()) + } + placeholder={t('searchConcept', 'Search using a concept name or UUID')} + required + size="md" + value={selectedConcept?.display} + /> + {(() => { + if (!conceptToLookup) return null; + if (isLoadingConcepts) + return ( + + ); + if (concepts?.length && !isLoadingConcepts) { + return ( +
    + {concepts?.map((concept, index) => ( +
  • handleConceptSelect(concept)} + > + {concept.display} +
  • + ))} +
+ ); + } return ( -
    - {concepts?.map((concept, index) => ( -
  • handleConceptSelect(concept)} + + + + {t('noMatchingConcepts', 'No concepts were found that match')}{' '} + "{conceptToLookup}". + + + +
    + { +

    + {t('conceptSearchHelpText', "Can't find a concept?")} +

    + } + - {concept.display} -
  • - ))} -
+ {t('searchInOCL', 'Search in OCL')} + + +
+ ); - } - return ( - - - - {t('noMatchingConcepts', 'No concepts were found that match')}{' '} - "{conceptToLookup}". - - - -
- { -

- {t('conceptSearchHelpText', "Can't find a concept?")} -

- } - - {t('searchInOCL', 'Search in OCL')} - - -
-
- ); - })()} - - )} - - - setAddObsComment(true)} - value="yes" - /> - setAddObsComment(false)} - value="no" - /> - - - - setAddInlineDate(true)} - value="yes" - /> - setAddInlineDate(false)} - value="no" - /> - -
- )} + })()} + + )} + + + setAddObsComment(true)} + value="yes" + /> + setAddObsComment(false)} + value="no" + /> + + + + setAddInlineDate(true)} + value="yes" + /> + setAddInlineDate(false)} + value="no" + /> + + + )} {conceptMappings?.length ? ( diff --git a/src/components/interactive-builder/interactive-builder.component.tsx b/src/components/interactive-builder/interactive-builder.component.tsx index 91b028e2..3e003609 100644 --- a/src/components/interactive-builder/interactive-builder.component.tsx +++ b/src/components/interactive-builder/interactive-builder.component.tsx @@ -1,7 +1,7 @@ import React, { useCallback, useState } from 'react'; import { useTranslation } from 'react-i18next'; import type { DragEndEvent } from '@dnd-kit/core'; -import { DndContext, KeyboardSensor, MouseSensor, useSensor, useSensors } from '@dnd-kit/core'; +import { DndContext, KeyboardSensor, MouseSensor, closestCorners, useSensor, useSensors } from '@dnd-kit/core'; import { Accordion, AccordionItem, Button, InlineLoading } from '@carbon/react'; import { Add, TrashCan } from '@carbon/react/icons'; import { useParams } from 'react-router-dom'; @@ -391,7 +391,11 @@ const InteractiveBuilder: React.FC = ({ )} - handleDragEnd(event)} sensors={sensors}> + handleDragEnd(event)} + sensors={sensors} + > {schema?.pages?.length ? schema.pages.map((page, pageIndex) => (
diff --git a/turbo.json b/turbo.json index 86547ab5..96e73253 100644 --- a/turbo.json +++ b/turbo.json @@ -1,18 +1,28 @@ { "$schema": "https://turbo.build/schema.json", - "pipeline": { + "tasks": { "build": { - "outputs": ["dist/**"] + "outputs": [ + "dist" + ] }, "extract-translations": { - "outputs": ["./translations/*"] + "outputs": [ + "./translations" + ] }, "lint": {}, "test": {}, + "test:watch": { + "cache": false, + "persistent": true + }, "coverage": { - "outputs": ["coverage/**"] + "outputs": [ + "coverage/**" + ] }, "typescript": {}, "verify": {} } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 8f4b9fdd..b187a4d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3070,7 +3070,7 @@ __metadata: rxjs: "npm:^6.6.7" sass: "npm:^1.67.0" swc-loader: "npm:^0.2.6" - turbo: "npm:^1.13.3" + turbo: "npm:^2.0.3" typescript: "npm:^4.9.5" webpack: "npm:^5.91.0" webpack-cli: "npm:^5.1.4" @@ -16433,58 +16433,58 @@ __metadata: languageName: node linkType: hard -"turbo-darwin-64@npm:1.13.3": - version: 1.13.3 - resolution: "turbo-darwin-64@npm:1.13.3" +"turbo-darwin-64@npm:2.0.3": + version: 2.0.3 + resolution: "turbo-darwin-64@npm:2.0.3" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"turbo-darwin-arm64@npm:1.13.3": - version: 1.13.3 - resolution: "turbo-darwin-arm64@npm:1.13.3" +"turbo-darwin-arm64@npm:2.0.3": + version: 2.0.3 + resolution: "turbo-darwin-arm64@npm:2.0.3" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"turbo-linux-64@npm:1.13.3": - version: 1.13.3 - resolution: "turbo-linux-64@npm:1.13.3" +"turbo-linux-64@npm:2.0.3": + version: 2.0.3 + resolution: "turbo-linux-64@npm:2.0.3" conditions: os=linux & cpu=x64 languageName: node linkType: hard -"turbo-linux-arm64@npm:1.13.3": - version: 1.13.3 - resolution: "turbo-linux-arm64@npm:1.13.3" +"turbo-linux-arm64@npm:2.0.3": + version: 2.0.3 + resolution: "turbo-linux-arm64@npm:2.0.3" conditions: os=linux & cpu=arm64 languageName: node linkType: hard -"turbo-windows-64@npm:1.13.3": - version: 1.13.3 - resolution: "turbo-windows-64@npm:1.13.3" +"turbo-windows-64@npm:2.0.3": + version: 2.0.3 + resolution: "turbo-windows-64@npm:2.0.3" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"turbo-windows-arm64@npm:1.13.3": - version: 1.13.3 - resolution: "turbo-windows-arm64@npm:1.13.3" +"turbo-windows-arm64@npm:2.0.3": + version: 2.0.3 + resolution: "turbo-windows-arm64@npm:2.0.3" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"turbo@npm:^1.13.3": - version: 1.13.3 - resolution: "turbo@npm:1.13.3" - dependencies: - turbo-darwin-64: "npm:1.13.3" - turbo-darwin-arm64: "npm:1.13.3" - turbo-linux-64: "npm:1.13.3" - turbo-linux-arm64: "npm:1.13.3" - turbo-windows-64: "npm:1.13.3" - turbo-windows-arm64: "npm:1.13.3" +"turbo@npm:^2.0.3": + version: 2.0.3 + resolution: "turbo@npm:2.0.3" + dependencies: + turbo-darwin-64: "npm:2.0.3" + turbo-darwin-arm64: "npm:2.0.3" + turbo-linux-64: "npm:2.0.3" + turbo-linux-arm64: "npm:2.0.3" + turbo-windows-64: "npm:2.0.3" + turbo-windows-arm64: "npm:2.0.3" dependenciesMeta: turbo-darwin-64: optional: true @@ -16500,7 +16500,7 @@ __metadata: optional: true bin: turbo: bin/turbo - checksum: 10/de96309b3c4c28b51d9436cdec57e3df452dea4ec4512e6c3b7f6596265d4b22d2c16b9c8a674cc1bafa3cc2eea9feb89a807526d6d820f9bca0522d8d86df12 + checksum: 10/b4073faa921865c5ff8efef6c3527cca7c04d60feda12e3bb4a1ce404c3a4a5665407e735c4bee3d530b9b88307f07ad6dc28352b1593ab32fdafe3a96f70449 languageName: node linkType: hard