mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-24 19:25:12 +03:00
feat(cli.js): rewrite cli.js with napi-rs, closes #2651,#3287 (#3370)
Co-authored-by: Chip Reed <chip@chip.sh> Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
parent
d218499574
commit
02ac3215ea
@ -255,22 +255,18 @@
|
|||||||
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
||||||
},
|
},
|
||||||
"cli.js": {
|
"cli.js": {
|
||||||
"path": "./tooling/cli.js",
|
"path": "./tooling/cli.rs/node",
|
||||||
"manager": "javascript",
|
"manager": "javascript",
|
||||||
"dependencies": ["cli.rs"],
|
"dependencies": ["cli.rs"],
|
||||||
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
|
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
|
||||||
"assets": [
|
"prepublish": [],
|
||||||
{
|
"publish": [],
|
||||||
"path": "./tooling/cli.js/tauri-apps-cli-${ pkgFile.version }.tgz",
|
"postpublish": []
|
||||||
"name": "cli.js-${ pkgFile.version }.tgz"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"cli.rs": {
|
"cli.rs": {
|
||||||
"path": "./tooling/cli.rs",
|
"path": "./tooling/cli.rs",
|
||||||
"manager": "rust",
|
"manager": "rust",
|
||||||
"dependencies": ["tauri-bundler", "tauri-utils"],
|
"dependencies": ["tauri-bundler", "tauri-utils"]
|
||||||
"postversion": "node ../../.scripts/covector/generate-cli-doc.js && node ../../.scripts/covector/generate-config-doc.js && cargo check"
|
|
||||||
},
|
},
|
||||||
"create-tauri-app": {
|
"create-tauri-app": {
|
||||||
"path": "./tooling/create-tauri-app",
|
"path": "./tooling/create-tauri-app",
|
||||||
|
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@ -19,6 +19,6 @@
|
|||||||
|
|
||||||
/tooling/cli.rs/ @tauri-apps/core
|
/tooling/cli.rs/ @tauri-apps/core
|
||||||
|
|
||||||
/tooling/cli.js/ @tauri-apps/js-cli
|
/tooling/cli.rs/node/ @tauri-apps/js-cli
|
||||||
|
|
||||||
/core/** @tauri-apps/core
|
/core/** @tauri-apps/core
|
||||||
|
15
.github/CONTRIBUTING.md
vendored
15
.github/CONTRIBUTING.md
vendored
@ -49,7 +49,7 @@ Hi! We, the maintainers, are really excited that you are interested in contribut
|
|||||||
|
|
||||||
First, [join our Discord server](https://discord.gg/SpmNs4S) and let us know that you want to contribute. This way we can point you in the right direction and help ensure your contribution will be as helpful as possible.
|
First, [join our Discord server](https://discord.gg/SpmNs4S) and let us know that you want to contribute. This way we can point you in the right direction and help ensure your contribution will be as helpful as possible.
|
||||||
|
|
||||||
To set up your machine for development, follow the [Tauri setup guide](https://tauri.studio/en/docs/get-started/intro#setting-up-your-environment) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [Yarn](https://yarnpkg.com/), it is only required if you are developing the Node CLI/API (`tooling/cli.js` and `api`). Next, fork and clone this repo. It is structured as a monorepo, which means that all the various Tauri packages are under the same repository. The development process varies depending on what part of Tauri you are contributing to, see the guides below for per-package instructions.
|
To set up your machine for development, follow the [Tauri setup guide](https://tauri.studio/en/docs/get-started/intro#setting-up-your-environment) to get all the tools you need to develop Tauri apps. The only additional tool you may need is [Yarn](https://yarnpkg.com/), it is only required if you are developing the Node CLI or API packages (`tooling/cli.rs/node` and `tooling/api`). Next, fork and clone this repo. It is structured as a monorepo, which means that all the various Tauri packages are under the same repository. The development process varies depending on what part of Tauri you are contributing to, see the guides below for per-package instructions.
|
||||||
|
|
||||||
Some Tauri packages will be automatically built when running one of the examples. Others, however, will need to be built beforehand. To build these automatically, run the `.scripts/setup.sh` (Linux and macOS) or `.scripts/setup.ps1` (Windows) script. This will install the Rust and Node.js CLI and build the JS API. After that, you should be able to run all the examples. Note that the setup script should be executed from the root folder of the respository in order to run correctly.
|
Some Tauri packages will be automatically built when running one of the examples. Others, however, will need to be built beforehand. To build these automatically, run the `.scripts/setup.sh` (Linux and macOS) or `.scripts/setup.ps1` (Windows) script. This will install the Rust and Node.js CLI and build the JS API. After that, you should be able to run all the examples. Note that the setup script should be executed from the root folder of the respository in order to run correctly.
|
||||||
|
|
||||||
@ -57,23 +57,14 @@ Some Tauri packages will be automatically built when running one of the examples
|
|||||||
|
|
||||||
- The JS API (`/tooling/api`) contains JS bindings to the builtin Rust functions in the Rust API.
|
- The JS API (`/tooling/api`) contains JS bindings to the builtin Rust functions in the Rust API.
|
||||||
- The Rust CLI (`/tooling/cli.rs`) is the primary CLI for creating and developing Tauri apps.
|
- The Rust CLI (`/tooling/cli.rs`) is the primary CLI for creating and developing Tauri apps.
|
||||||
- cli.js (`/tooling/cli.js`) is a Node.js CLI wrapper for `cli.rs`.
|
- cli.js (`/tooling/cli.rs/node`) is a Node.js CLI wrapper for `cli.rs`.
|
||||||
- Tauri Bundler (`/tooling/bundler`) is used by the Rust CLI to package executables into installers.
|
- Tauri Bundler (`/tooling/bundler`) is used by the Rust CLI to package executables into installers.
|
||||||
- Tauri Core (`/core/tauri`) is the heart of Tauri. It contains the code that starts the app, configures communication between Rust and the Webview, and ties all the other packages together.
|
- Tauri Core (`/core/tauri`) is the heart of Tauri. It contains the code that starts the app, configures communication between Rust and the Webview, and ties all the other packages together.
|
||||||
- The Macros (`/core/tauri-macros`) are used by Tauri Core for various functions.
|
- The Macros (`/core/tauri-macros`) are used by Tauri Core for various functions.
|
||||||
|
|
||||||
### Developing The Node.js CLI (cli.js)
|
### Developing The Node.js CLI (cli.js)
|
||||||
|
|
||||||
`cli.js` is a CLI tool that houses the `icon`, and `deps` command. The code for cli.js is located in `[Tauri repo root]/tooling/cli.js`. There are a few package scripts you should be aware of:
|
`cli.js` is a wrapper to `cli.rs` so most changes should be written on the Rust CLI. The `[Tauri repo root]/tooling/cli.rs/node` folder contains only packaging scripts to properly publish the Rust CLI binaries to NPM.
|
||||||
|
|
||||||
- `build` builds the CLI
|
|
||||||
- `test` runs the unit and e2e test suite
|
|
||||||
- `lint` runs ESLint to catch linting errors
|
|
||||||
- `format` formats code with Prettier to match the style guide
|
|
||||||
|
|
||||||
To test your changes, we recommend using the helloworld example app, located in `[Tauri repo root]/examples/helloworld`. Run `yarn tauri [COMMAND]` to run a command using your local cli.js copy. You will need to rebuild cli.js after every change by running `yarn build` in the cli.js directory.
|
|
||||||
|
|
||||||
If you want to use your local copy of cli.js in another app, we recommend using [yarn link](https://classic.yarnpkg.com/en/docs/cli/link/). First, make sure you have don't have cli.js installed globally by running `npm uninstall -g tauri && yarn global remove tauri`. Then, run `yarn link` in the cli.js directory (note that the setup script will do this for you, so you can skip this step if you ran that). Now, you can just run `tauri [COMMAND]` anywhere, and your local copy will be used.
|
|
||||||
|
|
||||||
### Developing Tauri Bundler and Rust CLI
|
### Developing Tauri Bundler and Rust CLI
|
||||||
|
|
||||||
|
12
.github/workflows/artifacts-updater.yml
vendored
12
.github/workflows/artifacts-updater.yml
vendored
@ -90,12 +90,8 @@ jobs:
|
|||||||
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
|
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
|
||||||
${{ matrix.platform }}-stable-cargo-cli-
|
${{ matrix.platform }}-stable-cargo-cli-
|
||||||
|
|
||||||
- name: install cli deps via yarn
|
- name: build and install cli.rs
|
||||||
working-directory: ./tooling/cli.js
|
run: cargo install --path tooling/cli.rs
|
||||||
run: yarn
|
|
||||||
- name: build cli
|
|
||||||
working-directory: ./tooling/cli.js
|
|
||||||
run: yarn build
|
|
||||||
- name: Check whether code signing should be enabled
|
- name: Check whether code signing should be enabled
|
||||||
id: enablecodesigning
|
id: enablecodesigning
|
||||||
env:
|
env:
|
||||||
@ -109,7 +105,7 @@ jobs:
|
|||||||
working-directory: ./examples/updater
|
working-directory: ./examples/updater
|
||||||
run: |
|
run: |
|
||||||
yarn install
|
yarn install
|
||||||
node ../../tooling/cli.js/bin/tauri build
|
cargo tauri build
|
||||||
env:
|
env:
|
||||||
# Notarization (disabled)
|
# Notarization (disabled)
|
||||||
# FIXME: enable only on `dev` push maybe? as it take some times...
|
# FIXME: enable only on `dev` push maybe? as it take some times...
|
||||||
@ -129,7 +125,7 @@ jobs:
|
|||||||
working-directory: ./examples/updater
|
working-directory: ./examples/updater
|
||||||
run: |
|
run: |
|
||||||
yarn install
|
yarn install
|
||||||
node ../../tooling/cli.js/bin/tauri build
|
cargo tauri build
|
||||||
env:
|
env:
|
||||||
TAURI_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5YTBGV3JiTy9lRDZVd3NkL0RoQ1htZmExNDd3RmJaNmRMT1ZGVjczWTBKZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQWdMekUzVkE4K0tWQ1hjeGt1Vkx2QnRUR3pzQjVuV0ZpM2czWXNkRm9hVUxrVnB6TUN3K1NheHJMREhQbUVWVFZRK3NIL1VsMDBHNW5ET1EzQno0UStSb21nRW4vZlpTaXIwZFh5ZmRlL1lSN0dKcHdyOUVPclVvdzFhVkxDVnZrbHM2T1o4Tk1NWEU9Cg==
|
TAURI_PRIVATE_KEY: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5YTBGV3JiTy9lRDZVd3NkL0RoQ1htZmExNDd3RmJaNmRMT1ZGVjczWTBKZ0FBQkFBQUFBQUFBQUFBQUlBQUFBQWdMekUzVkE4K0tWQ1hjeGt1Vkx2QnRUR3pzQjVuV0ZpM2czWXNkRm9hVUxrVnB6TUN3K1NheHJMREhQbUVWVFZRK3NIL1VsMDBHNW5ET1EzQno0UStSb21nRW4vZlpTaXIwZFh5ZmRlL1lSN0dKcHdyOUVPclVvdzFhVkxDVnZrbHM2T1o4Tk1NWEU9Cg==
|
||||||
# upload assets
|
# upload assets
|
||||||
|
2
.github/workflows/audit.yml
vendored
2
.github/workflows/audit.yml
vendored
@ -30,5 +30,5 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: yarn audit
|
- name: yarn audit
|
||||||
working-directory: tooling/cli.js
|
working-directory: tooling/cli.rs/node
|
||||||
run: yarn audit
|
run: yarn audit
|
||||||
|
12
.github/workflows/build-smoke-tests.yml
vendored
12
.github/workflows/build-smoke-tests.yml
vendored
@ -71,15 +71,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
||||||
- name: yarn install for cli
|
- name: build and install cli.rs
|
||||||
working-directory: tauri/tooling/cli.js
|
run: cargo install --path tauri/tooling/cli.rs
|
||||||
run: yarn
|
|
||||||
- name: build cli.js
|
|
||||||
working-directory: tauri/tooling/cli.js
|
|
||||||
run: |
|
|
||||||
yarn build-release
|
|
||||||
yarn global add $PWD
|
|
||||||
echo "::add-path::$(yarn global bin)"
|
|
||||||
- name: install and build assets
|
- name: install and build assets
|
||||||
working-directory: "example/${{ github.event.inputs.dir }}"
|
working-directory: "example/${{ github.event.inputs.dir }}"
|
||||||
run: ${{ github.event.inputs.buildAssets }}
|
run: ${{ github.event.inputs.buildAssets }}
|
||||||
@ -88,6 +81,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
tauriScript: cargo tauri
|
||||||
includeDebug: true
|
includeDebug: true
|
||||||
projectPath: "example/${{ github.event.inputs.dir }}"
|
projectPath: "example/${{ github.event.inputs.dir }}"
|
||||||
preferGlobal: true
|
preferGlobal: true
|
||||||
|
@ -80,3 +80,13 @@ jobs:
|
|||||||
token: ${{ secrets.TAURI_BOT_PAT }}
|
token: ${{ secrets.TAURI_BOT_PAT }}
|
||||||
repository: tauri-apps/tauri-docs
|
repository: tauri-apps/tauri-docs
|
||||||
event-type: update-docs
|
event-type: update-docs
|
||||||
|
|
||||||
|
- name: Trigger cli.js publishing workflow
|
||||||
|
if: |
|
||||||
|
steps.covector.outputs.successfulPublish == 'true' &&
|
||||||
|
contains(steps.covector.outputs.packagesPublished, 'tauri-cli')
|
||||||
|
uses: peter-evans/repository-dispatch@v1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.TAURI_BOT_PAT }}
|
||||||
|
repository: tauri-apps/tauri
|
||||||
|
event-type: publish-clijs
|
||||||
|
21
.github/workflows/js-lint.yml
vendored
21
.github/workflows/js-lint.yml
vendored
@ -7,10 +7,10 @@ name: eslint check
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- ".github/workflows/js-lint.yml"
|
- '.github/workflows/js-lint.yml'
|
||||||
- "tooling/cli.js/**"
|
- 'tooling/cli.rs/node/**'
|
||||||
- "tooling/api/**"
|
- 'tooling/api/**'
|
||||||
- "tooling/create-tauri-app/**"
|
- 'tooling/create-tauri-app/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
eslint-check:
|
eslint-check:
|
||||||
@ -19,17 +19,18 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: "12"
|
node-version: '12'
|
||||||
cache: yarn
|
cache: yarn
|
||||||
cache-dependency-path: tooling/*/yarn.lock
|
cache-dependency-path: tooling/*/yarn.lock
|
||||||
- name: install cli.js deps via yarn
|
- name: install cli.js deps via yarn
|
||||||
working-directory: ./tooling/cli.js/
|
working-directory: ./tooling/cli.rs/node/
|
||||||
run: yarn
|
run: yarn
|
||||||
- name: run cli.js lint
|
# nothing to lint
|
||||||
working-directory: ./tooling/cli.js/
|
#- name: run cli.js lint
|
||||||
run: yarn lint
|
# working-directory: ./tooling/cli.rs/node/
|
||||||
|
# run: yarn lint
|
||||||
- name: run cli.js format
|
- name: run cli.js format
|
||||||
working-directory: ./tooling/cli.js/
|
working-directory: ./tooling/cli.rs/node/
|
||||||
run: yarn format:check
|
run: yarn format:check
|
||||||
|
|
||||||
- name: install api deps via yarn
|
- name: install api deps via yarn
|
||||||
|
416
.github/workflows/publish-cli.yml
vendored
Normal file
416
.github/workflows/publish-cli.yml
vendored
Normal file
@ -0,0 +1,416 @@
|
|||||||
|
name: publish cli.js
|
||||||
|
env:
|
||||||
|
DEBUG: napi:*
|
||||||
|
APP_NAME: cli
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
||||||
|
'on':
|
||||||
|
workflow_dispatch:
|
||||||
|
repository_dispatch:
|
||||||
|
types: [publish-clijs]
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: tooling/cli.rs/node/
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
settings:
|
||||||
|
- host: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
architecture: x64
|
||||||
|
build: |
|
||||||
|
yarn build
|
||||||
|
strip -x *.node
|
||||||
|
- host: windows-latest
|
||||||
|
build: yarn build
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
architecture: x64
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
architecture: x64
|
||||||
|
docker: |
|
||||||
|
docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian
|
||||||
|
docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian builder
|
||||||
|
build: |
|
||||||
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/../../../:/build -w /build builder sh -c "cd tooling/cli.rs/node && yarn build && strip *.node"
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
architecture: x64
|
||||||
|
docker: |
|
||||||
|
docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||||
|
docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
|
||||||
|
build: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/../../../:/build -w /build builder sh -c "cd tooling/cli.rs/node && yarn build && strip *.node"
|
||||||
|
- host: macos-latest
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
build: |
|
||||||
|
yarn build --target=aarch64-apple-darwin
|
||||||
|
strip -x *.node
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
architecture: x64
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
setup: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y
|
||||||
|
build: |
|
||||||
|
yarn build --target=aarch64-unknown-linux-gnu
|
||||||
|
aarch64-linux-gnu-strip *.node
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
architecture: x64
|
||||||
|
target: armv7-unknown-linux-gnueabihf
|
||||||
|
setup: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
|
||||||
|
build: |
|
||||||
|
yarn build --target=armv7-unknown-linux-gnueabihf
|
||||||
|
arm-linux-gnueabihf-strip *.node
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
architecture: x64
|
||||||
|
target: aarch64-unknown-linux-musl
|
||||||
|
downloadTarget: aarch64-unknown-linux-musl
|
||||||
|
docker: |
|
||||||
|
docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||||
|
docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
|
||||||
|
build: |
|
||||||
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/../../../:/build -w /build builder sh -c "cd tooling/cli.rs/node && yarn build --target=aarch64-unknown-linux-musl && /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node"
|
||||||
|
#- host: windows-latest
|
||||||
|
# architecture: x64
|
||||||
|
# target: aarch64-pc-windows-msvc
|
||||||
|
# build: yarn build --target aarch64-pc-windows-msvc
|
||||||
|
name: stable - ${{ matrix.settings.target }} - node@16
|
||||||
|
runs-on: ${{ matrix.settings.host }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
cache-dependency-path: 'tooling/cli.rs/node/yarn.lock'
|
||||||
|
architecture: ${{ matrix.settings.architecture }}
|
||||||
|
- name: Install
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
toolchain: stable
|
||||||
|
target: ${{ matrix.settings.target }}
|
||||||
|
# should be committed
|
||||||
|
#- name: Generate Cargo.lock
|
||||||
|
# uses: actions-rs/cargo@v1
|
||||||
|
# with:
|
||||||
|
# command: generate-lockfile
|
||||||
|
- uses: Swatinem/rust-cache@v1
|
||||||
|
with:
|
||||||
|
key: ${{ matrix.settings.target }}
|
||||||
|
working-directory: 'tooling/cli.rs/'
|
||||||
|
- name: Pull latest image
|
||||||
|
run: ${{ matrix.settings.docker }}
|
||||||
|
env:
|
||||||
|
DOCKER_REGISTRY_URL: ghcr.io
|
||||||
|
if: ${{ matrix.settings.docker }}
|
||||||
|
- name: Setup toolchain
|
||||||
|
run: ${{ matrix.settings.setup }}
|
||||||
|
if: ${{ matrix.settings.setup }}
|
||||||
|
shell: bash
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Build
|
||||||
|
run: ${{ matrix.settings.build }}
|
||||||
|
shell: bash
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-${{ matrix.settings.target }}
|
||||||
|
path: tooling/cli.rs/node/${{ env.APP_NAME }}.*.node
|
||||||
|
if-no-files-found: error
|
||||||
|
# build-freebsd:
|
||||||
|
# runs-on: macos-10.15
|
||||||
|
# name: Build FreeBSD
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v2
|
||||||
|
# - name: Build
|
||||||
|
# id: build
|
||||||
|
# uses: vmactions/freebsd-vm@v0.1.5
|
||||||
|
# env:
|
||||||
|
# DEBUG: napi:*
|
||||||
|
# RUSTUP_HOME: /usr/local/rustup
|
||||||
|
# CARGO_HOME: /usr/local/cargo
|
||||||
|
# RUSTUP_IO_THREADS: 1
|
||||||
|
# with:
|
||||||
|
# envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS
|
||||||
|
# usesh: true
|
||||||
|
# mem: 3000
|
||||||
|
# prepare: |
|
||||||
|
# pkg install -y curl node14 python2
|
||||||
|
# curl -qL https://www.npmjs.com/install.sh | sh
|
||||||
|
# npm install -g yarn
|
||||||
|
# curl https://sh.rustup.rs -sSf --output rustup.sh
|
||||||
|
# sh rustup.sh -y --profile minimal --default-toolchain stable
|
||||||
|
# export PATH="/usr/local/cargo/bin:$PATH"
|
||||||
|
# echo "~~~~ rustc --version ~~~~"
|
||||||
|
# rustc --version
|
||||||
|
# echo "~~~~ node -v ~~~~"
|
||||||
|
# node -v
|
||||||
|
# echo "~~~~ yarn --version ~~~~"
|
||||||
|
# yarn --version
|
||||||
|
# run: |
|
||||||
|
# export PATH="/usr/local/cargo/bin:$PATH"
|
||||||
|
# pwd
|
||||||
|
# ls -lah
|
||||||
|
# whoami
|
||||||
|
# env
|
||||||
|
# freebsd-version
|
||||||
|
# cd ./tooling/cli.rs/node/
|
||||||
|
# yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
# yarn build
|
||||||
|
# strip -x *.node
|
||||||
|
# rm -rf node_modules
|
||||||
|
# rm -rf ../target
|
||||||
|
# - name: Upload artifact
|
||||||
|
# uses: actions/upload-artifact@v2
|
||||||
|
# with:
|
||||||
|
# name: bindings-freebsd
|
||||||
|
# path: tooling/cli.rs/node/${{ env.APP_NAME }}.*.node
|
||||||
|
# if-no-files-found: error
|
||||||
|
test-macOS-windows-binding:
|
||||||
|
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
settings:
|
||||||
|
- host: windows-latest
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ${{ matrix.settings.host }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
cache-dependency-path: 'tooling/cli.rs/node/yarn.lock'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-${{ matrix.settings.target }}
|
||||||
|
path: 'tooling/cli.rs/node/'
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Test bindings
|
||||||
|
run: yarn test
|
||||||
|
test-linux-x64-gnu-binding:
|
||||||
|
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
cache-dependency-path: 'tooling/cli.rs/node/yarn.lock'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-x86_64-unknown-linux-gnu
|
||||||
|
path: 'tooling/cli.rs/node/'
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Test bindings
|
||||||
|
run: yarn test
|
||||||
|
test-linux-x64-musl-binding:
|
||||||
|
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
cache-dependency-path: 'tooling/cli.rs/node/yarn.lock'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-x86_64-unknown-linux-musl
|
||||||
|
path: 'tooling/cli.rs/node/'
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Test bindings
|
||||||
|
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine sh -c "yarn test"
|
||||||
|
test-linux-aarch64-gnu-binding:
|
||||||
|
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-aarch64-unknown-linux-gnu
|
||||||
|
path: 'tooling/cli.rs/node/'
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Setup and run tests
|
||||||
|
uses: addnab/docker-run-action@v3
|
||||||
|
with:
|
||||||
|
image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }}
|
||||||
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
sh -c "cd tooling/cli.rs/node && yarn test"
|
||||||
|
ls -la
|
||||||
|
test-linux-aarch64-musl-binding:
|
||||||
|
name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-aarch64-unknown-linux-musl
|
||||||
|
path: 'tooling/cli.rs/node/'
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Setup and run tests
|
||||||
|
uses: addnab/docker-run-action@v3
|
||||||
|
with:
|
||||||
|
image: multiarch/alpine:aarch64-latest-stable
|
||||||
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
apk add nodejs npm yarn
|
||||||
|
sh -c "cd tooling/cli.rs/node && yarn test"
|
||||||
|
test-linux-arm-gnueabihf-binding:
|
||||||
|
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-armv7-unknown-linux-gnueabihf
|
||||||
|
path: 'tooling/cli.rs/node/'
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Setup and run tests
|
||||||
|
uses: addnab/docker-run-action@v3
|
||||||
|
with:
|
||||||
|
image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-${{ matrix.node }}
|
||||||
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
sh -c "cd tooling/cli.rs/node && yarn test"
|
||||||
|
ls -la
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
#- build-freebsd
|
||||||
|
- test-macOS-windows-binding
|
||||||
|
- test-linux-x64-gnu-binding
|
||||||
|
#- test-linux-x64-musl-binding
|
||||||
|
#- test-linux-aarch64-gnu-binding
|
||||||
|
#- test-linux-aarch64-musl-binding
|
||||||
|
#- test-linux-arm-gnueabihf-binding
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
cache-dependency-path: 'tooling/cli.rs/node/yarn.lock'
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
path: tooling/cli.rs/node/artifacts
|
||||||
|
- name: Move artifacts
|
||||||
|
run: yarn artifacts
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R ./npm
|
||||||
|
shell: bash
|
||||||
|
- name: Publish
|
||||||
|
run: |
|
||||||
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
||||||
|
npm publish
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
11
.github/workflows/test-core.yml
vendored
11
.github/workflows/test-core.yml
vendored
@ -170,7 +170,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 14
|
node-version: 14
|
||||||
cache: yarn
|
cache: yarn
|
||||||
cache-dependency-path: tooling/cli.js/yarn.lock
|
cache-dependency-path: tooling/cli.rs/node/yarn.lock
|
||||||
- name: install webkit2gtk (ubuntu only)
|
- name: install webkit2gtk (ubuntu only)
|
||||||
if: matrix.platform == 'ubuntu-latest'
|
if: matrix.platform == 'ubuntu-latest'
|
||||||
run: |
|
run: |
|
||||||
@ -221,7 +221,7 @@ jobs:
|
|||||||
- name: Cache template cargo target
|
- name: Cache template cargo target
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: tooling/cli.js/test/jest/fixtures/empty/src-tauri/target
|
path: tooling/cli.rs/node/test/jest/fixtures/empty/src-tauri/target
|
||||||
# Add date to the cache to keep it up to date
|
# Add date to the cache to keep it up to date
|
||||||
key: ${{ matrix.platform }}-stable-template-${{ hashFiles('tooling/cli.rs/templates/app/**') }}-${{ env.CURRENT_DATE }}
|
key: ${{ matrix.platform }}-stable-template-${{ hashFiles('tooling/cli.rs/templates/app/**') }}-${{ env.CURRENT_DATE }}
|
||||||
# Restore from outdated cache for speed
|
# Restore from outdated cache for speed
|
||||||
@ -232,10 +232,7 @@ jobs:
|
|||||||
- name: test
|
- name: test
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
run: |
|
run: |
|
||||||
cd ./tooling/cli.js
|
cd ./tooling/cli.rs/node
|
||||||
yarn
|
yarn
|
||||||
|
yarn build
|
||||||
yarn test
|
yarn test
|
||||||
- name: run release build
|
|
||||||
timeout-minutes: 15
|
|
||||||
working-directory: tooling/cli.js
|
|
||||||
run: yarn build-release
|
|
||||||
|
8
.github/workflows/test-cta.yml
vendored
8
.github/workflows/test-cta.yml
vendored
@ -46,10 +46,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
||||||
- run: yarn
|
#- run: yarn
|
||||||
working-directory: tooling/cli.js
|
# working-directory: tooling/cli.rs/node
|
||||||
- run: yarn build
|
#- run: yarn build
|
||||||
working-directory: tooling/cli.js
|
# working-directory: tooling/cli.rs/node
|
||||||
- run: yarn
|
- run: yarn
|
||||||
working-directory: tooling/api
|
working-directory: tooling/api
|
||||||
- run: yarn build
|
- run: yarn build
|
||||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -77,12 +77,6 @@ target
|
|||||||
/tooling/bench/tests/Cargo.lock
|
/tooling/bench/tests/Cargo.lock
|
||||||
/yarn.lock
|
/yarn.lock
|
||||||
|
|
||||||
/tooling/cli.js/test/jest/tmp
|
|
||||||
|
|
||||||
# doing this because of how our tests currently (naively) drop the tauri.conf.js in that folder
|
|
||||||
# todo: needs a proper fic
|
|
||||||
/tooling/cli.js/tauri.conf.js
|
|
||||||
|
|
||||||
# ignore frida handlers
|
# ignore frida handlers
|
||||||
__handlers__/
|
__handlers__/
|
||||||
|
|
||||||
|
@ -15,13 +15,12 @@ else
|
|||||||
cd ../..
|
cd ../..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(git diff --name-only tooling/cli.js)" ]; then
|
if [ -z "$(git diff --name-only tooling/cli.rs/node)" ]; then
|
||||||
echo "skipping cli.js - no changes detected"
|
echo "skipping cli.js - no changes detected"
|
||||||
else
|
else
|
||||||
cd tooling/cli.js
|
cd tooling/cli.rs/node
|
||||||
yarn format
|
yarn format
|
||||||
yarn lint-fix
|
cd ../../..
|
||||||
cd ../..
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$(git diff --name-only tooling/create-tauri-app)" ]; then
|
if [ -z "$(git diff --name-only tooling/create-tauri-app)" ]; then
|
||||||
|
@ -21,9 +21,9 @@ $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
|
|||||||
$result = $host.ui.PromptForChoice("Node.js CLI", "Do you want to install the Node.js CLI?", $options, 1)
|
$result = $host.ui.PromptForChoice("Node.js CLI", "Do you want to install the Node.js CLI?", $options, 1)
|
||||||
switch ($result) {
|
switch ($result) {
|
||||||
0{
|
0{
|
||||||
cd tooling\cli.js
|
cd tooling\cli.rs/node
|
||||||
yarn; yarn build; yarn link
|
yarn; yarn build; yarn link
|
||||||
cd ..\..
|
cd ..\..
|
||||||
echo "Tauri Node.js CLI installed. Run it with '$ tauri [COMMAND]'"
|
echo "Tauri Node.js CLI installed. use `yarn link @tauri-apps/cli` and run it with '$ yarn tauri [COMMAND]'."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@ echo "Do you want to install the Node.js CLI?"
|
|||||||
select yn in "Yes" "No"; do
|
select yn in "Yes" "No"; do
|
||||||
case $yn in
|
case $yn in
|
||||||
Yes )
|
Yes )
|
||||||
cd tooling/cli.js
|
cd tooling/cli.rs/node
|
||||||
yarn && yarn build && yarn link
|
yarn && yarn build && yarn link
|
||||||
cd ../..
|
cd ../../..
|
||||||
echo "Tauri Node.js CLI installed. Run it with '$ tauri [COMMAND]'."
|
echo "Tauri Node.js CLI installed. use `yarn link @tauri-apps/cli` and run it with '$ yarn tauri [COMMAND]'."
|
||||||
break;;
|
break;;
|
||||||
No ) break;;
|
No ) break;;
|
||||||
esac
|
esac
|
||||||
|
@ -44,8 +44,8 @@ A typescript library that creates `cjs` and `esm` Javascript endpoints for you t
|
|||||||
#### [bundler](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) [RUST / SHELL]
|
#### [bundler](https://github.com/tauri-apps/tauri/tree/dev/tooling/bundler) [RUST / SHELL]
|
||||||
The bundler is a library that builds a Tauri App for the platform triple it detects / is told. At the moment it currently supports macOS, Windows and Linux - but in the near future will support mobile platforms as well. May be used outside of Tauri projects.
|
The bundler is a library that builds a Tauri App for the platform triple it detects / is told. At the moment it currently supports macOS, Windows and Linux - but in the near future will support mobile platforms as well. May be used outside of Tauri projects.
|
||||||
|
|
||||||
#### [cli.js](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli.js) [JS]
|
#### [cli.js](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli.rs/node) [JS]
|
||||||
Written in Typescript and packaged such that it can be used with `npm`, `pnpm`, and `yarn`, this library provides a node.js runner for common tasks when using Tauri, like `yarn tauri dev`. For the most part it is a wrapper around [cli.rs](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli.rs).
|
It is a wrapper around [cli.rs](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli.rs) using [napi-rs](https://github.com/napi-rs/napi-rs) to produce NPM packages for each platform.
|
||||||
|
|
||||||
#### [cli.rs](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli.rs) [RUST]
|
#### [cli.rs](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli.rs) [RUST]
|
||||||
This rust executable provides the full interface to all of the required activities for which the CLI is required. It will run on macOS, Windows, and Linux.
|
This rust executable provides the full interface to all of the required activities for which the CLI is required. It will run on macOS, Windows, and Linux.
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
| Component | Description | Version | Lin | Win | Mac |
|
| Component | Description | Version | Lin | Win | Mac |
|
||||||
| --------------------------------------------------------------------------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | --- | --- | --- |
|
| --------------------------------------------------------------------------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | --- | --- | --- |
|
||||||
| [**cli.rs**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli.rs) | create, develop and build apps | [![](https://img.shields.io/crates/v/tauri-cli.svg)](https://crates.io/crates/tauri-cli) | ✅ | ✅ | ✅ |
|
| [**cli.rs**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli.rs) | create, develop and build apps | [![](https://img.shields.io/crates/v/tauri-cli.svg)](https://crates.io/crates/tauri-cli) | ✅ | ✅ | ✅ |
|
||||||
| [**cli.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli.js) | Node.js CLI wrapper for cli.rs | [![](https://img.shields.io/npm/v/@tauri-apps/cli.svg)](https://www.npmjs.com/package/@tauri-apps/cli) | ✅ | ✅ | ✅ |
|
| [**cli.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/cli.rs/node) | Node.js CLI wrapper for cli.rs | [![](https://img.shields.io/npm/v/@tauri-apps/cli.svg)](https://www.npmjs.com/package/@tauri-apps/cli) | ✅ | ✅ | ✅ |
|
||||||
| [**api.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) | JS API for interaction with Rust backend | [![](https://img.shields.io/npm/v/@tauri-apps/api.svg)](https://www.npmjs.com/package/@tauri-apps/api) | ✅ | ✅ | ✅ |
|
| [**api.js**](https://github.com/tauri-apps/tauri/tree/dev/tooling/api) | JS API for interaction with Rust backend | [![](https://img.shields.io/npm/v/@tauri-apps/api.svg)](https://www.npmjs.com/package/@tauri-apps/api) | ✅ | ✅ | ✅ |
|
||||||
| [**create-tauri-app**](https://github.com/tauri-apps/tauri/tree/dev/tooling/create-tauri-app) | Get started with your first Tauri app | [![](https://img.shields.io/npm/v/create-tauri-app.svg)](https://www.npmjs.com/package/create-tauri-app) | ✅ | ✅ | ✅ |
|
| [**create-tauri-app**](https://github.com/tauri-apps/tauri/tree/dev/tooling/create-tauri-app) | Get started with your first Tauri app | [![](https://img.shields.io/npm/v/create-tauri-app.svg)](https://www.npmjs.com/package/create-tauri-app) | ✅ | ✅ | ✅ |
|
||||||
| [**vue-cli-plugin-tauri**](https://github.com/tauri-apps/vue-cli-plugin-tauri/) | Vue CLI plugin for Tauri | [![](https://img.shields.io/npm/v/vue-cli-plugin-tauri.svg)](https://www.npmjs.com/package/vue-cli-plugin-tauri) | ✅ | ✅ | ✅ |
|
| [**vue-cli-plugin-tauri**](https://github.com/tauri-apps/vue-cli-plugin-tauri/) | Vue CLI plugin for Tauri | [![](https://img.shields.io/npm/v/vue-cli-plugin-tauri.svg)](https://www.npmjs.com/package/vue-cli-plugin-tauri) | ✅ | ✅ | ✅ |
|
||||||
|
@ -100,7 +100,7 @@ tokio-test = "0.4.2"
|
|||||||
tokio = { version = "1.16", features = [ "full" ] }
|
tokio = { version = "1.16", features = [ "full" ] }
|
||||||
|
|
||||||
[target."cfg(windows)".dev-dependencies.windows]
|
[target."cfg(windows)".dev-dependencies.windows]
|
||||||
version = "0.32.0"
|
version = "0.30.0"
|
||||||
features = [
|
features = [
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
]
|
]
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"dev": "vite --clearScreen false --port 5000",
|
"dev": "vite --clearScreen false --port 5000",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"serve": "vite preview",
|
"serve": "vite preview",
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "../../tooling/api/dist",
|
"@tauri-apps/api": "../../tooling/api/dist",
|
||||||
@ -17,4 +17,4 @@
|
|||||||
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.11",
|
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.11",
|
||||||
"vite": "^2.6.4"
|
"vite": "^2.6.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,6 @@
|
|||||||
"name": "state",
|
"name": "state",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,6 @@
|
|||||||
"name": "hello-world",
|
"name": "hello-world",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,9 +2,9 @@
|
|||||||
"name": "isolation",
|
"name": "isolation",
|
||||||
"license": "Apache-2.0 OR MIT",
|
"license": "Apache-2.0 OR MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "../../tooling/api/dist"
|
"@tauri-apps/api": "../../tooling/api/dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
@ -2,6 +2,6 @@
|
|||||||
"name": "navigation",
|
"name": "navigation",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,6 @@
|
|||||||
"name": "resources",
|
"name": "resources",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,11 +8,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri",
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js",
|
||||||
"package": "pkg package.json --output src-tauri/binaries/app && node scripts/move-binary.js"
|
"package": "pkg package.json --output src-tauri/binaries/app && node scripts/move-binary.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"execa": "5.1.1",
|
"execa": "5.1.1",
|
||||||
"pkg": "5.2.1"
|
"pkg": "5.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
@ -2,6 +2,6 @@
|
|||||||
"name": "hello-world",
|
"name": "hello-world",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "ncargo tauri"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"name": "streaming",
|
"name": "streaming",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,6 +2,6 @@
|
|||||||
"name": "updater",
|
"name": "updater",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tauri": "node ../../tooling/cli.js/bin/tauri"
|
"tauri": "node ../../tooling/cli.rs/node/tauri.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
197
maskfile.md
197
maskfile.md
@ -1,197 +0,0 @@
|
|||||||
# Shorthand Commands
|
|
||||||
|
|
||||||
<!--
|
|
||||||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
-->
|
|
||||||
|
|
||||||
## prepare
|
|
||||||
|
|
||||||
> Setup all stuff needed for running the smoke tests
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone --recursive git@github.com:tauri-apps/smoke-tests.git \
|
|
||||||
|| (cd smoke-tests && git pull origin dev; cd ..) # always prepare up-to-date smoke tests in case it's already available
|
|
||||||
|
|
||||||
cargo build --lib
|
|
||||||
cargo install --locked trunk --force # used by rust/yew
|
|
||||||
|
|
||||||
. .scripts/setup.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
# Setup Environment to execute in the tauri directory.
|
|
||||||
$CWD = [Environment]::CurrentDirectory
|
|
||||||
Push-Location $MyInvocation.MyCommand.Path
|
|
||||||
[Environment]::CurrentDirectory = $PWD
|
|
||||||
# send git stderr to powershell stdout
|
|
||||||
$env:GIT_REDIRECT_STDERR = '2>&1'
|
|
||||||
|
|
||||||
# if the smoke-tests path doesn't exist.
|
|
||||||
if (-Not (Test-Path $CWD\smoke-tests -PathType Any)) {
|
|
||||||
Start-Job -ScriptBlock {
|
|
||||||
# Setup Environment to execute in the tauri directory.
|
|
||||||
$CWD = [Environment]::CurrentDirectory
|
|
||||||
Push-Location $MyInvocation.MyCommand.Path
|
|
||||||
[Environment]::CurrentDirectory = $PWD
|
|
||||||
|
|
||||||
#clone the smoke-tests repo into the smoke-tests folder
|
|
||||||
git clone --recursive https://github.com/tauri-apps/smoke-tests.git $CWD\smoke-tests
|
|
||||||
} | Receive-Job -AutoRemoveJob -Wait
|
|
||||||
}
|
|
||||||
|
|
||||||
# Enter the smoke-tests folder and pull the latest data from origin/dev
|
|
||||||
cd smoke-tests; git pull origin dev; cd ..
|
|
||||||
|
|
||||||
# build and install everything Rust related.
|
|
||||||
cargo build --lib
|
|
||||||
cargo install --locked trunk --force
|
|
||||||
|
|
||||||
. .scripts/setup.ps1
|
|
||||||
```
|
|
||||||
|
|
||||||
## run
|
|
||||||
|
|
||||||
![tauri-mask-run-smoke-test](https://user-images.githubusercontent.com/4953069/75866011-00ed8600-5e37-11ea-9106-3cb104a05f80.gif)
|
|
||||||
|
|
||||||
### run smoke-test (name)
|
|
||||||
|
|
||||||
> Run specific smoketest in dev mode
|
|
||||||
|
|
||||||
```sh
|
|
||||||
shopt -s globstar
|
|
||||||
|
|
||||||
cd smoke-tests/**/$name 2>/dev/null \
|
|
||||||
|| cd smoke-tests/**/$name/$name # workaround for rust/yew/todomvc/todomvc
|
|
||||||
|
|
||||||
case "$PWD" in
|
|
||||||
*/node/*)
|
|
||||||
yarn && yarn tauri:dev
|
|
||||||
;;
|
|
||||||
*/rust/*)
|
|
||||||
cargo web deploy
|
|
||||||
[ $name = `basename $(dirname $PWD)` ] && cd ..
|
|
||||||
|
|
||||||
yarn add tauri@link:../../../tooling/cli.js
|
|
||||||
yarn && yarn tauri dev
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo unknown project $(dirname $name)/$name
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
```
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
param(
|
|
||||||
[string] $smoke_test_name
|
|
||||||
)
|
|
||||||
|
|
||||||
# Setup Environment to execute in the tauri directory.
|
|
||||||
$CWD = [Environment]::CurrentDirectory
|
|
||||||
Push-Location $MyInvocation.MyCommand.Path
|
|
||||||
[Environment]::CurrentDirectory = $PWD
|
|
||||||
|
|
||||||
# get the example paths.
|
|
||||||
$smoke_test_path = Get-ChildItem smoke-tests\*\*\$env:name
|
|
||||||
|
|
||||||
# if the example path is null get the todomvc path.
|
|
||||||
if ($smoke_test_path -eq $null) {
|
|
||||||
$smoke_test_path = Get-ChildItem smoke-tests\*\*\*\$env:name\$env:name
|
|
||||||
}
|
|
||||||
|
|
||||||
# if the example path is still null get the helloworld example path.
|
|
||||||
if ($smoke_test_path -eq $null) {
|
|
||||||
$smoke_test_path = Get-ChildItem smoke-tests\tauri\*\$env:name
|
|
||||||
}
|
|
||||||
|
|
||||||
# switch on the parent folder name.
|
|
||||||
switch ($smoke_test_path.parent) {
|
|
||||||
# if node, run yarn.
|
|
||||||
{"vanillajs" -Or "react" -Or "svelte" -Or "vue"} {
|
|
||||||
cd $smoke_test_path.FullName; yarn; yarn tauri:dev
|
|
||||||
}
|
|
||||||
# if rust, run cargo web deploy
|
|
||||||
"yew" {
|
|
||||||
cd $smoke_test_path.FullName; cargo web deploy
|
|
||||||
}
|
|
||||||
# if tauri run the helloworld example from the tauri folder.
|
|
||||||
"tauri" {
|
|
||||||
cd $CWD/tauri; cargo run --example helloworld
|
|
||||||
}
|
|
||||||
# transpiled are not supported yet.
|
|
||||||
"transpiled" {
|
|
||||||
Write-Output("Example not supported yet")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## list
|
|
||||||
|
|
||||||
### list smoke-tests
|
|
||||||
|
|
||||||
> List all available smoke tests
|
|
||||||
|
|
||||||
```sh
|
|
||||||
find smoke-tests/*/*/* -maxdepth 0 -type d -not -path '*.git*' \
|
|
||||||
-exec sh -c 'echo $(basename $(dirname {}))/$(basename {})' \;
|
|
||||||
```
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
# Setup Environment to execute in the tauri directory.
|
|
||||||
$CWD = [Environment]::CurrentDirectory
|
|
||||||
Push-Location $MyInvocation.MyCommand.Path
|
|
||||||
[Environment]::CurrentDirectory = $PWD
|
|
||||||
|
|
||||||
# initialize the smoke-tests list.
|
|
||||||
$smoke_tests = @()
|
|
||||||
|
|
||||||
# get the helloworld smoke tests
|
|
||||||
$smoke_tests += Get-ChildItem smoke-tests/*/* -Filter helloworld
|
|
||||||
# get the rest of the smoke-tests.
|
|
||||||
$smoke_tests += Get-ChildItem smoke-tests/*/* -Directory -Exclude ('src*', 'public', 'test*', 'source', 'lib', 'web', 'dist', 'node_*')
|
|
||||||
|
|
||||||
# print out the smoke tests.
|
|
||||||
foreach($e in $smoke_tests) {
|
|
||||||
Write-Output("$($e.Name): $($e.Parent)/$($e.Name)")
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## clean
|
|
||||||
|
|
||||||
> Remove installed dependencies and reset smoke tests in case something gone wrong
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cargo clean
|
|
||||||
|
|
||||||
shopt -s globstar
|
|
||||||
rm -r **/node_modules
|
|
||||||
|
|
||||||
cd smoke-tests
|
|
||||||
git checkout -- . # discard all unstaged changes
|
|
||||||
git clean -dfX # remove all untracked files & directories
|
|
||||||
```
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
# Setup Environment to execute in the tauri directory.
|
|
||||||
$CWD = [Environment]::CurrentDirectory
|
|
||||||
Push-Location $MyInvocation.MyCommand.Path
|
|
||||||
[Environment]::CurrentDirectory = $PWD
|
|
||||||
|
|
||||||
# clean up any artifacts.
|
|
||||||
cargo clean
|
|
||||||
|
|
||||||
# find any node_module folders.
|
|
||||||
$node_paths = Get-ChildItem -Path smoke-tests\ -Filter node_modules -Recurse -ErrorAction SilentlyContinue -Force
|
|
||||||
|
|
||||||
if (-Not $node_paths -eq $null) {
|
|
||||||
# delete all of the node_module folders.
|
|
||||||
foreach ($path in $node_paths) {
|
|
||||||
$path.Delete()
|
|
||||||
}
|
|
||||||
# enter the smoke-tests folder and remove any changes.
|
|
||||||
cd $CWD/smoke-tests; git checkout -- .; git clean -dfX
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
@ -8,8 +8,7 @@
|
|||||||
],
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/tauri-apps/tauri.git",
|
"url": "https://github.com/tauri-apps/tauri.git"
|
||||||
"directory": "tooling/cli.js"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
||||||
@ -18,7 +17,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"covector": "^0.5.3",
|
"covector": "^0.5.3",
|
||||||
"husky": "^6.0.0",
|
"husky": "^6.0.0",
|
||||||
"prettier": "^2.2.1"
|
"prettier": "^2.5.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"typescript": "^4.5.4"
|
"typescript": "^4.5.4"
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"paths": ["tooling/cli.js/**"],
|
"paths": ["tooling/cli.rs/node"],
|
||||||
"groupName": "Tauri JS CLI",
|
"groupName": "Tauri JS CLI",
|
||||||
"groupSlug": "allTauriJSCLI",
|
"groupSlug": "allTauriJSCLI",
|
||||||
"commitMessagePrefix": "chore(deps)",
|
"commitMessagePrefix": "chore(deps)",
|
||||||
|
@ -40,6 +40,7 @@ walkdir = "2"
|
|||||||
handlebars = { version = "4.2" }
|
handlebars = { version = "4.2" }
|
||||||
zip = { version = "0.5" }
|
zip = { version = "0.5" }
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
|
os_pipe = "1"
|
||||||
|
|
||||||
[target."cfg(target_os = \"windows\")".dependencies]
|
[target."cfg(target_os = \"windows\")".dependencies]
|
||||||
attohttpc = "0.18"
|
attohttpc = "0.18"
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
use crate::Settings;
|
use crate::{CommandExt, Settings};
|
||||||
use std::{
|
use std::{
|
||||||
ffi::OsStr,
|
ffi::OsStr,
|
||||||
fs::{self, File},
|
fs::{self, File},
|
||||||
io::{self, BufWriter, Write},
|
io::{self, BufWriter, Write},
|
||||||
path::Path,
|
path::Path,
|
||||||
process::{Command, Stdio},
|
process::Command,
|
||||||
};
|
};
|
||||||
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
|
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
|
||||||
|
|
||||||
@ -196,16 +196,10 @@ pub fn print_info(message: &str) -> crate::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute_with_verbosity(cmd: &mut Command, settings: &Settings) -> crate::Result<()> {
|
pub fn execute_with_verbosity(cmd: &mut Command, settings: &Settings) -> crate::Result<()> {
|
||||||
let stdio_config = if settings.is_verbose() {
|
if settings.is_verbose() {
|
||||||
Stdio::inherit
|
cmd.pipe()?;
|
||||||
} else {
|
}
|
||||||
Stdio::null
|
let status = cmd.status().expect("failed to spawn command");
|
||||||
};
|
|
||||||
let status = cmd
|
|
||||||
.stdout(stdio_config())
|
|
||||||
.stderr(stdio_config())
|
|
||||||
.status()
|
|
||||||
.expect("failed to spawn command");
|
|
||||||
|
|
||||||
if status.success() {
|
if status.success() {
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -33,10 +33,4 @@ wget -q -4 -O linuxdeploy-x86_64.AppImage https://github.com/linuxdeploy/linuxde
|
|||||||
chmod +x linuxdeploy-plugin-gtk.sh
|
chmod +x linuxdeploy-plugin-gtk.sh
|
||||||
chmod +x linuxdeploy-x86_64.AppImage
|
chmod +x linuxdeploy-x86_64.AppImage
|
||||||
|
|
||||||
args=()
|
OUTPUT="{{appimage_filename}}" ./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir "{{app_name}}.AppDir" --plugin gtk --output appimage
|
||||||
if ! lsmod | grep -q 'fuse'
|
|
||||||
then
|
|
||||||
args+=( '--appimage-extract-and-run' )
|
|
||||||
fi
|
|
||||||
|
|
||||||
OUTPUT="{{appimage_filename}}" ./linuxdeploy-x86_64.AppImage "${args[@]}" --appdir "{{app_name}}.AppDir" --plugin gtk --output appimage
|
|
||||||
|
@ -15,6 +15,18 @@
|
|||||||
//! - Windows
|
//! - Windows
|
||||||
//! - MSI using WiX
|
//! - MSI using WiX
|
||||||
|
|
||||||
|
pub(crate) trait CommandExt {
|
||||||
|
fn pipe(&mut self) -> Result<&mut Self>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CommandExt for std::process::Command {
|
||||||
|
fn pipe(&mut self) -> Result<&mut Self> {
|
||||||
|
self.stdout(os_pipe::dup_stdout()?);
|
||||||
|
self.stderr(os_pipe::dup_stderr()?);
|
||||||
|
Ok(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The bundle API.
|
/// The bundle API.
|
||||||
pub mod bundle;
|
pub mod bundle;
|
||||||
mod error;
|
mod error;
|
||||||
|
@ -1,45 +1,3 @@
|
|||||||
# @tauri-apps/cli
|
# @tauri-apps/cli
|
||||||
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" height="128" width="128">
|
# Deprecated
|
||||||
|
See https://github.com/tauri-apps/tauri/tooling/cli.rs/node/ for the new version based on napi-rs.
|
||||||
[![status](https://img.shields.io/badge/Status-Beta-green.svg)](https://github.com/tauri-apps/tauri)
|
|
||||||
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
|
|
||||||
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
|
|
||||||
|
|
||||||
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library
|
|
||||||
)
|
|
||||||
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.studio)
|
|
||||||
|
|
||||||
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
|
|
||||||
[![support](https://img.shields.io/badge/sponsor-Opencollective-blue.svg)](https://opencollective.com/tauri)
|
|
||||||
|
|
||||||
| Component | Version |
|
|
||||||
| --------- | ------------------------------------------- |
|
|
||||||
| @tauri-apps/cli | ![](https://img.shields.io/npm/v/@tauri-apps/cli.svg) |
|
|
||||||
|
|
||||||
## 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`, and `yarn`, this library provides a node.js runner for common tasks when using Tauri, like `yarn tauri dev`. For the most part it is a wrapper around [cli.rs](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli.rs).
|
|
||||||
|
|
||||||
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:
|
|
||||||
```
|
|
||||||
$ npm install --save-dev @tauri-apps/cli
|
|
||||||
$ yarn add --dev @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)
|
|
132
tooling/cli.rs/Cargo.lock
generated
132
tooling/cli.rs/Cargo.lock
generated
@ -337,6 +337,12 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "convert_case"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
@ -539,7 +545,7 @@ version = "0.99.17"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case 0.4.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
@ -1455,6 +1461,57 @@ dependencies = [
|
|||||||
"getrandom 0.2.4",
|
"getrandom 0.2.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "napi"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17ec66e60f000c78dd7c6215b6fa260e0591e09805024332bc5b3f55acc12244"
|
||||||
|
dependencies = [
|
||||||
|
"ctor",
|
||||||
|
"lazy_static",
|
||||||
|
"napi-sys",
|
||||||
|
"windows",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "napi-build"
|
||||||
|
version = "1.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ebd4419172727423cf30351406c54f6cc1b354a2cfb4f1dba3e6cd07f6d5522b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "napi-derive"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "74ac5287a5e94a8728fc82d16c5127acc5eb5b8ad6404ef5f82d6a4ce8d5bdd2"
|
||||||
|
dependencies = [
|
||||||
|
"convert_case 0.5.0",
|
||||||
|
"napi-derive-backend",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "napi-derive-backend"
|
||||||
|
version = "1.0.25"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "427f4f04525635cdf22005d1be62d6d671bcb5550d694a1efb480a315422b4af"
|
||||||
|
dependencies = [
|
||||||
|
"convert_case 0.5.0",
|
||||||
|
"once_cell",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"regex",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "napi-sys"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8a385494dac3c52cbcacb393bb3b42669e7db8ab240c7ad5115f549eb061f2cc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "native-tls"
|
name = "native-tls"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
@ -1636,6 +1693,16 @@ dependencies = [
|
|||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "os_pipe"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0e3492ebca331b895fe23ed427dce2013d9b2e00c45964f12040b0db38b8ab27"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"winapi 0.3.9",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_str_bytes"
|
name = "os_str_bytes"
|
||||||
version = "6.0.0"
|
version = "6.0.0"
|
||||||
@ -2393,9 +2460,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serialize-to-javascript"
|
name = "serialize-to-javascript"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9186a81e763ca2a5e13ba76d843534620bffe0cf1e76e1a2f2d231ba1db79b82"
|
checksum = "c9823f2d3b6a81d98228151fdeaf848206a7855a7a042bbf9bf870449a66cafb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@ -2404,9 +2471,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serialize-to-javascript-impl"
|
name = "serialize-to-javascript-impl"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4e3ff83d7962f690dbe675ca0fd516c097194723b6bda8c7c500d35f0b02902e"
|
checksum = "74064874e9f6a15f04c1f3cb627902d0e6b410abbf36668afa873c61889f1763"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -2600,6 +2667,7 @@ dependencies = [
|
|||||||
"image",
|
"image",
|
||||||
"libflate",
|
"libflate",
|
||||||
"md5",
|
"md5",
|
||||||
|
"os_pipe",
|
||||||
"regex",
|
"regex",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@ -2640,6 +2708,7 @@ dependencies = [
|
|||||||
"notify",
|
"notify",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"os_info",
|
"os_info",
|
||||||
|
"os_pipe",
|
||||||
"regex",
|
"regex",
|
||||||
"schemars",
|
"schemars",
|
||||||
"semver",
|
"semver",
|
||||||
@ -2660,6 +2729,16 @@ dependencies = [
|
|||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tauri-cli-node"
|
||||||
|
version = "0.0.0"
|
||||||
|
dependencies = [
|
||||||
|
"napi",
|
||||||
|
"napi-build",
|
||||||
|
"napi-derive",
|
||||||
|
"tauri-cli",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tauri-utils"
|
name = "tauri-utils"
|
||||||
version = "1.0.0-beta.3"
|
version = "1.0.0-beta.3"
|
||||||
@ -3161,6 +3240,49 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows"
|
||||||
|
version = "0.30.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b749ebd2304aa012c5992d11a25d07b406bdbe5f79d371cb7a918ce501a19eb0"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_msvc",
|
||||||
|
"windows_i686_gnu",
|
||||||
|
"windows_i686_msvc",
|
||||||
|
"windows_x86_64_gnu",
|
||||||
|
"windows_x86_64_msvc",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.30.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "29277a4435d642f775f63c7d1faeb927adba532886ce0287bd985bffb16b6bca"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.30.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1145e1989da93956c68d1864f32fb97c8f561a8f89a5125f6a2b7ea75524e4b8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.30.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d4a09e3a0d4753b73019db171c1339cd4362c8c44baf1bcea336235e955954a6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.30.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8ca64fcb0220d58db4c119e050e7af03c69e6f4f415ef69ec1773d9aab422d5a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.30.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08cabc9f0066848fef4bc6a1c1668e6efce38b661d2aeec75d18d8617eebb5f1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winreg"
|
name = "winreg"
|
||||||
version = "0.10.1"
|
version = "0.10.1"
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
workspace = { }
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "tauri-cli"
|
name = "tauri-cli"
|
||||||
@ -51,6 +54,7 @@ glob = "0.3"
|
|||||||
heck = "0.4"
|
heck = "0.4"
|
||||||
dialoguer = "0.9"
|
dialoguer = "0.9"
|
||||||
url = { version = "2.2", features = [ "serde" ] }
|
url = { version = "2.2", features = [ "serde" ] }
|
||||||
|
os_pipe = "1"
|
||||||
|
|
||||||
[target."cfg(windows)".dependencies]
|
[target."cfg(windows)".dependencies]
|
||||||
encode_unicode = "0.3"
|
encode_unicode = "0.3"
|
||||||
@ -68,3 +72,6 @@ serde = { version = "1.0", features = [ "derive" ] }
|
|||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_with = "1.12"
|
serde_with = "1.12"
|
||||||
url = { version = "2.2", features = [ "serde" ] }
|
url = { version = "2.2", features = [ "serde" ] }
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = true
|
||||||
|
7
tooling/cli.rs/node/.cargo/config.toml
Normal file
7
tooling/cli.rs/node/.cargo/config.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[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"
|
469
tooling/cli.rs/node/.github-example/workflows/CI.yml
Normal file
469
tooling/cli.rs/node/.github-example/workflows/CI.yml
Normal file
@ -0,0 +1,469 @@
|
|||||||
|
name: CI
|
||||||
|
env:
|
||||||
|
DEBUG: napi:*
|
||||||
|
APP_NAME: cli
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: '10.13'
|
||||||
|
'on':
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- LICENSE
|
||||||
|
- '**/*.gitignore'
|
||||||
|
- .editorconfig
|
||||||
|
- docs/**
|
||||||
|
pull_request: null
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
settings:
|
||||||
|
- host: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
architecture: x64
|
||||||
|
build: |
|
||||||
|
yarn build
|
||||||
|
strip -x *.node
|
||||||
|
- host: windows-latest
|
||||||
|
build: yarn build
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
architecture: x64
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
architecture: x64
|
||||||
|
docker: |
|
||||||
|
docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian
|
||||||
|
docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian builder
|
||||||
|
build: |
|
||||||
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip *.node
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
target: x86_64-unknown-linux-musl
|
||||||
|
architecture: x64
|
||||||
|
docker: |
|
||||||
|
docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||||
|
docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
|
||||||
|
build: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip *.node
|
||||||
|
- host: macos-latest
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
build: |
|
||||||
|
yarn build --target=aarch64-apple-darwin
|
||||||
|
strip -x *.node
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
architecture: x64
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
setup: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y
|
||||||
|
build: |
|
||||||
|
yarn build --target=aarch64-unknown-linux-gnu
|
||||||
|
aarch64-linux-gnu-strip *.node
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
architecture: x64
|
||||||
|
target: armv7-unknown-linux-gnueabihf
|
||||||
|
setup: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
|
||||||
|
build: |
|
||||||
|
yarn build --target=armv7-unknown-linux-gnueabihf
|
||||||
|
arm-linux-gnueabihf-strip *.node
|
||||||
|
- host: ubuntu-18.04
|
||||||
|
architecture: x64
|
||||||
|
target: aarch64-unknown-linux-musl
|
||||||
|
downloadTarget: aarch64-unknown-linux-musl
|
||||||
|
docker: |
|
||||||
|
docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
|
||||||
|
docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
|
||||||
|
build: |
|
||||||
|
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "yarn build --target=aarch64-unknown-linux-musl && /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node"
|
||||||
|
- host: windows-latest
|
||||||
|
architecture: x64
|
||||||
|
target: aarch64-pc-windows-msvc
|
||||||
|
build: yarn build --target aarch64-pc-windows-msvc
|
||||||
|
name: stable - ${{ matrix.settings.target }} - node@16
|
||||||
|
runs-on: ${{ matrix.settings.host }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
architecture: ${{ matrix.settings.architecture }}
|
||||||
|
- name: Install
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
toolchain: stable
|
||||||
|
target: ${{ matrix.settings.target }}
|
||||||
|
- name: Generate Cargo.lock
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: generate-lockfile
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ matrix.settings.target }}-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
- name: Cache cargo index
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/git
|
||||||
|
key: ${{ matrix.settings.target }}-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-${{ matrix.settings.target }}-node@16-${{ hashFiles('yarn.lock') }}
|
||||||
|
- name: Pull latest image
|
||||||
|
run: ${{ matrix.settings.docker }}
|
||||||
|
env:
|
||||||
|
DOCKER_REGISTRY_URL: ghcr.io
|
||||||
|
if: ${{ matrix.settings.docker }}
|
||||||
|
- name: Setup toolchain
|
||||||
|
run: ${{ matrix.settings.setup }}
|
||||||
|
if: ${{ matrix.settings.setup }}
|
||||||
|
shell: bash
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Build
|
||||||
|
run: ${{ matrix.settings.build }}
|
||||||
|
shell: bash
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-${{ matrix.settings.target }}
|
||||||
|
path: ${{ env.APP_NAME }}.*.node
|
||||||
|
if-no-files-found: error
|
||||||
|
build-freebsd:
|
||||||
|
runs-on: macos-10.15
|
||||||
|
name: Build FreeBSD
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build
|
||||||
|
id: build
|
||||||
|
uses: vmactions/freebsd-vm@v0.1.5
|
||||||
|
env:
|
||||||
|
DEBUG: napi:*
|
||||||
|
RUSTUP_HOME: /usr/local/rustup
|
||||||
|
CARGO_HOME: /usr/local/cargo
|
||||||
|
RUSTUP_IO_THREADS: 1
|
||||||
|
with:
|
||||||
|
envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS
|
||||||
|
usesh: true
|
||||||
|
mem: 3000
|
||||||
|
prepare: |
|
||||||
|
pkg install -y curl node14 python2
|
||||||
|
curl -qL https://www.npmjs.com/install.sh | sh
|
||||||
|
npm install -g yarn
|
||||||
|
curl https://sh.rustup.rs -sSf --output rustup.sh
|
||||||
|
sh rustup.sh -y --profile minimal --default-toolchain stable
|
||||||
|
export PATH="/usr/local/cargo/bin:$PATH"
|
||||||
|
echo "~~~~ rustc --version ~~~~"
|
||||||
|
rustc --version
|
||||||
|
echo "~~~~ node -v ~~~~"
|
||||||
|
node -v
|
||||||
|
echo "~~~~ yarn --version ~~~~"
|
||||||
|
yarn --version
|
||||||
|
run: |
|
||||||
|
export PATH="/usr/local/cargo/bin:$PATH"
|
||||||
|
pwd
|
||||||
|
ls -lah
|
||||||
|
whoami
|
||||||
|
env
|
||||||
|
freebsd-version
|
||||||
|
yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
yarn build
|
||||||
|
strip -x *.node
|
||||||
|
yarn test
|
||||||
|
rm -rf node_modules
|
||||||
|
rm -rf target
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-freebsd
|
||||||
|
path: ${{ env.APP_NAME }}.*.node
|
||||||
|
if-no-files-found: error
|
||||||
|
test-macOS-windows-binding:
|
||||||
|
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
settings:
|
||||||
|
- host: windows-latest
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ${{ matrix.settings.host }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-${{ matrix.settings.target }}
|
||||||
|
path: .
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Test bindings
|
||||||
|
run: yarn test
|
||||||
|
test-linux-x64-gnu-binding:
|
||||||
|
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-x86_64-unknown-linux-gnu
|
||||||
|
path: .
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Test bindings
|
||||||
|
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
|
||||||
|
test-linux-x64-musl-binding:
|
||||||
|
name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node }}
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-test-x86_64-unknown-linux-musl-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-x86_64-unknown-linux-musl
|
||||||
|
path: .
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Test bindings
|
||||||
|
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test
|
||||||
|
test-linux-aarch64-gnu-binding:
|
||||||
|
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-aarch64-unknown-linux-gnu
|
||||||
|
path: .
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-test-linux-aarch64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Setup and run tests
|
||||||
|
uses: addnab/docker-run-action@v3
|
||||||
|
with:
|
||||||
|
image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }}
|
||||||
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
yarn test
|
||||||
|
ls -la
|
||||||
|
test-linux-aarch64-musl-binding:
|
||||||
|
name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-aarch64-unknown-linux-musl
|
||||||
|
path: .
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-test-linux-aarch64-musl-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Setup and run tests
|
||||||
|
uses: addnab/docker-run-action@v3
|
||||||
|
with:
|
||||||
|
image: multiarch/alpine:aarch64-latest-stable
|
||||||
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
apk add nodejs npm yarn
|
||||||
|
yarn test
|
||||||
|
test-linux-arm-gnueabihf-binding:
|
||||||
|
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
node:
|
||||||
|
- '12'
|
||||||
|
- '14'
|
||||||
|
- '16'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: bindings-armv7-unknown-linux-gnueabihf
|
||||||
|
path: .
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R .
|
||||||
|
shell: bash
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-test-linux-arm-gnueabihf-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Setup and run tests
|
||||||
|
uses: addnab/docker-run-action@v3
|
||||||
|
with:
|
||||||
|
image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-${{ matrix.node }}
|
||||||
|
options: '-v ${{ github.workspace }}:/build -w /build'
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
yarn test
|
||||||
|
ls -la
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- build-freebsd
|
||||||
|
- test-macOS-windows-binding
|
||||||
|
- test-linux-x64-gnu-binding
|
||||||
|
- test-linux-x64-musl-binding
|
||||||
|
- test-linux-aarch64-gnu-binding
|
||||||
|
- test-linux-aarch64-musl-binding
|
||||||
|
- test-linux-arm-gnueabihf-binding
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
check-latest: true
|
||||||
|
cache: yarn
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: npm-cache-ubuntu-latest-${{ hashFiles('yarn.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
npm-cache-
|
||||||
|
- name: Install dependencies
|
||||||
|
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
- name: Move artifacts
|
||||||
|
run: yarn artifacts
|
||||||
|
- name: List packages
|
||||||
|
run: ls -R ./npm
|
||||||
|
shell: bash
|
||||||
|
- name: Publish
|
||||||
|
run: |
|
||||||
|
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
|
||||||
|
then
|
||||||
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
||||||
|
npm publish --access public
|
||||||
|
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
|
||||||
|
then
|
||||||
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
||||||
|
npm publish --tag next --access public
|
||||||
|
else
|
||||||
|
echo "Not a release, skipping publish"
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
2
tooling/cli.rs/node/.gitignore
vendored
Normal file
2
tooling/cli.rs/node/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Automatically generated
|
||||||
|
/*.node
|
10
tooling/cli.rs/node/.npmignore
Normal file
10
tooling/cli.rs/node/.npmignore
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
target
|
||||||
|
Cargo.lock
|
||||||
|
.cargo
|
||||||
|
.github
|
||||||
|
npm
|
||||||
|
.eslintrc
|
||||||
|
.prettierignore
|
||||||
|
rustfmt.toml
|
||||||
|
yarn.lock
|
||||||
|
*.node
|
16
tooling/cli.rs/node/Cargo.toml
Normal file
16
tooling/cli.rs/node/Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
edition = "2021"
|
||||||
|
name = "tauri-cli-node"
|
||||||
|
version = "0.0.0"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["cdylib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
|
||||||
|
napi = { version = "2.0", default-features = false, features = ["napi4"] }
|
||||||
|
napi-derive = "2.0"
|
||||||
|
tauri-cli = { path = ".." }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
napi-build = "1.2"
|
45
tooling/cli.rs/node/README.md
Normal file
45
tooling/cli.rs/node/README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# @tauri-apps/cli
|
||||||
|
<img align="right" src="https://github.com/tauri-apps/tauri/raw/dev/app-icon.png" height="128" width="128">
|
||||||
|
|
||||||
|
[![status](https://img.shields.io/badge/Status-Beta-green.svg)](https://github.com/tauri-apps/tauri)
|
||||||
|
[![Chat Server](https://img.shields.io/badge/chat-on%20discord-7289da.svg)](https://discord.gg/SpmNs4S)
|
||||||
|
[![devto](https://img.shields.io/badge/blog-dev.to-black.svg)](https://dev.to/tauri)
|
||||||
|
|
||||||
|
![](https://img.shields.io/github/workflow/status/tauri-apps/tauri/test%20library?label=test%20library
|
||||||
|
)
|
||||||
|
[![devto](https://img.shields.io/badge/documentation-site-purple.svg)](https://tauri.studio)
|
||||||
|
|
||||||
|
[![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation)
|
||||||
|
[![support](https://img.shields.io/badge/sponsor-Opencollective-blue.svg)](https://opencollective.com/tauri)
|
||||||
|
|
||||||
|
| Component | Version |
|
||||||
|
| --------- | ------------------------------------------- |
|
||||||
|
| @tauri-apps/cli | ![](https://img.shields.io/npm/v/@tauri-apps/cli.svg) |
|
||||||
|
|
||||||
|
## 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`, and `yarn`, this library provides a node.js runner for common tasks when using Tauri, like `yarn tauri dev`. For the most part it is a wrapper around [cli.rs](https://github.com/tauri-apps/tauri/blob/dev/tooling/cli.rs).
|
||||||
|
|
||||||
|
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:
|
||||||
|
```
|
||||||
|
$ npm install --save-dev @tauri-apps/cli
|
||||||
|
$ yarn add --dev @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)
|
7
tooling/cli.rs/node/build.rs
Normal file
7
tooling/cli.rs/node/build.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
::napi_build::setup();
|
||||||
|
}
|
12
tooling/cli.rs/node/index.d.ts
vendored
Normal file
12
tooling/cli.rs/node/index.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
|
||||||
|
/* auto-generated by NAPI-RS */
|
||||||
|
|
||||||
|
export class ExternalObject<T> {
|
||||||
|
readonly '': {
|
||||||
|
readonly '': unique symbol
|
||||||
|
[K: symbol]: T
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export function run(args: Array<string>, binName?: string | undefined | null): void
|
241
tooling/cli.rs/node/index.js
Normal file
241
tooling/cli.rs/node/index.js
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
const { existsSync, readFileSync } = require('fs')
|
||||||
|
const { join } = require('path')
|
||||||
|
|
||||||
|
const { platform, arch } = process
|
||||||
|
|
||||||
|
let nativeBinding = null
|
||||||
|
let localFileExisted = false
|
||||||
|
let loadError = null
|
||||||
|
|
||||||
|
function isMusl() {
|
||||||
|
// For Node 10
|
||||||
|
if (!process.report || typeof process.report.getReport !== 'function') {
|
||||||
|
try {
|
||||||
|
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
||||||
|
} catch (e) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const { glibcVersionRuntime } = process.report.getReport().header
|
||||||
|
return !glibcVersionRuntime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (platform) {
|
||||||
|
case 'android':
|
||||||
|
switch (arch) {
|
||||||
|
case 'arm64':
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'cli.android-arm64.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.android-arm64.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-android-arm64')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm':
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'cli.android-arm-eabi.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.android-arm-eabi.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-android-arm-eabi')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported architecture on Android ${arch}`)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'win32':
|
||||||
|
switch (arch) {
|
||||||
|
case 'x64':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.win32-x64-msvc.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.win32-x64-msvc.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-win32-x64-msvc')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'ia32':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.win32-ia32-msvc.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.win32-ia32-msvc.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-win32-ia32-msvc')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm64':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.win32-arm64-msvc.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.win32-arm64-msvc.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-win32-arm64-msvc')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'darwin':
|
||||||
|
switch (arch) {
|
||||||
|
case 'x64':
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'cli.darwin-x64.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.darwin-x64.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-darwin-x64')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm64':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.darwin-arm64.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.darwin-arm64.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-darwin-arm64')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'freebsd':
|
||||||
|
if (arch !== 'x64') {
|
||||||
|
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
||||||
|
}
|
||||||
|
localFileExisted = existsSync(join(__dirname, 'cli.freebsd-x64.node'))
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.freebsd-x64.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-freebsd-x64')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'linux':
|
||||||
|
switch (arch) {
|
||||||
|
case 'x64':
|
||||||
|
if (isMusl()) {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.linux-x64-musl.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.linux-x64-musl.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-linux-x64-musl')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.linux-x64-gnu.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.linux-x64-gnu.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-linux-x64-gnu')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm64':
|
||||||
|
if (isMusl()) {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.linux-arm64-musl.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.linux-arm64-musl.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-linux-arm64-musl')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.linux-arm64-gnu.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.linux-arm64-gnu.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-linux-arm64-gnu')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'arm':
|
||||||
|
localFileExisted = existsSync(
|
||||||
|
join(__dirname, 'cli.linux-arm-gnueabihf.node')
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
if (localFileExisted) {
|
||||||
|
nativeBinding = require('./cli.linux-arm-gnueabihf.node')
|
||||||
|
} else {
|
||||||
|
nativeBinding = require('@tauri-apps/cli-linux-arm-gnueabihf')
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
loadError = e
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nativeBinding) {
|
||||||
|
if (loadError) {
|
||||||
|
throw loadError
|
||||||
|
}
|
||||||
|
throw new Error(`Failed to load native binding`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { run } = nativeBinding
|
||||||
|
|
||||||
|
module.exports.run = run
|
3
tooling/cli.rs/node/npm/darwin-arm64/README.md
Normal file
3
tooling/cli.rs/node/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`
|
21
tooling/cli.rs/node/npm/darwin-arm64/package.json
Normal file
21
tooling/cli.rs/node/npm/darwin-arm64/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli-darwin-arm64",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"main": "cli.darwin-arm64.node",
|
||||||
|
"files": [
|
||||||
|
"cli.darwin-arm64.node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
}
|
3
tooling/cli.rs/node/npm/darwin-x64/README.md
Normal file
3
tooling/cli.rs/node/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`
|
21
tooling/cli.rs/node/npm/darwin-x64/package.json
Normal file
21
tooling/cli.rs/node/npm/darwin-x64/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli-darwin-x64",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"main": "cli.darwin-x64.node",
|
||||||
|
"files": [
|
||||||
|
"cli.darwin-x64.node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
}
|
3
tooling/cli.rs/node/npm/linux-arm-gnueabihf/README.md
Normal file
3
tooling/cli.rs/node/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`
|
21
tooling/cli.rs/node/npm/linux-arm-gnueabihf/package.json
Normal file
21
tooling/cli.rs/node/npm/linux-arm-gnueabihf/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli-linux-arm-gnueabihf",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"main": "cli.linux-arm-gnueabihf.node",
|
||||||
|
"files": [
|
||||||
|
"cli.linux-arm-gnueabihf.node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
}
|
3
tooling/cli.rs/node/npm/linux-arm64-gnu/README.md
Normal file
3
tooling/cli.rs/node/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`
|
21
tooling/cli.rs/node/npm/linux-arm64-gnu/package.json
Normal file
21
tooling/cli.rs/node/npm/linux-arm64-gnu/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli-linux-arm64-gnu",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"main": "cli.linux-arm64-gnu.node",
|
||||||
|
"files": [
|
||||||
|
"cli.linux-arm64-gnu.node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
}
|
3
tooling/cli.rs/node/npm/linux-arm64-musl/README.md
Normal file
3
tooling/cli.rs/node/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`
|
21
tooling/cli.rs/node/npm/linux-arm64-musl/package.json
Normal file
21
tooling/cli.rs/node/npm/linux-arm64-musl/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli-linux-arm64-musl",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"main": "cli.linux-arm64-musl.node",
|
||||||
|
"files": [
|
||||||
|
"cli.linux-arm64-musl.node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
}
|
3
tooling/cli.rs/node/npm/linux-x64-gnu/README.md
Normal file
3
tooling/cli.rs/node/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`
|
21
tooling/cli.rs/node/npm/linux-x64-gnu/package.json
Normal file
21
tooling/cli.rs/node/npm/linux-x64-gnu/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli-linux-x64-gnu",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"main": "cli.linux-x64-gnu.node",
|
||||||
|
"files": [
|
||||||
|
"cli.linux-x64-gnu.node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
}
|
3
tooling/cli.rs/node/npm/linux-x64-musl/README.md
Normal file
3
tooling/cli.rs/node/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`
|
21
tooling/cli.rs/node/npm/linux-x64-musl/package.json
Normal file
21
tooling/cli.rs/node/npm/linux-x64-musl/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli-linux-x64-musl",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"main": "cli.linux-x64-musl.node",
|
||||||
|
"files": [
|
||||||
|
"cli.linux-x64-musl.node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
}
|
3
tooling/cli.rs/node/npm/win32-x64-msvc/README.md
Normal file
3
tooling/cli.rs/node/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`
|
21
tooling/cli.rs/node/npm/win32-x64-msvc/package.json
Normal file
21
tooling/cli.rs/node/npm/win32-x64-msvc/package.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli-win32-x64-msvc",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"main": "cli.win32-x64-msvc.node",
|
||||||
|
"files": [
|
||||||
|
"cli.win32-x64-msvc.node"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
}
|
||||||
|
}
|
59
tooling/cli.rs/node/package.json
Normal file
59
tooling/cli.rs/node/package.json
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"name": "@tauri-apps/cli",
|
||||||
|
"version": "1.0.0-beta.10",
|
||||||
|
"description": "Command line interface for building Tauri apps",
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/tauri"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/tauri-apps/tauri.git"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
"Tauri Team <team@tauri-apps.org> (https://tauri.studio)"
|
||||||
|
],
|
||||||
|
"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": "index.js",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"napi": {
|
||||||
|
"name": "cli",
|
||||||
|
"triples": {
|
||||||
|
"additional": [
|
||||||
|
"aarch64-apple-darwin",
|
||||||
|
"aarch64-unknown-linux-gnu",
|
||||||
|
"aarch64-unknown-linux-musl",
|
||||||
|
"armv7-unknown-linux-gnueabihf",
|
||||||
|
"x86_64-unknown-linux-musl"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@napi-rs/cli": "^2.4.2",
|
||||||
|
"prettier": "^2.5.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"tauri": "./tauri.js"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"artifacts": "napi artifacts",
|
||||||
|
"build": "napi build --platform --release",
|
||||||
|
"build:debug": "napi build --platform",
|
||||||
|
"prepublishOnly": "napi prepublish -t npm",
|
||||||
|
"test": "node ./tauri.js help",
|
||||||
|
"version": "napi version",
|
||||||
|
"tauri": "tauri",
|
||||||
|
"format": "prettier --write ./package.json ./tauri.js",
|
||||||
|
"format:check": "prettier --check ./package.json ./tauri.js"
|
||||||
|
}
|
||||||
|
}
|
10
tooling/cli.rs/node/src/lib.rs
Normal file
10
tooling/cli.rs/node/src/lib.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
use napi::{Error, Result, Status};
|
||||||
|
|
||||||
|
#[napi_derive::napi]
|
||||||
|
pub fn run(args: Vec<String>, bin_name: Option<String>) -> Result<()> {
|
||||||
|
tauri_cli::run(args, bin_name).map_err(|e| Error::new(Status::GenericFailure, e.to_string()))
|
||||||
|
}
|
50
tooling/cli.rs/node/tauri.js
Executable file
50
tooling/cli.rs/node/tauri.js
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const cli = require('./index')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const [bin, script, ...arguments] = 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
|
||||||
|
|
||||||
|
// Even if started by a package manager, the binary will be NodeJS.
|
||||||
|
// Some distribution still use "nodejs" as the binary name.
|
||||||
|
if (binStem === 'node' || binStem === 'nodejs') {
|
||||||
|
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 and pnpm 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.
|
||||||
|
arguments.unshift(bin)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
cli.run(arguments, binName)
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Eror running CLI: ${e.message}`)
|
||||||
|
}
|
13
tooling/cli.rs/node/yarn.lock
Normal file
13
tooling/cli.rs/node/yarn.lock
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@napi-rs/cli@^2.4.2":
|
||||||
|
version "2.4.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/@napi-rs/cli/-/cli-2.4.2.tgz#89b32c7d8776004bc9617915605aea769339cf6f"
|
||||||
|
integrity sha512-+yCOuPqernvD8BMphbadF87ElaJ0rjanOZrbnauaEdR07YyoalGw3FTk15HHyflIwQKlYd69gkG5EM4WFkICKw==
|
||||||
|
|
||||||
|
prettier@^2.5.1:
|
||||||
|
version "2.5.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a"
|
||||||
|
integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==
|
@ -1329,21 +1329,11 @@
|
|||||||
{
|
{
|
||||||
"description": "A variable that is set while calling the command from the webview API.",
|
"description": "A variable that is set while calling the command from the webview API.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
|
||||||
"name"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"name": {
|
"validator": {
|
||||||
"description": "The name of the variable to be passed in.\n\nThis will try to match the key of the passed arguments object from the webview API.",
|
"description": "[regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validator` regex before it will be executed.\n\n[regex]: https://docs.rs/regex/latest/regex/#syntax",
|
||||||
|
"default": "",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
|
||||||
"validate": {
|
|
||||||
"description": "Optional [regex] validator to require passed values to conform to an expected input.\n\nThis will require the argument value passed to this variable to match the `validate` regex before it will be executed.\n\n[regex]: https://docs.rs/regex/latest/regex/#syntax",
|
|
||||||
"default": null,
|
|
||||||
"type": [
|
|
||||||
"string",
|
|
||||||
"null"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
@ -6,12 +6,11 @@ use crate::helpers::{
|
|||||||
app_paths::{app_dir, tauri_dir},
|
app_paths::{app_dir, tauri_dir},
|
||||||
command_env,
|
command_env,
|
||||||
config::{get as get_config, AppUrl, WindowUrl},
|
config::{get as get_config, AppUrl, WindowUrl},
|
||||||
execute_with_output,
|
|
||||||
manifest::rewrite_manifest,
|
manifest::rewrite_manifest,
|
||||||
updater_signature::sign_file_from_env_variables,
|
updater_signature::sign_file_from_env_variables,
|
||||||
Logger,
|
Logger,
|
||||||
};
|
};
|
||||||
use crate::Result;
|
use crate::{CommandExt, Result};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
@ -73,24 +72,31 @@ pub fn command(options: Options) -> Result<()> {
|
|||||||
if !before_build.is_empty() {
|
if !before_build.is_empty() {
|
||||||
logger.log(format!("Running `{}`", before_build));
|
logger.log(format!("Running `{}`", before_build));
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
execute_with_output(
|
let status = Command::new("cmd")
|
||||||
Command::new("cmd")
|
.arg("/S")
|
||||||
.arg("/S")
|
.arg("/C")
|
||||||
.arg("/C")
|
.arg(before_build)
|
||||||
.arg(before_build)
|
.current_dir(app_dir())
|
||||||
.current_dir(app_dir())
|
.envs(command_env(options.debug))
|
||||||
.envs(command_env(options.debug)),
|
.pipe()?
|
||||||
)
|
.status()
|
||||||
.with_context(|| format!("failed to run `{}` with `cmd /C`", before_build))?;
|
.with_context(|| format!("failed to run `{}` with `cmd /C`", before_build))?;
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
execute_with_output(
|
let status = Command::new("sh")
|
||||||
Command::new("sh")
|
.arg("-c")
|
||||||
.arg("-c")
|
.arg(before_build)
|
||||||
.arg(before_build)
|
.current_dir(app_dir())
|
||||||
.current_dir(app_dir())
|
.envs(command_env(options.debug))
|
||||||
.envs(command_env(options.debug)),
|
.pipe()?
|
||||||
)
|
.status()
|
||||||
.with_context(|| format!("failed to run `{}` with `sh -c`", before_build))?;
|
.with_context(|| format!("failed to run `{}` with `sh -c`", before_build))?;
|
||||||
|
if !status.success() {
|
||||||
|
return Err(anyhow::anyhow!(
|
||||||
|
"beforeDevCommand `{}` failed with exit code {}",
|
||||||
|
before_build,
|
||||||
|
status.code().unwrap_or_default()
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ use crate::{
|
|||||||
manifest::{get_workspace_members, rewrite_manifest},
|
manifest::{get_workspace_members, rewrite_manifest},
|
||||||
Logger,
|
Logger,
|
||||||
},
|
},
|
||||||
Result,
|
CommandExt, Result,
|
||||||
};
|
};
|
||||||
use clap::{AppSettings, Parser};
|
use clap::{AppSettings, Parser};
|
||||||
|
|
||||||
@ -92,7 +92,8 @@ pub fn command(options: Options) -> Result<()> {
|
|||||||
.arg("/C")
|
.arg("/C")
|
||||||
.arg(before_dev)
|
.arg(before_dev)
|
||||||
.current_dir(app_dir())
|
.current_dir(app_dir())
|
||||||
.envs(command_env(true)); // development build always includes debug information
|
.envs(command_env(true))
|
||||||
|
.pipe()?; // development build always includes debug information
|
||||||
command
|
command
|
||||||
};
|
};
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
@ -102,7 +103,8 @@ pub fn command(options: Options) -> Result<()> {
|
|||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(before_dev)
|
.arg(before_dev)
|
||||||
.current_dir(app_dir())
|
.current_dir(app_dir())
|
||||||
.envs(command_env(true)); // development build always includes debug information
|
.envs(command_env(true))
|
||||||
|
.pipe()?; // development build always includes debug information
|
||||||
command
|
command
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -316,6 +318,8 @@ fn start_app(
|
|||||||
command.arg("--").args(&options.args);
|
command.arg("--").args(&options.args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
command.pipe().unwrap();
|
||||||
|
|
||||||
let child =
|
let child =
|
||||||
SharedChild::spawn(&mut command).unwrap_or_else(|_| panic!("failed to run {}", runner));
|
SharedChild::spawn(&mut command).unwrap_or_else(|_| panic!("failed to run {}", runner));
|
||||||
let child_arc = Arc::new(child);
|
let child_arc = Arc::new(child);
|
||||||
|
@ -14,33 +14,9 @@ pub use logger::Logger;
|
|||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
io::{BufRead, BufReader},
|
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process::{Command, Stdio},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn execute_with_output(cmd: &mut Command) -> crate::Result<()> {
|
|
||||||
let mut child = cmd
|
|
||||||
.stdout(Stdio::piped())
|
|
||||||
.spawn()
|
|
||||||
.expect("failed to spawn command");
|
|
||||||
{
|
|
||||||
let stdout = child.stdout.as_mut().expect("Failed to get stdout handle");
|
|
||||||
let reader = BufReader::new(stdout);
|
|
||||||
|
|
||||||
for line in reader.lines() {
|
|
||||||
println!("{}", line.expect("Failed to get line"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let status = child.wait()?;
|
|
||||||
if status.success() {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err(anyhow::anyhow!("command failed"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn command_env(debug: bool) -> HashMap<String, String> {
|
pub fn command_env(debug: bool) -> HashMap<String, String> {
|
||||||
let mut map = HashMap::new();
|
let mut map = HashMap::new();
|
||||||
|
|
||||||
|
@ -15,11 +15,14 @@ use anyhow::Context;
|
|||||||
use heck::ToKebabCase;
|
use heck::ToKebabCase;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use crate::helpers::{
|
use crate::{
|
||||||
app_paths::tauri_dir,
|
helpers::{
|
||||||
config::{wix_settings, Config},
|
app_paths::tauri_dir,
|
||||||
manifest::Manifest,
|
config::{wix_settings, Config},
|
||||||
Logger,
|
manifest::Manifest,
|
||||||
|
Logger,
|
||||||
|
},
|
||||||
|
CommandExt,
|
||||||
};
|
};
|
||||||
use tauri_bundler::{
|
use tauri_bundler::{
|
||||||
AppCategory, BundleBinary, BundleSettings, DebianSettings, MacOsSettings, PackageSettings,
|
AppCategory, BundleBinary, BundleSettings, DebianSettings, MacOsSettings, PackageSettings,
|
||||||
@ -120,6 +123,8 @@ pub fn build_project(
|
|||||||
command.arg("--release");
|
command.arg("--release");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
command.pipe()?;
|
||||||
|
|
||||||
let status = command
|
let status = command
|
||||||
.status()
|
.status()
|
||||||
.with_context(|| format!("failed to run {}", runner))?;
|
.with_context(|| format!("failed to run {}", runner))?;
|
||||||
|
104
tooling/cli.rs/src/lib.rs
Normal file
104
tooling/cli.rs/src/lib.rs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
pub use anyhow::Result;
|
||||||
|
|
||||||
|
mod build;
|
||||||
|
mod dev;
|
||||||
|
mod helpers;
|
||||||
|
mod info;
|
||||||
|
mod init;
|
||||||
|
mod interface;
|
||||||
|
mod plugin;
|
||||||
|
mod signer;
|
||||||
|
|
||||||
|
use clap::{AppSettings, FromArgMatches, IntoApp, Parser, Subcommand};
|
||||||
|
|
||||||
|
use std::ffi::OsString;
|
||||||
|
|
||||||
|
pub(crate) trait CommandExt {
|
||||||
|
fn pipe(&mut self) -> Result<&mut Self>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl CommandExt for std::process::Command {
|
||||||
|
fn pipe(&mut self) -> Result<&mut Self> {
|
||||||
|
self.stdout(os_pipe::dup_stdout()?);
|
||||||
|
self.stderr(os_pipe::dup_stderr()?);
|
||||||
|
Ok(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Deserialize)]
|
||||||
|
pub struct VersionMetadata {
|
||||||
|
tauri: String,
|
||||||
|
#[serde(rename = "tauri-build")]
|
||||||
|
tauri_build: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Parser)]
|
||||||
|
#[clap(author, version, about, bin_name("cargo-tauri"))]
|
||||||
|
#[clap(global_setting(AppSettings::PropagateVersion))]
|
||||||
|
#[clap(global_setting(AppSettings::UseLongFormatForHelpSubcommand))]
|
||||||
|
#[clap(global_setting(AppSettings::NoBinaryName))]
|
||||||
|
#[clap(setting(AppSettings::SubcommandRequiredElseHelp))]
|
||||||
|
struct Cli {
|
||||||
|
#[clap(subcommand)]
|
||||||
|
command: Commands,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Subcommand)]
|
||||||
|
enum Commands {
|
||||||
|
Build(build::Options),
|
||||||
|
Dev(dev::Options),
|
||||||
|
Info(info::Options),
|
||||||
|
Init(init::Options),
|
||||||
|
Plugin(plugin::Cli),
|
||||||
|
Signer(signer::Cli),
|
||||||
|
}
|
||||||
|
|
||||||
|
fn format_error<I: IntoApp>(err: clap::Error) -> clap::Error {
|
||||||
|
let mut app = I::into_app();
|
||||||
|
err.format(&mut app)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Run the Tauri CLI with the passed arguments.
|
||||||
|
///
|
||||||
|
/// The passed arguments should have the binary argument(s) stripped out before being passed.
|
||||||
|
///
|
||||||
|
/// e.g.
|
||||||
|
/// 1. `tauri-cli 1 2 3` -> `1 2 3`
|
||||||
|
/// 2. `cargo tauri 1 2 3` -> `1 2 3`
|
||||||
|
/// 3. `node tauri.js 1 2 3` -> `1 2 3`
|
||||||
|
///
|
||||||
|
/// The passed `bin_name` parameter should be how you want the help messages to display the command.
|
||||||
|
/// This defaults to `cargo-tauri`, but should be set to how the program was called, such as
|
||||||
|
/// `cargo tauri`.
|
||||||
|
pub fn run<I, A>(args: I, bin_name: Option<String>) -> Result<()>
|
||||||
|
where
|
||||||
|
I: IntoIterator<Item = A>,
|
||||||
|
A: Into<OsString> + Clone,
|
||||||
|
{
|
||||||
|
let matches = match bin_name {
|
||||||
|
Some(bin_name) => Cli::into_app().bin_name(bin_name),
|
||||||
|
None => Cli::into_app(),
|
||||||
|
}
|
||||||
|
.get_matches_from(args);
|
||||||
|
|
||||||
|
let res = Cli::from_arg_matches(&matches).map_err(format_error::<Cli>);
|
||||||
|
let cli = match res {
|
||||||
|
Ok(s) => s,
|
||||||
|
Err(e) => e.exit(),
|
||||||
|
};
|
||||||
|
|
||||||
|
match cli.command {
|
||||||
|
Commands::Build(options) => build::command(options)?,
|
||||||
|
Commands::Dev(options) => dev::command(options)?,
|
||||||
|
Commands::Info(options) => info::command(options)?,
|
||||||
|
Commands::Init(options) => init::command(options)?,
|
||||||
|
Commands::Plugin(cli) => plugin::command(cli)?,
|
||||||
|
Commands::Signer(cli) => signer::command(cli)?,
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
@ -2,83 +2,33 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
pub use anyhow::Result;
|
use std::env::args_os;
|
||||||
|
use std::ffi::OsStr;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::process::exit;
|
||||||
|
|
||||||
mod build;
|
fn main() -> tauri_cli::Result<()> {
|
||||||
mod dev;
|
let mut args = args_os();
|
||||||
mod helpers;
|
let bin_name = match args
|
||||||
mod info;
|
.next()
|
||||||
mod init;
|
.as_deref()
|
||||||
mod interface;
|
.map(Path::new)
|
||||||
mod plugin;
|
.and_then(Path::file_stem)
|
||||||
mod signer;
|
.and_then(OsStr::to_str)
|
||||||
|
{
|
||||||
use clap::{AppSettings, FromArgMatches, IntoApp, Parser, Subcommand};
|
Some("cargo-tauri") => {
|
||||||
|
if args.by_ref().peekable().peek().and_then(|s| s.to_str()) == Some("tauri") {
|
||||||
#[derive(serde::Deserialize)]
|
Some("cargo tauri".into())
|
||||||
pub struct VersionMetadata {
|
} else {
|
||||||
tauri: String,
|
Some("cargo-tauri".into())
|
||||||
#[serde(rename = "tauri-build")]
|
}
|
||||||
tauri_build: String,
|
}
|
||||||
}
|
Some(stem) => Some(stem.to_string()),
|
||||||
|
None => {
|
||||||
#[derive(Parser)]
|
eprintln!("cargo-tauri wrapper unable to read first argument");
|
||||||
#[clap(author, version, about, bin_name("cargo tauri"))]
|
exit(1);
|
||||||
#[clap(global_setting(AppSettings::PropagateVersion))]
|
}
|
||||||
#[clap(global_setting(AppSettings::UseLongFormatForHelpSubcommand))]
|
|
||||||
#[clap(setting(AppSettings::SubcommandRequiredElseHelp))]
|
|
||||||
struct Cli {
|
|
||||||
#[clap(subcommand)]
|
|
||||||
command: Commands,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
|
||||||
enum Commands {
|
|
||||||
Build(build::Options),
|
|
||||||
Dev(dev::Options),
|
|
||||||
Info(info::Options),
|
|
||||||
Init(init::Options),
|
|
||||||
Plugin(plugin::Cli),
|
|
||||||
Signer(signer::Cli),
|
|
||||||
}
|
|
||||||
|
|
||||||
fn format_error<I: IntoApp>(err: clap::Error) -> clap::Error {
|
|
||||||
let mut app = I::into_app();
|
|
||||||
err.format(&mut app)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
|
||||||
let matches = <Cli as IntoApp>::into_app()
|
|
||||||
.arg(clap::Arg::new("cargo").hide(true).possible_value("tauri"))
|
|
||||||
.get_matches();
|
|
||||||
let res = <Cli as FromArgMatches>::from_arg_matches(&matches).map_err(format_error::<Cli>);
|
|
||||||
let cli = match res {
|
|
||||||
Ok(s) => s,
|
|
||||||
Err(e) => e.exit(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
match cli.command {
|
tauri_cli::run(args, bin_name)
|
||||||
Commands::Build(options) => build::command(options)?,
|
|
||||||
Commands::Dev(options) => dev::command(options)?,
|
|
||||||
Commands::Info(options) => info::command(options)?,
|
|
||||||
Commands::Init(options) => init::command(options)?,
|
|
||||||
Commands::Plugin(cli) => plugin::command(cli)?,
|
|
||||||
Commands::Signer(cli) => signer::command(cli)?,
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if let Some(matches) = matches.subcommand_matches("dev") {
|
|
||||||
dev::command(matches)?;
|
|
||||||
} else if let Some(matches) = matches.subcommand_matches("build") {
|
|
||||||
build::command(matches)?;
|
|
||||||
} else if let Some(matches) = matches.subcommand_matches("signer") {
|
|
||||||
signer::command(matches)?;
|
|
||||||
} else if let Some(_) = matches.subcommand_matches("info") {
|
|
||||||
info::command()?;
|
|
||||||
} else if let Some(matches) = matches.subcommand_matches("init") {
|
|
||||||
init::command(matches)?;
|
|
||||||
} else if let Some(matches) = matches.subcommand_matches("plugin") {
|
|
||||||
plugin::command(matches)?;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
@ -324,10 +324,10 @@ You may find the requirements here: ${cyan(setupLink)}
|
|||||||
return final
|
return final
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
// TODO: const tauriCLIVersion = !argv.dev ?
|
||||||
const tauriCLIVersion = !argv.dev
|
// 'latest'
|
||||||
? 'latest'
|
// :`file:${relative(appDirectory, join(__dirname, '../../cli.js'))}`
|
||||||
: `file:${relative(appDirectory, join(__dirname, '../../cli.js'))}`
|
const tauriCLIVersion = 'latest'
|
||||||
const apiVersion = !argv.dev
|
const apiVersion = !argv.dev
|
||||||
? 'latest'
|
? 'latest'
|
||||||
: `file:${relative(appDirectory, join(__dirname, '../../api/dist'))}`
|
: `file:${relative(appDirectory, join(__dirname, '../../api/dist'))}`
|
||||||
|
@ -18,8 +18,8 @@ if (nodeVersion === '14') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ctaBinary = path.resolve('./bin/create-tauri-app.js')
|
const ctaBinary = path.resolve('./bin/create-tauri-app.js')
|
||||||
const clijs = path.resolve('../cli.js/')
|
//const clijs = path.resolve('../cli.js/')
|
||||||
const api = path.resolve('../api/')
|
//const api = path.resolve('../api/')
|
||||||
|
|
||||||
const manager = process.env.TAURI_RUN_MANAGER || 'yarn'
|
const manager = process.env.TAURI_RUN_MANAGER || 'yarn'
|
||||||
const recipes = process.env.TAURI_RECIPE
|
const recipes = process.env.TAURI_RECIPE
|
||||||
|
Loading…
Reference in New Issue
Block a user