sliftutils 0.7.2 → 0.7.4
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/builders/electronBuild.ts +16 -0
- package/builders/setup.ts +12 -1
- package/electron/electronMain.ts +13 -13
- package/package.json +2 -2
|
@@ -7,6 +7,22 @@ import path from "path";
|
|
|
7
7
|
import { getAllFiles } from "../misc/fs";
|
|
8
8
|
|
|
9
9
|
async function main() {
|
|
10
|
+
// Check if Electron is installed
|
|
11
|
+
let electronPath = path.resolve("./node_modules/electron");
|
|
12
|
+
if (!fs.existsSync(electronPath)) {
|
|
13
|
+
console.error("ERROR: Electron is not installed.");
|
|
14
|
+
console.error("");
|
|
15
|
+
console.error("Electron is too heavy to be included by default for non-electron projects.");
|
|
16
|
+
console.error("Please manually add Electron to your package.json dependencies:");
|
|
17
|
+
console.error("");
|
|
18
|
+
console.error(" \"devDependencies\": {");
|
|
19
|
+
console.error(" \"electron\": \"^33.2.1\"");
|
|
20
|
+
console.error(" }");
|
|
21
|
+
console.error("");
|
|
22
|
+
console.error("Then run: yarn install");
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
10
26
|
let time = Date.now();
|
|
11
27
|
let yargObj = yargs(process.argv)
|
|
12
28
|
.option("mainEntry", { type: "string", default: "./electron/electronMain.ts", desc: `Path to the main process entry point` })
|
package/builders/setup.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
+
import { execSync } from "child_process";
|
|
3
4
|
|
|
4
5
|
async function main() {
|
|
5
|
-
let targetDir =
|
|
6
|
+
let targetDir = path.resolve(".");
|
|
6
7
|
let sourceDir = path.join(__dirname, "..");
|
|
7
8
|
|
|
8
9
|
console.log("Setting up sliftutils project...");
|
|
@@ -82,6 +83,16 @@ async function main() {
|
|
|
82
83
|
console.warn("\nNo package.json found in target directory");
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
// Run yarn install
|
|
87
|
+
console.log("\nRunning yarn install...");
|
|
88
|
+
try {
|
|
89
|
+
execSync("yarn install", { cwd: targetDir, stdio: "inherit" });
|
|
90
|
+
console.log("Yarn install completed successfully");
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error("Failed to run yarn install:", error);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
console.log("\nSetup complete!");
|
|
86
97
|
}
|
|
87
98
|
|
package/electron/electronMain.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { app, BrowserWindow } from "electron";
|
|
2
2
|
import { isInElectron } from "../misc/environment";
|
|
3
3
|
|
|
4
|
-
function main() {
|
|
4
|
+
async function main() {
|
|
5
5
|
if (!isInElectron()) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
app.whenReady()
|
|
10
|
-
const mainWindow = new BrowserWindow({
|
|
11
|
-
width: 800,
|
|
12
|
-
height: 600,
|
|
13
|
-
webPreferences: {
|
|
14
|
-
nodeIntegration: false,
|
|
15
|
-
contextIsolation: true,
|
|
16
|
-
},
|
|
17
|
-
});
|
|
9
|
+
await app.whenReady();
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
const mainWindow = new BrowserWindow({
|
|
12
|
+
width: 800,
|
|
13
|
+
height: 600,
|
|
14
|
+
webPreferences: {
|
|
15
|
+
nodeIntegration: false,
|
|
16
|
+
contextIsolation: true,
|
|
17
|
+
},
|
|
21
18
|
});
|
|
22
19
|
|
|
20
|
+
await mainWindow.loadFile("./electronIndex.html");
|
|
21
|
+
mainWindow.webContents.openDevTools();
|
|
22
|
+
|
|
23
23
|
app.on("window-all-closed", () => {
|
|
24
24
|
app.quit();
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
main();
|
|
28
|
+
main().catch(console.error);
|
|
29
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sliftutils",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"mobx": "^6.13.3",
|
|
42
42
|
"preact": "10.24.3",
|
|
43
43
|
"shell-quote": "^1.8.3",
|
|
44
|
-
"socket-function": "^0.
|
|
44
|
+
"socket-function": "^0.156.0",
|
|
45
45
|
"typenode": "^6.0.0",
|
|
46
46
|
"typesafecss": "^0.26.0",
|
|
47
47
|
"ws": "^8.18.3",
|