snapshot of https://github.com/tauri-apps/tauri.git (dev, 2026-09-23; blobs > 131072B omitted)
Some checks failed
Audit / audit-js (push) Failing after 0s
bench / bench (map[os:ubuntu-latest runner:xvfb-run --auto-servernum target:x86_64-unknown-linux-gnu], nightly) (push) Failing after 0s
covector version or publish / run-integration-tests (ubuntu-latest) (push) Failing after 0s
Audit / audit-rust (push) Failing after 0s
test `@tauri-apps/cli` / test (ubuntu-latest) (push) Failing after 0s
test `tauri-cli` / test (map[os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
deploy schema worker / deploy (push) Failing after 0s
lint rust / clippy (map[cargo:cargo include: os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
lint rust / clippy (map[cargo:cross include:--package api os:ubuntu-latest target:aarch64-linux-android]) (push) Failing after 0s
supply chain health status / check rust dependencies with cargo vet (push) Failing after 0s
test `@tauri-apps/api` e2e (mobile) / android (push) Failing after 0s
test `@tauri-apps/api` e2e / test (map[name:Linux os:ubuntu-latest]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
Udeps / changes (push) Failing after 0s
Udeps / setup (push) Has been skipped
Udeps / udeps (push) Has been skipped
bench / bench (map[os:macos-latest runner: target:aarch64-apple-darwin], nightly) (push) Has been cancelled
bench / bench (map[os:windows-latest runner: target:x86_64-pc-windows-msvc], nightly) (push) Has been cancelled
covector version or publish / run-integration-tests (macos-latest) (push) Has been cancelled
covector version or publish / run-integration-tests (windows-latest) (push) Has been cancelled
covector version or publish / version-or-publish (push) Has been cancelled
test `@tauri-apps/cli` / test (macos-latest) (push) Has been cancelled
test `tauri-cli` / test (map[args:--no-default-features --features native-tls-vendored os:windows-latest restore-only:true target:aarch64-pc-windows-msvc]) (push) Has been cancelled
test `tauri-cli` / test (map[os:macos-latest target:x86_64-apple-darwin]) (push) Has been cancelled
test `tauri-cli` / test (map[os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:macos-latest target:aarch64-apple-darwin]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include:--package api os:macos-latest target:aarch64-apple-ios]) (push) Has been cancelled
test `@tauri-apps/api` e2e (mobile) / ios (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:Windows os:windows-latest]) (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:macOS os:macos-latest]) (push) Has been cancelled
test `@tauri-apps/cli` / test (windows-latest) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
Some checks failed
Audit / audit-js (push) Failing after 0s
bench / bench (map[os:ubuntu-latest runner:xvfb-run --auto-servernum target:x86_64-unknown-linux-gnu], nightly) (push) Failing after 0s
covector version or publish / run-integration-tests (ubuntu-latest) (push) Failing after 0s
Audit / audit-rust (push) Failing after 0s
test `@tauri-apps/cli` / test (ubuntu-latest) (push) Failing after 0s
test `tauri-cli` / test (map[os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:ubuntu-latest target:x86_64-unknown-linux-gnu toolchain:1.90]) (push) Failing after 0s
test core / test (map[args:--no-default-features key:no-default], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
deploy schema worker / deploy (push) Failing after 0s
lint rust / clippy (map[cargo:cargo include: os:ubuntu-latest target:x86_64-unknown-linux-gnu]) (push) Failing after 0s
lint rust / clippy (map[cargo:cross include:--package api os:ubuntu-latest target:aarch64-linux-android]) (push) Failing after 0s
supply chain health status / check rust dependencies with cargo vet (push) Failing after 0s
test `@tauri-apps/api` e2e (mobile) / android (push) Failing after 0s
test `@tauri-apps/api` e2e / test (map[name:Linux os:ubuntu-latest]) (push) Failing after 0s
test core / test (map[args:--all-features key:all], map[cargo:cross command:build os:ubuntu-latest target:aarch64-linux-android toolchain:1.90]) (push) Failing after 0s
Udeps / changes (push) Failing after 0s
Udeps / setup (push) Has been skipped
Udeps / udeps (push) Has been skipped
bench / bench (map[os:macos-latest runner: target:aarch64-apple-darwin], nightly) (push) Has been cancelled
bench / bench (map[os:windows-latest runner: target:x86_64-pc-windows-msvc], nightly) (push) Has been cancelled
covector version or publish / run-integration-tests (macos-latest) (push) Has been cancelled
covector version or publish / run-integration-tests (windows-latest) (push) Has been cancelled
covector version or publish / version-or-publish (push) Has been cancelled
test `@tauri-apps/cli` / test (macos-latest) (push) Has been cancelled
test `tauri-cli` / test (map[args:--no-default-features --features native-tls-vendored os:windows-latest restore-only:true target:aarch64-pc-windows-msvc]) (push) Has been cancelled
test `tauri-cli` / test (map[os:macos-latest target:x86_64-apple-darwin]) (push) Has been cancelled
test `tauri-cli` / test (map[os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:macos-latest target:aarch64-apple-darwin]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include: os:windows-latest target:x86_64-pc-windows-msvc]) (push) Has been cancelled
lint rust / clippy (map[cargo:cargo include:--package api os:macos-latest target:aarch64-apple-ios]) (push) Has been cancelled
test `@tauri-apps/api` e2e (mobile) / ios (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:Windows os:windows-latest]) (push) Has been cancelled
test `@tauri-apps/api` e2e / test (map[name:macOS os:macos-latest]) (push) Has been cancelled
test `@tauri-apps/cli` / test (windows-latest) (push) Has been cancelled
test core / test (map[args:--all-features key:all], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:build os:macos-latest target:aarch64-apple-ios toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:macos-14 target:aarch64-apple-darwin toolchain:1.90]) (push) Has been cancelled
test core / test (map[args:--no-default-features key:no-default], map[cargo:cargo command:test os:windows-latest target:x86_64-pc-windows-msvc toolchain:1.90]) (push) Has been cancelled
This commit is contained in:
23
packages/cli/.cargo/config.toml
Normal file
23
packages/cli/.cargo/config.toml
Normal file
@@ -0,0 +1,23 @@
|
||||
# napi-rs can't handle custom target-dir configs yet so we make sure it's set to the default
|
||||
[build]
|
||||
target-dir = "target"
|
||||
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
linker = "aarch64-linux-gnu-gcc"
|
||||
|
||||
[target.aarch64-unknown-linux-musl]
|
||||
linker = "aarch64-linux-musl-gcc"
|
||||
rustflags = ["-C", "target-feature=-crt-static"]
|
||||
|
||||
[target.armv7-unknown-linux-gnueabihf]
|
||||
linker = "arm-linux-gnueabihf-gcc"
|
||||
|
||||
[target.riscv64gc-unknown-linux-gnu]
|
||||
linker = "riscv64-linux-gnu-gcc"
|
||||
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
rustflags = ["-C", "target-feature=+crt-static"]
|
||||
[target.i686-pc-windows-msvc]
|
||||
rustflags = ["-C", "target-feature=+crt-static"]
|
||||
[target.aarch64-pc-windows-msvc]
|
||||
rustflags = ["-C", "target-feature=+crt-static"]
|
||||
2
packages/cli/.gitignore
vendored
Normal file
2
packages/cli/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# debug builds of NAPI
|
||||
*.node
|
||||
14
packages/cli/.npmignore
Normal file
14
packages/cli/.npmignore
Normal file
@@ -0,0 +1,14 @@
|
||||
target
|
||||
Cargo.lock
|
||||
.cargo
|
||||
.github
|
||||
npm
|
||||
test
|
||||
.eslintrc
|
||||
.prettierignore
|
||||
rustfmt.toml
|
||||
*.node
|
||||
__tests__
|
||||
src
|
||||
Cargo.toml
|
||||
build.rs
|
||||
24
packages/cli/Cargo.toml
Normal file
24
packages/cli/Cargo.toml
Normal file
@@ -0,0 +1,24 @@
|
||||
[package]
|
||||
edition = "2024"
|
||||
name = "tauri-cli-node"
|
||||
version = "0.0.0"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
napi = "3.12.2"
|
||||
napi-derive = "3.6.3"
|
||||
tauri-cli = { path = "../../crates/tauri-cli", default-features = false }
|
||||
log = "0.4.21"
|
||||
|
||||
[build-dependencies]
|
||||
napi-build = "2.4.1"
|
||||
|
||||
[features]
|
||||
default = ["tauri-cli/default"]
|
||||
native-tls = ["tauri-cli/native-tls"]
|
||||
native-tls-vendored = ["tauri-cli/native-tls-vendored"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
177
packages/cli/LICENSE-APACHE-2.0
Normal file
177
packages/cli/LICENSE-APACHE-2.0
Normal file
@@ -0,0 +1,177 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
21
packages/cli/LICENSE-MIT
Normal file
21
packages/cli/LICENSE-MIT
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 - Present Tauri Apps Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
52
packages/cli/README.md
Normal file
52
packages/cli/README.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# @tauri-apps/cli
|
||||
|
||||
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png" height="128" width="128">
|
||||
|
||||
[](https://github.com/tauri-apps/tauri/tree/dev)
|
||||
[](https://opencollective.com/tauri)
|
||||
[](https://github.com/tauri-apps/tauri/actions/workflows/test-cli-js.yml)
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Ftauri-apps%2Ftauri?ref=badge_shield)
|
||||
[](https://discord.gg/SpmNs4S)
|
||||
[](https://tauri.app)
|
||||
[](https://good-labs.github.io/greater-good-affirmation)
|
||||
[](https://opencollective.com/tauri)
|
||||
|
||||
| Component | Version |
|
||||
| --------------- | ----------------------------------------------------- |
|
||||
| @tauri-apps/cli |  |
|
||||
|
||||
## About Tauri
|
||||
|
||||
Tauri is a polyglot and generic system that is very composable and allows engineers to make a wide variety of applications. It is used for building applications for Desktop Computers using a combination of Rust tools and HTML rendered in a Webview. Apps built with Tauri can ship with any number of pieces of an optional JS API / Rust API so that webviews can control the system via message passing. In fact, developers can extend the default API with their own functionality and bridge the Webview and Rust-based backend easily.
|
||||
|
||||
Tauri apps can have custom menus and have tray-type interfaces. They can be updated, and are managed by the user's operating system as expected. They are very small, because they use the system's webview. They do not ship a runtime, since the final binary is compiled from rust. This makes the reversing of Tauri apps not a trivial task.
|
||||
|
||||
## This module
|
||||
|
||||
Written in Typescript and packaged such that it can be used with `npm`, `pnpm`, `yarn`, and `bun`, this library provides a node.js runner for common tasks when using Tauri, like `pnpm tauri dev`. For the most part it is a wrapper around [tauri-cli](https://github.com/tauri-apps/tauri/blob/dev/crates/tauri-cli).
|
||||
|
||||
To learn more about the details of how all of these pieces fit together, please consult this [ARCHITECTURE.md](https://github.com/tauri-apps/tauri/blob/dev/ARCHITECTURE.md) document.
|
||||
|
||||
## Installation
|
||||
|
||||
The preferred method is to install this module locally as a development dependency:
|
||||
|
||||
```
|
||||
$ pnpm add -D @tauri-apps/cli
|
||||
$ yarn add -D @tauri-apps/cli
|
||||
$ npm add -D @tauri-apps/cli
|
||||
```
|
||||
|
||||
## Semver
|
||||
|
||||
**tauri** is following [Semantic Versioning 2.0](https://semver.org/).
|
||||
|
||||
## Licenses
|
||||
|
||||
Code: (c) 2019 - 2021 - The Tauri Programme within The Commons Conservancy.
|
||||
|
||||
MIT or MIT/Apache 2.0 where applicable.
|
||||
|
||||
Logo: CC-BY-NC-ND
|
||||
|
||||
- Original Tauri Logo Designs by [Daniel Thompson-Yvetot](https://github.com/nothingismagick) and [Guillaume Chau](https://github.com/akryum)
|
||||
1
packages/cli/__tests__/fixtures/empty/.gitignore
vendored
Normal file
1
packages/cli/__tests__/fixtures/empty/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
src-tauri
|
||||
6
packages/cli/__tests__/fixtures/empty/dist/index.html
vendored
Normal file
6
packages/cli/__tests__/fixtures/empty/dist/index.html
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
||||
5
packages/cli/__tests__/fixtures/empty/package.json
Normal file
5
packages/cli/__tests__/fixtures/empty/package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": ""
|
||||
}
|
||||
}
|
||||
89
packages/cli/__tests__/template.spec.ts
Normal file
89
packages/cli/__tests__/template.spec.ts
Normal file
@@ -0,0 +1,89 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { resolve } from 'node:path'
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import {
|
||||
existsSync,
|
||||
readFileSync,
|
||||
writeFileSync,
|
||||
rmSync,
|
||||
renameSync
|
||||
} from 'node:fs'
|
||||
import { beforeAll, describe, it } from 'vitest'
|
||||
|
||||
// Build CLI before tests, for local usage only.
|
||||
// CI builds the CLI on different platforms and architectures
|
||||
if (!process.env.CI) {
|
||||
beforeAll(() => {
|
||||
const cliDir = resolve(__dirname, '..')
|
||||
exec('pnpm', ['build:debug'], { cwd: cliDir })
|
||||
})
|
||||
}
|
||||
|
||||
describe('[CLI] @tauri-apps/cli template', () => {
|
||||
it('init a project and builds it', { timeout: 15 * 60 * 1000 }, async () => {
|
||||
const cwd = process.cwd()
|
||||
const fixturePath = resolve(__dirname, './fixtures/empty')
|
||||
const tauriFixturePath = resolve(fixturePath, 'src-tauri')
|
||||
const outPath = resolve(tauriFixturePath, 'target')
|
||||
const cacheOutPath = resolve(fixturePath, 'target')
|
||||
|
||||
process.chdir(fixturePath)
|
||||
|
||||
const outExists = existsSync(outPath)
|
||||
if (outExists) {
|
||||
if (existsSync(cacheOutPath)) {
|
||||
rmSync(cacheOutPath, { recursive: true, force: true })
|
||||
}
|
||||
renameSync(outPath, cacheOutPath)
|
||||
}
|
||||
|
||||
const cli = await import('../main.js')
|
||||
|
||||
await cli.run([
|
||||
'init',
|
||||
'-vv',
|
||||
'--directory',
|
||||
process.cwd(),
|
||||
'--force',
|
||||
'--tauri-path',
|
||||
resolve(__dirname, '../../..'),
|
||||
'--before-build-command',
|
||||
'',
|
||||
'--before-dev-command',
|
||||
'',
|
||||
'--ci'
|
||||
])
|
||||
|
||||
if (outExists) {
|
||||
renameSync(cacheOutPath, outPath)
|
||||
}
|
||||
|
||||
process.chdir(tauriFixturePath)
|
||||
|
||||
const manifestPath = resolve(tauriFixturePath, 'Cargo.toml')
|
||||
const manifestFile = readFileSync(manifestPath).toString()
|
||||
writeFileSync(manifestPath, `workspace = { }\n${manifestFile}`)
|
||||
|
||||
const configPath = resolve(tauriFixturePath, 'tauri.conf.json')
|
||||
const config = readFileSync(configPath).toString()
|
||||
writeFileSync(configPath, config.replace('com.tauri.dev', 'com.tauri.test'))
|
||||
|
||||
await cli.run(['build', '-vv'])
|
||||
process.chdir(cwd)
|
||||
})
|
||||
})
|
||||
|
||||
function exec(
|
||||
bin: string,
|
||||
args?: string[],
|
||||
opts?: {
|
||||
cwd?: string
|
||||
}
|
||||
) {
|
||||
process.platform === 'win32'
|
||||
? spawnSync('cmd', ['/c', bin, ...(args ?? [])], { cwd: opts?.cwd })
|
||||
: spawnSync(bin, args, { cwd: opts?.cwd })
|
||||
}
|
||||
15
packages/cli/append-headers.js
Normal file
15
packages/cli/append-headers.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const HEADERS = `// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT`
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
for (const file of ['index.js', 'index.d.ts']) {
|
||||
const content = fs.readFileSync(file, 'utf8')
|
||||
const newContent = `${HEADERS}\n\n${content}`
|
||||
fs.writeFileSync(file, newContent, 'utf8')
|
||||
}
|
||||
7
packages/cli/build.rs
Normal file
7
packages/cli/build.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
fn main() {
|
||||
::napi_build::setup();
|
||||
}
|
||||
9
packages/cli/index.d.ts
vendored
Normal file
9
packages/cli/index.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/* auto-generated by NAPI-RS */
|
||||
/* eslint-disable */
|
||||
export declare function logError(error: string): void
|
||||
|
||||
export declare function run(args: Array<string>, binName: string | undefined | null, callback: ((err: Error | null, arg: boolean) => any)): void
|
||||
595
packages/cli/index.js
Normal file
595
packages/cli/index.js
Normal file
@@ -0,0 +1,595 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// prettier-ignore
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
/* auto-generated by NAPI-RS */
|
||||
|
||||
const { readFileSync } = require('fs')
|
||||
let nativeBinding = null
|
||||
const loadErrors = []
|
||||
|
||||
const isMusl = () => {
|
||||
let musl = false
|
||||
if (process.platform === 'linux') {
|
||||
musl = isMuslFromFilesystem()
|
||||
if (musl === null) {
|
||||
musl = isMuslFromReport()
|
||||
}
|
||||
if (musl === null) {
|
||||
musl = isMuslFromChildProcess()
|
||||
}
|
||||
}
|
||||
return musl
|
||||
}
|
||||
|
||||
const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
|
||||
|
||||
const isMuslFromFilesystem = () => {
|
||||
try {
|
||||
return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
const isMuslFromReport = () => {
|
||||
let report = null
|
||||
if (process.report && typeof process.report.getReport === 'function') {
|
||||
process.report.excludeNetwork = true
|
||||
report = process.report.getReport()
|
||||
}
|
||||
if (!report) {
|
||||
return null
|
||||
}
|
||||
if (report.header && report.header.glibcVersionRuntime) {
|
||||
return false
|
||||
}
|
||||
if (Array.isArray(report.sharedObjects)) {
|
||||
if (report.sharedObjects.some(isFileMusl)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const isMuslFromChildProcess = () => {
|
||||
try {
|
||||
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
||||
} catch (e) {
|
||||
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function requireNative() {
|
||||
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
||||
try {
|
||||
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
||||
} catch (err) {
|
||||
loadErrors.push(err)
|
||||
}
|
||||
} else if (process.platform === 'android') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./cli.android-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-android-arm64')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-android-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./cli.android-arm-eabi.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-android-arm-eabi')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-android-arm-eabi/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'win32') {
|
||||
if (process.arch === 'x64') {
|
||||
if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
|
||||
try {
|
||||
return require('./cli.win32-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-win32-x64-gnu')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-win32-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./cli.win32-x64-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-win32-x64-msvc')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-win32-x64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'ia32') {
|
||||
try {
|
||||
return require('./cli.win32-ia32-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-win32-ia32-msvc')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-win32-ia32-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./cli.win32-arm64-msvc.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-win32-arm64-msvc')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-win32-arm64-msvc/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'darwin') {
|
||||
try {
|
||||
return require('./cli.darwin-universal.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-darwin-universal')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-darwin-universal/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./cli.darwin-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-darwin-x64')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-darwin-x64/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./cli.darwin-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-darwin-arm64')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-darwin-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'freebsd') {
|
||||
if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./cli.freebsd-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-freebsd-x64')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-freebsd-x64/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./cli.freebsd-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-freebsd-arm64')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-freebsd-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'linux') {
|
||||
if (process.arch === 'x64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./cli.linux-x64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-x64-musl')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-x64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./cli.linux-x64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-x64-gnu')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-x64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'arm64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./cli.linux-arm64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-arm64-musl')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-arm64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./cli.linux-arm64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-arm64-gnu')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-arm64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./cli.linux-arm-musleabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-arm-musleabihf')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-arm-musleabihf/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./cli.linux-arm-gnueabihf.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-arm-gnueabihf')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-arm-gnueabihf/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'loong64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./cli.linux-loong64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-loong64-musl')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-loong64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./cli.linux-loong64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-loong64-gnu')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-loong64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'riscv64') {
|
||||
if (isMusl()) {
|
||||
try {
|
||||
return require('./cli.linux-riscv64-musl.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-riscv64-musl')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-riscv64-musl/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
return require('./cli.linux-riscv64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-riscv64-gnu')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-riscv64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
}
|
||||
} else if (process.arch === 'ppc64') {
|
||||
try {
|
||||
return require('./cli.linux-ppc64-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-ppc64-gnu')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-ppc64-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 's390x') {
|
||||
try {
|
||||
return require('./cli.linux-s390x-gnu.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-linux-s390x-gnu')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-linux-s390x-gnu/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
||||
}
|
||||
} else if (process.platform === 'openharmony') {
|
||||
if (process.arch === 'arm64') {
|
||||
try {
|
||||
return require('./cli.openharmony-arm64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-openharmony-arm64')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-openharmony-arm64/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'x64') {
|
||||
try {
|
||||
return require('./cli.openharmony-x64.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-openharmony-x64')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-openharmony-x64/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else if (process.arch === 'arm') {
|
||||
try {
|
||||
return require('./cli.openharmony-arm.node')
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
try {
|
||||
const binding = require('@tauri-apps/cli-openharmony-arm')
|
||||
const bindingPackageVersion = require('@tauri-apps/cli-openharmony-arm/package.json').version
|
||||
if (bindingPackageVersion !== '2.11.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
||||
throw new Error(`Native binding package version mismatch, expected 2.11.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
||||
}
|
||||
return binding
|
||||
} catch (e) {
|
||||
loadErrors.push(e)
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
||||
}
|
||||
} else {
|
||||
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
||||
}
|
||||
}
|
||||
|
||||
nativeBinding = requireNative()
|
||||
|
||||
// NAPI_RS_FORCE_WASI is a tri-state flag:
|
||||
// unset / any other value → native binding preferred, WASI is only a fallback
|
||||
// 'true' → force WASI fallback even if native loaded
|
||||
// 'error' → force WASI and throw if no WASI binding is found
|
||||
// Treating any non-empty string as truthy (the historical behavior) meant
|
||||
// NAPI_RS_FORCE_WASI=false, NAPI_RS_FORCE_WASI=0, etc. inadvertently triggered
|
||||
// the WASI path, causing ENOENT for packages shipped without a .wasi.cjs file.
|
||||
const forceWasi =
|
||||
process.env.NAPI_RS_FORCE_WASI === 'true' || process.env.NAPI_RS_FORCE_WASI === 'error'
|
||||
|
||||
if (!nativeBinding || forceWasi) {
|
||||
let wasiBinding = null
|
||||
let wasiBindingError = null
|
||||
try {
|
||||
wasiBinding = require('./cli.wasi.cjs')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (forceWasi) {
|
||||
wasiBindingError = err
|
||||
}
|
||||
}
|
||||
if (!nativeBinding || forceWasi) {
|
||||
try {
|
||||
wasiBinding = require('@tauri-apps/cli-wasm32-wasi')
|
||||
nativeBinding = wasiBinding
|
||||
} catch (err) {
|
||||
if (forceWasi) {
|
||||
if (!wasiBindingError) {
|
||||
wasiBindingError = err
|
||||
} else {
|
||||
wasiBindingError.cause = err
|
||||
}
|
||||
loadErrors.push(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
||||
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
||||
error.cause = wasiBindingError
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
if (!nativeBinding) {
|
||||
if (loadErrors.length > 0) {
|
||||
const error = new Error(
|
||||
`Cannot find native binding. ` +
|
||||
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
|
||||
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
|
||||
)
|
||||
// assign instead of the `new Error(message, { cause })` options form,
|
||||
// which Node < 16.9 silently ignores
|
||||
error.cause = loadErrors.reduce((err, cur) => {
|
||||
cur.cause = err
|
||||
return cur
|
||||
})
|
||||
throw error
|
||||
}
|
||||
throw new Error(`Failed to load native binding`)
|
||||
}
|
||||
|
||||
module.exports = nativeBinding
|
||||
module.exports.logError = nativeBinding.logError
|
||||
module.exports.run = nativeBinding.run
|
||||
11
packages/cli/main.d.ts
vendored
Normal file
11
packages/cli/main.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
export function run(
|
||||
args: Array<string>,
|
||||
binName?: string | undefined | null
|
||||
): Promise<void>
|
||||
19
packages/cli/main.js
Normal file
19
packages/cli/main.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const { run, logError } = require('./index')
|
||||
|
||||
module.exports.run = (args, binName) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
run(args, binName, (error, res) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
} else {
|
||||
resolve(res)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
module.exports.logError = logError
|
||||
3
packages/cli/npm/darwin-arm64/README.md
Normal file
3
packages/cli/npm/darwin-arm64/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-darwin-arm64`
|
||||
|
||||
This is the **aarch64-apple-darwin** binary for `@tauri-apps/cli`
|
||||
33
packages/cli/npm/darwin-arm64/package.json
Normal file
33
packages/cli/npm/darwin-arm64/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-darwin-arm64",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"main": "cli.darwin-arm64.node",
|
||||
"files": [
|
||||
"cli.darwin-arm64.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/darwin-x64/README.md
Normal file
3
packages/cli/npm/darwin-x64/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-darwin-x64`
|
||||
|
||||
This is the **x86_64-apple-darwin** binary for `@tauri-apps/cli`
|
||||
33
packages/cli/npm/darwin-x64/package.json
Normal file
33
packages/cli/npm/darwin-x64/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-darwin-x64",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"main": "cli.darwin-x64.node",
|
||||
"files": [
|
||||
"cli.darwin-x64.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/linux-arm-gnueabihf/README.md
Normal file
3
packages/cli/npm/linux-arm-gnueabihf/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-linux-arm-gnueabihf`
|
||||
|
||||
This is the **armv7-unknown-linux-gnueabihf** binary for `@tauri-apps/cli`
|
||||
33
packages/cli/npm/linux-arm-gnueabihf/package.json
Normal file
33
packages/cli/npm/linux-arm-gnueabihf/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-linux-arm-gnueabihf",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"main": "cli.linux-arm-gnueabihf.node",
|
||||
"files": [
|
||||
"cli.linux-arm-gnueabihf.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/linux-arm64-gnu/README.md
Normal file
3
packages/cli/npm/linux-arm64-gnu/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-linux-arm64-gnu`
|
||||
|
||||
This is the **aarch64-unknown-linux-gnu** binary for `@tauri-apps/cli`
|
||||
36
packages/cli/npm/linux-arm64-gnu/package.json
Normal file
36
packages/cli/npm/linux-arm64-gnu/package.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-linux-arm64-gnu",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"main": "cli.linux-arm64-gnu.node",
|
||||
"files": [
|
||||
"cli.linux-arm64-gnu.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/linux-arm64-musl/README.md
Normal file
3
packages/cli/npm/linux-arm64-musl/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-linux-arm64-musl`
|
||||
|
||||
This is the **aarch64-unknown-linux-musl** binary for `@tauri-apps/cli`
|
||||
36
packages/cli/npm/linux-arm64-musl/package.json
Normal file
36
packages/cli/npm/linux-arm64-musl/package.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-linux-arm64-musl",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"main": "cli.linux-arm64-musl.node",
|
||||
"files": [
|
||||
"cli.linux-arm64-musl.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"musl"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/linux-riscv64-gnu/README.md
Normal file
3
packages/cli/npm/linux-riscv64-gnu/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-linux-riscv64-gnu`
|
||||
|
||||
This is the **riscv64gc-unknown-linux-gnu** binary for `@tauri-apps/cli`
|
||||
36
packages/cli/npm/linux-riscv64-gnu/package.json
Normal file
36
packages/cli/npm/linux-riscv64-gnu/package.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-linux-riscv64-gnu",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"main": "cli.linux-riscv64-gnu.node",
|
||||
"files": [
|
||||
"cli.linux-riscv64-gnu.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/linux-x64-gnu/README.md
Normal file
3
packages/cli/npm/linux-x64-gnu/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-linux-x64-gnu`
|
||||
|
||||
This is the **x86_64-unknown-linux-gnu** binary for `@tauri-apps/cli`
|
||||
36
packages/cli/npm/linux-x64-gnu/package.json
Normal file
36
packages/cli/npm/linux-x64-gnu/package.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-linux-x64-gnu",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"main": "cli.linux-x64-gnu.node",
|
||||
"files": [
|
||||
"cli.linux-x64-gnu.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/linux-x64-musl/README.md
Normal file
3
packages/cli/npm/linux-x64-musl/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-linux-x64-musl`
|
||||
|
||||
This is the **x86_64-unknown-linux-musl** binary for `@tauri-apps/cli`
|
||||
36
packages/cli/npm/linux-x64-musl/package.json
Normal file
36
packages/cli/npm/linux-x64-musl/package.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-linux-x64-musl",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"main": "cli.linux-x64-musl.node",
|
||||
"files": [
|
||||
"cli.linux-x64-musl.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"musl"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/win32-arm64-msvc/README.md
Normal file
3
packages/cli/npm/win32-arm64-msvc/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-win32-arm64-msvc`
|
||||
|
||||
This is the **aarch64-pc-windows-msvc** binary for `@tauri-apps/cli`
|
||||
33
packages/cli/npm/win32-arm64-msvc/package.json
Normal file
33
packages/cli/npm/win32-arm64-msvc/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-win32-arm64-msvc",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"main": "cli.win32-arm64-msvc.node",
|
||||
"files": [
|
||||
"cli.win32-arm64-msvc.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/win32-ia32-msvc/README.md
Normal file
3
packages/cli/npm/win32-ia32-msvc/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-win32-ia32-msvc`
|
||||
|
||||
This is the **i686-pc-windows-msvc** binary for `@tauri-apps/cli`
|
||||
33
packages/cli/npm/win32-ia32-msvc/package.json
Normal file
33
packages/cli/npm/win32-ia32-msvc/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-win32-ia32-msvc",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"main": "cli.win32-ia32-msvc.node",
|
||||
"files": [
|
||||
"cli.win32-ia32-msvc.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
}
|
||||
3
packages/cli/npm/win32-x64-msvc/README.md
Normal file
3
packages/cli/npm/win32-x64-msvc/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# `@tauri-apps/cli-win32-x64-msvc`
|
||||
|
||||
This is the **x86_64-pc-windows-msvc** binary for `@tauri-apps/cli`
|
||||
33
packages/cli/npm/win32-x64-msvc/package.json
Normal file
33
packages/cli/npm/win32-x64-msvc/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli-win32-x64-msvc",
|
||||
"version": "0.0.0",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"main": "cli.win32-x64-msvc.node",
|
||||
"files": [
|
||||
"cli.win32-x64-msvc.node"
|
||||
],
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
}
|
||||
67
packages/cli/package.json
Normal file
67
packages/cli/package.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "@tauri-apps/cli",
|
||||
"version": "2.11.4",
|
||||
"description": "Command line interface for building Tauri apps",
|
||||
"type": "commonjs",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/tauri"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||
},
|
||||
"contributors": [
|
||||
"Tauri Programme within The Commons Conservancy"
|
||||
],
|
||||
"license": "Apache-2.0 OR MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/tauri-apps/tauri/issues"
|
||||
},
|
||||
"homepage": "https://github.com/tauri-apps/tauri#readme",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "main.js",
|
||||
"types": "main.d.ts",
|
||||
"napi": {
|
||||
"binaryName": "cli",
|
||||
"targets": [
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-pc-windows-msvc",
|
||||
"x86_64-apple-darwin",
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"aarch64-unknown-linux-musl",
|
||||
"armv7-unknown-linux-gnueabihf",
|
||||
"x86_64-unknown-linux-musl",
|
||||
"riscv64gc-unknown-linux-gnu",
|
||||
"i686-pc-windows-msvc",
|
||||
"aarch64-pc-windows-msvc"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@napi-rs/cli": "3.9.0",
|
||||
"@types/node": "^24.11.0",
|
||||
"cross-env": "10.1.0",
|
||||
"vitest": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10"
|
||||
},
|
||||
"bin": {
|
||||
"tauri": "./tauri.js"
|
||||
},
|
||||
"scripts": {
|
||||
"artifacts": "napi artifacts",
|
||||
"build": "cross-env TARGET=node napi build --platform --profile release-size-optimized",
|
||||
"postbuild": "node append-headers.js",
|
||||
"build:debug": "cross-env TARGET=node napi build --platform",
|
||||
"postbuild:debug": "node append-headers.js",
|
||||
"prepublishOnly": "napi prepublish -t npm --gh-release-id $RELEASE_ID",
|
||||
"prepack": "cp ../../crates/tauri-schema-generator/schemas/config.schema.json .",
|
||||
"version": "napi version",
|
||||
"test": "vitest run",
|
||||
"tauri": "node ./tauri.js"
|
||||
}
|
||||
}
|
||||
53
packages/cli/src/lib.rs
Normal file
53
packages/cli/src/lib.rs
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#![cfg(any(target_os = "macos", target_os = "linux", windows))]
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use napi::{
|
||||
Error, Result, Status,
|
||||
threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode},
|
||||
};
|
||||
|
||||
#[napi_derive::napi]
|
||||
pub fn run(
|
||||
args: Vec<String>,
|
||||
bin_name: Option<String>,
|
||||
callback: Arc<ThreadsafeFunction<bool>>,
|
||||
) -> Result<()> {
|
||||
// we need to run in a separate thread so Node.js consumers
|
||||
// can do work while `tauri dev` is running.
|
||||
std::thread::spawn(move || {
|
||||
let res = match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
||||
tauri_cli::try_run(args, bin_name).inspect_err(|e| eprintln!("{e:#}"))
|
||||
})) {
|
||||
Ok(t) => t,
|
||||
Err(_) => {
|
||||
return callback.call(
|
||||
Err(Error::new(
|
||||
Status::GenericFailure,
|
||||
"Tauri CLI unexpected panic",
|
||||
)),
|
||||
ThreadsafeFunctionCallMode::Blocking,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
match res {
|
||||
Ok(_) => callback.call(Ok(true), ThreadsafeFunctionCallMode::Blocking),
|
||||
Err(e) => callback.call(
|
||||
Err(Error::new(Status::GenericFailure, format!("{e:#}"))),
|
||||
ThreadsafeFunctionCallMode::Blocking,
|
||||
),
|
||||
}
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[napi_derive::napi]
|
||||
pub fn log_error(error: String) {
|
||||
log::error!("{}", error);
|
||||
}
|
||||
57
packages/cli/tauri.js
Normal file
57
packages/cli/tauri.js
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
const cli = require('./main')
|
||||
const path = require('path')
|
||||
|
||||
const [bin, script, ...args] = process.argv
|
||||
const binStem = path.parse(bin).name.toLowerCase()
|
||||
|
||||
// We want to make a helpful binary name for the underlying CLI helper, if we
|
||||
// can successfully detect what command likely started the execution.
|
||||
let binName
|
||||
|
||||
// deno run -A npm:@tauri-apps/cli or deno task tauri
|
||||
if (globalThis.navigator?.userAgent?.includes('Deno')) {
|
||||
binName = bin
|
||||
}
|
||||
// Even if started by a package manager, the binary will be NodeJS.
|
||||
// Some distribution still use "nodejs" as the binary name.
|
||||
else if (/(nodejs|node|bun|electron)-?[0-9]*$/.test(binStem)) {
|
||||
const managerStem = process.env.npm_execpath
|
||||
? path.parse(process.env.npm_execpath).name.toLowerCase()
|
||||
: null
|
||||
if (managerStem) {
|
||||
let manager
|
||||
switch (managerStem) {
|
||||
// Only supported package manager that has a different filename is npm.
|
||||
case 'npm-cli':
|
||||
manager = 'npm'
|
||||
break
|
||||
|
||||
// Yarn, pnpm, and bun have the same stem name as their bin.
|
||||
// We assume all unknown package managers do as well.
|
||||
default:
|
||||
manager = managerStem
|
||||
break
|
||||
}
|
||||
|
||||
binName = `${manager} run ${process.env.npm_lifecycle_event}`
|
||||
} else {
|
||||
// Assume running NodeJS if we didn't detect a manager from the env.
|
||||
// We normalize the path to prevent the script's absolute path being used.
|
||||
const scriptNormal = path.normalize(path.relative(process.cwd(), script))
|
||||
binName = `${binStem} ${scriptNormal}`
|
||||
}
|
||||
} else {
|
||||
// We don't know what started it, assume it's already stripped.
|
||||
args.unshift(bin)
|
||||
}
|
||||
|
||||
cli.run(args, binName).catch((err) => {
|
||||
cli.logError(err.message)
|
||||
process.exit(1)
|
||||
})
|
||||
Reference in New Issue
Block a user