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

feat: add example project #63

Merged
merged 2 commits into from
Feb 7, 2024
Merged

feat: add example project #63

merged 2 commits into from
Feb 7, 2024

Conversation

ewanharris
Copy link
Member

Description

Adds an example for the JS SDK that copies the structure of the other SDKs. I made the following choices here:

  • Usage of ESM instead of CommonJS - Personal opinion that we should be moving to this in documentation
  • Usage of top level await/mjs - Avoids having to use an async iiife to allow using async/await
    • I think we could move to a .js file with a type field in the package.json of the example if desired
  • No package-lock committed - It's just another file to maintain and keep in sync between the SDK repo and the generator repo, and realistically adds 0 benefit

These two choices are what primarily drove the require for the >=16.13.0 (earliest 16 LTS) value in the examples engines.node field, although there is no check here so earlier versions will error with a potentially unhelpful error (is it worth adding a check?).

References

Closes out #198
Generated from: openfga/sdk-generator#305

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

@ewanharris ewanharris added this pull request to the merge queue Feb 7, 2024
Merged via the queue into main with commit 198b0f5 Feb 7, 2024
19 checks passed
@ewanharris ewanharris deleted the feat/js-example branch February 7, 2024 11:14
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.

2 participants