Wrangler: Clarity on the respective purposes of build and publish

Created on 21 Feb 2020  路  9Comments  路  Source: cloudflare/wrangler

馃挕 Feature request

Overview and problem statement

I guess this would likely fall into a request for documentation updates...

I just went to set up a CI/CD pipeline for an experimental Cloudflare Worker I am working on and wrangler did not behave how I intuitively expected it to.

I set up a Build stage to my pipeline in which I ran wrangler build, then published the built artifact for consumption in my Deploy stage. Pretty standard stuff I think.

In my Deploy stage I set up wrangler publish and expected it to be responsible for taking the result of wrangler build (a nice lightweight artifact) and publishing it to my Cloudflare account.

Instead it seems like publish essentially needs the full repo source and npm installation all over again, which suggests it is not intended to be combined with build at all, which has left me confused as to the design/intended use-cases of the commands.

Would love to hear your thoughts on this setup and intuition, maybe I have just messed up my approach.

Thanks!

never stale question status - needs design user report

Most helpful comment

This should remain open please

All 9 comments

I agree it is unclear and frustrating to have to build every time on publish. JS developers often know what steps to get a project built and prefer to have control of that. I think rather than documenting this we should consider solving the problem at the design of the CLI level.

Possible solutions:

  • publish --skip-build. Which would simply publish to CF but do no building. Radical, but if this flag gets popular consider sunsetting the old publish to skip builds by default
  • Inwrangler.toml, have type='javascript' not install wasm-pack or build anything it simply talks to CF's API

@victoriabernard92 thanks for acknowledging - I can see you work at Cloudflare, do you help run the project? Would you be willing to accept PRs to implement these proposed solutions?

@JamesHenry while we do accept PRs this proposal needs design from and buy in from our team. I am looking forward to hearing their suggestions and getting back to you.

@victoriabernard92 Are there individuals we can ping to make this a little more concrete?

Again, I am happy to do all the work here, I just need the go ahead

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This should remain open please

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This should remain open please.

@ashleymichal - is there a way I can avoid this now being my job to keep this open? 馃槄

This seems to have been acknowledged by the team as something that could be improved and will be addressed?

it is indeed; it also needs some attention alongside the other wrangler build issues. i think a wrangler publish --skip-build flag could be a good approach to solving the immediate problem; I think it would also benefit from a top-level build_dir setting in wrangler.toml that defaults to the existing build_dir settings.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xtuc picture xtuc  路  5Comments

mxdpeep picture mxdpeep  路  6Comments

tibotiber picture tibotiber  路  6Comments

jahredhope picture jahredhope  路  4Comments

EverlastingBugstopper picture EverlastingBugstopper  路  3Comments