-
Notifications
You must be signed in to change notification settings - Fork 774
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
Add action to publish JSON schema for Wrangler #2596
Conversation
|
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/runs/3991396461/npm-package-wrangler-2596 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/prs/2596/npm-package-wrangler-2596 Or you can use npx https://prerelease-registry.devprod.cloudflare.dev/runs/3991396461/npm-package-wrangler-2596 dev path/to/script.js Additional artifacts:npm install https://prerelease-registry.devprod.cloudflare.dev/runs/3991396461/npm-package-cloudflare-pages-shared-2596 |
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"deploy": "wrangler publish", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You npm run publish
from the Action workflow, but it's called deploy
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
Codecov Report
@@ Coverage Diff @@
## main #2596 +/- ##
==========================================
- Coverage 73.32% 73.23% -0.10%
==========================================
Files 159 159
Lines 9800 9847 +47
Branches 2583 2622 +39
==========================================
+ Hits 7186 7211 +25
- Misses 2614 2636 +22
|
export default { | ||
async fetch(request: Request, env: Env): Promise<Response> { | ||
const url = new URL(request.url); | ||
const matches = url.pathname.match(/\/(.*?)\.json/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this json-schema-worker
exclusively for testing? Or is the idea that we'll serve a production version from here too? If it's just the former, I reckon you could probably just re-use the prerelease-registry
and save yourself the maintenance of this new service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing the point of this PR.
But can't we just publish the schema inside the npm package of wrangler when we build?
This is what the Angular CLI does. So when you create a new Angular project you just stick a path to that schema in the config file. E.g. https://stackblitz.com/edit/angular-ivy-ycid3w?file=angular.json:
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
https://unpkg.com/browse/@angular/[email protected]/lib/config/schema.json
This requires more thought (especially around depreciated fields, which aren't handled by this) |
What this PR solves / how to test:
This adds a GitHub action to generate and publish a JSON schema for wrangler PRs. The next step will be to add it to schemastore.org for automatic inclusion in e.g. VSCode.
How to test:
"$schema": "https://json-schema.devprod.cloudflare.dev/penalosa/generate-json-schema.json"
Associated docs issues/PR:
Author has included the following, where applicable:
Reviewer has performed the following, where applicable:
Fixes #2376