Skip to content

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

Closed

Description

@stkb

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.

Activity

  1. f-f commented on May 27, 2019

    @f-f
    Member

    @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)

  2. stkb commented on May 27, 2019

    @stkb
    ContributorAuthor

    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.

  3. coot commented on Jun 13, 2020

    @coot

    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.

  4. f-f commented on Jun 13, 2020

    @f-f
    Member

    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
  5. f-f commented on Sep 16, 2023

    @f-f
    Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions