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: refresh types on Deno CLI cache #66

Merged
merged 5 commits into from
Jul 1, 2022
Merged

Conversation

eduardoboucas
Copy link
Member

As part of https://github.com/netlify/pillar-runtime/issues/322, we'd like customers to start importing the types from https://edge.netlify.com rather than netlify:edge. To ensure that they always have the latest version of that specifier, and not an outdated version cached by Deno CLI, this PR adds a new ensureLatestTypes function that will:

  1. Hit the /version.txt endpoint exposed by https://github.com/netlify/edge-functions-bootstrap/pull/57 to see what is the latest version of the types
  2. Check a types-version.txt file locally to see whether the cache was already refreshed for that version
  3. If not, run deno cache -r https://edge.netlify.com to update the specifier in the Deno CLI cache

ensureLatestTypes runs on both bundle and serve, and any errors resulting from the operation will be handled, so that the application will continue to operate normally if something goes wrong with the HTTP call or the cache refresh.

@eduardoboucas eduardoboucas added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jul 1, 2022
Skn0tt
Skn0tt previously approved these changes Jul 1, 2022
Copy link
Member

@Skn0tt Skn0tt left a comment

Choose a reason for hiding this comment

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

lgtm!

src/types.ts Outdated Show resolved Hide resolved
test/types.ts Show resolved Hide resolved
@kodiakhq kodiakhq bot merged commit 534ea80 into main Jul 1, 2022
Skn0tt pushed a commit to netlify/build that referenced this pull request Apr 23, 2024
* feat: refresh types on Deno CLI cache

* fix: use cache command

* chore: move rules to eslintrc

* chore: remove eslint comments

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants