@geode/opengeodeweb-front 10.22.0 → 10.22.1-rc.1
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.
|
@@ -10,8 +10,8 @@ import pTimeout from "p-timeout";
|
|
|
10
10
|
|
|
11
11
|
// Local imports
|
|
12
12
|
import { commandExistsSync, waitForReady } from "./scripts.js";
|
|
13
|
-
import { executableName, executablePath } from "./path.js";
|
|
14
13
|
import { microservicesMetadatasPath, projectMicroservices } from "./cleanup.js";
|
|
14
|
+
import { executablePath } from "./path.js";
|
|
15
15
|
|
|
16
16
|
const DEFAULT_TIMEOUT_SECONDS = 60;
|
|
17
17
|
const MILLISECONDS_PER_SECOND = 1000;
|
|
@@ -24,8 +24,8 @@ function getAvailablePort() {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async function runScript(
|
|
27
|
-
execName,
|
|
28
27
|
execPath,
|
|
28
|
+
execName,
|
|
29
29
|
args,
|
|
30
30
|
expectedResponse,
|
|
31
31
|
timeoutSeconds = DEFAULT_TIMEOUT_SECONDS,
|
|
@@ -34,7 +34,7 @@ async function runScript(
|
|
|
34
34
|
if (commandExistsSync(execName)) {
|
|
35
35
|
command = execName;
|
|
36
36
|
} else {
|
|
37
|
-
command = path.join(executablePath(execPath
|
|
37
|
+
command = path.join(executablePath(execPath, execName));
|
|
38
38
|
}
|
|
39
39
|
console.log("runScript", command, args);
|
|
40
40
|
|
|
@@ -82,8 +82,8 @@ async function runBack(execName, execPath, args = {}) {
|
|
|
82
82
|
if (process.env.NODE_ENV === "development" || !process.env.NODE_ENV) {
|
|
83
83
|
backArgs.push("--debug");
|
|
84
84
|
}
|
|
85
|
-
console.log("runBack",
|
|
86
|
-
await runScript(
|
|
85
|
+
console.log("runBack", execPath, execName, backArgs);
|
|
86
|
+
await runScript(execPath, execName, backArgs, "Serving Flask app");
|
|
87
87
|
return port;
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -98,8 +98,8 @@ async function runViewer(execName, execPath, args = {}) {
|
|
|
98
98
|
`--data_folder_path ${projectFolderPath}`,
|
|
99
99
|
`--timeout ${0}`,
|
|
100
100
|
];
|
|
101
|
-
console.log("runViewer",
|
|
102
|
-
await runScript(
|
|
101
|
+
console.log("runViewer", execPath, execName, viewerArgs);
|
|
102
|
+
await runScript(execPath, execName, viewerArgs, "Starting factory");
|
|
103
103
|
return port;
|
|
104
104
|
}
|
|
105
105
|
|
package/app/utils/local/path.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { setTimeout } from "node:timers/promises";
|
|
5
6
|
|
|
6
7
|
// Third party imports
|
|
7
8
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -9,22 +10,31 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
9
10
|
// Local imports
|
|
10
11
|
import { appMode } from "./app_mode.js";
|
|
11
12
|
|
|
12
|
-
function executablePath(
|
|
13
|
+
function executablePath(execPath, execName) {
|
|
13
14
|
const resourcesPath = process.env.RESOURCES_PATH;
|
|
14
15
|
const mode = process.env.MODE;
|
|
15
16
|
const nodeEnv = process.env.NODE_ENV;
|
|
16
|
-
console.log("[executablePath]", {
|
|
17
|
+
console.log("[executablePath]", { execPath, execName, mode, nodeEnv, resourcesPath });
|
|
17
18
|
if (mode === appMode.DESKTOP && nodeEnv === "production") {
|
|
18
|
-
|
|
19
|
+
const execPathInResources = path.join(resourcesPath, executableName(execName));
|
|
20
|
+
if (fs.existsSync(execPathInResources)) {
|
|
21
|
+
console.log(`[executablePath] Found executable in resources path: ${execPathInResources}`);
|
|
22
|
+
return execPathInResources;
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
|
-
|
|
25
|
+
const localExecPath = path.join(execPath, executableName(execName));
|
|
26
|
+
if (fs.existsSync(localExecPath)) {
|
|
27
|
+
console.log(`[executablePath] Found executable in local path: ${localExecPath}`);
|
|
28
|
+
return localExecPath;
|
|
29
|
+
}
|
|
30
|
+
throw new Error(`Executable not found: ${execName}`);
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
function executableName(
|
|
33
|
+
function executableName(execName) {
|
|
24
34
|
if (process.platform === "win32") {
|
|
25
|
-
return `${
|
|
35
|
+
return `${execName}.exe`;
|
|
26
36
|
}
|
|
27
|
-
return
|
|
37
|
+
return execName;
|
|
28
38
|
}
|
|
29
39
|
|
|
30
40
|
function createPath(dirPath) {
|
|
@@ -39,17 +49,62 @@ function generateProjectFolderPath(projectName) {
|
|
|
39
49
|
return path.join(os.tmpdir(), projectName.replaceAll("/", "_"), uuidv4());
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
async function lookForLocalExtensionDistPath(rootPath, extentionRepoName, frontendFile) {
|
|
53
|
+
const localExtensionPath = path.join(rootPath, "..", extentionRepoName);
|
|
54
|
+
const localExtensionDistPath = path.join(localExtensionPath, "dist");
|
|
55
|
+
|
|
56
|
+
if (!fs.existsSync(localExtensionDistPath)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
console.log(
|
|
60
|
+
`[extensionFrontendPath] Found existing folder: ${localExtensionDistPath}, deleting it...`,
|
|
61
|
+
);
|
|
62
|
+
fs.rmSync(localExtensionDistPath, { recursive: true, force: true });
|
|
63
|
+
const now = new Date();
|
|
64
|
+
fs.utimesSync(path.join(localExtensionPath, "package.json"), now, now);
|
|
65
|
+
|
|
66
|
+
const rebuiltFilePath = path.join(localExtensionDistPath, frontendFile);
|
|
67
|
+
const MAX_DELETE_FOLDER_RETRIES = 10;
|
|
68
|
+
const MILLISECONDS_PER_RETRY = 1000;
|
|
69
|
+
|
|
70
|
+
for (let i = 0; i <= MAX_DELETE_FOLDER_RETRIES; i += 1) {
|
|
71
|
+
if (fs.existsSync(rebuiltFilePath)) {
|
|
72
|
+
console.log(`Found rebuilt file: ${rebuiltFilePath}`);
|
|
73
|
+
return rebuiltFilePath;
|
|
74
|
+
}
|
|
75
|
+
console.log(`Waiting for rebuild... attempt ${i}/${MAX_DELETE_FOLDER_RETRIES}`);
|
|
76
|
+
// oxlint-disable-next-line no-await-in-loop
|
|
77
|
+
await setTimeout(MILLISECONDS_PER_RETRY);
|
|
45
78
|
}
|
|
79
|
+
|
|
80
|
+
throw new Error(`Failed to find local extension dist path: ${rebuiltFilePath}`);
|
|
81
|
+
}
|
|
82
|
+
async function extensionFrontendPath(unzippedExtensionPath, frontendFile, rootPath, extensionId) {
|
|
83
|
+
console.log("[extensionFrontendPath]", {
|
|
84
|
+
unzippedExtensionPath,
|
|
85
|
+
frontendFile,
|
|
86
|
+
rootPath,
|
|
87
|
+
extensionId,
|
|
88
|
+
});
|
|
46
89
|
const extentionRepoName = extensionId
|
|
47
90
|
.split("-")
|
|
48
91
|
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
49
92
|
.join("-");
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
93
|
+
|
|
94
|
+
const localFilePath = await lookForLocalExtensionDistPath(
|
|
95
|
+
rootPath,
|
|
96
|
+
extentionRepoName,
|
|
97
|
+
frontendFile,
|
|
98
|
+
);
|
|
99
|
+
if (localFilePath) {
|
|
100
|
+
return localFilePath;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const unzippedfrontendFilePath = path.join(unzippedExtensionPath, frontendFile);
|
|
104
|
+
if (fs.existsSync(unzippedfrontendFilePath)) {
|
|
105
|
+
return unzippedfrontendFilePath;
|
|
106
|
+
}
|
|
107
|
+
throw new Error(`Failed to find ${unzippedfrontendFilePath}`);
|
|
53
108
|
}
|
|
54
109
|
|
|
55
110
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geode/opengeodeweb-front",
|
|
3
|
-
"version": "10.22.
|
|
3
|
+
"version": "10.22.1-rc.1",
|
|
4
4
|
"description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
|
|
5
5
|
"homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
|
|
6
6
|
"bugs": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"build": ""
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@geode/opengeodeweb-back": "
|
|
38
|
-
"@geode/opengeodeweb-viewer": "
|
|
37
|
+
"@geode/opengeodeweb-back": "next",
|
|
38
|
+
"@geode/opengeodeweb-viewer": "next",
|
|
39
39
|
"@google-cloud/run": "3.2.0",
|
|
40
40
|
"@kitware/vtk.js": "33.3.0",
|
|
41
41
|
"@mdi/font": "7.4.47",
|
|
@@ -57,12 +57,14 @@ export default defineEventHandler(async (event) => {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const frontendFilePath = extensionFrontendPath(
|
|
61
|
-
|
|
60
|
+
const frontendFilePath = await extensionFrontendPath(
|
|
61
|
+
unzippedExtensionPath,
|
|
62
62
|
frontendFile,
|
|
63
63
|
path.resolve(),
|
|
64
64
|
id,
|
|
65
65
|
);
|
|
66
|
+
|
|
67
|
+
console.log("runExtensions", { frontendFilePath });
|
|
66
68
|
const frontendContent = await fs.promises.readFile(frontendFilePath, "utf8");
|
|
67
69
|
|
|
68
70
|
const backendExecutablePath = path.join(unzippedExtensionPath, backendExecutable);
|