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

fix(cli): use npm run tauri -- foo for correctly passing args to tauri #6448

Merged
merged 2 commits into from
Mar 16, 2023

Conversation

meowtec
Copy link
Contributor

@meowtec meowtec commented Mar 14, 2023

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

If use npm run tauri android init for generating Android project, we will get some error like this when run dev:

error: unexpected argument 'aarch64' found
Usage: npm run tauri android android-studio-script [OPTIONS]
For more information, try '--help'.

Executed commandis:

npm run  tauri android android-studio-script --target aarch64

NPM will consume argument --target, then pass android android-studio-script aarch64 to tauri.

When using npm, we should use -- for passing args into tauri.

Instead, we should use npm run tauri -- android android-studio-script --target aarch64.

The minimum case is npm run tauri -v which will output NPM version.

I have tested with pnpm and yarn,

Also see npm/npm#5518

@meowtec meowtec requested review from a team as code owners March 14, 2023 11:55
@meowtec meowtec changed the title fix(cli): use npm run tauri -- foo for correctly pass args to tauri fix(cli): use npm run tauri -- foo for correctly passing args to tauri Mar 14, 2023
.github/ISSUE_TEMPLATE/bug_report.yml Outdated Show resolved Hide resolved
ARCHITECTURE.md Outdated
@@ -113,7 +113,7 @@ Once everything is installed, you can run:
```
yarn tauri dev
-or-
npm run tauri dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -32,7 +32,7 @@ $ npm install
# with yarn
$ yarn tauri dev
# with npm
$ npm run tauri dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -33,7 +33,7 @@ $ yarn package
# with yarn
$ yarn tauri dev
# with npm
$ npm run tauri dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -33,7 +33,7 @@ $ yarn package
# with yarn
$ yarn tauri dev
# with npm
$ npm run tauri dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

amrbashir
amrbashir previously approved these changes Mar 14, 2023
@FabianLars
Copy link
Member

Judging from this single example:

npm run tauri android android-studio-script --target aarch64

I don't think this is something that needs changes inside tauri right? Aren't we just talking about this:

npm run tauri android android-studio-script -- --target aarch64

(note the extra --)

I mean, this is an issue with all commands (including desktop ones) so wouldn't we just make it inconsistent with this change?

Sorry if i'm missing something obvious here.

@meowtec
Copy link
Contributor Author

meowtec commented Mar 14, 2023

@FabianLars Mobile is special:

Judging from this single example:

npm run tauri android android-studio-script --target aarch64

I don't think this is something that needs changes inside tauri right? Aren't we just talking about this:

npm run tauri android android-studio-script -- --target aarch64

(note the extra --)

I mean, this is an issue with all commands (including desktop ones) so wouldn't we just make it inconsistent with this change?

Sorry if i'm missing something obvious here.

For desktop, it is simple to add -- before arguments. (And there should be some alert / advice in docs, in the future)

But mobile platform is different: the command ...android-studio-script --target ... is automatically generated into Android project by android init command, and executed by gradle, not explicitly / manually. So it is required to change tauri's code.

@lucasfernog lucasfernog merged commit 1b343bd into tauri-apps:next Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants