eitri-cli 1.9.0-beta.8 → 1.9.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/bitbucket-pipelines.yml +147 -34
- package/boilerplate/mini-app-cafe-madeira.zip +0 -0
- package/config/dev.js +3 -2
- package/eitri-cli-v2/Cargo.toml +24 -8
- package/eitri-cli-v2/build.rs +5 -0
- package/eitri-cli-v2/eitri-cli-v2.darwin-arm64.node +0 -0
- package/eitri-cli-v2/eitri-cli-v2.darwin-x64.node +0 -0
- package/eitri-cli-v2/eitri-cli-v2.linux-x64-gnu.node +0 -0
- package/eitri-cli-v2/eitri-cli-v2.win32-x64-msvc.node +0 -0
- package/eitri-cli-v2/index.d.ts +6 -0
- package/eitri-cli-v2/index.js +300 -2
- package/eitri-cli-v2/package-lock.json +0 -1
- package/eitri-cli-v2/package.json +28 -14
- package/eitri-cli-v2/src/commands/publish.rs +29 -61
- package/eitri-cli-v2/src/infra/mod.rs +0 -1
- package/eitri-cli-v2/src/lib.rs +7 -31
- package/eitri-cli-v2/src/services/eitri_manager.rs +2 -2
- package/eitri-cli-v2/src/services/workspace.rs +13 -10
- package/index.js +2 -1
- package/install-dev.bat +1 -1
- package/install-dev.sh +1 -1
- package/package.json +1 -1
- package/src/cmd/create.js +6 -4
- package/test/Executor.js +21 -7
- package/test/Helper.js +2 -0
- package/test/e2e/cli.test.js +255 -101
- package/eitri-cli-v2/Cargo.lock +0 -2512
- package/eitri-cli-v2/index.unix.node +0 -0
- package/eitri-cli-v2/index.win32.node +0 -0
- package/eitri-cli-v2/node_modules/.yarn-integrity +0 -16
- package/eitri-cli-v2/node_modules/cargo-cp-artifact/LICENSE +0 -21
- package/eitri-cli-v2/node_modules/cargo-cp-artifact/README.md +0 -93
- package/eitri-cli-v2/node_modules/cargo-cp-artifact/bin/cargo-cp-artifact.js +0 -6
- package/eitri-cli-v2/node_modules/cargo-cp-artifact/package.json +0 -34
- package/eitri-cli-v2/node_modules/cargo-cp-artifact/src/args.js +0 -131
- package/eitri-cli-v2/node_modules/cargo-cp-artifact/src/index.js +0 -164
- package/eitri-cli-v2/src/infra/async_runtime.rs +0 -9
- package/eitri-cli-v2/yarn.lock +0 -8
package/bitbucket-pipelines.yml
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
image: node:18
|
|
2
|
-
|
|
1
|
+
image: node:18-buster
|
|
3
2
|
pipelines:
|
|
4
3
|
custom:
|
|
5
4
|
test-validation:
|
|
@@ -8,10 +7,26 @@ pipelines:
|
|
|
8
7
|
caches:
|
|
9
8
|
- node
|
|
10
9
|
script:
|
|
11
|
-
-
|
|
10
|
+
- apt-get update
|
|
11
|
+
- apt-get install -y wget
|
|
12
|
+
- wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
13
|
+
- apt-get install -y ./google-chrome-stable_current_amd64.deb
|
|
14
|
+
- export PUPPETEER_EXECUTABLE_PATH='/usr/bin/google-chrome-stable'
|
|
15
|
+
- apt-get install -y libssl-dev
|
|
16
|
+
- apt-get install -y pkg-config
|
|
17
|
+
- apt-get install -y git
|
|
18
|
+
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
19
|
+
- export PATH="/root/.cargo/bin:${PATH}"
|
|
20
|
+
- rustup --version
|
|
21
|
+
- rustup target add x86_64-unknown-linux-gnu
|
|
22
|
+
- cd eitri-cli-v2
|
|
23
|
+
- npm i
|
|
24
|
+
- npm run build:debug
|
|
25
|
+
- cd ..
|
|
26
|
+
- npm i
|
|
12
27
|
- npm i -g .
|
|
13
28
|
- export FOUNDRY_CONTEXT_PATH=runes-foundry
|
|
14
|
-
-
|
|
29
|
+
- npm run test cli.test.js -- --force-exit
|
|
15
30
|
default:
|
|
16
31
|
- step: &runTests
|
|
17
32
|
name: Run tests
|
|
@@ -19,18 +34,26 @@ pipelines:
|
|
|
19
34
|
- node
|
|
20
35
|
script:
|
|
21
36
|
- apt-get update
|
|
37
|
+
- curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
|
|
38
|
+
- apt-get install -y wget
|
|
39
|
+
- wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
40
|
+
- apt-get install -y ./google-chrome-stable_current_amd64.deb
|
|
41
|
+
- export PUPPETEER_EXECUTABLE_PATH='/usr/bin/google-chrome-stable'
|
|
22
42
|
- apt-get install -y libssl-dev
|
|
23
43
|
- apt-get install -y pkg-config
|
|
24
|
-
- apt-get install -y
|
|
44
|
+
- apt-get install -y git
|
|
45
|
+
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
46
|
+
- export PATH="/root/.cargo/bin:${PATH}"
|
|
47
|
+
- rustup --version
|
|
48
|
+
- rustup target add x86_64-unknown-linux-gnu
|
|
25
49
|
- cd eitri-cli-v2
|
|
26
|
-
-
|
|
50
|
+
- npm i
|
|
51
|
+
- npm run build:debug
|
|
27
52
|
- cd ..
|
|
28
|
-
- apt-get install -y git
|
|
29
|
-
- apt-get install -y chromium
|
|
30
|
-
- export PUPPETEER_EXECUTABLE_PATH='/usr/bin/chromium-browser'
|
|
31
53
|
- yarn
|
|
32
54
|
- npm i -g .
|
|
33
|
-
-
|
|
55
|
+
- export FOUNDRY_CONTEXT_PATH=runes-foundry
|
|
56
|
+
- npm run test cli.test.js -- --force-exit --runInBand --bail
|
|
34
57
|
- step: &runRustTests
|
|
35
58
|
name: Run Rust tests
|
|
36
59
|
caches:
|
|
@@ -39,44 +62,134 @@ pipelines:
|
|
|
39
62
|
- apt-get update
|
|
40
63
|
- apt-get install -y libssl-dev
|
|
41
64
|
- apt-get install -y pkg-config
|
|
42
|
-
-
|
|
65
|
+
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
66
|
+
- export PATH="/root/.cargo/bin:${PATH}"
|
|
67
|
+
- rustup --version
|
|
68
|
+
- rustup target add x86_64-unknown-linux-gnu
|
|
43
69
|
- cd eitri-cli-v2
|
|
44
70
|
- cargo test
|
|
71
|
+
- step: &macOSCrossCompile
|
|
72
|
+
image: joseluisq/rust-linux-darwin-builder:1.76.0
|
|
73
|
+
name: "macOS cross compile"
|
|
74
|
+
caches:
|
|
75
|
+
- node
|
|
76
|
+
script:
|
|
77
|
+
- apt-get update
|
|
78
|
+
- apt-get install -y git
|
|
79
|
+
- apt-get install -y libssl-dev
|
|
80
|
+
- apt-get install -y libudev-dev
|
|
81
|
+
- apt-get install -y pkg-config
|
|
82
|
+
- apt-get install -y cargo
|
|
83
|
+
- apt-get install -y gcc-mingw-w64
|
|
84
|
+
- apt-get install -y curl
|
|
85
|
+
- curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
|
|
86
|
+
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
87
|
+
- export PATH="/root/.cargo/bin:${PATH}"
|
|
88
|
+
- rustup --version
|
|
89
|
+
- export CC=o64-clang
|
|
90
|
+
- export CXX=o64-clang++
|
|
91
|
+
- cd eitri-cli-v2
|
|
92
|
+
- cargo add openssl --features vendored
|
|
93
|
+
- npm install
|
|
94
|
+
- npm run build -- --target aarch64-apple-darwin
|
|
95
|
+
- npm run build -- --target x86_64-apple-darwin
|
|
96
|
+
- rm -rf target
|
|
97
|
+
- cp -r ./eitri-cli-v2.darwin-arm64.node ../eitri-cli-v2.darwin-arm64.node
|
|
98
|
+
- cp -r ./eitri-cli-v2.darwin-x64.node ../eitri-cli-v2.darwin-x64.node
|
|
99
|
+
- cp -r ./index.d.ts ../index.d.ts
|
|
100
|
+
- cp -r ./index.js ../rust-index.js
|
|
101
|
+
artifacts:
|
|
102
|
+
- eitri-cli-v2.darwin-arm64.node
|
|
103
|
+
- eitri-cli-v2.darwin-x64.node
|
|
104
|
+
- index.d.ts
|
|
105
|
+
- rust-index.js
|
|
106
|
+
- step: &linuxCrossCompile
|
|
107
|
+
caches:
|
|
108
|
+
- node
|
|
109
|
+
name: 'Linux compile'
|
|
110
|
+
script:
|
|
111
|
+
- apt-get update
|
|
112
|
+
- apt-get install -y git
|
|
113
|
+
- apt-get install -y libssl-dev
|
|
114
|
+
- apt-get install -y libudev-dev
|
|
115
|
+
- apt-get install -y pkg-config
|
|
116
|
+
- apt-get install -y cargo
|
|
117
|
+
- apt-get install -y gcc-mingw-w64
|
|
118
|
+
- apt-get install -y curl
|
|
119
|
+
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
120
|
+
- export PATH="/root/.cargo/bin:${PATH}"
|
|
121
|
+
- rustup --version
|
|
122
|
+
- curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
|
|
123
|
+
- rustup target add x86_64-unknown-linux-gnu
|
|
124
|
+
- cd eitri-cli-v2
|
|
125
|
+
- cargo add openssl --features vendored
|
|
126
|
+
- npm install
|
|
127
|
+
- npm run build -- --target x86_64-unknown-linux-gnu
|
|
128
|
+
- cp -r ./eitri-cli-v2.linux-x64-gnu.node ../eitri-cli-v2.linux-x64-gnu.node
|
|
129
|
+
artifacts:
|
|
130
|
+
- eitri-cli-v2.linux-x64-gnu.node
|
|
131
|
+
- step: &windowsCrossCompile
|
|
132
|
+
caches:
|
|
133
|
+
- node
|
|
134
|
+
name: 'Windows cross compile'
|
|
135
|
+
script:
|
|
136
|
+
- apt-get update
|
|
137
|
+
- apt-get install -y git
|
|
138
|
+
- apt-get install -y libssl-dev
|
|
139
|
+
- apt-get install -y libudev-dev
|
|
140
|
+
- apt-get install -y pkg-config
|
|
141
|
+
- apt-get install -y cargo
|
|
142
|
+
- apt-get install -y gcc-mingw-w64
|
|
143
|
+
- apt-get install -y curl
|
|
144
|
+
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
145
|
+
- export PATH="/root/.cargo/bin:${PATH}"
|
|
146
|
+
- rustup --version
|
|
147
|
+
- curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
|
|
148
|
+
- rustup target add x86_64-pc-windows-msvc
|
|
149
|
+
- cargo install cargo-xwin
|
|
150
|
+
- cd eitri-cli-v2
|
|
151
|
+
- npm install
|
|
152
|
+
- npm run build -- --target x86_64-pc-windows-msvc
|
|
153
|
+
- cp -r ./eitri-cli-v2.win32-x64-msvc.node ../eitri-cli-v2.win32-x64-msvc.node
|
|
154
|
+
artifacts:
|
|
155
|
+
- eitri-cli-v2.win32-x64-msvc.node
|
|
45
156
|
branches:
|
|
46
157
|
"**":
|
|
47
|
-
-
|
|
48
|
-
|
|
158
|
+
- parallel:
|
|
159
|
+
fail-fast: false
|
|
160
|
+
steps:
|
|
161
|
+
- step: *runTests
|
|
162
|
+
- step: *runRustTests
|
|
49
163
|
'{beta,master}':
|
|
50
|
-
|
|
51
|
-
|
|
164
|
+
- parallel:
|
|
165
|
+
fail-fast: false
|
|
166
|
+
steps:
|
|
167
|
+
- step: *runTests
|
|
168
|
+
- step: *runRustTests
|
|
169
|
+
- parallel:
|
|
170
|
+
fail-fast: true
|
|
171
|
+
steps:
|
|
172
|
+
- step: *windowsCrossCompile
|
|
173
|
+
- step: *linuxCrossCompile
|
|
174
|
+
- step: *macOSCrossCompile
|
|
52
175
|
- step:
|
|
53
176
|
name: "Generation of a new version: beta or stable."
|
|
54
177
|
caches:
|
|
55
178
|
- node
|
|
56
179
|
script:
|
|
180
|
+
- mv ./eitri-cli-v2.darwin-arm64.node ./eitri-cli-v2/eitri-cli-v2.darwin-arm64.node
|
|
181
|
+
- mv ./eitri-cli-v2.darwin-x64.node ./eitri-cli-v2/eitri-cli-v2.darwin-x64.node
|
|
182
|
+
- mv ./eitri-cli-v2.linux-x64-gnu.node ./eitri-cli-v2/eitri-cli-v2.linux-x64-gnu.node
|
|
183
|
+
- mv ./eitri-cli-v2.win32-x64-msvc.node ./eitri-cli-v2/eitri-cli-v2.win32-x64-msvc.node
|
|
184
|
+
- mv ./index.d.ts ./eitri-cli-v2/index.d.ts
|
|
185
|
+
- mv ./rust-index.js ./eitri-cli-v2/index.js
|
|
57
186
|
- apt-get update
|
|
58
187
|
- apt-get install -y git
|
|
59
|
-
- apt-get install -y libssl-dev
|
|
60
|
-
- apt-get install -y libudev-dev
|
|
61
|
-
- apt-get install -y pkg-config
|
|
62
|
-
- apt-get install -y cargo
|
|
63
|
-
- apt-get install -y gcc-mingw-w64
|
|
64
|
-
- apt-get install -y curl
|
|
65
|
-
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
66
|
-
- export PATH="/root/.cargo/bin:${PATH}"
|
|
67
|
-
- rustup --version
|
|
68
|
-
- rustup target add x86_64-pc-windows-gnu
|
|
69
|
-
- rustup target add x86_64-unknown-linux-gnu
|
|
70
|
-
- cd eitri-cli-v2
|
|
71
|
-
- yarn install
|
|
72
|
-
- yarn install:win32
|
|
73
|
-
- rm -rf target
|
|
74
|
-
- cd ..
|
|
75
188
|
- echo 'Start release'
|
|
76
189
|
- echo 'If there is a new version, it will be automatically published on NPM according to the channel/branch (beta or master (stable)).'
|
|
77
|
-
-
|
|
78
|
-
-
|
|
190
|
+
- npm i
|
|
191
|
+
- npm run release
|
|
79
192
|
- RELEASE_VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
|
|
80
193
|
- node -e "const fs = require('fs'); const packageJson = JSON.parse(fs.readFileSync('package.json')); packageJson.version = process.env.RELEASE_VERSION; fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 4));"
|
|
81
194
|
- echo 'New release'
|
|
82
|
-
- echo $RELEASE_VERSION
|
|
195
|
+
- echo $RELEASE_VERSION
|
|
Binary file
|
package/config/dev.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const HOST = "api.eitri.tech";
|
|
3
3
|
const packageJson = require("../package.json");
|
|
4
4
|
const path = require("path");
|
|
5
|
+
const FOUNDRY_CONTEXT_PATH = process.env.FOUNDRY_CONTEXT_PATH ?? 'foundry'
|
|
5
6
|
|
|
6
7
|
const config = {
|
|
7
8
|
userAgent: packageJson.name,
|
|
@@ -24,8 +25,8 @@ const config = {
|
|
|
24
25
|
},
|
|
25
26
|
workspace: {
|
|
26
27
|
url: `https://${HOST}`,
|
|
27
|
-
basePath:
|
|
28
|
-
targetPath:
|
|
28
|
+
basePath: FOUNDRY_CONTEXT_PATH,
|
|
29
|
+
targetPath: `/${FOUNDRY_CONTEXT_PATH}/targets`,
|
|
29
30
|
target: {
|
|
30
31
|
knownTargets: [
|
|
31
32
|
{
|
package/eitri-cli-v2/Cargo.toml
CHANGED
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
[package]
|
|
2
|
-
name = "eitri-cli-v2"
|
|
3
|
-
version = "0.1.0"
|
|
4
|
-
license = "ISC"
|
|
5
2
|
edition = "2021"
|
|
6
|
-
|
|
3
|
+
name = "eitri-cli-v2"
|
|
4
|
+
version = "0.0.0"
|
|
7
5
|
|
|
8
6
|
[lib]
|
|
9
7
|
crate-type = ["cdylib"]
|
|
10
8
|
|
|
11
|
-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
12
9
|
[dependencies]
|
|
10
|
+
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
|
|
11
|
+
napi = { version = "2.12.2", default-features = false, features = [
|
|
12
|
+
"napi4",
|
|
13
|
+
"async",
|
|
14
|
+
] }
|
|
15
|
+
napi-derive = "2.12.2"
|
|
13
16
|
homedir = "0.2.1"
|
|
14
17
|
httpmock = "0.7.0"
|
|
15
|
-
neon = "1"
|
|
16
18
|
once_cell = "1.19.0"
|
|
17
19
|
reqwest = { version = "0.11.24", features = ["json", "multipart", "cookies"] }
|
|
18
20
|
serde = { version = "1.0.197", features = ["derive"] }
|
|
19
21
|
serde_derive = "1.0.197"
|
|
20
22
|
serde_json = "1.0.114"
|
|
21
23
|
tokio = { version = "1.36.0", features = ["full"] }
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
[target.x86_64-unknown-linux-gnu]
|
|
26
|
+
openssl = { version = "0.9", features = ["vendored"] }
|
|
27
|
+
|
|
28
|
+
[target.aarch64-apple-darwin]
|
|
29
|
+
openssl = { version = "0.9", features = ["vendored"] }
|
|
30
|
+
|
|
31
|
+
[target.x86_64-apple-darwin]
|
|
32
|
+
openssl = { version = "0.9", features = ["vendored"] }
|
|
33
|
+
|
|
34
|
+
[build-dependencies]
|
|
35
|
+
napi-build = "2.0.1"
|
|
36
|
+
|
|
37
|
+
[profile.release]
|
|
38
|
+
lto = true
|
|
39
|
+
strip = "symbols"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/eitri-cli-v2/index.js
CHANGED
|
@@ -1,2 +1,300 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* prettier-ignore */
|
|
4
|
+
|
|
5
|
+
/* auto-generated by NAPI-RS */
|
|
6
|
+
|
|
7
|
+
const { existsSync, readFileSync } = require('fs')
|
|
8
|
+
const { join } = require('path')
|
|
9
|
+
|
|
10
|
+
const { platform, arch } = process
|
|
11
|
+
|
|
12
|
+
let nativeBinding = null
|
|
13
|
+
let localFileExisted = false
|
|
14
|
+
let loadError = null
|
|
15
|
+
|
|
16
|
+
function isMusl() {
|
|
17
|
+
// For Node 10
|
|
18
|
+
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
19
|
+
try {
|
|
20
|
+
const lddPath = require('child_process').execSync('which ldd').toString().trim()
|
|
21
|
+
return readFileSync(lddPath, 'utf8').includes('musl')
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
const { glibcVersionRuntime } = process.report.getReport().header
|
|
27
|
+
return !glibcVersionRuntime
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
switch (platform) {
|
|
32
|
+
case 'android':
|
|
33
|
+
switch (arch) {
|
|
34
|
+
case 'arm64':
|
|
35
|
+
localFileExisted = existsSync(join(__dirname, 'eitri-cli-v2.android-arm64.node'))
|
|
36
|
+
try {
|
|
37
|
+
if (localFileExisted) {
|
|
38
|
+
nativeBinding = require('./eitri-cli-v2.android-arm64.node')
|
|
39
|
+
} else {
|
|
40
|
+
nativeBinding = require('eitri-cli-v2-android-arm64')
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
loadError = e
|
|
44
|
+
}
|
|
45
|
+
break
|
|
46
|
+
case 'arm':
|
|
47
|
+
localFileExisted = existsSync(join(__dirname, 'eitri-cli-v2.android-arm-eabi.node'))
|
|
48
|
+
try {
|
|
49
|
+
if (localFileExisted) {
|
|
50
|
+
nativeBinding = require('./eitri-cli-v2.android-arm-eabi.node')
|
|
51
|
+
} else {
|
|
52
|
+
nativeBinding = require('eitri-cli-v2-android-arm-eabi')
|
|
53
|
+
}
|
|
54
|
+
} catch (e) {
|
|
55
|
+
loadError = e
|
|
56
|
+
}
|
|
57
|
+
break
|
|
58
|
+
default:
|
|
59
|
+
throw new Error(`Unsupported architecture on Android ${arch}`)
|
|
60
|
+
}
|
|
61
|
+
break
|
|
62
|
+
case 'win32':
|
|
63
|
+
switch (arch) {
|
|
64
|
+
case 'x64':
|
|
65
|
+
localFileExisted = existsSync(
|
|
66
|
+
join(__dirname, 'eitri-cli-v2.win32-x64-msvc.node')
|
|
67
|
+
)
|
|
68
|
+
try {
|
|
69
|
+
if (localFileExisted) {
|
|
70
|
+
nativeBinding = require('./eitri-cli-v2.win32-x64-msvc.node')
|
|
71
|
+
} else {
|
|
72
|
+
nativeBinding = require('eitri-cli-v2-win32-x64-msvc')
|
|
73
|
+
}
|
|
74
|
+
} catch (e) {
|
|
75
|
+
loadError = e
|
|
76
|
+
}
|
|
77
|
+
break
|
|
78
|
+
case 'ia32':
|
|
79
|
+
localFileExisted = existsSync(
|
|
80
|
+
join(__dirname, 'eitri-cli-v2.win32-ia32-msvc.node')
|
|
81
|
+
)
|
|
82
|
+
try {
|
|
83
|
+
if (localFileExisted) {
|
|
84
|
+
nativeBinding = require('./eitri-cli-v2.win32-ia32-msvc.node')
|
|
85
|
+
} else {
|
|
86
|
+
nativeBinding = require('eitri-cli-v2-win32-ia32-msvc')
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
loadError = e
|
|
90
|
+
}
|
|
91
|
+
break
|
|
92
|
+
case 'arm64':
|
|
93
|
+
localFileExisted = existsSync(
|
|
94
|
+
join(__dirname, 'eitri-cli-v2.win32-arm64-msvc.node')
|
|
95
|
+
)
|
|
96
|
+
try {
|
|
97
|
+
if (localFileExisted) {
|
|
98
|
+
nativeBinding = require('./eitri-cli-v2.win32-arm64-msvc.node')
|
|
99
|
+
} else {
|
|
100
|
+
nativeBinding = require('eitri-cli-v2-win32-arm64-msvc')
|
|
101
|
+
}
|
|
102
|
+
} catch (e) {
|
|
103
|
+
loadError = e
|
|
104
|
+
}
|
|
105
|
+
break
|
|
106
|
+
default:
|
|
107
|
+
throw new Error(`Unsupported architecture on Windows: ${arch}`)
|
|
108
|
+
}
|
|
109
|
+
break
|
|
110
|
+
case 'darwin':
|
|
111
|
+
localFileExisted = existsSync(join(__dirname, 'eitri-cli-v2.darwin-universal.node'))
|
|
112
|
+
try {
|
|
113
|
+
if (localFileExisted) {
|
|
114
|
+
nativeBinding = require('./eitri-cli-v2.darwin-universal.node')
|
|
115
|
+
} else {
|
|
116
|
+
nativeBinding = require('eitri-cli-v2-darwin-universal')
|
|
117
|
+
}
|
|
118
|
+
break
|
|
119
|
+
} catch {}
|
|
120
|
+
switch (arch) {
|
|
121
|
+
case 'x64':
|
|
122
|
+
localFileExisted = existsSync(join(__dirname, 'eitri-cli-v2.darwin-x64.node'))
|
|
123
|
+
try {
|
|
124
|
+
if (localFileExisted) {
|
|
125
|
+
nativeBinding = require('./eitri-cli-v2.darwin-x64.node')
|
|
126
|
+
} else {
|
|
127
|
+
nativeBinding = require('eitri-cli-v2-darwin-x64')
|
|
128
|
+
}
|
|
129
|
+
} catch (e) {
|
|
130
|
+
loadError = e
|
|
131
|
+
}
|
|
132
|
+
break
|
|
133
|
+
case 'arm64':
|
|
134
|
+
localFileExisted = existsSync(
|
|
135
|
+
join(__dirname, 'eitri-cli-v2.darwin-arm64.node')
|
|
136
|
+
)
|
|
137
|
+
try {
|
|
138
|
+
if (localFileExisted) {
|
|
139
|
+
nativeBinding = require('./eitri-cli-v2.darwin-arm64.node')
|
|
140
|
+
} else {
|
|
141
|
+
nativeBinding = require('eitri-cli-v2-darwin-arm64')
|
|
142
|
+
}
|
|
143
|
+
} catch (e) {
|
|
144
|
+
loadError = e
|
|
145
|
+
}
|
|
146
|
+
break
|
|
147
|
+
default:
|
|
148
|
+
throw new Error(`Unsupported architecture on macOS: ${arch}`)
|
|
149
|
+
}
|
|
150
|
+
break
|
|
151
|
+
case 'freebsd':
|
|
152
|
+
if (arch !== 'x64') {
|
|
153
|
+
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
|
|
154
|
+
}
|
|
155
|
+
localFileExisted = existsSync(join(__dirname, 'eitri-cli-v2.freebsd-x64.node'))
|
|
156
|
+
try {
|
|
157
|
+
if (localFileExisted) {
|
|
158
|
+
nativeBinding = require('./eitri-cli-v2.freebsd-x64.node')
|
|
159
|
+
} else {
|
|
160
|
+
nativeBinding = require('eitri-cli-v2-freebsd-x64')
|
|
161
|
+
}
|
|
162
|
+
} catch (e) {
|
|
163
|
+
loadError = e
|
|
164
|
+
}
|
|
165
|
+
break
|
|
166
|
+
case 'linux':
|
|
167
|
+
switch (arch) {
|
|
168
|
+
case 'x64':
|
|
169
|
+
if (isMusl()) {
|
|
170
|
+
localFileExisted = existsSync(
|
|
171
|
+
join(__dirname, 'eitri-cli-v2.linux-x64-musl.node')
|
|
172
|
+
)
|
|
173
|
+
try {
|
|
174
|
+
if (localFileExisted) {
|
|
175
|
+
nativeBinding = require('./eitri-cli-v2.linux-x64-musl.node')
|
|
176
|
+
} else {
|
|
177
|
+
nativeBinding = require('eitri-cli-v2-linux-x64-musl')
|
|
178
|
+
}
|
|
179
|
+
} catch (e) {
|
|
180
|
+
loadError = e
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
localFileExisted = existsSync(
|
|
184
|
+
join(__dirname, 'eitri-cli-v2.linux-x64-gnu.node')
|
|
185
|
+
)
|
|
186
|
+
try {
|
|
187
|
+
if (localFileExisted) {
|
|
188
|
+
nativeBinding = require('./eitri-cli-v2.linux-x64-gnu.node')
|
|
189
|
+
} else {
|
|
190
|
+
nativeBinding = require('eitri-cli-v2-linux-x64-gnu')
|
|
191
|
+
}
|
|
192
|
+
} catch (e) {
|
|
193
|
+
loadError = e
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
break
|
|
197
|
+
case 'arm64':
|
|
198
|
+
if (isMusl()) {
|
|
199
|
+
localFileExisted = existsSync(
|
|
200
|
+
join(__dirname, 'eitri-cli-v2.linux-arm64-musl.node')
|
|
201
|
+
)
|
|
202
|
+
try {
|
|
203
|
+
if (localFileExisted) {
|
|
204
|
+
nativeBinding = require('./eitri-cli-v2.linux-arm64-musl.node')
|
|
205
|
+
} else {
|
|
206
|
+
nativeBinding = require('eitri-cli-v2-linux-arm64-musl')
|
|
207
|
+
}
|
|
208
|
+
} catch (e) {
|
|
209
|
+
loadError = e
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
localFileExisted = existsSync(
|
|
213
|
+
join(__dirname, 'eitri-cli-v2.linux-arm64-gnu.node')
|
|
214
|
+
)
|
|
215
|
+
try {
|
|
216
|
+
if (localFileExisted) {
|
|
217
|
+
nativeBinding = require('./eitri-cli-v2.linux-arm64-gnu.node')
|
|
218
|
+
} else {
|
|
219
|
+
nativeBinding = require('eitri-cli-v2-linux-arm64-gnu')
|
|
220
|
+
}
|
|
221
|
+
} catch (e) {
|
|
222
|
+
loadError = e
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
break
|
|
226
|
+
case 'arm':
|
|
227
|
+
localFileExisted = existsSync(
|
|
228
|
+
join(__dirname, 'eitri-cli-v2.linux-arm-gnueabihf.node')
|
|
229
|
+
)
|
|
230
|
+
try {
|
|
231
|
+
if (localFileExisted) {
|
|
232
|
+
nativeBinding = require('./eitri-cli-v2.linux-arm-gnueabihf.node')
|
|
233
|
+
} else {
|
|
234
|
+
nativeBinding = require('eitri-cli-v2-linux-arm-gnueabihf')
|
|
235
|
+
}
|
|
236
|
+
} catch (e) {
|
|
237
|
+
loadError = e
|
|
238
|
+
}
|
|
239
|
+
break
|
|
240
|
+
case 'riscv64':
|
|
241
|
+
if (isMusl()) {
|
|
242
|
+
localFileExisted = existsSync(
|
|
243
|
+
join(__dirname, 'eitri-cli-v2.linux-riscv64-musl.node')
|
|
244
|
+
)
|
|
245
|
+
try {
|
|
246
|
+
if (localFileExisted) {
|
|
247
|
+
nativeBinding = require('./eitri-cli-v2.linux-riscv64-musl.node')
|
|
248
|
+
} else {
|
|
249
|
+
nativeBinding = require('eitri-cli-v2-linux-riscv64-musl')
|
|
250
|
+
}
|
|
251
|
+
} catch (e) {
|
|
252
|
+
loadError = e
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
localFileExisted = existsSync(
|
|
256
|
+
join(__dirname, 'eitri-cli-v2.linux-riscv64-gnu.node')
|
|
257
|
+
)
|
|
258
|
+
try {
|
|
259
|
+
if (localFileExisted) {
|
|
260
|
+
nativeBinding = require('./eitri-cli-v2.linux-riscv64-gnu.node')
|
|
261
|
+
} else {
|
|
262
|
+
nativeBinding = require('eitri-cli-v2-linux-riscv64-gnu')
|
|
263
|
+
}
|
|
264
|
+
} catch (e) {
|
|
265
|
+
loadError = e
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
break
|
|
269
|
+
case 's390x':
|
|
270
|
+
localFileExisted = existsSync(
|
|
271
|
+
join(__dirname, 'eitri-cli-v2.linux-s390x-gnu.node')
|
|
272
|
+
)
|
|
273
|
+
try {
|
|
274
|
+
if (localFileExisted) {
|
|
275
|
+
nativeBinding = require('./eitri-cli-v2.linux-s390x-gnu.node')
|
|
276
|
+
} else {
|
|
277
|
+
nativeBinding = require('eitri-cli-v2-linux-s390x-gnu')
|
|
278
|
+
}
|
|
279
|
+
} catch (e) {
|
|
280
|
+
loadError = e
|
|
281
|
+
}
|
|
282
|
+
break
|
|
283
|
+
default:
|
|
284
|
+
throw new Error(`Unsupported architecture on Linux: ${arch}`)
|
|
285
|
+
}
|
|
286
|
+
break
|
|
287
|
+
default:
|
|
288
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (!nativeBinding) {
|
|
292
|
+
if (loadError) {
|
|
293
|
+
throw loadError
|
|
294
|
+
}
|
|
295
|
+
throw new Error(`Failed to load native binding`)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const { publish } = nativeBinding
|
|
299
|
+
|
|
300
|
+
module.exports.publish = publish
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eitri-cli-v2",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "0.0.0",
|
|
5
4
|
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"napi": {
|
|
7
|
+
"name": "eitri-cli-v2",
|
|
8
|
+
"triples": {
|
|
9
|
+
"defaults": false,
|
|
10
|
+
"additional": [
|
|
11
|
+
"aarch64-apple-darwin"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
15
14
|
},
|
|
16
|
-
"
|
|
17
|
-
"license": "ISC",
|
|
15
|
+
"license": "MIT",
|
|
18
16
|
"devDependencies": {
|
|
19
|
-
"
|
|
17
|
+
"@napi-rs/cli": "^2.18.0",
|
|
18
|
+
"ava": "^6.0.1"
|
|
19
|
+
},
|
|
20
|
+
"ava": {
|
|
21
|
+
"timeout": "3m"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">= 10"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"artifacts": "napi artifacts",
|
|
28
|
+
"build": "napi build --platform --release",
|
|
29
|
+
"build:debug": "napi build --platform",
|
|
30
|
+
"prepublishOnly": "napi prepublish -t npm",
|
|
31
|
+
"test": "ava",
|
|
32
|
+
"universal": "napi universal",
|
|
33
|
+
"version": "napi version"
|
|
20
34
|
}
|
|
21
35
|
}
|