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

Upgrade & Convert to TS #3459

Merged
merged 8 commits into from
Jun 14, 2023
Merged

Conversation

JacobMGEvans
Copy link
Contributor

We had many templates that were in pretty old states for TypeScript. This goes through a majority of them and updates their TSConfigs to be inline with most up to date TS configurations and Wrangler.

Additionally, many templates were written in TypeScript and had many errors in their tests and a few in their workers code (caused by updates to Wrangler & the ecosystem) converting them to TypeScript helps to fix them and helps future maintaining when updating or making changes to the templates.

Part of #3441

Reviewer is to perform the following, as applicable:

  • Checked for inclusion of relevant tests
  • Checked for inclusion of a relevant changeset
  • Checked for creation of associated docs updates
  • Manually pulled down the changes and spot-tested

@JacobMGEvans JacobMGEvans added maintenance Maintenance task quick win Potentially easy/straightforward issue to tackle labels Jun 13, 2023
@JacobMGEvans JacobMGEvans requested a review from admah June 13, 2023 22:15
@JacobMGEvans JacobMGEvans requested a review from a team as a code owner June 13, 2023 22:15
@changeset-bot
Copy link

changeset-bot bot commented Jun 13, 2023

⚠️ No Changeset found

Latest commit: c2b7c02

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@JacobMGEvans
Copy link
Contributor Author

I am reduce the scope of this, by remove adding templates to workspaces, that really made this look bigger than it needs to be right now.

We had many templates that were in pretty old states for TypeScript. This goes through a majority of them and updates their TSConfigs to be inline with most up to date
TS configurations and Wrangler.

Additionally, many templates were written in TypeScript and had many errors in their tests and a few in their workers code (caused by updates to Wrangler & the ecosystem)
converting them to TypeScript helps to fix them and helps future maintaining when updating or making changes to the templates.
…ate TSConfigs and replaced them with a standard one.
@JacobMGEvans JacobMGEvans force-pushed the jacobmgevans/templates-typescript branch from 34ea3ed to ea2981e Compare June 14, 2023 15:25
Comment on lines 8 to 14
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
},
"testRegex": "/test/.*\\.test\\.js$",
"testRegex": "/test/.*\\.(test|spec)\\.(ts|tsx|js)$",
"testEnvironment": "miniflare",
"testEnvironmentOptions": {
"scriptPath": "./src/index.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ill be converting these all to Vitest soon, don't worry too much about them it was just to get it working.

@JacobMGEvans JacobMGEvans force-pushed the jacobmgevans/templates-typescript branch from ea2981e to 8f70cd3 Compare June 14, 2023 15:56
@github-actions
Copy link
Contributor

github-actions bot commented Jun 14, 2023

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5270776696/npm-package-wrangler-3459

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/3459/npm-package-wrangler-3459

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5270776696/npm-package-wrangler-3459 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/5270776696/npm-package-cloudflare-pages-shared-3459

Note that these links will no longer work once the GitHub Actions artifact expires.

Copy link
Contributor

@admah admah left a comment

Choose a reason for hiding this comment

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

Added comments on creating projects with templates. I have a PR in progress with similar instructions in each template's subdirectory.

templates/README.md Outdated Show resolved Hide resolved
templates/README.md Outdated Show resolved Hide resolved
JacobMGEvans and others added 2 commits June 14, 2023 11:25
Co-authored-by: Adam Murray <admah@users.noreply.github.com>
Co-authored-by: Adam Murray <admah@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Jun 14, 2023

Codecov Report

Merging #3459 (eba9ddf) into main (b0bbf69) will not change coverage.
The diff coverage is n/a.

❗ Current head eba9ddf differs from pull request most recent head c2b7c02. Consider uploading reports for the commit c2b7c02 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3459   +/-   ##
=======================================
  Coverage   75.17%   75.17%           
=======================================
  Files         183      183           
  Lines       11055    11055           
  Branches     2904     2904           
=======================================
  Hits         8311     8311           
  Misses       2744     2744           

Copy link
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

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

LGTM - I didn't try any of the templates out for real though...

@JacobMGEvans JacobMGEvans merged commit 026d944 into main Jun 14, 2023
@JacobMGEvans JacobMGEvans deleted the jacobmgevans/templates-typescript branch June 14, 2023 18:29
lrapoport-cf pushed a commit that referenced this pull request Aug 11, 2023
* Upgrade & Convert to TS
We had many templates that were in pretty old states for TypeScript. This goes through a majority of them and updates their TSConfigs to be inline with most up to date
TS configurations and Wrangler.

Additionally, many templates were written in TypeScript and had many errors in their tests and a few in their workers code (caused by updates to Wrangler & the ecosystem)
converting them to TypeScript helps to fix them and helps future maintaining when updating or making changes to the templates.

* Upgraded all the templates packages Worker Types and removed boilerplate TSConfigs and replaced them with a standard one.

---------

Co-authored-by: Adam Murray <admah@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance task quick win Potentially easy/straightforward issue to tackle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants