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

bundle-* commands don't support the purs --output option #216

Closed
stkb opened this issue May 27, 2019 · 5 comments
Closed

bundle-* commands don't support the purs --output option #216

stkb opened this issue May 27, 2019 · 5 comments

Comments

@stkb
Copy link
Contributor

stkb commented May 27, 2019

If you want your output dir as anything other than /output, then using this is fine:

spago build -- --output outputDir

However this doesn't work...

spago bundle-app --to index.js -- --output outputDir

...because although it compiles the .purs files into outputDir, It then runs the purs bundle command with "output" hardcoded:

Running command: `purs bundle "output/*/*.js" -m Main --main Main -o index.js`
purs bundle: No input files.

I guess the solution would be either to detect the --output/-o args passed to the purs compiler, or possibly to add an --output option to spago itself? An entry in spago.dhall would also be nice, if you're going that way.

@f-f
Copy link
Member

f-f commented May 27, 2019

@stkb great catch!

And yeah I agree with your analysis, we could either detect the --output in the args being passed to purs, or if this is too tricky we can add the --output flag to all the relevant commands, so we could just use that for everything. (I guess the question in this case would be "but what happens when we pass the --output to purs but the user also adds it as an extra argument for purs?")

I think adding adding an entry to spago.dhall is also a good idea, but a proper handling of the flags is necessary either way (because e.g. you might want to override the config value with a flag)

@stkb
Copy link
Contributor Author

stkb commented May 27, 2019

Good points. This kinda opened up a can of worms 😃, but after having thought through all the options, I think it's fairly simple.

Currently, args specified after -- don't get added to the purs bundle command, only to purs compile I don't know if this was a conscious decision, but I think it should stay this way for simplicity (at least for now).

There are however two purs bundle options not currently supported by spago (--namespace and --source-maps), but I think that's ok; you can say: spago bundle-* is just a convenience command. If you want all the options, you can do spago build && purs bundle ... instead.

If there's config option for the output dir in spago.dhall, I guess I don't really also need an --output arg for spago? (Since all it does is save a few characters over -- --output, which I can use if I really need to override the config).

So it's then just detecting use of -- --output in the bundle- commands too.

I guess I could have a go at this.

@coot
Copy link

coot commented Jun 13, 2020

zephyr reads from output writes to dce-output; it would be nice if:

spago bundle-app -s --output dce-output

would read from the output directory to create the bundle.

@f-f
Copy link
Member

f-f commented Jun 13, 2020

Yes! These days we even sort-of-detect when the --output option is provided as a purs arg, so we could:

  • add a output flag to spago itself
  • detect when this flag is passed as a purs argument, and issue an error/warning pointing to the --output flag instead

@f-f
Copy link
Member

f-f commented Sep 16, 2023

All commands that perform a build now support the --output option

@f-f f-f closed this as completed Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants