@tauri-apps/cli 2.0.0-rc.15 → 2.0.0-rc.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/__tests__/fixtures/empty/dist/index.html +6 -0
- package/__tests__/fixtures/empty/package.json +5 -0
- package/__tests__/template.spec.ts +65 -0
- package/config.schema.json +7 -1
- package/main.d.ts +1 -1
- package/package.json +14 -17
- package/src/lib.rs +1 -1
- package/jest.config.js +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## \[2.0.0-rc.16]
|
|
4
|
+
|
|
5
|
+
### New Features
|
|
6
|
+
|
|
7
|
+
- [`9bb8fc618`](https://www.github.com/tauri-apps/tauri/commit/9bb8fc6189a93bcb811588b36e710d0f7818a1f9) ([#11030](https://www.github.com/tauri-apps/tauri/pull/11030) by [@amrbashir](https://www.github.com/tauri-apps/tauri/../../amrbashir)) Add `--no-example` flag for `tauri plugin new` and `tauri plugin init` to disable creation of an example project.
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
- Upgraded to `tauri-cli@2.0.0-rc.16`
|
|
12
|
+
|
|
3
13
|
## \[2.0.0-rc.15]
|
|
4
14
|
|
|
5
15
|
### Enhancements
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
import { resolve } from 'node:path'
|
|
6
|
+
import {
|
|
7
|
+
existsSync,
|
|
8
|
+
readFileSync,
|
|
9
|
+
writeFileSync,
|
|
10
|
+
rmSync,
|
|
11
|
+
renameSync
|
|
12
|
+
} from 'node:fs'
|
|
13
|
+
import cli from '../main.js'
|
|
14
|
+
import { describe, it } from 'vitest'
|
|
15
|
+
|
|
16
|
+
describe('[CLI] @tauri-apps/cli template', () => {
|
|
17
|
+
it('init a project and builds it', { timeout: 15 * 60 * 1000 }, async () => {
|
|
18
|
+
const cwd = process.cwd()
|
|
19
|
+
const fixturePath = resolve(__dirname, './fixtures/empty')
|
|
20
|
+
const tauriFixturePath = resolve(fixturePath, 'src-tauri')
|
|
21
|
+
const outPath = resolve(tauriFixturePath, 'target')
|
|
22
|
+
const cacheOutPath = resolve(fixturePath, 'target')
|
|
23
|
+
|
|
24
|
+
process.chdir(fixturePath)
|
|
25
|
+
|
|
26
|
+
const outExists = existsSync(outPath)
|
|
27
|
+
if (outExists) {
|
|
28
|
+
if (existsSync(cacheOutPath)) {
|
|
29
|
+
rmSync(cacheOutPath, { recursive: true, force: true })
|
|
30
|
+
}
|
|
31
|
+
renameSync(outPath, cacheOutPath)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
await cli.run([
|
|
35
|
+
'init',
|
|
36
|
+
'--directory',
|
|
37
|
+
process.cwd(),
|
|
38
|
+
'--force',
|
|
39
|
+
'--tauri-path',
|
|
40
|
+
resolve(__dirname, '../../..'),
|
|
41
|
+
'--before-build-command',
|
|
42
|
+
'',
|
|
43
|
+
'--before-dev-command',
|
|
44
|
+
'',
|
|
45
|
+
'--ci'
|
|
46
|
+
])
|
|
47
|
+
|
|
48
|
+
if (outExists) {
|
|
49
|
+
renameSync(cacheOutPath, outPath)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
process.chdir(tauriFixturePath)
|
|
53
|
+
|
|
54
|
+
const manifestPath = resolve(tauriFixturePath, 'Cargo.toml')
|
|
55
|
+
const manifestFile = readFileSync(manifestPath).toString()
|
|
56
|
+
writeFileSync(manifestPath, `workspace = { }\n${manifestFile}`)
|
|
57
|
+
|
|
58
|
+
const configPath = resolve(tauriFixturePath, 'tauri.conf.json')
|
|
59
|
+
const config = readFileSync(configPath).toString()
|
|
60
|
+
writeFileSync(configPath, config.replace('com.tauri.dev', 'com.tauri.test'))
|
|
61
|
+
|
|
62
|
+
await cli.run(['build', '--verbose'])
|
|
63
|
+
process.chdir(cwd)
|
|
64
|
+
})
|
|
65
|
+
})
|
package/config.schema.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://schema.tauri.app/config/2.0.0-rc.15",
|
|
3
4
|
"title": "Config",
|
|
4
5
|
"description": "The Tauri configuration object.\n It is read from a file where you can define your frontend assets,\n configure the bundler and define a tray icon.\n\n The configuration file is generated by the\n [`tauri init`](https://tauri.app/v1/api/cli#init) command that lives in\n your Tauri application source directory (src-tauri).\n\n Once generated, you may modify it at will to customize your Tauri application.\n\n ## File Formats\n\n By default, the configuration is defined as a JSON file named `tauri.conf.json`.\n\n Tauri also supports JSON5 and TOML files via the `config-json5` and `config-toml` Cargo features, respectively.\n The JSON5 file name must be either `tauri.conf.json` or `tauri.conf.json5`.\n The TOML file name is `Tauri.toml`.\n\n ## Platform-Specific Configuration\n\n In addition to the default configuration file, Tauri can\n read a platform-specific configuration from `tauri.linux.conf.json`,\n `tauri.windows.conf.json`, `tauri.macos.conf.json`, `tauri.android.conf.json` and `tauri.ios.conf.json`\n (or `Tauri.linux.toml`, `Tauri.windows.toml`, `Tauri.macos.toml`, `Tauri.android.toml` and `Tauri.ios.toml` if the `Tauri.toml` format is used),\n which gets merged with the main configuration object.\n\n ## Configuration Structure\n\n The configuration is composed of the following objects:\n\n - [`app`](#appconfig): The Tauri configuration\n - [`build`](#buildconfig): The build configuration\n - [`bundle`](#bundleconfig): The bundle configurations\n - [`plugins`](#pluginconfig): The plugins configuration\n\n Example tauri.config.json file:\n\n ```json\n {\n \"productName\": \"tauri-app\",\n \"version\": \"0.1.0\",\n \"build\": {\n \"beforeBuildCommand\": \"\",\n \"beforeDevCommand\": \"\",\n \"devUrl\": \"../dist\",\n \"frontendDist\": \"../dist\"\n },\n \"app\": {\n \"security\": {\n \"csp\": null\n },\n \"windows\": [\n {\n \"fullscreen\": false,\n \"height\": 600,\n \"resizable\": true,\n \"title\": \"Tauri App\",\n \"width\": 800\n }\n ]\n },\n \"bundle\": {},\n \"plugins\": {}\n }\n ```",
|
|
5
6
|
"type": "object",
|
|
@@ -160,7 +161,7 @@
|
|
|
160
161
|
"type": "object",
|
|
161
162
|
"properties": {
|
|
162
163
|
"windows": {
|
|
163
|
-
"description": "The windows configuration.",
|
|
164
|
+
"description": "The app windows configuration.",
|
|
164
165
|
"default": [],
|
|
165
166
|
"type": "array",
|
|
166
167
|
"items": {
|
|
@@ -225,6 +226,11 @@
|
|
|
225
226
|
"default": "main",
|
|
226
227
|
"type": "string"
|
|
227
228
|
},
|
|
229
|
+
"create": {
|
|
230
|
+
"description": "Whether Tauri should create this window at app startup or not.\n\n When this is set to `false` you must manually grab the config object via `app.config().app.windows`\n and create it with [`WebviewWindowBuilder::from_config`](https://docs.rs/tauri/2.0.0-rc/tauri/webview/struct.WebviewWindowBuilder.html#method.from_config).",
|
|
231
|
+
"default": true,
|
|
232
|
+
"type": "boolean"
|
|
233
|
+
},
|
|
228
234
|
"url": {
|
|
229
235
|
"description": "The window webview URL.",
|
|
230
236
|
"default": "index.html",
|
package/main.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/cli",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.16",
|
|
4
4
|
"description": "Command line interface for building Tauri apps",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "opencollective",
|
|
@@ -39,12 +39,9 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@napi-rs/cli": "2.18.3",
|
|
42
|
+
"@types/node": "20.16.1",
|
|
42
43
|
"cross-env": "7.0.3",
|
|
43
|
-
"
|
|
44
|
-
"fs-extra": "11.2.0",
|
|
45
|
-
"jest": "29.7.0",
|
|
46
|
-
"jest-transform-toml": "1.0.0",
|
|
47
|
-
"prettier": "3.3.2"
|
|
44
|
+
"vitest": "^2.1.1"
|
|
48
45
|
},
|
|
49
46
|
"engines": {
|
|
50
47
|
"node": ">= 10"
|
|
@@ -58,20 +55,20 @@
|
|
|
58
55
|
"build": "cross-env TARGET=node napi build --platform",
|
|
59
56
|
"prepublishOnly": "napi prepublish -t npm --gh-release-id $RELEASE_ID",
|
|
60
57
|
"prepack": "cp ../../crates/tauri-schema-generator/schemas/config.schema.json .",
|
|
61
|
-
"test": "jest --runInBand --forceExit --no-cache",
|
|
62
58
|
"version": "napi version",
|
|
59
|
+
"test": "vitest run",
|
|
63
60
|
"tauri": "node ./tauri.js"
|
|
64
61
|
},
|
|
65
62
|
"optionalDependencies": {
|
|
66
|
-
"@tauri-apps/cli-win32-x64-msvc": "2.0.0-rc.
|
|
67
|
-
"@tauri-apps/cli-darwin-x64": "2.0.0-rc.
|
|
68
|
-
"@tauri-apps/cli-linux-x64-gnu": "2.0.0-rc.
|
|
69
|
-
"@tauri-apps/cli-darwin-arm64": "2.0.0-rc.
|
|
70
|
-
"@tauri-apps/cli-linux-arm64-gnu": "2.0.0-rc.
|
|
71
|
-
"@tauri-apps/cli-linux-arm64-musl": "2.0.0-rc.
|
|
72
|
-
"@tauri-apps/cli-linux-arm-gnueabihf": "2.0.0-rc.
|
|
73
|
-
"@tauri-apps/cli-linux-x64-musl": "2.0.0-rc.
|
|
74
|
-
"@tauri-apps/cli-win32-ia32-msvc": "2.0.0-rc.
|
|
75
|
-
"@tauri-apps/cli-win32-arm64-msvc": "2.0.0-rc.
|
|
63
|
+
"@tauri-apps/cli-win32-x64-msvc": "2.0.0-rc.16",
|
|
64
|
+
"@tauri-apps/cli-darwin-x64": "2.0.0-rc.16",
|
|
65
|
+
"@tauri-apps/cli-linux-x64-gnu": "2.0.0-rc.16",
|
|
66
|
+
"@tauri-apps/cli-darwin-arm64": "2.0.0-rc.16",
|
|
67
|
+
"@tauri-apps/cli-linux-arm64-gnu": "2.0.0-rc.16",
|
|
68
|
+
"@tauri-apps/cli-linux-arm64-musl": "2.0.0-rc.16",
|
|
69
|
+
"@tauri-apps/cli-linux-arm-gnueabihf": "2.0.0-rc.16",
|
|
70
|
+
"@tauri-apps/cli-linux-x64-musl": "2.0.0-rc.16",
|
|
71
|
+
"@tauri-apps/cli-win32-ia32-msvc": "2.0.0-rc.16",
|
|
72
|
+
"@tauri-apps/cli-win32-arm64-msvc": "2.0.0-rc.16"
|
|
76
73
|
}
|
|
77
74
|
}
|
package/src/lib.rs
CHANGED
|
@@ -18,7 +18,7 @@ pub fn run(args: Vec<String>, bin_name: Option<String>, callback: JsFunction) ->
|
|
|
18
18
|
// can do work while `tauri dev` is running.
|
|
19
19
|
std::thread::spawn(move || {
|
|
20
20
|
let res = match std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
|
21
|
-
tauri_cli::try_run(args, bin_name)
|
|
21
|
+
tauri_cli::try_run(args, bin_name).inspect_err(|e| eprintln!("{e:#}"))
|
|
22
22
|
})) {
|
|
23
23
|
Ok(t) => t,
|
|
24
24
|
Err(_) => {
|
package/jest.config.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
// SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
setupFilesAfterEnv: ['<rootDir>/test/jest/jest.setup.js'],
|
|
7
|
-
testMatch: [
|
|
8
|
-
'<rootDir>/test/jest/__tests__/**/*.spec.js',
|
|
9
|
-
'<rootDir>/test/jest/__tests__/**/*.test.js'
|
|
10
|
-
],
|
|
11
|
-
moduleFileExtensions: ['ts', 'js', 'json'],
|
|
12
|
-
moduleNameMapper: {
|
|
13
|
-
'^~/(.*)$': '<rootDir>/$1'
|
|
14
|
-
},
|
|
15
|
-
transform: {
|
|
16
|
-
'\\.toml$': 'jest-transform-toml'
|
|
17
|
-
}
|
|
18
|
-
}
|