@lvce-editor/shared-process 0.17.1 → 0.17.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "Utility package for @lvce-editor/server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -16,10 +16,10 @@
16
16
  "node": ">=16"
17
17
  },
18
18
  "dependencies": {
19
- "@babel/code-frame": "^7.22.5",
20
- "@lvce-editor/extension-host": "0.17.1",
21
- "@lvce-editor/extension-host-helper-process": "0.17.1",
22
- "@lvce-editor/pty-host": "0.17.1",
19
+ "@babel/code-frame": "^7.22.10",
20
+ "@lvce-editor/extension-host": "0.17.2",
21
+ "@lvce-editor/extension-host-helper-process": "0.17.2",
22
+ "@lvce-editor/pty-host": "0.17.2",
23
23
  "debug": "^4.3.4",
24
24
  "execa": "^7.2.0",
25
25
  "exit-hook": "^3.2.0",
@@ -8,8 +8,11 @@ import * as GetNsisDownloadPath from '../GetNsisUpdateDownloadPath/GetNsisUpdate
8
8
  import * as GetWindowsNsisDownloadUrl from '../GetWindowsNsisDownloadUrl/GetWindowsNsisDownloadUrl.js'
9
9
  import * as Logger from '../Logger/Logger.js'
10
10
  import * as Platform from '../Platform/Platform.js'
11
+ import * as UpdateState from '../UpdateState/UpdateState.js'
12
+ import * as UpdateStateType from '../UpdateStateType/UpdateStateType.js'
11
13
  import { VError } from '../VError/VError.js'
12
14
 
15
+ // TODO make it possible to cancel downloading updates
13
16
  export const downloadUpdate = async (version) => {
14
17
  try {
15
18
  Assert.string(version)
@@ -19,7 +22,9 @@ export const downloadUpdate = async (version) => {
19
22
  const downLoadUrl = GetWindowsNsisDownloadUrl.getDownloadUrl(repository, version, fileName)
20
23
  const outFile = GetNsisDownloadPath.getNsisUpdateDownloadPath(version)
21
24
  Logger.info(`[shared-process] downloading nsis update: ${downLoadUrl} -> ${outFile}`)
25
+ UpdateState.set(UpdateStateType.Downloading)
22
26
  await Download.download(downLoadUrl, outFile)
27
+ UpdateState.set(UpdateStateType.Downloaded)
23
28
  Logger.info(`[shared-process] downloaded nsis update: ${outFile}`)
24
29
  return outFile
25
30
  } catch (error) {
@@ -32,6 +37,7 @@ export const installAndRestart = async (downloadPath) => {
32
37
  Assert.string(downloadPath)
33
38
  const args = GetNsisUpdateArgs.getNsisUpdateArgs()
34
39
  Logger.info(`[shared-process] spawning nsis update: ${downloadPath}`)
40
+ UpdateState.set(UpdateStateType.Updating)
35
41
  const child = spawn(downloadPath, args, {
36
42
  stdio: 'inherit',
37
43
  detached: true,
@@ -169,11 +169,11 @@ export const getSetupName = () => {
169
169
  return 'Lvce-Setup'
170
170
  }
171
171
 
172
- export const version = '0.17.1'
172
+ export const version = '0.17.2'
173
173
 
174
- export const commit = 'b3e9c7f'
174
+ export const commit = 'e83e740'
175
175
 
176
- export const date = '2023-08-05T20:50:47.000Z'
176
+ export const date = '2023-08-12T10:04:22.000Z'
177
177
 
178
178
  export const getVersion = () => {
179
179
  return version
@@ -0,0 +1,13 @@
1
+ import * as UpdateStateType from '../UpdateStateType/UpdateStateType.js'
2
+
3
+ export const state = {
4
+ updateState: UpdateStateType.Uninitialized,
5
+ }
6
+
7
+ export const get = () => {
8
+ return state.updateState
9
+ }
10
+
11
+ export const set = (value) => {
12
+ state.updateState = value
13
+ }
@@ -0,0 +1,9 @@
1
+ export const Uninitialized = 1
2
+ export const Idle = 2
3
+ export const Disabled = 3
4
+ export const CheckingForUpdates = 3
5
+ export const AvailableForDownload = 4
6
+ export const Downloading = 5
7
+ export const Downloaded = 6
8
+ export const Updating = 7
9
+ export const Ready = 8