vaultfs 1.0.6 → 1.0.7
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 +102 -137
- package/package.json +10 -2
- package/version.txt +1 -1
- package/frontend/package-lock.json +0 -3584
package/bin/postinstall.js
CHANGED
|
@@ -1,137 +1,102 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { execSync } = require(
|
|
3
|
-
const fs = require(
|
|
4
|
-
const path = require(
|
|
5
|
-
const os = require(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
console.log(
|
|
25
|
-
|
|
26
|
-
console.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
console.log(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
stdio: "inherit",
|
|
104
|
-
shell: true
|
|
105
|
-
});
|
|
106
|
-
success("Dependencies installed");
|
|
107
|
-
|
|
108
|
-
info("Building React app...");
|
|
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");
|
|
124
|
-
|
|
125
|
-
// ─── Done ──────────────────────────────────────────────────
|
|
126
|
-
console.log("");
|
|
127
|
-
console.log(` ${GREEN}${BOLD}✅ VaultFS is ready!${RESET} Type ${CYAN}vaultfs${RESET} to launch.`);
|
|
128
|
-
console.log("");
|
|
129
|
-
|
|
130
|
-
} catch (err) {
|
|
131
|
-
console.log("");
|
|
132
|
-
error(`${RED}Post-install failed: ${err.message}${RESET}`);
|
|
133
|
-
console.log("");
|
|
134
|
-
console.log(` Run ${CYAN}vaultfs doctor${RESET} to diagnose the issue.`);
|
|
135
|
-
console.log("");
|
|
136
|
-
process.exit(1);
|
|
137
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
const isWin = process.platform === 'win32';
|
|
8
|
+
const npmCmd = isWin ? 'npm.cmd' : 'npm';
|
|
9
|
+
const installDir = path.join(os.homedir(), '.vaultfs');
|
|
10
|
+
const frontendDir = path.join(installDir, 'frontend');
|
|
11
|
+
|
|
12
|
+
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');
|
|
13
|
+
console.log(' \u2551 VaultFS \u2014 Running post-install setup \u2551');
|
|
14
|
+
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');
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
// Step 1 — Detect OS
|
|
18
|
+
const os_name = isWin ? 'Windows' : process.platform === 'darwin' ? 'macOS' : 'Linux';
|
|
19
|
+
console.log(` \u2713 OS detected: ${os_name}`);
|
|
20
|
+
|
|
21
|
+
// Step 2 — Check Java
|
|
22
|
+
try {
|
|
23
|
+
const javaVersion = execSync('java -version 2>&1', { shell: true }).toString();
|
|
24
|
+
console.log(` \u2713 Java found`);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
console.error(' \u2717 Java 11+ is required. Download from: https://adoptium.net');
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Step 3 — Copy files to ~/.vaultfs
|
|
31
|
+
console.log(` \u2192 Setting up ${installDir}...`);
|
|
32
|
+
if (!fs.existsSync(installDir)) {
|
|
33
|
+
fs.mkdirSync(installDir, { recursive: true });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const pkgDir = path.join(__dirname, '..');
|
|
37
|
+
const itemsToCopy = ['src', 'frontend', 'version.txt', '.env.example'];
|
|
38
|
+
for (const item of itemsToCopy) {
|
|
39
|
+
const src = path.join(pkgDir, item);
|
|
40
|
+
const dest = path.join(installDir, item);
|
|
41
|
+
if (fs.existsSync(src)) {
|
|
42
|
+
if (fs.existsSync(dest)) {
|
|
43
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
44
|
+
}
|
|
45
|
+
fs.cpSync(src, dest, { recursive: true });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
console.log(' \u2713 Source files copied');
|
|
49
|
+
|
|
50
|
+
// Step 4 — Create .env if missing
|
|
51
|
+
const envFile = path.join(installDir, '.env');
|
|
52
|
+
const envExample = path.join(installDir, '.env.example');
|
|
53
|
+
if (!fs.existsSync(envFile) && fs.existsSync(envExample)) {
|
|
54
|
+
fs.copyFileSync(envExample, envFile);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Step 5 — Clean and install frontend dependencies
|
|
58
|
+
console.log(' \u2192 Installing frontend dependencies...');
|
|
59
|
+
const frontendModules = path.join(frontendDir, 'node_modules');
|
|
60
|
+
if (fs.existsSync(frontendModules)) {
|
|
61
|
+
fs.rmSync(frontendModules, { recursive: true, force: true });
|
|
62
|
+
console.log(' \u2713 Cleaned old modules');
|
|
63
|
+
}
|
|
64
|
+
execSync(`${npmCmd} install`, {
|
|
65
|
+
cwd: frontendDir,
|
|
66
|
+
stdio: 'inherit',
|
|
67
|
+
shell: true
|
|
68
|
+
});
|
|
69
|
+
console.log(' \u2713 Dependencies installed');
|
|
70
|
+
|
|
71
|
+
// Step 6 — Build frontend using local vite binary
|
|
72
|
+
console.log(' \u2192 Building React app...');
|
|
73
|
+
const viteBin = path.join(frontendDir, 'node_modules', '.bin', isWin ? 'vite.cmd' : 'vite');
|
|
74
|
+
if (!fs.existsSync(viteBin)) {
|
|
75
|
+
throw new Error(`Vite binary not found at: ${viteBin}`);
|
|
76
|
+
}
|
|
77
|
+
execSync(`"${viteBin}" build`, {
|
|
78
|
+
cwd: frontendDir,
|
|
79
|
+
stdio: 'inherit',
|
|
80
|
+
shell: true
|
|
81
|
+
});
|
|
82
|
+
console.log(' \u2713 React app built');
|
|
83
|
+
|
|
84
|
+
// Step 7 — Compile Java
|
|
85
|
+
console.log(' \u2192 Compiling Java sources...');
|
|
86
|
+
const outDir = path.join(installDir, 'out');
|
|
87
|
+
if (!fs.existsSync(outDir)) {
|
|
88
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
89
|
+
}
|
|
90
|
+
execSync(
|
|
91
|
+
'javac -d out src/models/*.java src/datastructures/*.java src/utils/*.java src/auth/*.java src/sync/*.java src/filesystem/*.java src/Main.java',
|
|
92
|
+
{ cwd: installDir, stdio: 'inherit', shell: true }
|
|
93
|
+
);
|
|
94
|
+
console.log(' \u2713 Java compiled');
|
|
95
|
+
|
|
96
|
+
console.log('\n \u2705 VaultFS is ready! Type vaultfs to launch.\n');
|
|
97
|
+
|
|
98
|
+
} catch (err) {
|
|
99
|
+
console.error(`\n \u2717 Post-install failed: ${err.message}`);
|
|
100
|
+
console.error(' Run vaultfs doctor to diagnose the issue.\n');
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vaultfs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "A CLI-based secure file system simulator with OAuth 2.0 authentication and advanced data structures",
|
|
5
5
|
"bin": {
|
|
6
6
|
"vaultfs": "bin/vaultfs-npm.js"
|
|
@@ -24,7 +24,15 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"bin/",
|
|
26
26
|
"src/",
|
|
27
|
-
"frontend/",
|
|
27
|
+
"frontend/src/",
|
|
28
|
+
"frontend/public/",
|
|
29
|
+
"frontend/package.json",
|
|
30
|
+
"frontend/index.html",
|
|
31
|
+
"frontend/vite.config.js",
|
|
32
|
+
"frontend/.env.example",
|
|
33
|
+
"frontend/eslint.config.js",
|
|
34
|
+
"frontend/README.md",
|
|
35
|
+
"frontend/success.html",
|
|
28
36
|
"version.txt",
|
|
29
37
|
".env.example",
|
|
30
38
|
"install.sh",
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.7
|