Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] worker-build -h is confusing, because it prints help text for wasm-pack build instead #739

@eric-seppanen

Description

@eric-seppanen

Is there an existing issue for this?

  • I have searched the existing issues

What version of workers-rs are you using?

n/a

What version of wrangler are you using?

n/a

Describe the bug

with worker-build 0.1.2 installed:

$ worker-build -h
Error: Everything required to configure and run the `wasm-pack build` command

Usage: --no-typescript [OPTIONS] [PATH] [EXTRA_OPTIONS]...

Arguments:
  [PATH]              The path to the Rust crate. If not set, searches up the path from the current directory
  [EXTRA_OPTIONS]...  List of extra options to pass to `cargo build`

Options:
  -s, --scope <SCOPE>        The npm scope to use in package.json, if any
  -m, --mode <MODE>          Sets steps to be run. [possible values: no-install, normal, force] [default: normal]
      --no-typescript        By default a *.d.ts file is generated for the generated JS file, but this flag will disable generating this TypeScript file
      --weak-refs            Enable usage of the JS weak references proposal
      --reference-types      Enable usage of WebAssembly reference types
  -t, --target <TARGET>      Sets the target environment. [possible values: bundler, nodejs, web, no-modules, deno] [default: bundler]
      --debug                Deprecated. Renamed to `--dev`
      --dev                  Create a development build. Enable debug info, and disable optimizations
      --release              Create a release build. Enable optimizations and disable debug info
      --profiling            Create a profiling build. Enable optimizations and debug info
  -d, --out-dir <OUT_DIR>    Sets the output directory with a relative path [default: pkg]
      --out-name <OUT_NAME>  Sets the output file names. Defaults to package name
      --no-pack              Option to not generate a package.json
      --no-opt               Option to skip optimization with wasm-opt
  -h, --help                 Print help

It looks as though worker-build propagated the -h flag to a wasm-pack build command, which then printed its help text.

This is confusing and not helpful. For example, it led me to believe that I could run worker-build --out-dir foo, which doesn't work because worker-build already supplied that argument (and it can't be specified twice).

Steps To Reproduce

  1. Run worker-build -h (in any directory; no project needed); produces the help text above.
  2. After reading the help text, get confused and try worker build --out-dir foo, which returns an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions