question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom CLI arguments failing in version 3.0.5

See original GitHub issue

Do you want to request a feature or report a bug?

Reporting a bug

What is the current behaviour?

When upgrading an application to 3.0.5, custom CLI arguments no longer work and throw an error when attempting to run via “npm run dev”. This behavior works in 3.0.3, so something with the upgrade removed the ability to do this. This seems to be a breaking change, as projects using custom CLI commands will no longer work post-upgrade.

Custom CLI arguments are insanely useful for providing global variables and customizing behavior based on things like instance or client - and the breaking change caused by the minor version upgrade should be prevented in any case, as applications using custom CLI arguments no longer function when upgraded from 3.0.3 to 3.0.5.

Thank you much for the help!

If the current behaviour is a bug, please provide the steps to reproduce.

  1. In a preact application with preact-cli@3.0.3, add a custom CLI argument to the “dev” script in the package.json file. This can be a fresh project made from “preact create”

"dev": "preact watch --port 9090 --CUSTOM my-value",

  1. Run the script via “npm run dev”. This should work fine and the application should start.

  2. Upgrade to preact-cli@3.0.5

  3. Run the script again via “npm run dev” and note that the script fails with the following error.

× ERROR Invalid argument CUSTOM passed to watch. Please refer to 'preact watch --help' for full list of options.

image

What is the expected behaviour?

Custom CLI arguments should be accepted, or some other way to provide custom parameters should be provided.

If this is a feature request, what is motivation or use case for changing the behaviour?

Please mention other relevant information.

Please paste the results of preact info here.

System: OS: Windows 10 10.0.18363 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Binaries: Node: 12.16.1 - C:\Program Files\nodejs\node.EXE npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 87.0.4280.141 Edge: Spartan (44.18362.449.0) npmPackages: preact: ^10.3.2 => 10.5.9 preact-cli: ^3.0.5 => 3.0.5 preact-render-to-string: ^5.1.4 => 5.1.12 preact-router: ^3.2.1 => 3.2.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rschristiancommented, Jan 12, 2021

@Dmurl5 Looks like custom flags will be a no-go. Environment variables are the way to go for that.

1reaction
rschristiancommented, Jan 11, 2021

We can leave this open for now, wait for feedback.

You don’t have to use cross-env, but it seems like Windows is quite touchy about white space which seemed like a hassle. Here’s SO thread with a few solutions, not sure which would work for you: https://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-on-windows

If you are an organization which could be cross platform, cross-env is the simplest solution usually.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Custom CLI arguments failing in version 3.0.5 -
Custom CLI arguments failing in version 3.0.5 · Run the script via "npm run dev". This should work fine and the application should...
Read more >
Detected Maven Version: 3.0.5 is not in the allowed range 3.2
It is the jpmml-project to evaluate some pmml file. Now I got this error: Rule 0: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message: ...
Read more >
Command-Line Options - Win32 apps | Microsoft Learn
Command-line options for msiexec.exe for Windows Installer 3.0 and earlier. Provides a table showing options, parameters, and descriptions.
Read more >
OpenSSL 3.0 - OpenSSLWiki
To complete the installation you need to run the 'fipsinstall' command line application. This does 2 things: Runs the FIPS module self tests ......
Read more >
Command-line API | Node.js v19.3.0 Documentation
Command-line API ... Pass the rest of the arguments to the script. ... Specify the module of a custom experimental ECMAScript module loader....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found