From fe9f49d7797f9c0bc7bf50315d1f62614052d20b Mon Sep 17 00:00:00 2001 From: Zane Rockenbaugh Date: Fri, 10 Nov 2023 11:27:13 -0600 Subject: [PATCH 1/3] Update getQuestionControls() to deal with unscoped packages --- package.json | 15 ++++----------- src/lib/integrations/get-question-controls.mjs | 11 +++++++++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 1c564fc..292adce 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "files": [ "dist/*" ], + "engines": { + "node": ">=18.0.0" + }, "keywords": [], "author": "Zane Rockenbaugh ", "license": "UNLICENSED", @@ -27,7 +30,7 @@ "@liquid-labs/http-smart-response": "^1.0.0-alpha.3", "@liquid-labs/liq-handlers-lib": "^1.0.0-alpha.15", "@liquid-labs/liq-qa-lib": "^1.0.0-alpha.8", - "@liquid-labs/npm-toolkit": "^1.0.0-alpha.10", + "@liquid-labs/npm-toolkit": "file:.yalc/@liquid-labs/npm-toolkit", "@liquid-labs/resource-item": "^1.0.0-alpha.4", "@liquid-labs/resource-model": "file:.yalc/@liquid-labs/resource-model", "http-errors": "^2.0.0", @@ -38,15 +41,5 @@ }, "devDependencies": { "@liquid-labs/catalyst-scripts-node-project": "^1.0.0-alpha.5" - }, - "engines": { - "node": ">=18.0.0" - }, - "catalyst-scripts": { - "preset-env": { - "targets": { - "node": "18.0" - } - } } } diff --git a/src/lib/integrations/get-question-controls.mjs b/src/lib/integrations/get-question-controls.mjs index 79d7e25..2a9cbb4 100644 --- a/src/lib/integrations/get-question-controls.mjs +++ b/src/lib/integrations/get-question-controls.mjs @@ -4,7 +4,7 @@ import * as fsPath from 'node:path' import yaml from 'js-yaml' const getQuestionControls = async({ app, controlsName, projectName, reporter }) => { - const { projectPath } = app.ext._liqProjects.playgroundMonitor.getProjectData(projectName) + const { pkgJSON, projectPath } = app.ext._liqProjects.playgroundMonitor.getProjectData(projectName) const packageControlsPath = fsPath.join(projectPath, 'controls', controlsName + '.qcontrols.yaml') let controlsContent @@ -22,7 +22,14 @@ const getQuestionControls = async({ app, controlsName, projectName, reporter }) throw e } // else, no problem, just doesn't define the control at the package level reporter.log(' not found') - const [orgKey] = projectName.split('/') + let [orgKey, basename] = projectName.split('/') + if (basename === undefined) { + // then we have an unscoped project and we look at the package.json to determine the org key + orgKey = pkgJSON._comply?.orgKey + if (orgKey === undefined) { + throw new Error("Did not find expected '_comply.orgKey' in the 'package.json' file. This value must be defined for unscoped packages.") + } + } const org = app.ext._liqOrgs.orgs[orgKey] if (org !== undefined) { const controlsSpec = org.controls.getControl(controlsName) From 372c9cd6c0d55db7da23aea6fca3a64c068f9ee9 Mon Sep 17 00:00:00 2001 From: Zane Rockenbaugh Date: Fri, 10 Nov 2023 11:28:10 -0600 Subject: [PATCH 2/3] Save QA files. --- qa/lint.txt | 1 + qa/unit-test.txt | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 qa/lint.txt create mode 100644 qa/unit-test.txt diff --git a/qa/lint.txt b/qa/lint.txt new file mode 100644 index 0000000..9f20a5d --- /dev/null +++ b/qa/lint.txt @@ -0,0 +1 @@ +Test git rev: fe9f49d7797f9c0bc7bf50315d1f62614052d20b diff --git a/qa/unit-test.txt b/qa/unit-test.txt new file mode 100644 index 0000000..3897721 --- /dev/null +++ b/qa/unit-test.txt @@ -0,0 +1,24 @@ +Test git rev: fe9f49d7797f9c0bc7bf50315d1f62614052d20b +PASS lib/handlers/orgs/controls/_lib/test/list-lib.test.js +PASS lib/resources/test/controls.test.js +PASS lib/handlers/orgs/controls/test/list.test.js +PASS lib/resources/test/question-controls.test.js +-----------------------------|---------|----------|---------|---------|--------------------- +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s +-----------------------------|---------|----------|---------|---------|--------------------- +All files | 78.94 | 32.14 | 69.56 | 77.52 | + handlers/orgs/controls | 100 | 100 | 100 | 100 | + list.mjs | 100 | 100 | 100 | 100 | + handlers/orgs/controls/_lib | 54.28 | 0 | 25 | 54.28 | + list-lib.mjs | 54.28 | 0 | 25 | 54.28 | 9-17,21-28,32-39,45 + resources | 92 | 75 | 92.3 | 91.48 | + control.mjs | 92.3 | 75 | 100 | 92.3 | 15 + controls.mjs | 95.23 | 0 | 100 | 94.73 | 34 + question-control.mjs | 87.5 | 100 | 80 | 86.66 | 22-23 +-----------------------------|---------|----------|---------|---------|--------------------- + +Test Suites: 4 passed, 4 total +Tests: 6 passed, 6 total +Snapshots: 0 total +Time: 0.494 s, estimated 1 s +Ran all test suites. From 051030eeb514780cdcac1a813794a91236608e17 Mon Sep 17 00:00:00 2001 From: Zane Rockenbaugh Date: Fri, 10 Nov 2023 11:28:10 -0600 Subject: [PATCH 3/3] removed QA files --- qa/lint.txt | 1 - qa/unit-test.txt | 24 ------------------------ 2 files changed, 25 deletions(-) delete mode 100644 qa/lint.txt delete mode 100644 qa/unit-test.txt diff --git a/qa/lint.txt b/qa/lint.txt deleted file mode 100644 index 9f20a5d..0000000 --- a/qa/lint.txt +++ /dev/null @@ -1 +0,0 @@ -Test git rev: fe9f49d7797f9c0bc7bf50315d1f62614052d20b diff --git a/qa/unit-test.txt b/qa/unit-test.txt deleted file mode 100644 index 3897721..0000000 --- a/qa/unit-test.txt +++ /dev/null @@ -1,24 +0,0 @@ -Test git rev: fe9f49d7797f9c0bc7bf50315d1f62614052d20b -PASS lib/handlers/orgs/controls/_lib/test/list-lib.test.js -PASS lib/resources/test/controls.test.js -PASS lib/handlers/orgs/controls/test/list.test.js -PASS lib/resources/test/question-controls.test.js ------------------------------|---------|----------|---------|---------|--------------------- -File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s ------------------------------|---------|----------|---------|---------|--------------------- -All files | 78.94 | 32.14 | 69.56 | 77.52 | - handlers/orgs/controls | 100 | 100 | 100 | 100 | - list.mjs | 100 | 100 | 100 | 100 | - handlers/orgs/controls/_lib | 54.28 | 0 | 25 | 54.28 | - list-lib.mjs | 54.28 | 0 | 25 | 54.28 | 9-17,21-28,32-39,45 - resources | 92 | 75 | 92.3 | 91.48 | - control.mjs | 92.3 | 75 | 100 | 92.3 | 15 - controls.mjs | 95.23 | 0 | 100 | 94.73 | 34 - question-control.mjs | 87.5 | 100 | 80 | 86.66 | 22-23 ------------------------------|---------|----------|---------|---------|--------------------- - -Test Suites: 4 passed, 4 total -Tests: 6 passed, 6 total -Snapshots: 0 total -Time: 0.494 s, estimated 1 s -Ran all test suites.