mirror of https://github.com/tauri-apps/tauri
feat(ci): fill CLI docs on `covector version` (#2886)
This commit is contained in:
parent
db275f0b63
commit
8000675366
|
@ -218,13 +218,13 @@
|
|||
"path": "./core/tauri-runtime",
|
||||
"manager": "rust",
|
||||
"dependencies": ["tauri-utils"],
|
||||
"postversion": "node ../../.scripts/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||
"postversion": "node ../../.scripts/covector/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||
},
|
||||
"tauri-runtime-wry": {
|
||||
"path": "./core/tauri-runtime-wry",
|
||||
"manager": "rust",
|
||||
"dependencies": ["tauri-utils", "tauri-runtime"],
|
||||
"postversion": "node ../../.scripts/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||
"postversion": "node ../../.scripts/covector/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||
},
|
||||
"tauri-codegen": {
|
||||
"path": "./core/tauri-codegen",
|
||||
|
@ -240,7 +240,7 @@
|
|||
"path": "./core/tauri-build",
|
||||
"manager": "rust",
|
||||
"dependencies": ["tauri-codegen", "tauri-utils"],
|
||||
"postversion": "node ../../.scripts/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
||||
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
||||
},
|
||||
"tauri": {
|
||||
"path": "./core/tauri",
|
||||
|
@ -251,13 +251,13 @@
|
|||
"tauri-runtime",
|
||||
"tauri-runtime-wry"
|
||||
],
|
||||
"postversion": "node ../../.scripts/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
||||
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }"
|
||||
},
|
||||
"cli.js": {
|
||||
"path": "./tooling/cli.js",
|
||||
"manager": "javascript",
|
||||
"dependencies": ["cli.rs"],
|
||||
"postversion": "node ../../.scripts/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
|
||||
"postversion": "node ../../.scripts/covector/sync-cli-metadata.js ${ pkg.pkg } ${ release.type }",
|
||||
"assets": [
|
||||
{
|
||||
"path": "./tooling/cli.js/tauri-apps-cli-${ pkgFile.version }.tgz",
|
||||
|
@ -269,7 +269,7 @@
|
|||
"path": "./tooling/cli.rs",
|
||||
"manager": "rust",
|
||||
"dependencies": ["tauri-bundler"],
|
||||
"postversion": "cargo check"
|
||||
"postversion": "node ../../.scripts/covector/generate-cli-doc.js && cargo check"
|
||||
},
|
||||
"create-tauri-app": {
|
||||
"path": "./tooling/create-tauri-app",
|
||||
|
@ -278,7 +278,7 @@
|
|||
"tauri-driver": {
|
||||
"path": "./tooling/webdriver",
|
||||
"manager": "rust",
|
||||
"postversion": "node ../../.scripts/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||
"postversion": "node ../../.scripts/covector/sync-prerelease.js ${ pkg.pkg } ${ release.type }"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,24 @@ jobs:
|
|||
registry-url: "https://registry.npmjs.org"
|
||||
cache: yarn
|
||||
cache-dependency-path: tooling/*/yarn.lock
|
||||
|
||||
- name: Cache CLI cargo target
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: tooling/cli.rs/target
|
||||
# Add date to the cache to keep it up to date
|
||||
key: ubuntu-latest-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}-${{ env.CURRENT_DATE }}
|
||||
# Restore from outdated cache for speed
|
||||
restore-keys: |
|
||||
ubuntu-latest-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
|
||||
ubuntu-latest-stable-cargo-cli-
|
||||
|
||||
- name: build CLI
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --manifest-path ./tooling/cli.rs/Cargo.toml
|
||||
|
||||
- name: cargo login
|
||||
run: cargo login ${{ secrets.crate_token }}
|
||||
- name: git config
|
||||
|
@ -105,7 +123,10 @@ jobs:
|
|||
# Moving docs for Indexation
|
||||
- name: copy docs
|
||||
working-directory: ./tauri
|
||||
run: mv docs/sidebar.json ../tauri-docs/sidebars/core.json && cp -r docs ../tauri-docs/docs/en && mv ARCHITECTURE.md ../tauri-docs/docs/en/about/architecture.md
|
||||
run: |
|
||||
mv docs/sidebar.json ${{ github.workspace }}/tauri-docs/sidebars/core.json
|
||||
cp -r docs/!(.templates) ${{ github.workspace }}/tauri-docs/docs/en
|
||||
mv ARCHITECTURE.md ${{ github.workspace }}/tauri-docs/docs/en/about/architecture.md
|
||||
|
||||
# Indexing
|
||||
- name: meilisearch indexation
|
||||
|
|
|
@ -73,7 +73,10 @@ jobs:
|
|||
# Moving docs for Indexation
|
||||
- name: copy docs
|
||||
working-directory: ./tauri
|
||||
run: mv docs/sidebar.json ${{ github.workspace }}/tauri-docs/sidebars/core.json && cp -r docs/* ${{ github.workspace }}/tauri-docs/docs/en && mv ARCHITECTURE.md ${{ github.workspace }}/tauri-docs/docs/en/about/architecture.md
|
||||
run: |
|
||||
mv docs/sidebar.json ${{ github.workspace }}/tauri-docs/sidebars/core.json
|
||||
cp -r docs/!(.templates) ${{ github.workspace }}/tauri-docs/docs/en
|
||||
mv ARCHITECTURE.md ${{ github.workspace }}/tauri-docs/docs/en/about/architecture.md
|
||||
|
||||
# Indexing
|
||||
- name: meilisearch indexation
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
const childProcess = require('child_process')
|
||||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const rustCliPath = path.join(__dirname, '../../tooling/cli.rs/target/debug/cargo-tauri')
|
||||
const templatePath = path.join(__dirname, '../../docs/.templates/cli.md')
|
||||
const targetPath = path.join(__dirname, '../../docs/api/cli.md')
|
||||
const template = fs.readFileSync(templatePath, 'utf8')
|
||||
|
||||
const commands = ['info', 'init', 'plugin init', 'dev', 'build']
|
||||
|
||||
let doc = template
|
||||
|
||||
for (const cmd of commands) {
|
||||
const output = childProcess.execSync(`${rustCliPath} ${cmd} --help`).toString().split('\n')
|
||||
output.splice(0, 2)
|
||||
output.splice(-1)
|
||||
doc = doc.replace(`{${cmd}}`, '```\n' + output.join('\n') + '\n```')
|
||||
}
|
||||
|
||||
fs.writeFileSync(targetPath, doc)
|
|
@ -0,0 +1,104 @@
|
|||
---
|
||||
id: cli
|
||||
title: CLI
|
||||
---
|
||||
|
||||
import Command from '@theme/Command'
|
||||
import Alert from '@theme/Alert'
|
||||
|
||||
The `cli.js` command line interface is composed in TypeScript and published as a JavaScript NPM. It offers the `deps` and the `icon` commands, and propagates other commands to `cli.rs`.
|
||||
|
||||
## `info`
|
||||
|
||||
<Command name="info" />
|
||||
|
||||
{info}
|
||||
|
||||
It shows a concise list of information about the environment, Rust, Node.js and their versions as well as some relevant configurations.
|
||||
|
||||
<Alert title="Note" icon="info-alt">
|
||||
This command is pretty helpful when you need to have a quick overview of your application. When requesting some help, it can be useful that you share this report with us.
|
||||
</Alert>
|
||||
|
||||
## `init`
|
||||
|
||||
<Command name="init" />
|
||||
|
||||
{init}
|
||||
|
||||
## `plugin init`
|
||||
|
||||
<Command name="plugin init" />
|
||||
|
||||
{plugin init}
|
||||
|
||||
## `dev`
|
||||
|
||||
<Command name="dev" />
|
||||
|
||||
{dev}
|
||||
|
||||
This command will open the WebView in development mode. It makes use of the `build.devPath` property from your `src-tauri/tauri.conf.json` file.
|
||||
|
||||
If you have entered a command to the `build.beforeDevCommand` property, this one will be executed before the `dev` command.
|
||||
|
||||
<a href="/docs/api/config#build">See more about the configuration.</a><br/><br/>
|
||||
|
||||
<Alert title="Troubleshooting" type="warning" icon="alert">
|
||||
|
||||
If you're not using `build.beforeDevCommand`, make sure your `build.devPath` is correct and, if using a development server, that it's started before using this command.
|
||||
</Alert>
|
||||
|
||||
## `deps`
|
||||
|
||||
<Command name="deps" />
|
||||
|
||||
{deps}
|
||||
|
||||
## `build`
|
||||
|
||||
<Command name="build" />
|
||||
|
||||
{build}
|
||||
|
||||
This command will bundle your application, either in production mode or debug mode if you used the `--debug` flag. It makes use of the `build.distDir` property from your `src-tauri/tauri.conf.json` file.
|
||||
|
||||
If you have entered a command to the `build.beforeBuildCommand` property, this one will be executed before the `build` command.
|
||||
|
||||
<a href="/docs/api/config#build">See more about the configuration.</a>
|
||||
|
||||
## `icon`
|
||||
|
||||
<Command name="icon" />
|
||||
|
||||
```
|
||||
Description
|
||||
Create all the icons you need for your Tauri app.
|
||||
|
||||
Usage
|
||||
$ tauri icon /path/to/icon.png
|
||||
|
||||
Options
|
||||
--help, -h Displays this message
|
||||
--log, -l Logging [boolean]
|
||||
--target, -t Target folder (default: 'src-tauri/icons')
|
||||
--compression, -c Compression type [optipng|zopfli]
|
||||
--ci Runs the script in CI mode
|
||||
```
|
||||
|
||||
This command will generate a set of icons, based on the source icon you've entered. Note that the source icon must be 1240x1240 with transparency.
|
||||
|
||||
## `version`
|
||||
|
||||
<Command name="--version" />
|
||||
|
||||
```
|
||||
Description
|
||||
Returns the current version of tauri
|
||||
```
|
||||
|
||||
This command will show the current version of Tauri.
|
||||
|
||||
## CLI usage
|
||||
|
||||
See more about the usage through this [complete guide](/docs/usage/development/integration).
|
|
@ -44,7 +44,7 @@ if (argv.help) {
|
|||
--log, l Logging [boolean]
|
||||
--target, t Target folder (default: 'src-tauri/icons')
|
||||
--compression, c Compression type [optipng|zopfli]
|
||||
--ci Runs the script in CI mode
|
||||
--ci Runs the script in CI mode
|
||||
`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ subcommands:
|
|||
about: Overwrite private key even if it exists on the specified path
|
||||
requires: generate
|
||||
- info:
|
||||
about: Shows information about Tauri dependencies
|
||||
about: Shows information about Tauri dependencies and project configuration.
|
||||
- init:
|
||||
about: Initializes a Tauri project.
|
||||
args:
|
||||
|
|
Loading…
Reference in New Issue