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: entry point is not mandatory if --assets is passed #1289

Merged
merged 1 commit into from
Jun 17, 2022

Conversation

threepointone
Copy link
Contributor

@threepointone threepointone commented Jun 17, 2022

Since we use a facade worker with --assets, an entry point is not strictly necessary. This makes a common usecase of "deploy a bunch of static assets" extremely easy to start, as a one liner npx wrangler dev --assets path/to/folder (and same with publish).

@changeset-bot
Copy link

changeset-bot bot commented Jun 17, 2022

🦋 Changeset detected

Latest commit: 0709b87

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

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

@threepointone
Copy link
Contributor Author

I was quite surprised at how easy this was 😅

Copy link
Contributor

@rozenmd rozenmd left a comment

Choose a reason for hiding this comment

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

I had an observation, but it shouldn't block this from going live

@@ -35,6 +39,8 @@ export async function getEntry(
? path.resolve(config.site?.["entry-point"])
: // site.entry-point could be a directory
path.resolve(config.site?.["entry-point"], "index.js");
} else if (args["experimental-public"]) {
file = path.resolve(__dirname, "../templates/no-op-worker.js");
Copy link
Contributor

Choose a reason for hiding this comment

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

Wasn't immediately obvious that the facade imports this worker - on the surface it looks like we're 404ing all requests 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, it's spooky lol! I couldn't think of a meaningful test here, open to suggestions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe I'll at least add a comment here for anyone who reads this code in the future

@github-actions
Copy link
Contributor

github-actions bot commented Jun 17, 2022

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

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2516777968/npm-package-wrangler-1289

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

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/1289/npm-package-wrangler-1289

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/2516777968/npm-package-wrangler-1289 dev path/to/script.js

Since we use a facade worker with `--assets`, an entry point is not strictly necessary. This makes a common usecase of "deploy a bunch of static assets" extremely easy to start, as a one liner `npx wrangler dev --assets path/to/folder` (and same with `publish`).
@threepointone threepointone changed the title feat: entry point is not mandatory if --experimental-public is passed feat: entry point is not mandatory if --assets is passed Jun 17, 2022
@threepointone threepointone merged commit 0d6098c into main Jun 17, 2022
@threepointone threepointone deleted the assets-default-worker branch June 17, 2022 17:52
@github-actions github-actions bot mentioned this pull request Jun 17, 2022
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