diff --git a/.changes/config.json b/.changes/config.json index df24db02d..1cff960aa 100644 --- a/.changes/config.json +++ b/.changes/config.json @@ -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 }" } } } diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index c8e18d1a5..bd35188ea 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -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 diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index 8c84cfbaa..47ea49a8d 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -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 diff --git a/.scripts/covector/generate-cli-doc.js b/.scripts/covector/generate-cli-doc.js new file mode 100644 index 000000000..ca98baad6 --- /dev/null +++ b/.scripts/covector/generate-cli-doc.js @@ -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) diff --git a/.scripts/sync-cli-metadata.js b/.scripts/covector/sync-cli-metadata.js similarity index 100% rename from .scripts/sync-cli-metadata.js rename to .scripts/covector/sync-cli-metadata.js diff --git a/.scripts/sync-prerelease.js b/.scripts/covector/sync-prerelease.js similarity index 100% rename from .scripts/sync-prerelease.js rename to .scripts/covector/sync-prerelease.js diff --git a/docs/.templates/cli.md b/docs/.templates/cli.md new file mode 100644 index 000000000..146588670 --- /dev/null +++ b/docs/.templates/cli.md @@ -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` + + + +{info} + +It shows a concise list of information about the environment, Rust, Node.js and their versions as well as some relevant configurations. + + +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. + + +## `init` + + + +{init} + +## `plugin init` + + + +{plugin init} + +## `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. + +See more about the configuration.

+ + + +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. + + +## `deps` + + + +{deps} + +## `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. + +See more about the configuration. + +## `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` + + + +``` + 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). diff --git a/tooling/cli.js/bin/tauri-icon.js b/tooling/cli.js/bin/tauri-icon.js index 137df7d37..9285c0f3e 100644 --- a/tooling/cli.js/bin/tauri-icon.js +++ b/tooling/cli.js/bin/tauri-icon.js @@ -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) } diff --git a/tooling/cli.rs/src/cli.yml b/tooling/cli.rs/src/cli.yml index 4f249176f..ac855e8bc 100644 --- a/tooling/cli.rs/src/cli.yml +++ b/tooling/cli.rs/src/cli.yml @@ -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: