From f6f191128f9efd3ca017a086e9162804b2d1fbcd Mon Sep 17 00:00:00 2001 From: mikesealey Date: Fri, 31 May 2024 10:12:30 +0100 Subject: [PATCH 01/12] Merge branch 'master' of https://github.com/budibase/budibase into BUDI-8196 --- packages/bbui/src/Drawer/Drawer.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/bbui/src/Drawer/Drawer.svelte b/packages/bbui/src/Drawer/Drawer.svelte index 89ee92726d..b2b7d57586 100644 --- a/packages/bbui/src/Drawer/Drawer.svelte +++ b/packages/bbui/src/Drawer/Drawer.svelte @@ -181,7 +181,7 @@ />
0} + class:stacked={depth > 999} class:modal={$modal} transition:drawerSlide|local {style} @@ -223,7 +223,7 @@ height: 420px; background: var(--background); border: var(--border-light); - z-index: 100; + z-index: 1000; border-radius: 8px; overflow: hidden; box-sizing: border-box; From ffff27f9178bf17c51bf331663baa76eae418485 Mon Sep 17 00:00:00 2001 From: mikesealey Date: Fri, 31 May 2024 10:33:26 +0100 Subject: [PATCH 02/12] undoes unecessary tweaks --- packages/bbui/src/Drawer/Drawer.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bbui/src/Drawer/Drawer.svelte b/packages/bbui/src/Drawer/Drawer.svelte index b2b7d57586..1f38389a63 100644 --- a/packages/bbui/src/Drawer/Drawer.svelte +++ b/packages/bbui/src/Drawer/Drawer.svelte @@ -181,7 +181,7 @@ />
999} + class:stacked={depth > 0} class:modal={$modal} transition:drawerSlide|local {style} From 3818b6d8cfd17b3c03e7816c7fb14e2be3a8166c Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 1 Jul 2024 15:48:49 +0100 Subject: [PATCH 03/12] Using the relationship name rather than the table name - the relationship may have a different name to the related table, this makes it a bit more sensible. --- packages/frontend-core/src/utils/searchFields.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/frontend-core/src/utils/searchFields.js b/packages/frontend-core/src/utils/searchFields.js index dec6e93480..294f2c0f38 100644 --- a/packages/frontend-core/src/utils/searchFields.js +++ b/packages/frontend-core/src/utils/searchFields.js @@ -2,7 +2,6 @@ import { BannedSearchTypes } from "../constants" export function getTableFields(tables, linkField) { const table = tables.find(table => table._id === linkField.tableId) - // TODO: mdrury - add support for this with SQS at some point if (!table || !table.sql) { return [] } @@ -11,7 +10,7 @@ export function getTableFields(tables, linkField) { }) return linkFields.map(field => ({ ...field, - name: `${table.name}.${field.name}`, + name: `${linkField.name}.${field.name}`, })) } From c4ffd37caa18753977a15ebe621914a5e3856a61 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 1 Jul 2024 16:37:38 +0100 Subject: [PATCH 04/12] Adding fix for backwards compat, removing columns (but still filtering on) returns no rows, rather than an error. --- .../src/api/routes/tests/search.spec.ts | 30 ++++++++++++++++--- .../server/src/sdk/app/rows/search/sqs.ts | 12 ++++++-- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/packages/server/src/api/routes/tests/search.spec.ts b/packages/server/src/api/routes/tests/search.spec.ts index 2d01ec0f6d..5cd28f4506 100644 --- a/packages/server/src/api/routes/tests/search.spec.ts +++ b/packages/server/src/api/routes/tests/search.spec.ts @@ -9,20 +9,20 @@ import { db as dbCore, utils } from "@budibase/backend-core" import * as setup from "./utilities" import { AutoFieldSubType, + BBReferenceFieldSubType, Datasource, EmptyFilterOption, - BBReferenceFieldSubType, FieldType, + RelationshipType, + Row, RowSearchParams, SearchFilters, + SearchResponse, SortOrder, SortType, Table, TableSchema, User, - Row, - RelationshipType, - SearchResponse, } from "@budibase/types" import _ from "lodash" import tk from "timekeeper" @@ -2084,6 +2084,28 @@ describe.each([ }) }) + isInternal && + describe("no column error backwards compat", () => { + beforeAll(async () => { + table = await createTable({ + name: { + name: "name", + type: FieldType.STRING, + }, + }) + }) + + it("shouldn't error when column doesn't exist", async () => { + await expectSearch({ + query: { + string: { + "1:something": "a", + }, + }, + }).toMatch({ rows: [] }) + }) + }) + // lucene can't count the total rows !isLucene && describe("row counting", () => { diff --git a/packages/server/src/sdk/app/rows/search/sqs.ts b/packages/server/src/sdk/app/rows/search/sqs.ts index 0720600a15..e23f3a35b5 100644 --- a/packages/server/src/sdk/app/rows/search/sqs.ts +++ b/packages/server/src/sdk/app/rows/search/sqs.ts @@ -39,7 +39,10 @@ import { import { dataFilters } from "@budibase/shared-core" const builder = new sql.Sql(SqlClient.SQL_LITE) -const NO_SUCH_COLUMN_REGEX = new RegExp(`no such colum.+${USER_COLUMN_PREFIX}`) +const MISSING_COLUMN_REGEX = new RegExp(`no such column: .+`) +const USER_COLUMN_PREFIX_REGEX = new RegExp( + `no such column: .+${USER_COLUMN_PREFIX}` +) function buildInternalFieldList( table: Table, @@ -331,12 +334,17 @@ export async function search( } catch (err: any) { const msg = typeof err === "string" ? err : err.message const syncAndRepeat = - (err.status === 400 && msg?.match(NO_SUCH_COLUMN_REGEX)) || + (err.status === 400 && msg?.match(USER_COLUMN_PREFIX_REGEX)) || (err.status === 404 && msg?.includes(SQLITE_DESIGN_DOC_ID)) if (syncAndRepeat) { await sdk.tables.sqs.syncDefinition() return search(options, table) } + // previously the internal table didn't error when + console.log(JSON.stringify(err)) + if (err.status === 400 && msg?.match(MISSING_COLUMN_REGEX)) { + return { rows: [] } + } throw new Error(`Unable to search by SQL - ${msg}`, { cause: err }) } } From 2c3e8f756c6bd4c16923ff67d04419b64ac06277 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 1 Jul 2024 17:51:39 +0200 Subject: [PATCH 05/12] Rename --- .github/workflows/budibase_ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index d6e0432e83..050417144e 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -25,7 +25,7 @@ env: BASE_BRANCH: ${{ github.event.pull_request.base.ref}} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} NX_BASE_BRANCH: origin/${{ github.base_ref }} - USE_NX_AFFECTED: ${{ github.event_name == 'pull_request' }} + ONLY_AFFECTED_TASKS: ${{ github.event_name == 'pull_request' }} IS_OSS_CONTRIBUTOR: ${{ inputs.run_as_oss == true || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != 'Budibase/budibase') }} jobs: @@ -72,7 +72,7 @@ jobs: # Check the types of the projects built via esbuild - name: Check types run: | - if ${{ env.USE_NX_AFFECTED }}; then + if ${{ env.ONLY_AFFECTED_TASKS }}; then yarn check:types --since=${{ env.NX_BASE_BRANCH }} --ignore @budibase/account-portal-server else yarn check:types --ignore @budibase/account-portal-server @@ -116,7 +116,7 @@ jobs: - run: yarn --frozen-lockfile - name: Test run: | - if ${{ env.USE_NX_AFFECTED }}; then + if ${{ env.ONLY_AFFECTED_TASKS }}; then yarn test --ignore=@budibase/worker --ignore=@budibase/server --since=${{ env.NX_BASE_BRANCH }} else yarn test --ignore=@budibase/worker --ignore=@budibase/server @@ -140,7 +140,7 @@ jobs: - run: yarn --frozen-lockfile - name: Test worker run: | - if ${{ env.USE_NX_AFFECTED }}; then + if ${{ env.ONLY_AFFECTED_TASKS }}; then yarn test --scope=@budibase/worker --since=${{ env.NX_BASE_BRANCH }} else yarn test --scope=@budibase/worker @@ -180,7 +180,7 @@ jobs: - name: Test server run: | - if ${{ env.USE_NX_AFFECTED }}; then + if ${{ env.ONLY_AFFECTED_TASKS }}; then yarn test --scope=@budibase/server --since=${{ env.NX_BASE_BRANCH }} else yarn test --scope=@budibase/server From cc8c9e62c49b49c6dfd023ef59073d911db8741a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 1 Jul 2024 17:54:56 +0200 Subject: [PATCH 06/12] Update lerna to latest 7.x and remove nx dependency --- package.json | 3 +- yarn.lock | 291 +++++++++++++++++++++++++++++++-------------------- 2 files changed, 178 insertions(+), 116 deletions(-) diff --git a/package.json b/package.json index d4a51f2e62..7e5ce25923 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,8 @@ "eslint-plugin-svelte": "^2.34.0", "husky": "^8.0.3", "kill-port": "^1.6.1", - "lerna": "7.1.1", + "lerna": "7.4.2", "madge": "^6.0.0", - "nx": "16.4.3", "nx-cloud": "16.0.5", "prettier": "2.8.8", "prettier-plugin-svelte": "^2.3.0", diff --git a/yarn.lock b/yarn.lock index c060cc9da3..542847053d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3514,32 +3514,84 @@ path-to-regexp "1.x" urijs "^1.19.2" -"@lerna/child-process@7.1.1": - version "7.1.1" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-7.1.1.tgz#60eddd6dc4b6ba0fd51851c78b6dbdc4e1614220" - integrity sha512-mR8PaTkckYPLmEBG2VsVsJq2UuzEvjXevOB1rKLKUZ/dPCGcottVhbiEzTxickc+s7Y/1dTTLn/1BKj3B1a5BA== +"@lerna/child-process@7.4.2": + version "7.4.2" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-7.4.2.tgz#a2fd013ac2150dc288270d3e0d0b850c06bec511" + integrity sha512-je+kkrfcvPcwL5Tg8JRENRqlbzjdlZXyaR88UcnCdNW0AJ1jX9IfHRys1X7AwSroU2ug8ESNC+suoBw1vX833Q== dependencies: chalk "^4.1.0" execa "^5.0.0" strong-log-transformer "^2.1.0" -"@lerna/create@7.1.1": - version "7.1.1" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-7.1.1.tgz#2af94afb01971c1b594c06347b6998607aefe5c4" - integrity sha512-1PY2OgwGxp7b91JzLKEhONVl69mCt1IyYEc6pzKy3Sv+UOdeK2QFq1SX/85hNOR3iitiyZ75bNWUTcBly1ZlZg== +"@lerna/create@7.4.2": + version "7.4.2" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-7.4.2.tgz#f845fad1480e46555af98bd39af29571605dddc9" + integrity sha512-1wplFbQ52K8E/unnqB0Tq39Z4e+NEoNrpovEnl6GpsTUrC6WDp8+w0Le2uCBV0hXyemxChduCkLz4/y1H1wTeg== dependencies: - "@lerna/child-process" "7.1.1" + "@lerna/child-process" "7.4.2" + "@npmcli/run-script" "6.0.2" + "@nx/devkit" ">=16.5.1 < 17" + "@octokit/plugin-enterprise-rest" "6.0.1" + "@octokit/rest" "19.0.11" + byte-size "8.1.1" + chalk "4.1.0" + clone-deep "4.0.1" + cmd-shim "6.0.1" + columnify "1.6.0" + conventional-changelog-core "5.0.1" + conventional-recommended-bump "7.0.1" + cosmiconfig "^8.2.0" dedent "0.7.0" + execa "5.0.0" fs-extra "^11.1.1" + get-stream "6.0.0" + git-url-parse "13.1.0" + glob-parent "5.1.2" + globby "11.1.0" + graceful-fs "4.2.11" + has-unicode "2.0.1" + ini "^1.3.8" init-package-json "5.0.0" + inquirer "^8.2.4" + is-ci "3.0.1" + is-stream "2.0.0" + js-yaml "4.1.0" + libnpmpublish "7.3.0" + load-json-file "6.2.0" + lodash "^4.17.21" + make-dir "4.0.0" + minimatch "3.0.5" + multimatch "5.0.0" + node-fetch "2.6.7" npm-package-arg "8.1.1" + npm-packlist "5.1.1" + npm-registry-fetch "^14.0.5" + npmlog "^6.0.2" + nx ">=16.5.1 < 17" + p-map "4.0.0" + p-map-series "2.1.0" + p-queue "6.6.2" p-reduce "^2.1.0" pacote "^15.2.0" pify "5.0.0" + read-cmd-shim "4.0.0" + read-package-json "6.0.4" + resolve-from "5.0.0" + rimraf "^4.4.1" semver "^7.3.4" + signal-exit "3.0.7" slash "^3.0.0" + ssri "^9.0.1" + strong-log-transformer "2.1.0" + tar "6.1.11" + temp-dir "1.0.0" + upath "2.0.1" + uuid "^9.0.0" validate-npm-package-license "^3.0.4" validate-npm-package-name "5.0.0" + write-file-atomic "5.0.1" + write-pkg "4.0.0" + yargs "16.2.0" yargs-parser "20.2.4" "@lezer/common@^1.0.0": @@ -3717,12 +3769,12 @@ read-package-json-fast "^3.0.0" which "^3.0.0" -"@nrwl/devkit@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-16.4.3.tgz#036be0d478ef7156e55c1cfb4d13da080983503d" - integrity sha512-sDGv3RX5DHBMFFiHdd91e4YFXb87X5jsKkEg5Y2jmFtz/OilBKA9yoRhZ8t+iLBOmbgUngC5ZYPHc+Ykd2U3nA== +"@nrwl/devkit@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-16.10.0.tgz#ac8c5b4db00f12c4b817c937be2f7c4eb8f2593c" + integrity sha512-fRloARtsDQoQgQ7HKEy0RJiusg/HSygnmg4gX/0n/Z+SUS+4KoZzvHjXc6T5ZdEiSjvLypJ+HBM8dQzIcVACPQ== dependencies: - "@nx/devkit" "16.4.3" + "@nx/devkit" "16.10.0" "@nrwl/nx-cloud@16.0.5": version "16.0.5" @@ -3731,74 +3783,76 @@ dependencies: nx-cloud "16.0.5" -"@nrwl/tao@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-16.4.3.tgz#8a72e8c1c903d8d7e1d9a298c28f03a000a925d8" - integrity sha512-h+/UdXtdVuH9K2+Rx1HK5AHXGtgXNIqdLIH1KRL+74fiQ+JNO2Xuz9wqiD+rZ5tmtL/4hZpePCMkTz2FusKvbA== +"@nrwl/tao@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-16.10.0.tgz#94642a0380709b8e387e1e33705a5a9624933375" + integrity sha512-QNAanpINbr+Pod6e1xNgFbzK1x5wmZl+jMocgiEFXZ67KHvmbD6MAQQr0MMz+GPhIu7EE4QCTLTyCEMlAG+K5Q== dependencies: - nx "16.4.3" + nx "16.10.0" + tslib "^2.3.0" -"@nx/devkit@16.4.3", "@nx/devkit@>=16.1.3 < 17": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/devkit/-/devkit-16.4.3.tgz#a5e691f1fd49b5b0d8bb0a4347b3501b11e33056" - integrity sha512-5LHtia3Ioy4uwWDIpnCbslFwxNdRJ2cWWmzq4oDINZnUMzNsjatVowKkOUBeG4Xh++6Dvui/VSdKZ6J0MUoQzw== +"@nx/devkit@16.10.0", "@nx/devkit@>=16.5.1 < 17": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/devkit/-/devkit-16.10.0.tgz#7e466be2dee2dcb1ccaf286786ca2a0a639aa007" + integrity sha512-IvKQqRJFDDiaj33SPfGd3ckNHhHi6ceEoqCbAP4UuMXOPPVOX6H0KVk+9tknkPb48B7jWIw6/AgOeWkBxPRO5w== dependencies: - "@nrwl/devkit" "16.4.3" + "@nrwl/devkit" "16.10.0" ejs "^3.1.7" + enquirer "~2.3.6" ignore "^5.0.4" semver "7.5.3" tmp "~0.2.1" tslib "^2.3.0" -"@nx/nx-darwin-arm64@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-darwin-arm64/-/nx-darwin-arm64-16.4.3.tgz#08e63921c4e4dfc9eb9da612140c62ca8c190059" - integrity sha512-iVr3KTHXqGWx34mLxKjdDT1m6px9NME7zqSoKZW9DQuxDt3G7NN4PkK6+n2YqVNNSOmYml/Oo5iVtQ2TUCJDFA== +"@nx/nx-darwin-arm64@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-darwin-arm64/-/nx-darwin-arm64-16.10.0.tgz#0c73010cac7a502549483b12bad347da9014e6f1" + integrity sha512-YF+MIpeuwFkyvM5OwgY/rTNRpgVAI/YiR0yTYCZR+X3AAvP775IVlusNgQ3oedTBRUzyRnI4Tknj1WniENFsvQ== -"@nx/nx-darwin-x64@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-darwin-x64/-/nx-darwin-x64-16.4.3.tgz#e1e591f38bd103cf110487bd8c35daf17f8636c7" - integrity sha512-Km1N7Rek4VZW9rFMpV/gwmW0YHCoeV/5/tbYOYjSPJY6n2GB/vVoqE1DTf69muIk32436aK+qYRpd98bXC8GKg== +"@nx/nx-darwin-x64@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-darwin-x64/-/nx-darwin-x64-16.10.0.tgz#2ccf270418d552fd0a8e0d6089aee4944315adaa" + integrity sha512-ypi6YxwXgb0kg2ixKXE3pwf5myVNUgWf1CsV5OzVccCM8NzheMO51KDXTDmEpXdzUsfT0AkO1sk5GZeCjhVONg== -"@nx/nx-freebsd-x64@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-freebsd-x64/-/nx-freebsd-x64-16.4.3.tgz#dc7fd8dbb87d7eb613b3f7302b0e3cba233277fd" - integrity sha512-i6gc7oiDekYY2DS20COoeIrUqSQt0A3V+xUbrMGTInbHMux8QlfY5LGPRHGzqRlvnmUbrpgN0TdwBB9KOgaWmw== +"@nx/nx-freebsd-x64@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-freebsd-x64/-/nx-freebsd-x64-16.10.0.tgz#c3ee6914256e69493fed9355b0d6661d0e86da44" + integrity sha512-UeEYFDmdbbDkTQamqvtU8ibgu5jQLgFF1ruNb/U4Ywvwutw2d4ruOMl2e0u9hiNja9NFFAnDbvzrDcMo7jYqYw== -"@nx/nx-linux-arm-gnueabihf@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-16.4.3.tgz#5a2aa53297eff9b3d0cef5b0280d67400e61e80d" - integrity sha512-hozcDrzbv3X0oWYYbJfSybVmKviko78wjjxvdwYS2H9eqNN6sNBZ5+LL+duUazCeGGHj1fRipvb9E3rJxiKWEw== +"@nx/nx-linux-arm-gnueabihf@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-16.10.0.tgz#a961eccbb38acb2da7fc125b29d1fead0b39152f" + integrity sha512-WV3XUC2DB6/+bz1sx+d1Ai9q2Cdr+kTZRN50SOkfmZUQyEBaF6DRYpx/a4ahhxH3ktpNfyY8Maa9OEYxGCBkQA== -"@nx/nx-linux-arm64-gnu@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-16.4.3.tgz#2129426f8258e193f9997adafcda570e23d94435" - integrity sha512-LrlSKCZtFl8TiIFuLjkSNN/yzQ8phZ6+0jgsuumrIE8t02y+WLcZ4dSGlCo4nwVX/MDCtTbc9LPI+rIoBvO/pQ== +"@nx/nx-linux-arm64-gnu@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-16.10.0.tgz#795f20072549d03822b5c4639ef438e473dbb541" + integrity sha512-aWIkOUw995V3ItfpAi5FuxQ+1e9EWLS1cjWM1jmeuo+5WtaKToJn5itgQOkvSlPz+HSLgM3VfXMvOFALNk125g== -"@nx/nx-linux-arm64-musl@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm64-musl/-/nx-linux-arm64-musl-16.4.3.tgz#0285f71f94b5a2eb40f15033457f937e0362770d" - integrity sha512-3ahS0k330T339FdVBQhr3EGrghAaezqdVpbOwG2pyiZRwvLVgnDkPF/d4EkGd3ZAsOLazcPkPH/fKxPPf8HP2g== +"@nx/nx-linux-arm64-musl@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm64-musl/-/nx-linux-arm64-musl-16.10.0.tgz#f2428ee6dbe2b2c326e8973f76c97666def33607" + integrity sha512-uO6Gg+irqpVcCKMcEPIQcTFZ+tDI02AZkqkP7koQAjniLEappd8DnUBSQdcn53T086pHpdc264X/ZEpXFfrKWQ== -"@nx/nx-linux-x64-gnu@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-16.4.3.tgz#defea39bbd5f494c28369bd403f909d5ec905ac0" - integrity sha512-Nbo+FLBYZRhJUB367Eg9f0mH7Q+X67H+QAF+wU2oK3StSGQNQbLnr7Q0yfmX912WdYDe7gWhEpqWTLZ7rv65mg== +"@nx/nx-linux-x64-gnu@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-16.10.0.tgz#d36c2bcf94d49eaa24e3880ddaf6f1f617de539b" + integrity sha512-134PW/u/arNFAQKpqMJniC7irbChMPz+W+qtyKPAUXE0XFKPa7c1GtlI/wK2dvP9qJDZ6bKf0KtA0U/m2HMUOA== -"@nx/nx-linux-x64-musl@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-linux-x64-musl/-/nx-linux-x64-musl-16.4.3.tgz#c78db85f3234d2b899c7acaa7b5e2ef2c8591eb6" - integrity sha512-RG31ewe3GRmwSMBgWF0yeJ1zu8s42xywpwK8swgGHpUp+Z6JN8dkUqi7UfHGbjeaOIDg4w45/7OJyrE7dlqHCg== +"@nx/nx-linux-x64-musl@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-x64-musl/-/nx-linux-x64-musl-16.10.0.tgz#78bd2ab97a583b3d4ea3387b67fd7b136907493c" + integrity sha512-q8sINYLdIJxK/iUx9vRk5jWAWb/2O0PAbOJFwv4qkxBv4rLoN7y+otgCZ5v0xfx/zztFgk/oNY4lg5xYjIso2Q== -"@nx/nx-win32-arm64-msvc@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-16.4.3.tgz#d131273e8267eb98a7640f79a94049b5f12d572e" - integrity sha512-5HXY8S0vGUculndAhWqBrqkrQxY6M3v3Ac/3rr8O238JkdkhRiHilnGbwS2MIQpU7dou3wROO6wKT7+TyFv+cA== +"@nx/nx-win32-arm64-msvc@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-16.10.0.tgz#ef20ec8d0c83d66e73e20df12d2c788b8f866396" + integrity sha512-moJkL9kcqxUdJSRpG7dET3UeLIciwrfP08mzBQ12ewo8K8FzxU8ZUsTIVVdNrwt01CXOdXoweGfdQLjJ4qTURA== -"@nx/nx-win32-x64-msvc@16.4.3": - version "16.4.3" - resolved "https://registry.yarnpkg.com/@nx/nx-win32-x64-msvc/-/nx-win32-x64-msvc-16.4.3.tgz#cc8d87dbada3965b3156440277951b742b6c0de3" - integrity sha512-9vdA5t5xuWCQ9JFJZFjzYGz9w5wtZ7zfKcx2HdBvg2nDWUzK5Z3khwsakTSsc7Ff7Hnd0i0l5T3Ls6Hk42Haww== +"@nx/nx-win32-x64-msvc@16.10.0": + version "16.10.0" + resolved "https://registry.yarnpkg.com/@nx/nx-win32-x64-msvc/-/nx-win32-x64-msvc-16.10.0.tgz#7410a51d0f8be631eec9552f01b2e5946285927c" + integrity sha512-5iV2NKZnzxJwZZ4DM5JVbRG/nkhAbzEskKaLBB82PmYGKzaDHuMHP1lcPoD/rtYMlowZgNA/RQndfKvPBPwmXA== "@octokit/auth-token@^3.0.0": version "3.0.3" @@ -8856,10 +8910,10 @@ content-type@^1.0.4: resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== -conventional-changelog-angular@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz#a9a9494c28b7165889144fd5b91573c4aa9ca541" - integrity sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg== +conventional-changelog-angular@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-7.0.0.tgz#5eec8edbff15aa9b1680a8dcfbd53e2d7eb2ba7a" + integrity sha512-ROjNchA9LgfNMTTFSIWPzebCwOGFdgkEq45EnvvrmSLvCtAw0HSmrCs7/ty+wAeYUZyNay0YMUNYFTRL72PkBQ== dependencies: compare-func "^2.0.0" @@ -10071,6 +10125,11 @@ dot-prop@^5.1.0, dot-prop@^5.2.0: dependencies: is-obj "^2.0.0" +dotenv-expand@~10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-10.0.0.tgz#12605d00fb0af6d0a592e6558585784032e4ef37" + integrity sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A== + dotenv@16.0.1: version "16.0.1" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.1.tgz#8f8f9d94876c35dac989876a5d3a82a267fdce1d" @@ -10091,6 +10150,11 @@ dotenv@~10.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== +dotenv@~16.3.1: + version "16.3.2" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.2.tgz#3cb611ce5a63002dbabf7c281bc331f69d28f03f" + integrity sha512-HTlk5nmhkm8F6JcdXvHIzaorzCoziNQT9mGxLPVXW8wJF1TiGSL60ZGB4gHWabHOaMmWmhvk2/lPHfnBiT78AQ== + double-ended-queue@2.1.0-0: version "2.1.0-0" resolved "https://registry.yarnpkg.com/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz#103d3527fd31528f40188130c841efdd78264e5c" @@ -11151,17 +11215,6 @@ fast-fifo@^1.1.0, fast-fifo@^1.2.0: resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== -fast-glob@3.2.7: - version "3.2.7" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1" - integrity sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - fast-glob@^3.2.11, fast-glob@^3.2.9: version "3.2.12" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" @@ -13654,7 +13707,7 @@ jest-config@^29.7.0: slash "^3.0.0" strip-json-comments "^3.1.1" -"jest-diff@>=29.4.3 < 30", jest-diff@^29.7.0: +"jest-diff@>=29.4.3 < 30", jest-diff@^29.4.1, jest-diff@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== @@ -14691,15 +14744,15 @@ leaflet@^1.7.1: resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.9.3.tgz#52ec436954964e2d3d39e0d433da4b2500d74414" integrity sha512-iB2cR9vAkDOu5l3HAay2obcUHZ7xwUBBjph8+PGtmW/2lYhbLizWtG7nTeYht36WfOslixQF9D/uSIzhZgGMfQ== -lerna@7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-7.1.1.tgz#6703062e6c4ddefdaf41e8890e9200690924fd71" - integrity sha512-rjivAl3bYu2+lWOi90vy0tYFgwBYPMiNkR/DuEWZC08wle5dsbOZ/SlXeLk9+kzbF89Bt5P6p+qF78A2tJsWPA== +lerna@7.4.2: + version "7.4.2" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-7.4.2.tgz#03497125d7b7c8d463eebfe17a701b16bde2ad09" + integrity sha512-gxavfzHfJ4JL30OvMunmlm4Anw7d7Tq6tdVHzUukLdS9nWnxCN/QB21qR+VJYp5tcyXogHKbdUEGh6qmeyzxSA== dependencies: - "@lerna/child-process" "7.1.1" - "@lerna/create" "7.1.1" + "@lerna/child-process" "7.4.2" + "@lerna/create" "7.4.2" "@npmcli/run-script" "6.0.2" - "@nx/devkit" ">=16.1.3 < 17" + "@nx/devkit" ">=16.5.1 < 17" "@octokit/plugin-enterprise-rest" "6.0.1" "@octokit/rest" "19.0.11" byte-size "8.1.1" @@ -14707,7 +14760,7 @@ lerna@7.1.1: clone-deep "4.0.1" cmd-shim "6.0.1" columnify "1.6.0" - conventional-changelog-angular "6.0.0" + conventional-changelog-angular "7.0.0" conventional-changelog-core "5.0.1" conventional-recommended-bump "7.0.1" cosmiconfig "^8.2.0" @@ -14733,7 +14786,8 @@ lerna@7.1.1: libnpmaccess "7.0.2" libnpmpublish "7.3.0" load-json-file "6.2.0" - make-dir "3.1.0" + lodash "^4.17.21" + make-dir "4.0.0" minimatch "3.0.5" multimatch "5.0.0" node-fetch "2.6.7" @@ -14741,7 +14795,7 @@ lerna@7.1.1: npm-packlist "5.1.1" npm-registry-fetch "^14.0.5" npmlog "^6.0.2" - nx ">=16.1.3 < 17" + nx ">=16.5.1 < 17" p-map "4.0.0" p-map-series "2.1.0" p-pipe "3.1.0" @@ -15463,12 +15517,12 @@ magic-string@^0.30.5: dependencies: "@jridgewell/sourcemap-codec" "^1.4.15" -make-dir@3.1.0, make-dir@^3.0.0, make-dir@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" - integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== +make-dir@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== dependencies: - semver "^6.0.0" + semver "^7.5.3" make-dir@^1.0.0, make-dir@^1.3.0: version "1.3.0" @@ -15485,6 +15539,13 @@ make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" +make-dir@^3.0.0, make-dir@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + make-error@1.x, make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" @@ -16341,7 +16402,7 @@ node-int64@^0.4.0: resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== -node-machine-id@^1.1.12: +node-machine-id@1.1.12, node-machine-id@^1.1.12: version "1.1.12" resolved "https://registry.yarnpkg.com/node-machine-id/-/node-machine-id-1.1.12.tgz#37904eee1e59b320bb9c5d6c0a59f3b469cb6267" integrity sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ== @@ -16663,12 +16724,12 @@ nx-cloud@16.0.5: tar "6.1.11" yargs-parser ">=21.1.1" -nx@16.4.3, "nx@>=16.1.3 < 17": - version "16.4.3" - resolved "https://registry.yarnpkg.com/nx/-/nx-16.4.3.tgz#0bd8e408eeb9f09f9fca334689bf3d13f361254f" - integrity sha512-bq3wc7WI/j/mmz4MbrhDVE+DLJ6ywvmAoUjxNRcVAhPi+rT7bDaztVZceDbxxVFW55wfOIjcYwhS9fGQMSBBpQ== +nx@16.10.0, "nx@>=16.5.1 < 17": + version "16.10.0" + resolved "https://registry.yarnpkg.com/nx/-/nx-16.10.0.tgz#b070461f7de0a3d7988bd78558ea84cda3543ace" + integrity sha512-gZl4iCC0Hx0Qe1VWmO4Bkeul2nttuXdPpfnlcDKSACGu3ZIo+uySqwOF8yBAxSTIf8xe2JRhgzJN1aFkuezEBg== dependencies: - "@nrwl/tao" "16.4.3" + "@nrwl/tao" "16.10.0" "@parcel/watcher" "2.0.4" "@yarnpkg/lockfile" "^1.1.0" "@yarnpkg/parsers" "3.0.0-rc.46" @@ -16677,19 +16738,21 @@ nx@16.4.3, "nx@>=16.1.3 < 17": chalk "^4.1.0" cli-cursor "3.1.0" cli-spinners "2.6.1" - cliui "^7.0.2" - dotenv "~10.0.0" + cliui "^8.0.1" + dotenv "~16.3.1" + dotenv-expand "~10.0.0" enquirer "~2.3.6" - fast-glob "3.2.7" figures "3.2.0" flat "^5.0.2" fs-extra "^11.1.0" glob "7.1.4" ignore "^5.0.4" + jest-diff "^29.4.1" js-yaml "4.1.0" jsonc-parser "3.2.0" lines-and-columns "~2.0.3" minimatch "3.0.5" + node-machine-id "1.1.12" npm-run-path "^4.0.1" open "^8.4.0" semver "7.5.3" @@ -16703,16 +16766,16 @@ nx@16.4.3, "nx@>=16.1.3 < 17": yargs "^17.6.2" yargs-parser "21.1.1" optionalDependencies: - "@nx/nx-darwin-arm64" "16.4.3" - "@nx/nx-darwin-x64" "16.4.3" - "@nx/nx-freebsd-x64" "16.4.3" - "@nx/nx-linux-arm-gnueabihf" "16.4.3" - "@nx/nx-linux-arm64-gnu" "16.4.3" - "@nx/nx-linux-arm64-musl" "16.4.3" - "@nx/nx-linux-x64-gnu" "16.4.3" - "@nx/nx-linux-x64-musl" "16.4.3" - "@nx/nx-win32-arm64-msvc" "16.4.3" - "@nx/nx-win32-x64-msvc" "16.4.3" + "@nx/nx-darwin-arm64" "16.10.0" + "@nx/nx-darwin-x64" "16.10.0" + "@nx/nx-freebsd-x64" "16.10.0" + "@nx/nx-linux-arm-gnueabihf" "16.10.0" + "@nx/nx-linux-arm64-gnu" "16.10.0" + "@nx/nx-linux-arm64-musl" "16.10.0" + "@nx/nx-linux-x64-gnu" "16.10.0" + "@nx/nx-linux-x64-musl" "16.10.0" + "@nx/nx-win32-arm64-msvc" "16.10.0" + "@nx/nx-win32-x64-msvc" "16.10.0" oauth-sign@~0.9.0: version "0.9.0" From dd70f0b72bfb1f552135743a5bded6341f84d6d7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 1 Jul 2024 17:55:16 +0200 Subject: [PATCH 07/12] yarn lerna repair --- lerna.json | 4 ++-- nx.json | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lerna.json b/lerna.json index 1bce056679..10bb67fd27 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,5 @@ { + "$schema": "node_modules/lerna/schemas/lerna-schema.json", "version": "2.29.5", "npmClient": "yarn", "packages": [ @@ -6,7 +7,6 @@ "!packages/account-portal", "packages/account-portal/packages/*" ], - "useNx": true, "concurrency": 20, "command": { "publish": { @@ -22,4 +22,4 @@ "loadEnvFiles": false } } -} \ No newline at end of file +} diff --git a/nx.json b/nx.json index 8ba8798946..54db3a24a3 100644 --- a/nx.json +++ b/nx.json @@ -1,4 +1,5 @@ { + "$schema": "./node_modules/nx/schemas/nx-schema.json", "tasksRunnerOptions": { "default": { "runner": "nx-cloud", @@ -11,5 +12,10 @@ "build": { "inputs": ["{workspaceRoot}/scripts/*", "{workspaceRoot}/lerna.json"] } + }, + "namedInputs": { + "default": ["{projectRoot}/**/*", "sharedGlobals"], + "sharedGlobals": [], + "production": ["default"] } } From 5ac9fe43fc655f8b52086096e171cc854616b029 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 1 Jul 2024 17:50:34 +0100 Subject: [PATCH 08/12] PR comments. --- packages/server/src/sdk/app/rows/search/sqs.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/server/src/sdk/app/rows/search/sqs.ts b/packages/server/src/sdk/app/rows/search/sqs.ts index e23f3a35b5..e3aedf9de8 100644 --- a/packages/server/src/sdk/app/rows/search/sqs.ts +++ b/packages/server/src/sdk/app/rows/search/sqs.ts @@ -340,8 +340,7 @@ export async function search( await sdk.tables.sqs.syncDefinition() return search(options, table) } - // previously the internal table didn't error when - console.log(JSON.stringify(err)) + // previously the internal table didn't error when a column didn't exist in search if (err.status === 400 && msg?.match(MISSING_COLUMN_REGEX)) { return { rows: [] } } From e14c569aa40675774f5155ed7f546a4330c948cf Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 2 Jul 2024 11:38:21 +0200 Subject: [PATCH 09/12] Add run-affected script --- scripts/run-affected.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/run-affected.js diff --git a/scripts/run-affected.js b/scripts/run-affected.js new file mode 100755 index 0000000000..051c61f114 --- /dev/null +++ b/scripts/run-affected.js @@ -0,0 +1,29 @@ +const { execSync } = require("child_process") + +const argv = require("yargs").demandOption([ + "task", + "since", + "package-name", +]).argv + +const { task, since, packageName } = argv + +const affectedPackages = execSync( + `yarn --silent lerna ls --since=${since} --json`, + { + encoding: "utf-8", + } +) + +const packages = JSON.parse(affectedPackages) + +const isAffected = packages.some(pkg => pkg.name === packageName) + +if (isAffected) { + console.log(`${packageName} is affected. Running ${task}...`) + execSync(`yarn ${task} --scope=${packageName}`, { + stdio: "inherit", + }) +} else { + console.log(`${packageName} is not affected. Skipping ${task}...`) +} From 8e4ccdcb9598b6aad7f7a54f95cf436012f4fb1c Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 2 Jul 2024 11:48:01 +0200 Subject: [PATCH 10/12] Use script on pipeline --- .github/workflows/budibase_ci.yml | 4 ++-- scripts/run-affected.js | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 050417144e..86fd4f6799 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -141,7 +141,7 @@ jobs: - name: Test worker run: | if ${{ env.ONLY_AFFECTED_TASKS }}; then - yarn test --scope=@budibase/worker --since=${{ env.NX_BASE_BRANCH }} + node scripts/run-affected.js --task=test --scope=@budibase/worker --since=${{ env.NX_BASE_BRANCH }} else yarn test --scope=@budibase/worker fi @@ -181,7 +181,7 @@ jobs: - name: Test server run: | if ${{ env.ONLY_AFFECTED_TASKS }}; then - yarn test --scope=@budibase/server --since=${{ env.NX_BASE_BRANCH }} + node scripts/run-affected.js --task=test --scope=@budibase/server --since=${{ env.NX_BASE_BRANCH }} else yarn test --scope=@budibase/server fi diff --git a/scripts/run-affected.js b/scripts/run-affected.js index 051c61f114..3e7f9bed03 100755 --- a/scripts/run-affected.js +++ b/scripts/run-affected.js @@ -1,12 +1,17 @@ +/*** + * Running lerna with since and scope is not working as expected. + * For example, running the command `yarn test --scope=@budibase/worker --since=master`, with changes only on @budibase/backend-core will not work, as it does not analyse the dependencies properly. + * + * This script is using `lerna ls` to detect all the affected projects from a given commit, and if the scoped package is affected, the actual command will be executed + * + * The current version of the script only supports a single project in the scope. + */ + const { execSync } = require("child_process") -const argv = require("yargs").demandOption([ - "task", - "since", - "package-name", -]).argv +const argv = require("yargs").demandOption(["task", "since", "scope"]).argv -const { task, since, packageName } = argv +const { task, since, scope } = argv const affectedPackages = execSync( `yarn --silent lerna ls --since=${since} --json`, @@ -17,13 +22,13 @@ const affectedPackages = execSync( const packages = JSON.parse(affectedPackages) -const isAffected = packages.some(pkg => pkg.name === packageName) +const isAffected = packages.some(pkg => pkg.name === scope) if (isAffected) { - console.log(`${packageName} is affected. Running ${task}...`) - execSync(`yarn ${task} --scope=${packageName}`, { + console.log(`${scope} is affected. Running task "${task}"`) + execSync(`yarn ${task} --scope=${scope}`, { stdio: "inherit", }) } else { - console.log(`${packageName} is not affected. Skipping ${task}...`) + console.log(`${scope} is not affected. Skipping task "${task}"`) } From 9a598c7b3a02d106121212cb01a9fa11bb0cea7d Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 2 Jul 2024 12:02:00 +0200 Subject: [PATCH 11/12] Comments --- scripts/run-affected.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run-affected.js b/scripts/run-affected.js index 3e7f9bed03..2b3565734a 100755 --- a/scripts/run-affected.js +++ b/scripts/run-affected.js @@ -1,8 +1,8 @@ /*** * Running lerna with since and scope is not working as expected. - * For example, running the command `yarn test --scope=@budibase/worker --since=master`, with changes only on @budibase/backend-core will not work, as it does not analyse the dependencies properly. + * For example, running the command `yarn test --scope=@budibase/worker --since=master`, with changes only on `@budibase/backend-core` will not work as expected, as it does not analyse the dependencies properly. The actual `@budibase/worker` task will not be triggered. * - * This script is using `lerna ls` to detect all the affected projects from a given commit, and if the scoped package is affected, the actual command will be executed + * This script is using `lerna ls` to detect all the affected projects from a given commit, and if the scoped package is affected, the actual command will be executed. * * The current version of the script only supports a single project in the scope. */ From 18acd579e306046f13a09eee43173f1480e871c0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 2 Jul 2024 12:28:25 +0200 Subject: [PATCH 12/12] Fix --- scripts/run-affected.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run-affected.js b/scripts/run-affected.js index 2b3565734a..97f79bb463 100755 --- a/scripts/run-affected.js +++ b/scripts/run-affected.js @@ -14,7 +14,7 @@ const argv = require("yargs").demandOption(["task", "since", "scope"]).argv const { task, since, scope } = argv const affectedPackages = execSync( - `yarn --silent lerna ls --since=${since} --json`, + `yarn --silent nx show projects --affected -t ${task} --base=${since} --json`, { encoding: "utf-8", } @@ -22,7 +22,7 @@ const affectedPackages = execSync( const packages = JSON.parse(affectedPackages) -const isAffected = packages.some(pkg => pkg.name === scope) +const isAffected = packages.includes(scope) if (isAffected) { console.log(`${scope} is affected. Running task "${task}"`)