@lvce-editor/shared-process 0.14.11 → 0.14.12

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.14.11",
3
+ "version": "0.14.12",
4
4
  "description": "Utility package for @lvce-editor/server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -17,9 +17,9 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/code-frame": "^7.21.4",
20
- "@lvce-editor/extension-host": "0.14.11",
21
- "@lvce-editor/extension-host-helper-process": "0.14.11",
22
- "@lvce-editor/pty-host": "0.14.11",
20
+ "@lvce-editor/extension-host": "0.14.12",
21
+ "@lvce-editor/extension-host-helper-process": "0.14.12",
22
+ "@lvce-editor/pty-host": "0.14.12",
23
23
  "debug": "^4.3.4",
24
24
  "execa": "^7.1.1",
25
25
  "exit-hook": "^3.2.0",
@@ -1,11 +1,12 @@
1
1
  import { spawn } from 'node:child_process'
2
2
  import { rename } from 'node:fs/promises'
3
3
  import { tmpdir } from 'node:os'
4
- import { basename, dirname, join } from 'node:path'
4
+ import { join } from 'node:path'
5
5
  import * as Assert from '../Assert/Assert.js'
6
6
  import * as CompareVersion from '../CompareVersion/CompareVersion.js'
7
7
  import * as Download from '../Download/Download.js'
8
8
  import * as GetAppImageDownloadUrl from '../GetAppImageDownloadUrl/GetAppImageDownloadUrl.js'
9
+ import * as GetAppImagePath from '../GetAppImagePath/GetAppImagePath.js'
9
10
  import * as GetLatestReleaseVersion from '../GetLatestReleaseVersion/GetLatestReleaseVersion.js'
10
11
  import * as MakeExecutable from '../MakeExecutable/MakeExecutable.js'
11
12
  import * as Platform from '../Platform/Platform.js'
@@ -45,22 +46,10 @@ export const checkForUpdatesAndNotify = async () => {
45
46
  }
46
47
  }
47
48
 
48
- const getAppImagePath = () => {
49
- return process.env.APPIMAGE
50
- }
51
-
52
49
  const installNewAppImage = async (currentAppImageFile, downloadPath) => {
53
50
  try {
54
- const currentFileName = basename(currentAppImageFile)
55
- const newFileName = basename(downloadPath)
56
- if (currentFileName === newFileName) {
57
- await rename(downloadPath, currentAppImageFile)
58
- return currentAppImageFile
59
- }
60
- const destinationFolder = dirname(currentAppImageFile)
61
- const destinationPath = join(destinationFolder, newFileName)
62
- await rename(downloadPath, destinationPath)
63
- return destinationPath
51
+ await rename(downloadPath, currentAppImageFile)
52
+ return currentAppImageFile
64
53
  } catch (error) {
65
54
  // @ts-ignore
66
55
  throw new VError(error, `Failed to rename AppImage file`)
@@ -75,7 +64,7 @@ const restart = (downloadPath) => {
75
64
  export const installAndRestart = async (downloadPath) => {
76
65
  try {
77
66
  Assert.string(downloadPath)
78
- const currentAppImageFile = getAppImagePath()
67
+ const currentAppImageFile = GetAppImagePath.getAppImagePath()
79
68
  if (!currentAppImageFile) {
80
69
  throw new Error(`AppImage path not found`)
81
70
  }
@@ -0,0 +1,3 @@
1
+ export const getAppImagePath = () => {
2
+ return process.env.APPIMAGE
3
+ }