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

Poor performance because wrangler is not cached or in-lined #60

Open
ari-becker opened this issue Feb 15, 2023 · 2 comments
Open

Poor performance because wrangler is not cached or in-lined #60

ari-becker opened this issue Feb 15, 2023 · 2 comments

Comments

@ari-becker
Copy link

ari-becker commented Feb 15, 2023

This action invokes npx wrangler via the shell:

$$ npx wrangler@2 pages publish "${directory}" --project-name="${projectName}" --branch="${branch}"

This causes NPM to re-download and re-install wranger on each invocation of this action.

image

Notice how there is an NPM warning that it will need to install wrangler.

We're considering migrating from Netlify to Cloudflare Pages - to deploy the same site, nwtgck/actions-netlify takes 2 seconds while this action takes 19 seconds.

image

If wrangler was in-lined / cached by this action, the deployment would take much less time to finish.

ari-becker added a commit to ari-becker/pages-action that referenced this issue Feb 15, 2023
@ari-becker ari-becker changed the title Poor performance because a dist folder is not used Poor performance because wrangler is not cached Mar 1, 2023
@ari-becker ari-becker changed the title Poor performance because wrangler is not cached Poor performance because wrangler is not cached or in-lined Mar 1, 2023
@WalshyDev
Copy link
Member

Once we have more of the Wrangler API built out we could use it as a dependency + bundle it into the action. Right now, however, we cannot.

We could theoretically use cache here, I'm not too sure it'll make a big improvement. 19 seconds is still a pretty short time.
I'll leave this open to consider though.

@aaronadamsCA
Copy link
Contributor

Unless I'm missing something:

Given the Wrangler CLI is already an NPM package, is there any reason it doesn't export its main program to be invoked programmatically? It wouldn't increase the API surface of that package at all, but it would allow this package to import main and call it directly, at which point it would also allow this package to esbuild that package into the shipped JavaScript file. It would also resolve #74 and #75.

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 a pull request may close this issue.

3 participants