@tauri-apps/cli 1.0.0-beta.9 → 1.0.0-rc.0
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/.github-example/workflows/CI.yml +469 -0
- package/CHANGELOG.md +14 -302
- package/Cargo.toml +16 -0
- package/README.md +1 -1
- package/build.rs +7 -0
- package/index.d.ts +12 -0
- package/index.js +241 -0
- package/jest.config.js +14 -0
- package/package.json +45 -89
- package/src/lib.rs +10 -0
- package/tauri.js +50 -0
- package/test/jest/__tests__/template.spec.js +41 -0
- package/test/jest/fixtures/app/dist/index.html +140 -0
- package/test/jest/fixtures/app/index.js +53 -0
- package/test/jest/fixtures/app/package.json +22 -0
- package/test/jest/fixtures/app/src-tauri/Cargo.toml +34 -0
- package/test/jest/fixtures/app/src-tauri/build.rs +7 -0
- package/test/jest/fixtures/app/src-tauri/icons/128x128.png +0 -0
- package/test/jest/fixtures/app/src-tauri/icons/128x128@2x.png +0 -0
- package/test/jest/fixtures/app/src-tauri/icons/32x32.png +0 -0
- package/test/jest/fixtures/app/src-tauri/icons/icon.icns +0 -0
- package/test/jest/fixtures/app/src-tauri/icons/icon.ico +0 -0
- package/test/jest/fixtures/app/src-tauri/icons/icon.png +0 -0
- package/test/jest/fixtures/app/src-tauri/src/main.rs +20 -0
- package/test/jest/fixtures/app/src-tauri/tauri.conf.json +28 -0
- package/test/jest/fixtures/app-test-setup.js +86 -0
- package/test/jest/fixtures/empty/dist/index.html +6 -0
- package/test/jest/fixtures/empty/package.json +1 -0
- package/test/jest/helpers/logger.js +25 -0
- package/test/jest/helpers/spawn.js +73 -0
- package/test/jest/jest.setup.js +6 -0
- package/LICENSE_APACHE-2.0 +0 -177
- package/LICENSE_MIT +0 -21
- 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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
const http = require('http')
|
|
3
|
+
|
|
4
|
+
const currentDirName = __dirname
|
|
5
|
+
const mockFixtureDir = path.resolve(currentDirName, '../fixtures')
|
|
6
|
+
|
|
7
|
+
module.exports.fixtureDir = mockFixtureDir
|
|
8
|
+
|
|
9
|
+
module.exports.initJest = (mockFixture) => {
|
|
10
|
+
jest.setTimeout(1200000)
|
|
11
|
+
|
|
12
|
+
const mockAppDir = path.join(mockFixtureDir, mockFixture)
|
|
13
|
+
process.env.__TAURI_TEST_APP_DIR = mockAppDir
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports.startServer = (onSuccess) => {
|
|
17
|
+
const responses = {
|
|
18
|
+
writeFile: null,
|
|
19
|
+
readFile: null,
|
|
20
|
+
writeFileWithDir: null,
|
|
21
|
+
readFileWithDir: null,
|
|
22
|
+
readDir: null,
|
|
23
|
+
readDirWithDir: null,
|
|
24
|
+
copyFile: null,
|
|
25
|
+
copyFileWithDir: null,
|
|
26
|
+
createDir: null,
|
|
27
|
+
createDirWithDir: null,
|
|
28
|
+
removeDir: null,
|
|
29
|
+
removeDirWithDir: null,
|
|
30
|
+
renameFile: null,
|
|
31
|
+
renameFileWithDir: null,
|
|
32
|
+
removeFile: null,
|
|
33
|
+
renameFileWithDir: null,
|
|
34
|
+
listen: null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function addResponse(response) {
|
|
38
|
+
responses[response.cmd] = true
|
|
39
|
+
if (!Object.values(responses).some((c) => c === null)) {
|
|
40
|
+
server.close(onSuccess)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const app = http.createServer((req, res) => {
|
|
45
|
+
// Set CORS headers
|
|
46
|
+
res.setHeader('Access-Control-Allow-Origin', '*')
|
|
47
|
+
res.setHeader('Access-Control-Request-Method', '*')
|
|
48
|
+
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET')
|
|
49
|
+
res.setHeader('Access-Control-Allow-Headers', '*')
|
|
50
|
+
|
|
51
|
+
if (req.method === 'OPTIONS') {
|
|
52
|
+
res.writeHead(200)
|
|
53
|
+
res.end()
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (req.method === 'POST') {
|
|
58
|
+
let body = ''
|
|
59
|
+
req.on('data', (chunk) => {
|
|
60
|
+
body += chunk.toString()
|
|
61
|
+
})
|
|
62
|
+
if (req.url === '/reply') {
|
|
63
|
+
req.on('end', () => {
|
|
64
|
+
const json = JSON.parse(body)
|
|
65
|
+
addResponse(json)
|
|
66
|
+
res.writeHead(200)
|
|
67
|
+
res.end()
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
if (req.url === '/error') {
|
|
71
|
+
req.on('end', () => {
|
|
72
|
+
res.writeHead(200)
|
|
73
|
+
res.end()
|
|
74
|
+
throw new Error(body)
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const port = 7000
|
|
81
|
+
const server = app.listen(port)
|
|
82
|
+
return {
|
|
83
|
+
server,
|
|
84
|
+
responses
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
const ms = require('ms')
|
|
6
|
+
|
|
7
|
+
let prevTime
|
|
8
|
+
|
|
9
|
+
module.exports = (banner) => {
|
|
10
|
+
return (msg) => {
|
|
11
|
+
const curr = +new Date()
|
|
12
|
+
const diff = curr - (prevTime || curr)
|
|
13
|
+
|
|
14
|
+
prevTime = curr
|
|
15
|
+
|
|
16
|
+
if (msg) {
|
|
17
|
+
console.log(
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call
|
|
19
|
+
` ${String(banner)} ${msg} ${`+${ms(diff)}`}`
|
|
20
|
+
)
|
|
21
|
+
} else {
|
|
22
|
+
console.log()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
const crossSpawn = require('cross-spawn')
|
|
6
|
+
const logger = require('./logger')
|
|
7
|
+
|
|
8
|
+
const log = logger('app:spawn')
|
|
9
|
+
const warn = logger('app:spawn')
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
Returns pid, takes onClose
|
|
13
|
+
*/
|
|
14
|
+
module.exports.spawn = (
|
|
15
|
+
cmd,
|
|
16
|
+
params,
|
|
17
|
+
cwd,
|
|
18
|
+
onClose
|
|
19
|
+
) => {
|
|
20
|
+
log(`Running "${cmd} ${params.join(' ')}"`)
|
|
21
|
+
log()
|
|
22
|
+
|
|
23
|
+
// TODO: move to execa?
|
|
24
|
+
const runner = crossSpawn(cmd, params, {
|
|
25
|
+
stdio: 'inherit',
|
|
26
|
+
cwd,
|
|
27
|
+
env: process.env
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
runner.on('close', (code) => {
|
|
31
|
+
log()
|
|
32
|
+
if (code) {
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
34
|
+
log(`Command "${cmd}" failed with exit code: ${code}`)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
38
|
+
onClose && onClose(code || 0, runner.pid || 0)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
return runner.pid || 0
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
Returns nothing, takes onFail
|
|
46
|
+
*/
|
|
47
|
+
module.exports.spawnSync = (
|
|
48
|
+
cmd,
|
|
49
|
+
params,
|
|
50
|
+
cwd,
|
|
51
|
+
onFail
|
|
52
|
+
) => {
|
|
53
|
+
log(`[sync] Running "${cmd} ${params.join(' ')}"`)
|
|
54
|
+
log()
|
|
55
|
+
|
|
56
|
+
const runner = crossSpawn.sync(cmd, params, {
|
|
57
|
+
stdio: 'inherit',
|
|
58
|
+
cwd
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
62
|
+
if (runner.status || runner.error) {
|
|
63
|
+
warn()
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
65
|
+
warn(`⚠️ Command "${cmd}" failed with exit code: ${runner.status}`)
|
|
66
|
+
if (runner.status === null) {
|
|
67
|
+
warn(`⚠️ Please globally install "${cmd}"`)
|
|
68
|
+
}
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
70
|
+
onFail && onFail()
|
|
71
|
+
process.exit(1)
|
|
72
|
+
}
|
|
73
|
+
}
|
package/LICENSE_APACHE-2.0
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
package/LICENSE_MIT
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 - Present Tauri Apps Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
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};
|