@tauri-apps/cli 1.0.0-beta.9 → 1.0.0-rc.10
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 +121 -301
- package/Cargo.toml +16 -0
- package/README.md +1 -1
- package/build.rs +7 -0
- package/index.d.ts +6 -0
- package/index.js +241 -0
- package/jest.config.js +14 -0
- package/main.d.ts +4 -0
- package/main.js +13 -0
- package/package.json +49 -89
- package/schema.json +2291 -0
- package/src/lib.rs +24 -0
- package/tauri.js +49 -0
- package/bin/tauri-deps.js +0 -26
- package/bin/tauri-icon.js +0 -61
- package/bin/tauri.js +0 -101
- package/dist/api/cli.js +0 -1
- package/dist/api/dependency-manager.js +0 -1
- package/dist/api/tauricon.js +0 -1
- package/dist/app-paths-46150e8b.js +0 -1
- package/dist/helpers/download-binary.js +0 -1
- package/dist/helpers/rust-cli.js +0 -1
- package/dist/helpers/spawn.js +0 -1
- package/dist/logger-27e93e7d.js +0 -1
- package/dist/tslib.es6-753a81cf.js +0 -1
package/src/lib.rs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
use napi::{
|
|
6
|
+
threadsafe_function::{ErrorStrategy, ThreadsafeFunction, ThreadsafeFunctionCallMode},
|
|
7
|
+
Error, JsFunction, Result, Status,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
#[napi_derive::napi]
|
|
11
|
+
pub fn run(args: Vec<String>, bin_name: Option<String>, callback: JsFunction) -> Result<()> {
|
|
12
|
+
let function: ThreadsafeFunction<bool, ErrorStrategy::CalleeHandled> = callback
|
|
13
|
+
.create_threadsafe_function(0, |ctx| ctx.env.get_boolean(ctx.value).map(|v| vec![v]))?;
|
|
14
|
+
|
|
15
|
+
std::thread::spawn(move || match tauri_cli::run(args, bin_name) {
|
|
16
|
+
Ok(_) => function.call(Ok(true), ThreadsafeFunctionCallMode::Blocking),
|
|
17
|
+
Err(e) => function.call(
|
|
18
|
+
Err(Error::new(Status::GenericFailure, format!("{:#}", e))),
|
|
19
|
+
ThreadsafeFunctionCallMode::Blocking,
|
|
20
|
+
),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
Ok(())
|
|
24
|
+
}
|
package/tauri.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const cli = require('./main')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
|
|
6
|
+
const [bin, script, ...arguments] = process.argv
|
|
7
|
+
const binStem = path.parse(bin).name.toLowerCase()
|
|
8
|
+
|
|
9
|
+
// We want to make a helpful binary name for the underlying CLI helper, if we
|
|
10
|
+
// can successfully detect what command likely started the execution.
|
|
11
|
+
let binName
|
|
12
|
+
|
|
13
|
+
// Even if started by a package manager, the binary will be NodeJS.
|
|
14
|
+
// Some distribution still use "nodejs" as the binary name.
|
|
15
|
+
if (binStem === 'node' || binStem === 'nodejs') {
|
|
16
|
+
const managerStem = process.env.npm_execpath
|
|
17
|
+
? path.parse(process.env.npm_execpath).name.toLowerCase()
|
|
18
|
+
: null
|
|
19
|
+
if (managerStem) {
|
|
20
|
+
let manager
|
|
21
|
+
switch (managerStem) {
|
|
22
|
+
// Only supported package manager that has a different filename is npm.
|
|
23
|
+
case 'npm-cli':
|
|
24
|
+
manager = 'npm'
|
|
25
|
+
break
|
|
26
|
+
|
|
27
|
+
// Yarn and pnpm have the same stem name as their bin.
|
|
28
|
+
// We assume all unknown package managers do as well.
|
|
29
|
+
default:
|
|
30
|
+
manager = managerStem
|
|
31
|
+
break
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
binName = `${manager} run ${process.env.npm_lifecycle_event}`
|
|
35
|
+
} else {
|
|
36
|
+
// Assume running NodeJS if we didn't detect a manager from the env.
|
|
37
|
+
// We normalize the path to prevent the script's absolute path being used.
|
|
38
|
+
const scriptNormal = path.normalize(path.relative(process.cwd(), script))
|
|
39
|
+
binName = `${binStem} ${scriptNormal}`
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
// We don't know what started it, assume it's already stripped.
|
|
43
|
+
arguments.unshift(bin)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
cli.run(arguments, binName).catch((err) => {
|
|
47
|
+
console.log(`Error running CLI: ${err.message}`)
|
|
48
|
+
process.exit(1)
|
|
49
|
+
})
|
package/bin/tauri-deps.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
// SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
installDependencies,
|
|
7
|
-
updateDependencies
|
|
8
|
-
} from '../dist/api/dependency-manager.js'
|
|
9
|
-
|
|
10
|
-
async function run() {
|
|
11
|
-
const choice = process.argv[2]
|
|
12
|
-
if (choice === 'install') {
|
|
13
|
-
await installDependencies()
|
|
14
|
-
} else if (choice === 'update') {
|
|
15
|
-
await updateDependencies()
|
|
16
|
-
} else {
|
|
17
|
-
console.log(`
|
|
18
|
-
Description
|
|
19
|
-
Tauri dependency management script
|
|
20
|
-
Usage
|
|
21
|
-
$ tauri deps [install|update]
|
|
22
|
-
`)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
run()
|
package/bin/tauri-icon.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
// SPDX-License-Identifier: MIT
|
|
4
|
-
|
|
5
|
-
import parseArgs from 'minimist'
|
|
6
|
-
import tauricon from '../dist/api/tauricon.js'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @type {object}
|
|
10
|
-
* @property {boolean} h
|
|
11
|
-
* @property {boolean} help
|
|
12
|
-
* @property {string|boolean} f
|
|
13
|
-
* @property {string|boolean} force
|
|
14
|
-
* @property {boolean} l
|
|
15
|
-
* @property {boolean} log
|
|
16
|
-
* @property {boolean} c
|
|
17
|
-
* @property {boolean} config
|
|
18
|
-
* @property {boolean} s
|
|
19
|
-
* @property {boolean} source
|
|
20
|
-
* @property {boolean} t
|
|
21
|
-
* @property {boolean} target
|
|
22
|
-
*/
|
|
23
|
-
const argv = parseArgs(process.argv.slice(2), {
|
|
24
|
-
alias: {
|
|
25
|
-
h: 'help',
|
|
26
|
-
l: 'log',
|
|
27
|
-
c: 'config',
|
|
28
|
-
t: 'target'
|
|
29
|
-
},
|
|
30
|
-
boolean: ['h', 'l']
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
if (argv.help) {
|
|
34
|
-
console.log(`
|
|
35
|
-
Description
|
|
36
|
-
Create all the icons you need for your Tauri app.
|
|
37
|
-
The icon path is the source icon (png, 1240x1240 with transparency).
|
|
38
|
-
|
|
39
|
-
Usage
|
|
40
|
-
$ tauri icon [ICON-PATH]
|
|
41
|
-
|
|
42
|
-
Options
|
|
43
|
-
--help, -h Displays this message
|
|
44
|
-
--log, l Logging [boolean]
|
|
45
|
-
--target, t Target folder (default: 'src-tauri/icons')
|
|
46
|
-
--compression, c Compression type [optipng|zopfli]
|
|
47
|
-
--ci Runs the script in CI mode
|
|
48
|
-
`)
|
|
49
|
-
process.exit(0)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
tauricon
|
|
53
|
-
.make(argv._[0], argv.t, argv.c || 'optipng')
|
|
54
|
-
.then(() => {
|
|
55
|
-
// TODO: use logger module for prettier output
|
|
56
|
-
console.log('app:tauri (tauricon) Completed')
|
|
57
|
-
})
|
|
58
|
-
.catch((e) => {
|
|
59
|
-
// TODO: use logger module for prettier output
|
|
60
|
-
console.error('app:tauri (icon)', e)
|
|
61
|
-
})
|
package/bin/tauri.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
3
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
// SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
import chalk from 'chalk'
|
|
7
|
-
import updateNotifier from 'update-notifier'
|
|
8
|
-
import { createRequire } from 'module'
|
|
9
|
-
const require = createRequire(import.meta.url)
|
|
10
|
-
const pkg = require('../package.json')
|
|
11
|
-
|
|
12
|
-
const cmds = ['icon', 'deps']
|
|
13
|
-
const rustCliCmds = ['dev', 'build', 'init', 'info', 'sign']
|
|
14
|
-
|
|
15
|
-
const cmd = process.argv[2]
|
|
16
|
-
/**
|
|
17
|
-
* @description This is the bootstrapper that in turn calls subsequent
|
|
18
|
-
* Tauri Commands
|
|
19
|
-
*
|
|
20
|
-
* @param {string|array} command
|
|
21
|
-
*/
|
|
22
|
-
const tauri = async function (command) {
|
|
23
|
-
// notifying updates.
|
|
24
|
-
if (!process.argv.some((arg) => arg === '--no-update-notifier')) {
|
|
25
|
-
updateNotifier({
|
|
26
|
-
pkg,
|
|
27
|
-
updateCheckInterval: 0
|
|
28
|
-
}).notify()
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (typeof command === 'object') {
|
|
32
|
-
// technically we just care about an array
|
|
33
|
-
command = command[0]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const help =
|
|
37
|
-
!command || command === '-h' || command === '--help' || command === 'help'
|
|
38
|
-
if (help) {
|
|
39
|
-
console.log(`
|
|
40
|
-
${chalk.cyan(`
|
|
41
|
-
:oooodddoooo; ;oddl, ,ol, ,oc, ,ldoooooooc, ,oc,
|
|
42
|
-
';;;cxOx:;;;' ;xOxxko' :kx: lkd, :xkl;;;;:okx: lkd,
|
|
43
|
-
'dOo' 'oOd;:xkc :kx: lkd, :xx: ;xkc lkd,
|
|
44
|
-
'dOo' ckx: lkx; :kx: lkd, :xx: :xkc lkd,
|
|
45
|
-
'dOo' ;xkl ,dko' :kx: lkd, :xx:.....xko, lkd,
|
|
46
|
-
'dOo' 'oOd, :xkc :kx: lkd, :xx:,;cokko' lkd,
|
|
47
|
-
'dOo' ckk: lkx; :kx: lkd, :xx: ckkc lkd,
|
|
48
|
-
'dOo' ;xOl lko; :xkl;,....;oOd, :xx: :xkl' lkd,
|
|
49
|
-
'okl' 'kd' 'xx' 'dxxxddddxxo' :dd; ;dxc 'xo'`)}
|
|
50
|
-
|
|
51
|
-
${chalk.yellow('Description')}
|
|
52
|
-
This is the Tauri CLI
|
|
53
|
-
${chalk.yellow('Usage')}
|
|
54
|
-
$ tauri ${[...rustCliCmds, ...cmds].join('|')}
|
|
55
|
-
${chalk.yellow('Options')}
|
|
56
|
-
--help, -h Displays this message
|
|
57
|
-
--version, -v Displays the Tauri CLI version
|
|
58
|
-
`)
|
|
59
|
-
|
|
60
|
-
process.exit(0)
|
|
61
|
-
// eslint-disable-next-line no-unreachable
|
|
62
|
-
return false // do this for node consumers and tests
|
|
63
|
-
} else if (command === '-v' || command === '--version') {
|
|
64
|
-
console.log(`${pkg.version}`)
|
|
65
|
-
return false // do this for node consumers and tests
|
|
66
|
-
} else if (cmds.includes(command)) {
|
|
67
|
-
if (process.argv && process.env.NODE_ENV !== 'test') {
|
|
68
|
-
process.argv.splice(2, 1)
|
|
69
|
-
}
|
|
70
|
-
console.log(`[tauri]: running ${command}`)
|
|
71
|
-
await import(`./tauri-${command}.js`)
|
|
72
|
-
} else {
|
|
73
|
-
const { runOnRustCli } = await import('../dist/helpers/rust-cli.js')
|
|
74
|
-
if (process.argv && process.env.NODE_ENV !== 'test') {
|
|
75
|
-
process.argv.splice(0, 3)
|
|
76
|
-
}
|
|
77
|
-
;(
|
|
78
|
-
await runOnRustCli(
|
|
79
|
-
command,
|
|
80
|
-
(process.argv || []).filter((v) => v !== '--no-update-notifier')
|
|
81
|
-
)
|
|
82
|
-
).promise
|
|
83
|
-
.then(() => {
|
|
84
|
-
if (command === 'init' && !process.argv.some((arg) => arg === '--ci')) {
|
|
85
|
-
return import('../dist/api/dependency-manager.js').then(
|
|
86
|
-
({ installDependencies }) => installDependencies()
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
.catch(() => process.exit(1))
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export default tauri
|
|
95
|
-
|
|
96
|
-
// on test we use the module.exports
|
|
97
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
98
|
-
tauri(cmd).catch((e) => {
|
|
99
|
-
throw e
|
|
100
|
-
})
|
|
101
|
-
}
|
package/dist/api/cli.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as t,a as r}from"../tslib.es6-753a81cf.js";import{runOnRustCli as e}from"../helpers/rust-cli.js";import"fs";import"path";import"../helpers/spawn.js";import"cross-spawn";import"../logger-27e93e7d.js";import"chalk";import"ms";import"../helpers/download-binary.js";import"util";import"stream";import"global-agent";import"url";import"module";function i(i,n){return t(this,void 0,void 0,(function(){var t,o,s,u,a,c;return r(this,(function(r){switch(r.label){case 0:for(t=[],o=0,s=Object.entries(null!=n?n:{});o<s.length;o++)u=s[o],a=u[0],!1!==(c=u[1])&&(t.push("--"+a.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase()),!0!==c&&t.push("string"==typeof c?c:JSON.stringify(c)));return[4,e(i,t)];case 1:return[2,r.sent()]}}))}))}var n=function(e){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,i("init",e)];case 1:return[2,t.sent()]}}))}))},o=function(e){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,i("dev",e)];case 1:return[2,t.sent()]}}))}))},s=function(e){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,i("build",e)];case 1:return[2,t.sent()]}}))}))};export{s as build,o as dev,n as init};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as t,_ as e,a as n,c as r}from"../tslib.es6-753a81cf.js";import{l as a}from"../logger-27e93e7d.js";import{spawnSync as i}from"../helpers/spawn.js";import{sync as s}from"cross-spawn";import{downloadRustup as o}from"../helpers/download-binary.js";import{existsSync as u,readFileSync as c,writeFileSync as l}from"fs";import{dirname as p,resolve as d}from"path";import{platform as f}from"os";import"https";import{fileURLToPath as g}from"url";import{a as v,r as m,t as h}from"../app-paths-46150e8b.js";import w from"inquirer";import{createRequire as y}from"module";import"chalk";import"ms";import"util";import"stream";import"global-agent";var b;!function(t){t[t.Install=0]="Install",t[t.InstallDev=1]="InstallDev",t[t.Update=2]="Update"}(b||(b={}));var k=p(g(import.meta.url)),I=a("dependency:rust");function P(){return e(this,void 0,void 0,(function(){var t,e;return n(this,(function(n){switch(n.label){case 0:return t="win32"===f()?"rustup-init.exe":"rustup-init.sh",e=d(k,"../../bin/"+t),u(e)?[3,2]:[4,o()];case 1:n.sent(),n.label=2;case 2:return"win32"===f()?[2,i("powershell",["-NoProfile",e],process.cwd())]:[2,i("/bin/sh",[e],process.cwd())]}}))}))}function S(r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return null!==function(e,n){void 0===n&&(n=[]);try{var r=s(e,t(t([],n),["--version"]));return 0===r.status?String(r.output[1]).replace(/\n/g,""):null}catch(t){return null}}("rustup")?[3,2]:(I("Installing rustup..."),[4,P()]);case 1:e.sent(),e.label=2;case 2:return r===b.Update&&i("rustup",["update"],process.cwd()),[2]}}))}))}function U(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,S(b.Install)];case 1:return[2,t.sent()]}}))}))}function D(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,S(b.Update)];case 1:return[2,t.sent()]}}))}))}var x=function(){function t(){this.type="yarn"}return t.prototype.installPackage=function(t){i("yarn",["add",t],v)},t.prototype.installDevPackage=function(t){i("yarn",["add",t,"--dev"],v)},t.prototype.updatePackage=function(t){i("yarn",["upgrade",t,"--latest"],v)},t.prototype.getPackageVersion=function(t){var e=s("yarn",["list","--pattern",t,"--depth","0"],{cwd:v}),n=String(e.output[1]),r=new RegExp(t+"@(\\S+)","g").exec(n);return(null==r?void 0:r[1])?r[1]:null},t.prototype.getLatestVersion=function(t){var e=s("yarn",["info",t,"version","--json"],{cwd:v}),n=String(e.output[1]);return JSON.parse(n).data},t}(),V=function(){function t(){this.type="npm"}return t.prototype.installPackage=function(t){i("npm",["install",t],v)},t.prototype.installDevPackage=function(t){i("npm",["install",t,"--save-dev"],v)},t.prototype.updatePackage=function(t){i("npm",["install",t+"@latest"],v)},t.prototype.getPackageVersion=function(t){var e=s("npm",["list",t,"version","--depth","0"],{cwd:v}),n=String(e.output[1]),r=new RegExp(t+"@(\\S+)","g").exec(n);return(null==r?void 0:r[1])?r[1]:null},t.prototype.getLatestVersion=function(t){var e=s("npm",["show",t,"version"],{cwd:v});return String(e.output[1]).replace("\n","")},t}(),j=function(){function t(){this.type="pnpm"}return t.prototype.installPackage=function(t){i("pnpm",["add",t],v)},t.prototype.installDevPackage=function(t){i("pnpm",["add",t,"--save-dev"],v)},t.prototype.updatePackage=function(t){i("pnpm",["add",t+"@latest"],v)},t.prototype.getPackageVersion=function(t){var e=s("pnpm",["list",t,"version","--depth","0"],{cwd:v}),n=String(e.output[1]),r=new RegExp(t+" (\\S+)","g").exec(n);return(null==r?void 0:r[1])?r[1]:null},t.prototype.getLatestVersion=function(t){var e=s("pnpm",["info",t,"version"],{cwd:v});return String(e.output[1]).replace("\n","")},t}(),C=function(){return u(m.app("yarn.lock"))?new x:u(m.app("pnpm-lock.yaml"))?new j:new V};function E(t){var e=s("cargo",["search",t,"--limit","1"]),n=String(e.output[1]),r=new RegExp(t+' = "(\\S+)"',"g").exec(n);return(null==r?void 0:r[1])?r[1]:null}function R(t,e){return t!==e}var L=y(import.meta.url)("@tauri-apps/toml"),M=a("dependency:crates"),N=["tauri"];function q(t){if(u(t)){var e=c(t).toString();return L.parse(e)}return null}function A(t,e){return"string"==typeof t?e:r(r({},t),{version:e})}function J(r){return e(this,void 0,void 0,(function(){var e,a,s,o,c,p,d,f,g,v;return n(this,(function(y){switch(y.label){case 0:if(e=[],a=[],s=new Map,null===(o=q(m.tauri("Cargo.toml"))))return M("Cargo.toml not found. Skipping crates check..."),[2,s];c=m.tauri("Cargo.lock"),u(c)||i("cargo",["generate-lockfile"],h),p=q(c),d=function(t){var i,s,u,c;return n(this,(function(n){switch(n.label){case 0:return i=p?p.package.filter((function(e){return e.name===t})):[],s=o.dependencies[t],void 0!==(u=1===i.length?i[0].version:"string"==typeof s?s:null==s?void 0:s.version)?[3,1]:(M("Installing "+t+"..."),null!==(c=E(t))&&(o.dependencies[t]=A(o.dependencies[t],c)),e.push(t),[3,6]);case 1:return r!==b.Update?[3,5]:null===(c=E(t))?[3,4]:R(u,c)?[4,w.prompt([{type:"confirm",name:"answer",message:'[CRATES] "'+t+'" latest version is '+c+". Do you want to update?",default:!1}])]:[3,3];case 2:return n.sent().answer&&(M("Updating "+t+"..."),o.dependencies[t]=A(o.dependencies[t],c),a.push(t)),[3,4];case 3:o.dependencies[t]=A(o.dependencies[t],c),a.push(t),M('"'+t+'" is up to date'),n.label=4;case 4:return[3,6];case 5:M('"'+t+'" is already installed'),n.label=6;case 6:return[2]}}))},f=0,g=N,y.label=1;case 1:return f<g.length?(v=g[f],[5,d(v)]):[3,4];case 2:y.sent(),y.label=3;case 3:return f++,[3,1];case 4:return(e.length||a.length)&&l(m.tauri("Cargo.toml"),L.stringify(o)),a.length&&(u(m.tauri("Cargo.lock"))||i("cargo",["generate-lockfile"],h),i("cargo",t(["update","--aggressive"],a.reduce((function(e,n){return t(t([],e),["-p",n])}),[])),h)),s.set(b.Install,e),s.set(b.Update,a),[2,s]}}))}))}function O(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,J(b.Install)];case 1:return[2,t.sent()]}}))}))}function T(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,J(b.Update)];case 1:return[2,t.sent()]}}))}))}var _=a("dependency:npm-packages");function z(t,r){var a,i,o;return e(this,void 0,void 0,(function(){var e,c,l,p,d,f,g,v,h,y,k,I,P;return n(this,(function(n){switch(n.label){case 0:if(e=[],c=[],l=s("npm",["--version"]),p=s("yarn",["--version"]),d=s("pnpm",["--version"]),(null!==(a=l.status)&&void 0!==a?a:l.error)&&(null!==(i=p.status)&&void 0!==i?i:p.error)&&(null!==(o=d.status)&&void 0!==o?o:d.error))throw new Error("must have installed one of the following package managers `npm`, `yarn`, `pnpm` to manage dependenices");if(!u(m.app("package.json")))return[3,10];f=0,g=r,n.label=1;case 1:return f<g.length?(v=g[f],S=v,h=C().getPackageVersion(S),y=C().type.toUpperCase(),null!==h?[3,4]:(_("Installing "+v+"..."),t!==b.Install&&t!==b.InstallDev?[3,3]:(k=t===b.InstallDev?" as dev-dependency":"",[4,w.prompt([{type:"confirm",name:"answer",message:"["+y+']: "Do you want to install '+v+k+'?"',default:!1}])]))):[3,10];case 2:n.sent().answer&&(t===b.Install?function(t){C().installPackage(t)}(v):t===b.InstallDev&&function(t){C().installDevPackage(t)}(v),e.push(v)),n.label=3;case 3:return[3,9];case 4:return t!==b.Update?[3,8]:(I=function(t){return C().getLatestVersion(t)}(v),R(h,I)?[4,w.prompt([{type:"confirm",name:"answer",message:"["+y+']: "'+v+'" latest version is '+I+". Do you want to update?",default:!1}])]:[3,6]);case 5:return n.sent().answer&&(_("Updating "+v+"..."),function(t){C().updatePackage(t)}(v),c.push(v)),[3,7];case 6:_('"'+v+'" is up to date'),n.label=7;case 7:return[3,9];case 8:_('"'+v+'" is already installed'),n.label=9;case 9:return f++,[3,1];case 10:return(P=new Map).set(b.Install,e),P.set(b.Update,c),[2,P]}var S}))}))}var B=["@tauri-apps/api","@tauri-apps/cli"];function F(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,z(b.Install,B)];case 1:return[2,t.sent()]}}))}))}function G(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return[4,z(b.Update,B)];case 1:return[2,t.sent()]}}))}))}var H=a("dependency:manager");function K(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return H("Installing missing dependencies..."),[4,U()];case 1:return t.sent(),[4,O()];case 2:return t.sent(),[4,F()];case 3:return t.sent(),[2]}}))}))}function Q(){return e(this,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return H("Updating dependencies..."),[4,D()];case 1:return t.sent(),[4,T()];case 2:return t.sent(),[4,G()];case 3:return t.sent(),[2]}}))}))}export{K as installDependencies,Q as updateDependencies};
|
package/dist/api/tauricon.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,a as r}from"../tslib.es6-753a81cf.js";import*as t from"fs-extra";import n from"imagemin";import i from"imagemin-optipng";import s from"imagemin-zopfli";import o from"is-png";import a from"path";import*as c from"png2icons";import u from"read-chunk";import f from"sharp";import{t as l,a as p}from"../app-paths-46150e8b.js";import{l as d}from"../logger-27e93e7d.js";import h from"chalk";import{createRequire as g}from"module";import"fs";import"ms";var b={background_color:"#000074",theme_color:"#02aa9b",sharp:"kernel: sharp.kernel.lanczos3",minify:{batch:!1,overwrite:!0,available:["optipng","zopfli"],type:"optipng",optipngOptions:{optimizationLevel:4,paletteReduction:!0},zopfliOptions:{transparent:!0,more:!0}},splash_type:"generate",tauri:{linux:{folder:".",prefix:"",infix:!0,suffix:".png",sizes:[32,128]},linux_2x:{folder:".",prefix:"128x128@2x",infix:!1,suffix:".png",sizes:[256]},defaults:{folder:".",prefix:"icon",infix:!1,suffix:".png",sizes:[512]},appx_logo:{folder:".",prefix:"StoreLogo",infix:!1,suffix:".png",sizes:[50]},appx_square:{folder:".",prefix:"Square",infix:!0,suffix:"Logo.png",sizes:[30,44,71,89,107,142,150,284,310]}}},m=t.default,v=m.access,x=m.ensureDir,w=m.ensureFileSync,y=m.writeFileSync,k=g(import.meta.url)("../../package.json").version,z=d("app:spawn"),I=d("app:spawn",h.red),R=!1,S=null,_=function(t){return e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,v(t)];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},O=function(t){return e(void 0,void 0,void 0,(function(){var e,n;return r(this,(function(r){switch(r.label){case 0:return!1===R?[3,1]:[2,R];case 1:return[4,_(t)];case 2:return r.sent()?[3,3]:(R=!1,S&&clearInterval(S),I("[ERROR] Source image for tauricon not found"),process.exit(1),[3,8]);case 3:return[4,u(t,0,8)];case 4:return e=r.sent(),o(e)?[4,(R=f(t)).metadata()]:[3,7];case 5:return(n=r.sent()).hasAlpha&&4===n.channels||(S&&clearInterval(S),I("[ERROR] Source png for tauricon is not transparent"),process.exit(1)),[4,R.stats()];case 6:return r.sent().isOpaque&&(S&&clearInterval(S),I("[ERROR] Source png for tauricon could not be detected as transparent"),process.exit(1)),[2,R];case 7:R=!1,S&&clearInterval(S),I("[ERROR] Source image for tauricon is not a png"),process.exit(1),r.label=8;case 8:return[2]}}))}))},j=function(e){var r=[];for(var t in e){var n=e[String(t)];n.folder&&r.push(n.folder)}return r=r.sort().filter((function(e,r,t){return!r||e!==t[r-1]}))},E=function(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(function(e,r,t,n){return r+r+t+t+n+n}));var r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:void 0},B=function(t,n){return e(void 0,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return void 0===n?[3,2]:[4,x(n)];case 1:e.sent(),e.label=2;case 2:return[4,O(t)];case 3:return[2,e.sent()]}}))}))},C=function(e){process.stdout.write(" "+e+" \r")},F={validate:function(t,n){return e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,B(t,n)];case 1:return e.sent(),[2,"object"==typeof R]}}))}))},version:function(){return k},make:function(t,n,i,s){return void 0===n&&(n=a.resolve(l,"icons")),e(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return t||(t=a.resolve(p,"app-icon.png")),S="CI"in process.env||process.argv.some((function(e){return"--ci"===e}))?null:setInterval((function(){process.stdout.write("/ \r"),setTimeout((function(){process.stdout.write("- \r"),setTimeout((function(){process.stdout.write("\\ \r"),setTimeout((function(){process.stdout.write("| \r")}),100)}),100)}),100)}),500),s=s||b.tauri,C('Building Tauri icns and ico from "'+t+'"'),[4,this.validate(t,n)];case 1:return e.sent(),[4,this.icns(t,n,s,i)];case 2:return e.sent(),C("Building Tauri png icons"),[4,this.build(t,n,s)];case 3:return e.sent(),i?(C("Minifying assets with "+i),[4,this.minify(n,s,i,"batch")]):[3,5];case 4:return e.sent(),[3,6];case 5:z("no minify strategy"),e.label=6;case 6:return C("Tauricon Finished"),S&&clearInterval(S),[2,!0]}}))}))},build:function(t,n,i){return e(this,void 0,void 0,(function(){var s,o,c,u,l,p,d,h,g,b,m,v,w,y,k,z,R,S;return r(this,(function(_){switch(_.label){case 0:return[4,this.validate(t,n)];case 1:for(l in _.sent(),s=f(t),o=function(t){return e(this,void 0,void 0,(function(){var e,n,o;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),e=s.resize(t[1],t[1]),t[2]&&(n=E(i.background_color)||{r:void 0,g:void 0,b:void 0},e.flatten({background:{r:n.r,g:n.g,b:n.b,alpha:1}})),e.png(),[4,e.toFile(t[0])];case 1:return r.sent(),[3,3];case 2:return o=r.sent(),I(o),[3,3];case 3:return[2]}}))}))},u=j(i))p=u[Number(l)],x(""+n+a.sep+p);for(h in d=[],i)d.push(h);g=0,_.label=2;case 2:if(!(g<d.length))return[3,7];for(w in b=d[g],m=i[String(b)],v=[],m.sizes)v.push(w);y=0,_.label=3;case 3:return y<v.length?(k=v[y],z=m.sizes[String(k)],m.splash?[3,5]:(R=n+"/"+m.folder,c=!0===m.infix?""+R+a.sep+m.prefix+z+"x"+z+m.suffix:""+R+a.sep+m.prefix+m.suffix,S=[c,z,m.background],[4,o(S)])):[3,6];case 4:_.sent(),_.label=5;case 5:return y++,[3,3];case 6:return g++,[3,2];case 7:return[2]}}))}))},splash:function(t,n,i,s){return e(this,void 0,void 0,(function(){var e,o,c,u,l,p,d,h,g,b,m,v,w,y,k,z,I;return r(this,(function(r){switch(r.label){case 0:return o=!1,c=E(s.background_color)||{r:void 0,g:void 0,b:void 0},n===t&&(o=!0),o||"generate"===s.splashscreen_type?[4,this.validate(t,i)]:[3,2];case 1:return r.sent(),R||process.exit(1),(u=f(t)).extend({top:726,bottom:726,left:726,right:726,background:{r:c.r,g:c.g,b:c.b,alpha:1}}).flatten({background:{r:c.r,g:c.g,b:c.b,alpha:1}}),[3,3];case 2:if("overlay"===s.splashscreen_type)u=f(n).flatten({background:{r:c.r,g:c.g,b:c.b,alpha:1}}).composite([{input:t}]);else{if("pure"!==s.splashscreen_type)throw new Error("unknown options.splashscreen_type: "+s.splashscreen_type);u=f(n).flatten({background:{r:c.r,g:c.g,b:c.b,alpha:1}})}r.label=3;case 3:return[4,u.toBuffer()];case 4:for(d in l=r.sent(),p=[],s)p.push(d);h=0,r.label=5;case 5:if(!(h<p.length))return[3,11];for(v in g=p[h],b=s[String(g)],m=[],b.sizes)m.push(v);w=0,r.label=6;case 6:return w<m.length?(y=m[w],k=b.sizes[String(y)],b.splash?(z=""+i+a.sep+b.folder,[4,x(z)]):[3,9]):[3,10];case 7:return r.sent(),e=!0===b.infix?""+z+a.sep+b.prefix+k+"x"+k+b.suffix:""+z+a.sep+b.prefix+b.suffix,I=[e,k],[4,f(l).resize(I[1][0],I[1][1]).toFile(I[0])];case 8:r.sent(),r.label=9;case 9:return w++,[3,6];case 10:return h++,[3,5];case 11:return[2]}}))}))},minify:function(t,o,c,u){return e(this,void 0,void 0,(function(){var f,l,p,d,h,g,m,v,x,w=this;return r(this,(function(y){switch(y.label){case 0:switch((l=b.minify).available.find((function(e){return e===c}))||(c=l.type),c){case"optipng":f=i(l.optipngOptions);break;case"zopfli":f=s(l.zopfliOptions);break;default:throw new Error("unknown strategy"+c)}switch(p=function(t,i){return e(w,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,n([t[0]],{destination:t[1],plugins:[i]}).catch((function(e){I(e)}))];case 1:return e.sent(),[2]}}))}))},u){case"singlefile":return[3,1];case"batch":return[3,3]}return[3,8];case 1:return[4,p([t,a.dirname(t)],f)];case 2:return y.sent(),[3,9];case 3:for(g in d=j(o),h=[],d)h.push(g);m=0,y.label=4;case 4:return m<h.length?(v=h[m],x=d[Number(v)],z("batch minify:"+String(x)),[4,p([""+t+a.sep+x+a.sep+"*.png",""+t+a.sep+x],f)]):[3,7];case 5:y.sent(),y.label=6;case 6:return m++,[3,4];case 7:return[3,9];case 8:I("[ERROR] Minify mode must be one of [ singlefile | batch]"),process.exit(1),y.label=9;case 9:return[2,"minified"]}}))}))},icns:function(t,n,i,s){return e(this,void 0,void 0,(function(){var e,i,s,o;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),R||process.exit(1),[4,this.validate(t,n)];case 1:return r.sent(),[4,f(t).toBuffer()];case 2:if(e=r.sent(),null===(i=c.createICNS(e,c.BICUBIC,0)))throw new Error("Failed to create icon.icns");if(w(a.join(n,"/icon.icns")),y(a.join(n,"/icon.icns"),i),null===(s=c.createICO(e,c.BICUBIC,0,!0)))throw new Error("Failed to create icon.ico");return w(a.join(n,"/icon.ico")),y(a.join(n,"/icon.ico"),s),[3,4];case 3:throw o=r.sent(),console.error(o),o;case 4:return[2]}}))}))}};export{F as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{existsSync as r}from"fs";import{resolve as t,sep as o,join as e,normalize as a,isAbsolute as n}from"path";import{l as i}from"./logger-27e93e7d.js";import s from"chalk";var u=i("tauri",s.red);function c(r,o){return o&&n(o)?o:t(r,o)}var f=function(){for(var t,n=null!==(t=process.env.__TAURI_TEST_APP_DIR)&&void 0!==t?t:process.cwd(),i=0;n.length>0&&!n.endsWith(o)&&i<=2;){if(r(e(n,"src-tauri","tauri.conf.json")))return n;i++,n=a(e(n,".."))}u("Couldn't recognize the current folder as a part of a Tauri project"),process.exit(1)}(),p=t(f,"src-tauri"),l={app:function(r){return c(f,r)},tauri:function(r){return c(p,r)}};export{f as a,l as r,p as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as r,a as t}from"../tslib.es6-753a81cf.js";import{promisify as o}from"util";import n from"stream";import i from"fs";import e from"path";import{bootstrap as s}from"global-agent";import{fileURLToPath as a}from"url";import{createRequire as c}from"module";var u=e.dirname(a(import.meta.url)),l=c(import.meta.url)("got"),p=o(n.pipeline),m={};function f(o,n,e){return r(this,void 0,void 0,(function(){var r,a;return t(this,(function(t){switch(t.label){case 0:return r="https://github.com/tauri-apps/binary-releases/releases/download/"+o+"/"+n,a=function(){try{r in m||i.unlinkSync(e)}finally{process.exit()}},process.on("exit",a),process.on("SIGINT",a),process.on("SIGTERM",a),process.on("SIGHUP",a),process.on("SIGBREAK",a),s({environmentVariableNamespace:""}),[4,p(l.stream(r),i.createWriteStream(e)).catch((function(r){try{i.unlinkSync(e)}catch(r){}throw r}))];case 1:return t.sent(),m[r]=!0,i.chmodSync(e,448),console.log("Download Complete"),[2]}}))}))}function d(){return r(this,void 0,void 0,(function(){var r,o,n;return t(this,(function(t){switch(t.label){case 0:if("win32"===(r=process.platform))r="windows";else if("linux"===r)r="linux";else{if("darwin"!==r)throw Error("Unsupported platform");r="macos"}return o="windows"===r?".exe":"",n=e.join(u,"../../bin/tauri-cli"+o),console.log("Downloading Rust CLI..."),[4,f("tauri-cli-v1.0.0-beta.6","tauri-cli_"+r+o,n)];case 1:return t.sent(),[2]}}))}))}function h(){return r(this,void 0,void 0,(function(){var r;return t(this,(function(t){switch(t.label){case 0:return r="win32"===process.platform?"rustup-init.exe":"rustup-init.sh",console.log("Downloading Rustup..."),[4,f("rustup",r,e.join(u,"../../bin/"+r))];case 1:return[2,t.sent()]}}))}))}export{d as downloadCli,h as downloadRustup};
|
package/dist/helpers/rust-cli.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as r,a as t,b as o}from"../tslib.es6-753a81cf.js";import{existsSync as i}from"fs";import{dirname as e,resolve as s,join as a}from"path";import{spawnSync as c,spawn as n}from"./spawn.js";import{downloadCli as m}from"./download-binary.js";import{fileURLToPath as p}from"url";import"cross-spawn";import"../logger-27e93e7d.js";import"chalk";import"ms";import"util";import"stream";import"global-agent";import"module";var u=e(p(import.meta.url));function l(e,p){return r(this,void 0,void 0,(function(){var r,l,f,d,w,b,g,h,v;return t(this,(function(t){switch(t.label){case 0:return r=s(u,"../.."),l=a(r,"bin/tauri-cli"+("win32"===process.platform?".exe":"")),b=new Promise((function(r,t){f=r,d=function(){return t(new Error)}})),g=function(r,t){0===r?f():d()},i(l)?(w=n(l,o(["tauri",e],p),process.cwd(),g),[3,4]):[3,1];case 1:return[4,m()];case 2:return t.sent(),w=n(l,o(["tauri",e],p),process.cwd(),g),[3,4];case 3:i(s(r,"test"))?(h=s(r,"../cli.rs"),c("cargo",["build","--release"],h),v=s(r,"../cli.rs/target/release/cargo-tauri"),w=n(v,o(["tauri",e],p),process.cwd(),g)):(c("cargo",["install","--root",r,"tauri-cli","--version","1.0.0-beta.6"],process.cwd()),w=n(l,o(["tauri",e],p),process.cwd(),g)),t.label=4;case 4:return[2,{pid:w,promise:b}]}}))}))}export{l as runOnRustCli};
|
package/dist/helpers/spawn.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import n from"cross-spawn";import{l as i}from"../logger-27e93e7d.js";import o from"chalk";import"ms";var r=i("app:spawn"),s=i("app:spawn",o.red),t=function(i,o,s,t){var e;r('Running "'+i+" "+o.join(" ")+'"'),r();var a=n(i,o,{stdio:"inherit",cwd:s,env:process.env});return a.on("close",(function(n){var o;r(),n&&r('Command "'+i+'" failed with exit code: '+n),t&&t(null!=n?n:0,null!==(o=a.pid)&&void 0!==o?o:0)})),null!==(e=a.pid)&&void 0!==e?e:0},e=function(i,o,t,e){r('[sync] Running "'+i+" "+o.join(" ")+'"'),r();var a=n.sync(i,o,{stdio:"inherit",cwd:t});(a.status||a.error)&&(s(),s('⚠️ Command "'+i+'" failed with exit code: '+a.status),null===a.status&&s('⚠️ Please globally install "'+i+'"'),e&&e(),process.exit(1))};export{t as spawn,e as spawnSync};
|
package/dist/logger-27e93e7d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import o from"chalk";import r from"ms";var n,e=function(e,t){return void 0===t&&(t=o.green),function(i){var l=+new Date,a=l-(n||l);n=l,i?console.log(" "+t(String(e))+" "+i+" "+o.green("+"+r(a))):console.log()}};export{e as l};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=function(){return(n=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}).apply(this,arguments)};function t(n,t,e,r){return new(e||(e=Promise))((function(o,a){function l(n){try{i(r.next(n))}catch(n){a(n)}}function c(n){try{i(r.throw(n))}catch(n){a(n)}}function i(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(l,c)}i((r=r.apply(n,t||[])).next())}))}function e(n,t){var e,r,o,a,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(e)throw new TypeError("Generator is already executing.");for(;l;)try{if(e=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(n,l)}catch(n){a=[6,n],r=0}finally{e=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function r(n,t,e){if(e||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return n.concat(r||Array.prototype.slice.call(t))}export{t as _,e as a,r as b,n as c};
|