@tauri-apps/cli 1.0.0-rc.0 → 1.0.0-rc.5

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.
@@ -1,469 +0,0 @@
1
- name: CI
2
- env:
3
- DEBUG: napi:*
4
- APP_NAME: cli
5
- MACOSX_DEPLOYMENT_TARGET: '10.13'
6
- 'on':
7
- push:
8
- branches:
9
- - main
10
- tags-ignore:
11
- - '**'
12
- paths-ignore:
13
- - '**/*.md'
14
- - LICENSE
15
- - '**/*.gitignore'
16
- - .editorconfig
17
- - docs/**
18
- pull_request: null
19
- jobs:
20
- build:
21
- if: "!contains(github.event.head_commit.message, 'skip ci')"
22
- strategy:
23
- fail-fast: false
24
- matrix:
25
- settings:
26
- - host: macos-latest
27
- target: x86_64-apple-darwin
28
- architecture: x64
29
- build: |
30
- yarn build
31
- strip -x *.node
32
- - host: windows-latest
33
- build: yarn build
34
- target: x86_64-pc-windows-msvc
35
- architecture: x64
36
- - host: ubuntu-18.04
37
- target: x86_64-unknown-linux-gnu
38
- architecture: x64
39
- docker: |
40
- docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian
41
- docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-debian builder
42
- build: |
43
- docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip *.node
44
- - host: ubuntu-18.04
45
- target: x86_64-unknown-linux-musl
46
- architecture: x64
47
- docker: |
48
- docker pull $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine
49
- docker tag $DOCKER_REGISTRY_URL/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
50
- build: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder yarn build && strip *.node
51
- - host: macos-latest
52
- target: aarch64-apple-darwin
53
- build: |
54
- yarn build --target=aarch64-apple-darwin
55
- strip -x *.node
56
- - host: ubuntu-18.04
57
- architecture: x64
58
- target: aarch64-unknown-linux-gnu
59
- setup: |
60
- sudo apt-get update
61
- sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y
62
- build: |
63
- yarn build --target=aarch64-unknown-linux-gnu
64
- aarch64-linux-gnu-strip *.node
65
- - host: ubuntu-18.04
66
- architecture: x64
67
- target: armv7-unknown-linux-gnueabihf
68
- setup: |
69
- sudo apt-get update
70
- sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
71
- build: |
72
- yarn build --target=armv7-unknown-linux-gnueabihf
73
- arm-linux-gnueabihf-strip *.node
74
- - host: ubuntu-18.04
75
- architecture: x64
76
- target: aarch64-unknown-linux-musl
77
- downloadTarget: aarch64-unknown-linux-musl
78
- docker: |
79
- docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
80
- docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
81
- build: |
82
- docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "yarn build --target=aarch64-unknown-linux-musl && /aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node"
83
- - host: windows-latest
84
- architecture: x64
85
- target: aarch64-pc-windows-msvc
86
- build: yarn build --target aarch64-pc-windows-msvc
87
- name: stable - ${{ matrix.settings.target }} - node@16
88
- runs-on: ${{ matrix.settings.host }}
89
- steps:
90
- - uses: actions/checkout@v2
91
- - name: Setup node
92
- uses: actions/setup-node@v2
93
- with:
94
- node-version: 16
95
- check-latest: true
96
- cache: yarn
97
- architecture: ${{ matrix.settings.architecture }}
98
- - name: Install
99
- uses: actions-rs/toolchain@v1
100
- with:
101
- profile: minimal
102
- override: true
103
- toolchain: stable
104
- target: ${{ matrix.settings.target }}
105
- - name: Generate Cargo.lock
106
- uses: actions-rs/cargo@v1
107
- with:
108
- command: generate-lockfile
109
- - name: Cache cargo registry
110
- uses: actions/cache@v2
111
- with:
112
- path: ~/.cargo/registry
113
- key: ${{ matrix.settings.target }}-node@16-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
114
- - name: Cache cargo index
115
- uses: actions/cache@v2
116
- with:
117
- path: ~/.cargo/git
118
- key: ${{ matrix.settings.target }}-node@16-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
119
- - name: Cache NPM dependencies
120
- uses: actions/cache@v2
121
- with:
122
- path: node_modules
123
- key: npm-cache-${{ matrix.settings.target }}-node@16-${{ hashFiles('yarn.lock') }}
124
- - name: Pull latest image
125
- run: ${{ matrix.settings.docker }}
126
- env:
127
- DOCKER_REGISTRY_URL: ghcr.io
128
- if: ${{ matrix.settings.docker }}
129
- - name: Setup toolchain
130
- run: ${{ matrix.settings.setup }}
131
- if: ${{ matrix.settings.setup }}
132
- shell: bash
133
- - name: Install dependencies
134
- run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
135
- - name: Build
136
- run: ${{ matrix.settings.build }}
137
- shell: bash
138
- - name: Upload artifact
139
- uses: actions/upload-artifact@v2
140
- with:
141
- name: bindings-${{ matrix.settings.target }}
142
- path: ${{ env.APP_NAME }}.*.node
143
- if-no-files-found: error
144
- build-freebsd:
145
- runs-on: macos-10.15
146
- name: Build FreeBSD
147
- steps:
148
- - uses: actions/checkout@v2
149
- - name: Build
150
- id: build
151
- uses: vmactions/freebsd-vm@v0.1.5
152
- env:
153
- DEBUG: napi:*
154
- RUSTUP_HOME: /usr/local/rustup
155
- CARGO_HOME: /usr/local/cargo
156
- RUSTUP_IO_THREADS: 1
157
- with:
158
- envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS
159
- usesh: true
160
- mem: 3000
161
- prepare: |
162
- pkg install -y curl node14 python2
163
- curl -qL https://www.npmjs.com/install.sh | sh
164
- npm install -g yarn
165
- curl https://sh.rustup.rs -sSf --output rustup.sh
166
- sh rustup.sh -y --profile minimal --default-toolchain stable
167
- export PATH="/usr/local/cargo/bin:$PATH"
168
- echo "~~~~ rustc --version ~~~~"
169
- rustc --version
170
- echo "~~~~ node -v ~~~~"
171
- node -v
172
- echo "~~~~ yarn --version ~~~~"
173
- yarn --version
174
- run: |
175
- export PATH="/usr/local/cargo/bin:$PATH"
176
- pwd
177
- ls -lah
178
- whoami
179
- env
180
- freebsd-version
181
- yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
182
- yarn build
183
- strip -x *.node
184
- yarn test
185
- rm -rf node_modules
186
- rm -rf target
187
- - name: Upload artifact
188
- uses: actions/upload-artifact@v2
189
- with:
190
- name: bindings-freebsd
191
- path: ${{ env.APP_NAME }}.*.node
192
- if-no-files-found: error
193
- test-macOS-windows-binding:
194
- name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
195
- needs:
196
- - build
197
- strategy:
198
- fail-fast: false
199
- matrix:
200
- settings:
201
- - host: windows-latest
202
- target: x86_64-pc-windows-msvc
203
- node:
204
- - '12'
205
- - '14'
206
- - '16'
207
- runs-on: ${{ matrix.settings.host }}
208
- steps:
209
- - uses: actions/checkout@v2
210
- - name: Setup node
211
- uses: actions/setup-node@v2
212
- with:
213
- node-version: ${{ matrix.node }}
214
- check-latest: true
215
- cache: yarn
216
- - name: Cache NPM dependencies
217
- uses: actions/cache@v2
218
- with:
219
- path: node_modules
220
- key: npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
221
- - name: Install dependencies
222
- run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
223
- - name: Download artifacts
224
- uses: actions/download-artifact@v2
225
- with:
226
- name: bindings-${{ matrix.settings.target }}
227
- path: .
228
- - name: List packages
229
- run: ls -R .
230
- shell: bash
231
- - name: Test bindings
232
- run: yarn test
233
- test-linux-x64-gnu-binding:
234
- name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
235
- needs:
236
- - build
237
- strategy:
238
- fail-fast: false
239
- matrix:
240
- node:
241
- - '12'
242
- - '14'
243
- - '16'
244
- runs-on: ubuntu-latest
245
- steps:
246
- - uses: actions/checkout@v2
247
- - name: Setup node
248
- uses: actions/setup-node@v2
249
- with:
250
- node-version: ${{ matrix.node }}
251
- check-latest: true
252
- cache: yarn
253
- - name: Cache NPM dependencies
254
- uses: actions/cache@v2
255
- with:
256
- path: node_modules
257
- key: npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
258
- - name: Install dependencies
259
- run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
260
- - name: Download artifacts
261
- uses: actions/download-artifact@v2
262
- with:
263
- name: bindings-x86_64-unknown-linux-gnu
264
- path: .
265
- - name: List packages
266
- run: ls -R .
267
- shell: bash
268
- - name: Test bindings
269
- run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
270
- test-linux-x64-musl-binding:
271
- name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }}
272
- needs:
273
- - build
274
- strategy:
275
- fail-fast: false
276
- matrix:
277
- node:
278
- - '12'
279
- - '14'
280
- - '16'
281
- runs-on: ubuntu-latest
282
- steps:
283
- - uses: actions/checkout@v2
284
- - name: Setup node
285
- uses: actions/setup-node@v2
286
- with:
287
- node-version: ${{ matrix.node }}
288
- check-latest: true
289
- cache: yarn
290
- - name: Cache NPM dependencies
291
- uses: actions/cache@v2
292
- with:
293
- path: node_modules
294
- key: npm-cache-test-x86_64-unknown-linux-musl-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
295
- - name: Install dependencies
296
- run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
297
- - name: Download artifacts
298
- uses: actions/download-artifact@v2
299
- with:
300
- name: bindings-x86_64-unknown-linux-musl
301
- path: .
302
- - name: List packages
303
- run: ls -R .
304
- shell: bash
305
- - name: Test bindings
306
- run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine yarn test
307
- test-linux-aarch64-gnu-binding:
308
- name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
309
- needs:
310
- - build
311
- strategy:
312
- fail-fast: false
313
- matrix:
314
- node:
315
- - '12'
316
- - '14'
317
- - '16'
318
- runs-on: ubuntu-latest
319
- steps:
320
- - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
321
- - uses: actions/checkout@v2
322
- - name: Download artifacts
323
- uses: actions/download-artifact@v2
324
- with:
325
- name: bindings-aarch64-unknown-linux-gnu
326
- path: .
327
- - name: List packages
328
- run: ls -R .
329
- shell: bash
330
- - name: Cache NPM dependencies
331
- uses: actions/cache@v2
332
- with:
333
- path: node_modules
334
- key: npm-cache-test-linux-aarch64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
335
- - name: Install dependencies
336
- run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
337
- - name: Setup and run tests
338
- uses: addnab/docker-run-action@v3
339
- with:
340
- image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }}
341
- options: '-v ${{ github.workspace }}:/build -w /build'
342
- run: |
343
- set -e
344
- yarn test
345
- ls -la
346
- test-linux-aarch64-musl-binding:
347
- name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }}
348
- needs:
349
- - build
350
- runs-on: ubuntu-latest
351
- steps:
352
- - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
353
- - uses: actions/checkout@v2
354
- - name: Download artifacts
355
- uses: actions/download-artifact@v2
356
- with:
357
- name: bindings-aarch64-unknown-linux-musl
358
- path: .
359
- - name: List packages
360
- run: ls -R .
361
- shell: bash
362
- - name: Cache NPM dependencies
363
- uses: actions/cache@v2
364
- with:
365
- path: node_modules
366
- key: npm-cache-test-linux-aarch64-musl-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
367
- - name: Install dependencies
368
- run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
369
- - name: Setup and run tests
370
- uses: addnab/docker-run-action@v3
371
- with:
372
- image: multiarch/alpine:aarch64-latest-stable
373
- options: '-v ${{ github.workspace }}:/build -w /build'
374
- run: |
375
- set -e
376
- apk add nodejs npm yarn
377
- yarn test
378
- test-linux-arm-gnueabihf-binding:
379
- name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
380
- needs:
381
- - build
382
- strategy:
383
- fail-fast: false
384
- matrix:
385
- node:
386
- - '12'
387
- - '14'
388
- - '16'
389
- runs-on: ubuntu-latest
390
- steps:
391
- - run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
392
- - uses: actions/checkout@v2
393
- - name: Download artifacts
394
- uses: actions/download-artifact@v2
395
- with:
396
- name: bindings-armv7-unknown-linux-gnueabihf
397
- path: .
398
- - name: List packages
399
- run: ls -R .
400
- shell: bash
401
- - name: Cache NPM dependencies
402
- uses: actions/cache@v2
403
- with:
404
- path: node_modules
405
- key: npm-cache-test-linux-arm-gnueabihf-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
406
- - name: Install dependencies
407
- run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
408
- - name: Setup and run tests
409
- uses: addnab/docker-run-action@v3
410
- with:
411
- image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-${{ matrix.node }}
412
- options: '-v ${{ github.workspace }}:/build -w /build'
413
- run: |
414
- set -e
415
- yarn test
416
- ls -la
417
- publish:
418
- name: Publish
419
- runs-on: ubuntu-latest
420
- needs:
421
- - build-freebsd
422
- - test-macOS-windows-binding
423
- - test-linux-x64-gnu-binding
424
- - test-linux-x64-musl-binding
425
- - test-linux-aarch64-gnu-binding
426
- - test-linux-aarch64-musl-binding
427
- - test-linux-arm-gnueabihf-binding
428
- steps:
429
- - uses: actions/checkout@v2
430
- - name: Setup node
431
- uses: actions/setup-node@v2
432
- with:
433
- node-version: 16
434
- check-latest: true
435
- cache: yarn
436
- - name: Cache NPM dependencies
437
- uses: actions/cache@v2
438
- with:
439
- path: node_modules
440
- key: npm-cache-ubuntu-latest-${{ hashFiles('yarn.lock') }}
441
- restore-keys: |
442
- npm-cache-
443
- - name: Install dependencies
444
- run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
445
- - name: Download all artifacts
446
- uses: actions/download-artifact@v2
447
- with:
448
- path: artifacts
449
- - name: Move artifacts
450
- run: yarn artifacts
451
- - name: List packages
452
- run: ls -R ./npm
453
- shell: bash
454
- - name: Publish
455
- run: |
456
- if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
457
- then
458
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
459
- npm publish --access public
460
- elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
461
- then
462
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
463
- npm publish --tag next --access public
464
- else
465
- echo "Not a release, skipping publish"
466
- fi
467
- env:
468
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
469
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,41 +0,0 @@
1
- const fixtureSetup = require('../fixtures/app-test-setup.js')
2
- const { resolve } = require('path')
3
- const { existsSync, readFileSync, writeFileSync } = require('fs')
4
- const { move } = require('fs-extra')
5
- const cli = require('~/index.js')
6
-
7
- const currentDirName = __dirname
8
-
9
- describe('[CLI] cli.js template', () => {
10
- it('init a project and builds it', async () => {
11
- const cwd = process.cwd()
12
- const fixturePath = resolve(currentDirName, '../fixtures/empty')
13
- const tauriFixturePath = resolve(fixturePath, 'src-tauri')
14
- const outPath = resolve(tauriFixturePath, 'target')
15
- const cacheOutPath = resolve(fixturePath, 'target')
16
-
17
- fixtureSetup.initJest('empty')
18
-
19
- process.chdir(fixturePath)
20
-
21
- const outExists = existsSync(outPath)
22
- if (outExists) {
23
- await move(outPath, cacheOutPath)
24
- }
25
-
26
- cli.run(['init', '--directory', process.cwd(), '--force', '--tauri-path', resolve(currentDirName, '../../../../../..'), '--ci'])
27
-
28
- if (outExists) {
29
- await move(cacheOutPath, outPath)
30
- }
31
-
32
- process.chdir(tauriFixturePath)
33
-
34
- const manifestPath = resolve(tauriFixturePath, 'Cargo.toml')
35
- const manifestFile = readFileSync(manifestPath).toString()
36
- writeFileSync(manifestPath, `workspace = { }\n${manifestFile}`)
37
-
38
- cli.run(['build', '--verbose'])
39
- process.chdir(cwd)
40
- })
41
- })
@@ -1,140 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <body>
4
- <script>
5
- function callBackEnd(route, args) {
6
- console.log(route)
7
- console.log(args)
8
- window.__TAURI__.http
9
- .fetch('http://localhost:7000/' + route, {
10
- method: 'POST',
11
- body: window.__TAURI__.http.Body.json(args),
12
- responseType: window.__TAURI__.http.ResponseType.Binary
13
- })
14
- .catch(console.error)
15
- }
16
-
17
- function reply(args) {
18
- return callBackEnd('reply', args)
19
- }
20
-
21
- function sendError(error) {
22
- return callBackEnd('error', error)
23
- }
24
-
25
- function testFs(dir) {
26
- var contents = 'TAURI E2E TEST FILE'
27
- var commandSuffix = dir ? 'WithDir' : ''
28
-
29
- var options = {
30
- dir: dir || null
31
- }
32
-
33
- return window.__TAURI__.fs
34
- .writeFile(
35
- {
36
- path: 'tauri-test.txt',
37
- contents: contents
38
- },
39
- options
40
- )
41
- .then(function (res) {
42
- reply({
43
- cmd: 'writeFile' + commandSuffix
44
- })
45
- return window.__TAURI__.fs
46
- .readTextFile('tauri-test.txt', options)
47
- .then(function (res) {
48
- if (res === contents) {
49
- reply({
50
- cmd: 'readFile' + commandSuffix
51
- })
52
-
53
- return window.__TAURI__.fs
54
- .readDir('.', options)
55
- .then((res) => {
56
- reply({
57
- cmd: 'readDir' + commandSuffix
58
- })
59
-
60
- return window.__TAURI__.fs
61
- .copyFile(
62
- 'tauri-test.txt',
63
- 'tauri-test-copy.txt',
64
- options
65
- )
66
- .then(function (res) {
67
- reply({
68
- cmd: 'copyFile' + commandSuffix
69
- })
70
-
71
- return window.__TAURI__.fs
72
- .createDir('tauri-test-dir', options)
73
- .then(function (res) {
74
- reply({
75
- cmd: 'createDir' + commandSuffix
76
- })
77
- return window.__TAURI__.fs
78
- .removeDir('tauri-test-dir', options)
79
- .then(function (res) {
80
- reply({
81
- cmd: 'removeDir' + commandSuffix
82
- })
83
- })
84
- })
85
- .then(function (res) {
86
- return window.__TAURI__.fs
87
- .renameFile(
88
- 'tauri-test.txt',
89
- 'tauri.testt.txt',
90
- options
91
- )
92
- .then(function (res) {
93
- reply({
94
- cmd: 'renameFile' + commandSuffix
95
- })
96
- return Promise.all([
97
- window.__TAURI__.fs.removeFile(
98
- 'tauri.testt.txt',
99
- options
100
- ),
101
- window.__TAURI__.fs.removeFile(
102
- 'tauri-test-copy.txt',
103
- options
104
- )
105
- ]).then(function (res) {
106
- reply({
107
- cmd: 'removeFile' + commandSuffix
108
- })
109
- })
110
- })
111
- })
112
- })
113
- })
114
- } else {
115
- sendError('expected "' + contents + '" found "' + res + '"')
116
- }
117
- })
118
- })
119
- .catch(sendError)
120
- }
121
-
122
- window.__TAURI__.event.listen('reply', function (res) {
123
- reply({
124
- cmd: 'listen'
125
- })
126
- })
127
- window.onTauriInit = function () {
128
- window.__TAURI__.event.emit('hello')
129
- }
130
-
131
- testFs(null).then(function () {
132
- testFs(window.__TAURI__.fs.Dir.Config)
133
- })
134
-
135
- setTimeout(function () {
136
- window.__TAURI__.invoke('exit')
137
- }, 15000)
138
- </script>
139
- </body>
140
- </html>
@@ -1,53 +0,0 @@
1
- const express = require('express')
2
- const cors = require('cors')
3
- const app = express()
4
- app.use(cors())
5
- app.use(express.json())
6
- const port = 7000
7
- let appPid
8
-
9
- app.post('/reply', (req, res) => {
10
- if (req.body && req.body.msg !== 'TEST') {
11
- throw new Error(`unexpected reply ${JSON.stringify(req.body)}`)
12
- }
13
- console.log('App event replied')
14
- exit(0)
15
- })
16
-
17
- const server = app.listen(port, () =>
18
- console.log(`Test listening on port ${port}!`)
19
- )
20
-
21
- const exit = (code) => {
22
- server.close()
23
- process.kill(appPid)
24
- process.exit(code)
25
- }
26
-
27
- const path = require('path')
28
- const dist = path.resolve(__dirname, 'dist')
29
-
30
- const build = require('../tooling/cli.js/dist/api/build')
31
- build({
32
- build: {
33
- devPath: dist
34
- },
35
- ctx: {
36
- debug: true
37
- }
38
- }).then(() => {
39
- const spawn = require('../tooling/cli.js/dist/helpers/spawn').spawn
40
- const artifactPath = path.resolve(__dirname, 'src-tauri/target/debug/app')
41
- appPid = spawn(
42
- process.platform === 'win32'
43
- ? `${artifactPath}.exe`
44
- : artifactPath.replace('debug/app', 'debug/./app'),
45
- [],
46
- null
47
- )
48
-
49
- // if it didn't reply, throw an error
50
- setTimeout(() => {
51
- throw new Error("App didn't reply")
52
- }, 2000)
53
- })