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(deno): Retrieve version from import.meta.url or git, when possible #1985

Merged
merged 9 commits into from
Jun 10, 2024

Conversation

effigies
Copy link
Collaborator

@effigies effigies commented Jun 6, 2024

❯ deno run --reload --allow-all https://github.com/effigies/bids-validator/raw/enh/deno-version/bids-validator/src/bids-validator.ts --version
bids-validator enh/deno-version
❯ deno run --allow-all bids-validator/src/bids-validator.ts --version
bids-validator v1.14.7-dev.0-38-g5314ea00

Should emit the right version for released versions on deno.land. We can improve it for untagged versions in the future.

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.68%. Comparing base (07cbca5) to head (748cf3c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1985   +/-   ##
=======================================
  Coverage   85.68%   85.68%           
=======================================
  Files          91       91           
  Lines        3792     3792           
  Branches     1220     1220           
=======================================
  Hits         3249     3249           
  Misses        457      457           
  Partials       86       86           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@effigies

This comment was marked as resolved.

@effigies effigies force-pushed the enh/deno-version branch from 98b660e to f6665a3 Compare June 6, 2024 21:00
@effigies effigies changed the title feat(deno): Retrieve version from import.meta.url feat(deno): Retrieve version from import.meta.url or git, when possible Jun 6, 2024
@effigies effigies force-pushed the enh/deno-version branch from f6665a3 to 7b85ad9 Compare June 7, 2024 20:41
@effigies effigies requested a review from nellh June 7, 2024 20:43
@effigies
Copy link
Collaborator Author

effigies commented Jun 7, 2024

I think this should be good to go.

@effigies effigies force-pushed the enh/deno-version branch from 7b85ad9 to 961dc35 Compare June 8, 2024 14:03
let version = getArchiveVersion()
if (version) { return version }

const url = new URL(Deno.mainModule)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched to Deno.mainModule to display a module users would expect, if we can't find any version info. Not sure if tying it to Deno is wise. Could inspect the stack trace to find the main module.

'--filenameMode',
'Enable filename checks for newline separated filenames read from stdin',
)
async function getValidatorCommand() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return annotation caused headaches, so I dropped it, and typescript was happy enough.

@effigies effigies force-pushed the enh/deno-version branch 2 times, most recently from 5221c61 to c5775f2 Compare June 10, 2024 02:31
Copy link
Member

@nellh nellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made one change which preserves the export for validateCommand since this is used by OpenNeuro CLI.

@effigies
Copy link
Collaborator Author

Rebased to resolve tests (I hope).

effigies added 2 commits June 10, 2024 12:58
This way git can fail and we fall back to the URL, rather than have Deno
crash.
@nellh nellh merged commit bd30213 into bids-standard:master Jun 10, 2024
33 checks passed
@effigies effigies deleted the enh/deno-version branch June 10, 2024 18:52
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