psych-ds / psychds-validator

Validator tools for the psych-DS specification
1 stars 1 forks source link

Npm install #60

Closed bleonar5 closed 3 weeks ago

bleonar5 commented 2 months ago

npm Package Integration for Deno Application

This pull request addresses issue #58 and implements the necessary changes to make Deno application available as a functional npm library.

Key Changes

  1. Bundling Solution:

    • Implemented a robust bundling strategy to resolve import issues, particularly with the jsonld library.
    • Utilized an import map file to manage dependencies more effectively.
  2. Custom Document Loader:

    • Developed a customDocumentLoader for the jsonld.expand function.
    • This loader fetches the schema.org schema from a dedicated JSON representation, circumventing the need to pull from the main schema.org link directly.
  3. npm Library Structure:

    • Added essential files and configurations required for npm package functionality.
  4. Default schema file

    • Added a local schema file to import in cases where schema pull fails.
  5. Ensure exit

    • Added an explicit exit() command at the end of the main function to handle cases where process hangs within npm.

Technical Details

Additional Files

This PR includes several new files necessary for npm package integration:

Testing

If possible, reviewers could try out installing and running the app through npm as a test:

nvm install 18
nvm use 18
sudo npm install -g psychds-validator
validate <path_to_input_dir>