@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/index.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
const { existsSync, readFileSync } = require('fs')
|
|
2
|
+
const { join } = require('path')
|
|
3
|
+
|
|
4
|
+
const { platform, arch } = process
|
|
5
|
+
|
|
6
|
+
let nativeBinding = null
|
|
7
|
+
let localFileExisted = false
|
|
8
|
+
let loadError = null
|
|
9
|
+
|
|
10
|
+
function isMusl() {
|
|
11
|
+
// For Node 10
|
|
12
|
+
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
13
|
+
try {
|
|
14
|
+
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl')
|
|
15
|
+
} catch (e) {
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
|
20
|
+
return !glibcVersionRuntime
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
switch (platform) {
|
|
25
|
+
case 'android':
|
|
26
|
+
switch (arch) {
|
|
27
|
+
case 'arm64':
|
|
28
|
+
localFileExisted = existsSync(join(__dirname, 'cli.android-arm64.node'))
|
|
29
|
+
try {
|
|
30
|
+
if (localFileExisted) {
|
|
31
|
+
nativeBinding = require('./cli.android-arm64.node')
|
|
32
|
+
} else {
|
|
33
|
+
nativeBinding = require('@tauri-apps/cli-android-arm64')
|
|
34
|
+
}
|
|
35
|
+
} catch (e) {
|
|
36
|
+
loadError = e
|
|
37
|
+
}
|
|
38
|
+
break
|
|
39
|
+
case 'arm':
|
|
40
|
+
localFileExisted = existsSync(join(__dirname, 'cli.android-arm-eabi.node'))
|
|
41
|
+
try {
|
|
42
|
+
if (localFileExisted) {
|
|
43
|
+
nativeBinding = require('./cli.android-arm-eabi.node')
|
|
44
|
+
} else {
|
|
45
|
+
nativeBinding = require('@tauri-apps/cli-android-arm-eabi')
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
loadError = e
|
|
49
|
+
}
|
|
50
|
+
break
|
|
51
|
+
default:
|
|
52
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
53
|
+
}
|
|
54
|
+
break
|
|
55
|
+
case 'win32':
|
|
56
|
+
switch (arch) {
|
|
57
|
+
case 'x64':
|
|
58
|
+
localFileExisted = existsSync(
|
|
59
|
+
join(__dirname, 'cli.win32-x64-msvc.node')
|
|
60
|
+
)
|
|
61
|
+
try {
|
|
62
|
+
if (localFileExisted) {
|
|
63
|
+
nativeBinding = require('./cli.win32-x64-msvc.node')
|
|
64
|
+
} else {
|
|
65
|
+
nativeBinding = require('@tauri-apps/cli-win32-x64-msvc')
|
|
66
|
+
}
|
|
67
|
+
} catch (e) {
|
|
68
|
+
loadError = e
|
|
69
|
+
}
|
|
70
|
+
break
|
|
71
|
+
case 'ia32':
|
|
72
|
+
localFileExisted = existsSync(
|
|
73
|
+
join(__dirname, 'cli.win32-ia32-msvc.node')
|
|
74
|
+
)
|
|
75
|
+
try {
|
|
76
|
+
if (localFileExisted) {
|
|
77
|
+
nativeBinding = require('./cli.win32-ia32-msvc.node')
|
|
78
|
+
} else {
|
|
79
|
+
nativeBinding = require('@tauri-apps/cli-win32-ia32-msvc')
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
loadError = e
|
|
83
|
+
}
|
|
84
|
+
break
|
|
85
|
+
case 'arm64':
|
|
86
|
+
localFileExisted = existsSync(
|
|
87
|
+
join(__dirname, 'cli.win32-arm64-msvc.node')
|
|
88
|
+
)
|
|
89
|
+
try {
|
|
90
|
+
if (localFileExisted) {
|
|
91
|
+
nativeBinding = require('./cli.win32-arm64-msvc.node')
|
|
92
|
+
} else {
|
|
93
|
+
nativeBinding = require('@tauri-apps/cli-win32-arm64-msvc')
|
|
94
|
+
}
|
|
95
|
+
} catch (e) {
|
|
96
|
+
loadError = e
|
|
97
|
+
}
|
|
98
|
+
break
|
|
99
|
+
default:
|
|
100
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
101
|
+
}
|
|
102
|
+
break
|
|
103
|
+
case 'darwin':
|
|
104
|
+
switch (arch) {
|
|
105
|
+
case 'x64':
|
|
106
|
+
localFileExisted = existsSync(join(__dirname, 'cli.darwin-x64.node'))
|
|
107
|
+
try {
|
|
108
|
+
if (localFileExisted) {
|
|
109
|
+
nativeBinding = require('./cli.darwin-x64.node')
|
|
110
|
+
} else {
|
|
111
|
+
nativeBinding = require('@tauri-apps/cli-darwin-x64')
|
|
112
|
+
}
|
|
113
|
+
} catch (e) {
|
|
114
|
+
loadError = e
|
|
115
|
+
}
|
|
116
|
+
break
|
|
117
|
+
case 'arm64':
|
|
118
|
+
localFileExisted = existsSync(
|
|
119
|
+
join(__dirname, 'cli.darwin-arm64.node')
|
|
120
|
+
)
|
|
121
|
+
try {
|
|
122
|
+
if (localFileExisted) {
|
|
123
|
+
nativeBinding = require('./cli.darwin-arm64.node')
|
|
124
|
+
} else {
|
|
125
|
+
nativeBinding = require('@tauri-apps/cli-darwin-arm64')
|
|
126
|
+
}
|
|
127
|
+
} catch (e) {
|
|
128
|
+
loadError = e
|
|
129
|
+
}
|
|
130
|
+
break
|
|
131
|
+
default:
|
|
132
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
133
|
+
}
|
|
134
|
+
break
|
|
135
|
+
case 'freebsd':
|
|
136
|
+
if (arch !== 'x64') {
|
|
137
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
138
|
+
}
|
|
139
|
+
localFileExisted = existsSync(join(__dirname, 'cli.freebsd-x64.node'))
|
|
140
|
+
try {
|
|
141
|
+
if (localFileExisted) {
|
|
142
|
+
nativeBinding = require('./cli.freebsd-x64.node')
|
|
143
|
+
} else {
|
|
144
|
+
nativeBinding = require('@tauri-apps/cli-freebsd-x64')
|
|
145
|
+
}
|
|
146
|
+
} catch (e) {
|
|
147
|
+
loadError = e
|
|
148
|
+
}
|
|
149
|
+
break
|
|
150
|
+
case 'linux':
|
|
151
|
+
switch (arch) {
|
|
152
|
+
case 'x64':
|
|
153
|
+
if (isMusl()) {
|
|
154
|
+
localFileExisted = existsSync(
|
|
155
|
+
join(__dirname, 'cli.linux-x64-musl.node')
|
|
156
|
+
)
|
|
157
|
+
try {
|
|
158
|
+
if (localFileExisted) {
|
|
159
|
+
nativeBinding = require('./cli.linux-x64-musl.node')
|
|
160
|
+
} else {
|
|
161
|
+
nativeBinding = require('@tauri-apps/cli-linux-x64-musl')
|
|
162
|
+
}
|
|
163
|
+
} catch (e) {
|
|
164
|
+
loadError = e
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
localFileExisted = existsSync(
|
|
168
|
+
join(__dirname, 'cli.linux-x64-gnu.node')
|
|
169
|
+
)
|
|
170
|
+
try {
|
|
171
|
+
if (localFileExisted) {
|
|
172
|
+
nativeBinding = require('./cli.linux-x64-gnu.node')
|
|
173
|
+
} else {
|
|
174
|
+
nativeBinding = require('@tauri-apps/cli-linux-x64-gnu')
|
|
175
|
+
}
|
|
176
|
+
} catch (e) {
|
|
177
|
+
loadError = e
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
break
|
|
181
|
+
case 'arm64':
|
|
182
|
+
if (isMusl()) {
|
|
183
|
+
localFileExisted = existsSync(
|
|
184
|
+
join(__dirname, 'cli.linux-arm64-musl.node')
|
|
185
|
+
)
|
|
186
|
+
try {
|
|
187
|
+
if (localFileExisted) {
|
|
188
|
+
nativeBinding = require('./cli.linux-arm64-musl.node')
|
|
189
|
+
} else {
|
|
190
|
+
nativeBinding = require('@tauri-apps/cli-linux-arm64-musl')
|
|
191
|
+
}
|
|
192
|
+
} catch (e) {
|
|
193
|
+
loadError = e
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
localFileExisted = existsSync(
|
|
197
|
+
join(__dirname, 'cli.linux-arm64-gnu.node')
|
|
198
|
+
)
|
|
199
|
+
try {
|
|
200
|
+
if (localFileExisted) {
|
|
201
|
+
nativeBinding = require('./cli.linux-arm64-gnu.node')
|
|
202
|
+
} else {
|
|
203
|
+
nativeBinding = require('@tauri-apps/cli-linux-arm64-gnu')
|
|
204
|
+
}
|
|
205
|
+
} catch (e) {
|
|
206
|
+
loadError = e
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
break
|
|
210
|
+
case 'arm':
|
|
211
|
+
localFileExisted = existsSync(
|
|
212
|
+
join(__dirname, 'cli.linux-arm-gnueabihf.node')
|
|
213
|
+
)
|
|
214
|
+
try {
|
|
215
|
+
if (localFileExisted) {
|
|
216
|
+
nativeBinding = require('./cli.linux-arm-gnueabihf.node')
|
|
217
|
+
} else {
|
|
218
|
+
nativeBinding = require('@tauri-apps/cli-linux-arm-gnueabihf')
|
|
219
|
+
}
|
|
220
|
+
} catch (e) {
|
|
221
|
+
loadError = e
|
|
222
|
+
}
|
|
223
|
+
break
|
|
224
|
+
default:
|
|
225
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
226
|
+
}
|
|
227
|
+
break
|
|
228
|
+
default:
|
|
229
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (!nativeBinding) {
|
|
233
|
+
if (loadError) {
|
|
234
|
+
throw loadError
|
|
235
|
+
}
|
|
236
|
+
throw new Error(`Failed to load native binding`)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const { run } = nativeBinding
|
|
240
|
+
|
|
241
|
+
module.exports.run = run
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
setupFilesAfterEnv: ['<rootDir>/test/jest/jest.setup.js'],
|
|
3
|
+
testMatch: [
|
|
4
|
+
'<rootDir>/test/jest/__tests__/**/*.spec.js',
|
|
5
|
+
'<rootDir>/test/jest/__tests__/**/*.test.js'
|
|
6
|
+
],
|
|
7
|
+
moduleFileExtensions: ['ts', 'js', 'json'],
|
|
8
|
+
moduleNameMapper: {
|
|
9
|
+
'^~/(.*)$': '<rootDir>/$1'
|
|
10
|
+
},
|
|
11
|
+
transform: {
|
|
12
|
+
'\\.toml$': 'jest-transform-toml'
|
|
13
|
+
}
|
|
14
|
+
}
|
package/main.d.ts
ADDED
package/main.js
ADDED
package/package.json
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/cli",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc.10",
|
|
4
4
|
"description": "Command line interface for building Tauri apps",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"tauri": "./bin/tauri.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"bin",
|
|
11
|
-
"dist",
|
|
12
|
-
"scripts"
|
|
13
|
-
],
|
|
14
5
|
"funding": {
|
|
15
6
|
"type": "opencollective",
|
|
16
7
|
"url": "https://opencollective.com/tauri"
|
|
17
8
|
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "rimraf ./dist && rollup -c --silent",
|
|
20
|
-
"build-release": "rimraf ./dist && cross-env NODE_ENV=production rollup -c",
|
|
21
|
-
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --forceExit --no-cache --testPathIgnorePatterns=\"(build|dev)\"",
|
|
22
|
-
"pretest": "yarn build",
|
|
23
|
-
"prepublishOnly": "yarn build-release",
|
|
24
|
-
"test:local": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand --forceExit",
|
|
25
|
-
"lint": "eslint --ext ts \"./src/**/*.ts\"",
|
|
26
|
-
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
|
|
27
|
-
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
|
|
28
|
-
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore",
|
|
29
|
-
"format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore"
|
|
30
|
-
},
|
|
31
9
|
"repository": {
|
|
32
10
|
"type": "git",
|
|
33
11
|
"url": "git+https://github.com/tauri-apps/tauri.git"
|
|
@@ -43,75 +21,57 @@
|
|
|
43
21
|
"publishConfig": {
|
|
44
22
|
"access": "public"
|
|
45
23
|
},
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
24
|
+
"main": "main.js",
|
|
25
|
+
"types": "main.d.ts",
|
|
26
|
+
"napi": {
|
|
27
|
+
"name": "cli",
|
|
28
|
+
"triples": {
|
|
29
|
+
"additional": [
|
|
30
|
+
"aarch64-apple-darwin",
|
|
31
|
+
"aarch64-unknown-linux-gnu",
|
|
32
|
+
"aarch64-unknown-linux-musl",
|
|
33
|
+
"armv7-unknown-linux-gnueabihf",
|
|
34
|
+
"x86_64-unknown-linux-musl",
|
|
35
|
+
"i686-pc-windows-msvc"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
50
38
|
},
|
|
51
|
-
"
|
|
52
|
-
"@
|
|
53
|
-
"chalk": "4.1.2",
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@napi-rs/cli": "2.7.0",
|
|
54
41
|
"cross-env": "7.0.3",
|
|
55
42
|
"cross-spawn": "7.0.3",
|
|
56
|
-
"fs-extra": "10.
|
|
57
|
-
"
|
|
58
|
-
"got": "11.8.2",
|
|
59
|
-
"imagemin": "8.0.1",
|
|
60
|
-
"imagemin-optipng": "8.0.0",
|
|
61
|
-
"imagemin-zopfli": "7.0.0",
|
|
62
|
-
"inquirer": "8.1.2",
|
|
63
|
-
"is-png": "3.0.0",
|
|
64
|
-
"minimist": "1.2.5",
|
|
65
|
-
"ms": "2.1.3",
|
|
66
|
-
"png2icons": "2.0.1",
|
|
67
|
-
"read-chunk": "3.2.0",
|
|
68
|
-
"semver": "7.3.5",
|
|
69
|
-
"sharp": "0.28.3",
|
|
70
|
-
"update-notifier": "5.1.0"
|
|
71
|
-
},
|
|
72
|
-
"devDependencies": {
|
|
73
|
-
"@babel/core": "7.15.0",
|
|
74
|
-
"@babel/preset-env": "7.15.0",
|
|
75
|
-
"@babel/preset-typescript": "7.15.0",
|
|
76
|
-
"@jest/globals": "27.0.6",
|
|
77
|
-
"@rollup/plugin-babel": "5.3.0",
|
|
78
|
-
"@rollup/plugin-commonjs": "20.0.0",
|
|
79
|
-
"@rollup/plugin-node-resolve": "13.0.4",
|
|
80
|
-
"@rollup/plugin-replace": "^3.0.0",
|
|
81
|
-
"@rollup/plugin-typescript": "8.2.5",
|
|
82
|
-
"@types/cross-spawn": "6.0.2",
|
|
83
|
-
"@types/fs-extra": "9.0.12",
|
|
84
|
-
"@types/global-agent": "2.1.1",
|
|
85
|
-
"@types/imagemin": "7.0.1",
|
|
86
|
-
"@types/imagemin-optipng": "5.2.1",
|
|
87
|
-
"@types/inquirer": "7.3.3",
|
|
88
|
-
"@types/ms": "0.7.31",
|
|
89
|
-
"@types/semver": "7.3.8",
|
|
90
|
-
"@types/sharp": "0.28.5",
|
|
91
|
-
"@typescript-eslint/eslint-plugin": "4.29.1",
|
|
92
|
-
"@typescript-eslint/parser": "4.29.1",
|
|
93
|
-
"babel-jest": "27.0.6",
|
|
94
|
-
"eslint": "7.32.0",
|
|
95
|
-
"eslint-config-prettier": "8.3.0",
|
|
96
|
-
"eslint-config-standard-with-typescript": "20.0.0",
|
|
97
|
-
"eslint-plugin-import": "2.24.0",
|
|
98
|
-
"eslint-plugin-lodash-template": "0.19.0",
|
|
99
|
-
"eslint-plugin-node": "11.1.0",
|
|
100
|
-
"eslint-plugin-promise": "5.1.0",
|
|
101
|
-
"eslint-plugin-security": "1.4.0",
|
|
102
|
-
"is-running": "2.1.0",
|
|
103
|
-
"jest": "27.0.6",
|
|
43
|
+
"fs-extra": "10.1.0",
|
|
44
|
+
"jest": "28.0.3",
|
|
104
45
|
"jest-transform-toml": "1.0.0",
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
"
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
|
|
46
|
+
"prettier": "2.6.2"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">= 10"
|
|
50
|
+
},
|
|
51
|
+
"bin": {
|
|
52
|
+
"tauri": "./tauri.js"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"artifacts": "napi artifacts",
|
|
56
|
+
"build:release": "cross-env TARGET=node napi build --platform --release",
|
|
57
|
+
"build": "cross-env TARGET=node napi build --platform",
|
|
58
|
+
"prepublishOnly": "napi prepublish -t npm",
|
|
59
|
+
"prepack": "cp ../schema.json .",
|
|
60
|
+
"test": "jest --runInBand --forceExit --no-cache",
|
|
61
|
+
"version": "napi version",
|
|
62
|
+
"tauri": "node ./tauri.js",
|
|
63
|
+
"format": "prettier --write ./package.json ./tauri.js",
|
|
64
|
+
"format:check": "prettier --check ./package.json ./tauri.js"
|
|
113
65
|
},
|
|
114
|
-
"
|
|
115
|
-
"
|
|
66
|
+
"optionalDependencies": {
|
|
67
|
+
"@tauri-apps/cli-win32-x64-msvc": "1.0.0-rc.10",
|
|
68
|
+
"@tauri-apps/cli-darwin-x64": "1.0.0-rc.10",
|
|
69
|
+
"@tauri-apps/cli-linux-x64-gnu": "1.0.0-rc.10",
|
|
70
|
+
"@tauri-apps/cli-darwin-arm64": "1.0.0-rc.10",
|
|
71
|
+
"@tauri-apps/cli-linux-arm64-gnu": "1.0.0-rc.10",
|
|
72
|
+
"@tauri-apps/cli-linux-arm64-musl": "1.0.0-rc.10",
|
|
73
|
+
"@tauri-apps/cli-linux-arm-gnueabihf": "1.0.0-rc.10",
|
|
74
|
+
"@tauri-apps/cli-linux-x64-musl": "1.0.0-rc.10",
|
|
75
|
+
"@tauri-apps/cli-win32-ia32-msvc": "1.0.0-rc.10"
|
|
116
76
|
}
|
|
117
|
-
}
|
|
77
|
+
}
|