Open bleonar5 opened 4 weeks ago
@becky-gilbert You mentioned that you would be pulling this down and testing it, so here is some context for that:
(switch to node v20)
You can run the validator normally by installing deno and running: deno run -A stc/psychds-validator.ts <dataset>
, and you can add warnings with the -w
flag.
To run the dnt build script: deno run -A build_npm.ts 1.0.0
If this runs successfully, try installing the npm CLI tool locally:
cd npm
npm pack
npm install -g psychds-validator-1.0.0.tgz
validate ../test_data/valid_datasets/bfi-dataset
If you want, you can also test the esm and cjs imports:
(from the root of psychds-validator)
mkdir test
cd test
npm init -y
npm install ../npm/psychds-validator-1.0.0.tgz
add these test files:
(test-cjs.cjs)
// test-cjs.cjs
const { validate } = require('psychds-validator');
async function runTest() {
try {
const result = await validate('../test_data/valid_datasets/bfi-dataset');
console.log('CJS Test Result:', result);
} catch (error) {
console.error('CJS Test Error:', error);
}
}
runTest();
and (test-esm.mjs)
// test-esm.mjs
import { validate } from 'psychds-validator';
async function runTest() {
try {
const result = await validate('../test_data/valid_datasets/bfi-dataset');
console.log('ESM Test Result:', result);
} catch (error) {
console.error('ESM Test Error:', error);
}
}
runTest();
and then run them:
node test-esm.mjs
node test-cjs.cjs
Refactor codebase for cross-platform compatibility and npm publication
Overview
This pull request represents a major overhaul of our codebase, transitioning from Deno-specific implementations to more cross-platform compatible solutions. The primary goal is to prepare our project for a dnt (Deno to Node.js) build and eventual publication to npm.
Key Changes
Impact
Testing
All existing tests have been updated to work with the new implementations. Additional tests have been added where necessary to ensure functionality and improve coverage. Test reliability has been enhanced by using mock responses where appropriate.