Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): add missing export for models #687

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

eddyfidel
Copy link
Contributor

This change addresses an issue where the OpenSkill model definitions (bradleyTerryFull, bradleyTerryPart, plackettLuce, thurstoneMostellerFull, and thurstoneMostellerPart) were not properly exported, making them inaccessible through standard import paths. The new configuration in the package.json allows users to directly import these models in their projects using different module formats (ES Modules, CommonJS, and TypeScript types).

Change Details:
The exports section in the package.json was updated to include a dedicated path for the models directory:

"exports": {
  ".": {
    "require": "./dist/index.cjs",
    "import": "./dist/index.js",
    "types": "./dist/index.d.ts"
  },
  "./models": {
    "require": "./dist/models/index.cjs",
    "import": "./dist/models/index.js",
    "types": "./dist/models/index.d.ts"
  }
}

This addition ensures that the various models can now be imported using a simplified syntax and are compatible with different module systems. The following import variants can now be used:

  1. ES Modules:

    import {
      bradleyTerryFull,
      bradleyTerryPart,
      plackettLuce,
      thurstoneMostellerFull,
      thurstoneMostellerPart
    } from "openskill/models";
  2. CommonJS (Require Syntax):

    const {
      bradleyTerryFull,
      bradleyTerryPart,
      plackettLuce,
      thurstoneMostellerFull,
      thurstoneMostellerPart
    } = require("openskill/models");
  3. TypeScript Imports:

    import type {
      bradleyTerryFull,
      bradleyTerryPart,
      plackettLuce,
      thurstoneMostellerFull,
      thurstoneMostellerPart
    } from "openskill/models";

Impact:
This enhancement provides a more convenient and modular import path, allowing users to access the rating models independently from the main library, improving usability and maintaining compatibility with various module systems.

@eddyfidel
Copy link
Contributor Author

Hi @philihp, please when you get a chance review this PR and let me know if I'm missing something or all good, thanks!

@philihp
Copy link
Owner

philihp commented Oct 11, 2024

Thank you so much for providing this fix! Apologies for the mistake, this is great work :)

@coveralls
Copy link

Coverage Status

coverage: 100.0%. remained the same
when pulling 4100e8b on eddyfidel:feature/missing-models-export
into 4f78c21 on philihp:main.

@philihp philihp merged commit e4c3e22 into philihp:main Oct 11, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants