vaultfs 1.0.6 → 1.0.8
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/bin/postinstall.js +66 -121
- package/frontend/dist/assets/index-CTly5DdU.js +9 -0
- package/frontend/dist/assets/style-Di8h79_5.css +2 -0
- package/frontend/dist/favicon.svg +1 -0
- package/frontend/dist/icons.svg +24 -0
- package/frontend/dist/index.html +13 -0
- package/package.json +11 -2
- package/version.txt +1 -1
- package/frontend/package-lock.json +0 -3584
package/bin/postinstall.js
CHANGED
|
@@ -1,137 +1,82 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const { execSync } = require(
|
|
3
|
-
const fs = require(
|
|
4
|
-
const path = require(
|
|
5
|
-
const os = require(
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const BOLD = "\x1b[1m";
|
|
10
|
-
const RED = "\x1b[31m";
|
|
11
|
-
const GREEN = "\x1b[32m";
|
|
12
|
-
const CYAN = "\x1b[36m";
|
|
13
|
-
const DIM = "\x1b[2m";
|
|
7
|
+
const isWin = process.platform === 'win32';
|
|
8
|
+
const installDir = path.join(os.homedir(), '.vaultfs');
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// ─── Banner ──────────────────────────────────────────────────
|
|
20
|
-
console.log("");
|
|
21
|
-
console.log(`${CYAN}${BOLD} ╔══════════════════════════════════════════════╗${RESET}`);
|
|
22
|
-
console.log(`${CYAN}${BOLD} ║ ║${RESET}`);
|
|
23
|
-
console.log(`${CYAN}${BOLD} ║ ${GREEN}▓▓ VaultFS — Running post-install setup${CYAN} ║${RESET}`);
|
|
24
|
-
console.log(`${CYAN}${BOLD} ║ ║${RESET}`);
|
|
25
|
-
console.log(`${CYAN}${BOLD} ╚══════════════════════════════════════════════╝${RESET}`);
|
|
26
|
-
console.log("");
|
|
10
|
+
console.log('\n \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557');
|
|
11
|
+
console.log(' \u2551 VaultFS \u2014 Running post-install setup \u2551');
|
|
12
|
+
console.log(' \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n');
|
|
27
13
|
|
|
28
14
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} catch {
|
|
43
|
-
javaVersion = 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (javaVersion < 11) {
|
|
47
|
-
error(`${RED}Java 11+ is required${javaVersion > 0 ? ` (found Java ${javaVersion})` : " (not found)"}.${RESET}`);
|
|
48
|
-
console.log("");
|
|
49
|
-
console.log(` Download Java from: ${CYAN}https://adoptium.net${RESET}`);
|
|
50
|
-
console.log("");
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
success(`Java ${BOLD}${javaVersion}${RESET} found`);
|
|
54
|
-
|
|
55
|
-
// ─── Install directory ─────────────────────────────────────
|
|
56
|
-
const installDir = path.join(os.homedir(), ".vaultfs");
|
|
57
|
-
|
|
58
|
-
if (fs.existsSync(installDir) && fs.existsSync(path.join(installDir, "out", "Main.class"))) {
|
|
59
|
-
info("Already installed, skipping build.");
|
|
60
|
-
console.log("");
|
|
61
|
-
console.log(` ${GREEN}${BOLD}✅ VaultFS is ready!${RESET} Type ${CYAN}vaultfs${RESET} to launch.`);
|
|
62
|
-
console.log("");
|
|
63
|
-
process.exit(0);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ─── Copy package contents into install dir ────────────────
|
|
67
|
-
info(`Setting up ${DIM}${installDir}${RESET}...`);
|
|
15
|
+
// Step 1 — Detect OS
|
|
16
|
+
const os_name = isWin ? 'Windows' : process.platform === 'darwin' ? 'macOS' : 'Linux';
|
|
17
|
+
console.log(` \u2713 OS detected: ${os_name}`);
|
|
18
|
+
|
|
19
|
+
// Step 2 — Check Java 11+
|
|
20
|
+
try {
|
|
21
|
+
execSync('java -version 2>&1', { shell: true });
|
|
22
|
+
console.log(' \u2713 Java found');
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error(' \u2717 Java 11+ is required.');
|
|
25
|
+
console.error(' Download from: https://adoptium.net');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
68
28
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
29
|
+
// Step 3 — Copy files to ~/.vaultfs
|
|
30
|
+
console.log(` \u2192 Setting up ${installDir}...`);
|
|
31
|
+
if (!fs.existsSync(installDir)) {
|
|
32
|
+
fs.mkdirSync(installDir, { recursive: true });
|
|
33
|
+
}
|
|
72
34
|
|
|
73
|
-
|
|
74
|
-
|
|
35
|
+
const pkgDir = path.join(__dirname, '..');
|
|
36
|
+
const itemsToCopy = ['src', 'frontend', 'version.txt', '.env.example'];
|
|
37
|
+
for (const item of itemsToCopy) {
|
|
38
|
+
const src = path.join(pkgDir, item);
|
|
39
|
+
const dest = path.join(installDir, item);
|
|
40
|
+
if (fs.existsSync(src)) {
|
|
41
|
+
if (fs.existsSync(dest)) {
|
|
42
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
43
|
+
}
|
|
44
|
+
fs.cpSync(src, dest, { recursive: true });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
console.log(' \u2713 Source files copied');
|
|
75
48
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
49
|
+
// Step 4 — Create .env if missing
|
|
50
|
+
const envFile = path.join(installDir, '.env');
|
|
51
|
+
const envExample = path.join(installDir, '.env.example');
|
|
52
|
+
if (!fs.existsSync(envFile) && fs.existsSync(envExample)) {
|
|
53
|
+
fs.copyFileSync(envExample, envFile);
|
|
54
|
+
}
|
|
81
55
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
// Step 5 — Verify pre-built frontend dist exists
|
|
57
|
+
const distDir = path.join(installDir, 'frontend', 'dist');
|
|
58
|
+
if (fs.existsSync(distDir)) {
|
|
59
|
+
console.log(' \u2713 Frontend ready (pre-built)');
|
|
85
60
|
} else {
|
|
86
|
-
|
|
87
|
-
const parent = path.dirname(dest);
|
|
88
|
-
if (!fs.existsSync(parent)) fs.mkdirSync(parent, { recursive: true });
|
|
89
|
-
fs.copyFileSync(src, dest);
|
|
61
|
+
console.log(' \u26A0 Frontend dist not found - login UI may not work');
|
|
90
62
|
}
|
|
91
|
-
}
|
|
92
|
-
success("Source files copied");
|
|
93
|
-
|
|
94
|
-
// ─── Platform-aware commands ───────────────────────────────
|
|
95
|
-
const npmCmd = platform === "win32" ? "npm.cmd" : "npm";
|
|
96
|
-
const npxCmd = platform === "win32" ? "npx.cmd" : "npx";
|
|
97
63
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
execSync(`${npmCmd} run build`, {
|
|
110
|
-
cwd: frontendDir,
|
|
111
|
-
stdio: "inherit",
|
|
112
|
-
shell: true
|
|
113
|
-
});
|
|
114
|
-
success("React app built");
|
|
115
|
-
|
|
116
|
-
// ─── Compile Java ──────────────────────────────────────────
|
|
117
|
-
info("Compiling Java sources...");
|
|
118
|
-
execSync("javac -d out src/models/*.java src/datastructures/*.java src/utils/*.java src/auth/*.java src/sync/*.java src/filesystem/*.java src/Main.java", {
|
|
119
|
-
cwd: installDir,
|
|
120
|
-
stdio: "inherit",
|
|
121
|
-
shell: true
|
|
122
|
-
});
|
|
123
|
-
success("All sources compiled");
|
|
64
|
+
// Step 6 — Compile Java
|
|
65
|
+
console.log(' \u2192 Compiling Java sources...');
|
|
66
|
+
const outDir = path.join(installDir, 'out');
|
|
67
|
+
if (!fs.existsSync(outDir)) {
|
|
68
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
69
|
+
}
|
|
70
|
+
execSync(
|
|
71
|
+
'javac -d out src/models/*.java src/datastructures/*.java src/utils/*.java src/auth/*.java src/sync/*.java src/filesystem/*.java src/Main.java',
|
|
72
|
+
{ cwd: installDir, stdio: 'inherit', shell: true }
|
|
73
|
+
);
|
|
74
|
+
console.log(' \u2713 Java compiled');
|
|
124
75
|
|
|
125
|
-
|
|
126
|
-
console.log("");
|
|
127
|
-
console.log(` ${GREEN}${BOLD}✅ VaultFS is ready!${RESET} Type ${CYAN}vaultfs${RESET} to launch.`);
|
|
128
|
-
console.log("");
|
|
76
|
+
console.log('\n \u2705 VaultFS is ready! Type vaultfs to launch.\n');
|
|
129
77
|
|
|
130
78
|
} catch (err) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
console.log(` Run ${CYAN}vaultfs doctor${RESET} to diagnose the issue.`);
|
|
135
|
-
console.log("");
|
|
136
|
-
process.exit(1);
|
|
79
|
+
console.error(`\n \u2717 Post-install failed: ${err.message}`);
|
|
80
|
+
console.error(' Run vaultfs doctor to diagnose the issue.\n');
|
|
81
|
+
process.exit(1);
|
|
137
82
|
}
|