@learnrudi/cli 1.8.3 → 1.8.5
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 +1 -1
- package/scripts/postinstall.js +27 -2
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -37,7 +37,7 @@ function ensureDirectories() {
|
|
|
37
37
|
RUDI_HOME,
|
|
38
38
|
path.join(RUDI_HOME, 'runtimes'),
|
|
39
39
|
path.join(RUDI_HOME, 'stacks'),
|
|
40
|
-
path.join(RUDI_HOME, '
|
|
40
|
+
path.join(RUDI_HOME, 'binaries'),
|
|
41
41
|
path.join(RUDI_HOME, 'shims'),
|
|
42
42
|
path.join(RUDI_HOME, 'cache'),
|
|
43
43
|
];
|
|
@@ -145,6 +145,27 @@ function initSecrets() {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// Initialize database
|
|
149
|
+
function initDatabase() {
|
|
150
|
+
const dbPath = path.join(RUDI_HOME, 'rudi.db');
|
|
151
|
+
|
|
152
|
+
if (fs.existsSync(dbPath)) {
|
|
153
|
+
console.log(` ✓ Database already exists`);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
// Use rudi CLI to init the database (it has the schema)
|
|
159
|
+
execSync('node -e "require(\'@learnrudi/db\').initSchema()"', {
|
|
160
|
+
stdio: 'pipe',
|
|
161
|
+
cwd: path.dirname(process.argv[1])
|
|
162
|
+
});
|
|
163
|
+
console.log(` ✓ Database initialized`);
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.log(` ⚠ Database init deferred (run 'rudi init' later)`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
148
169
|
// Download a binary from manifest
|
|
149
170
|
async function downloadBinary(binaryName, platformArch) {
|
|
150
171
|
const manifestUrl = `${REGISTRY_BASE}/catalog/binaries/${binaryName}.json`;
|
|
@@ -158,7 +179,7 @@ async function downloadBinary(binaryName, platformArch) {
|
|
|
158
179
|
return false;
|
|
159
180
|
}
|
|
160
181
|
|
|
161
|
-
const destDir = path.join(RUDI_HOME, '
|
|
182
|
+
const destDir = path.join(RUDI_HOME, 'binaries', binaryName);
|
|
162
183
|
const binaryPath = path.join(destDir, manifest.binary || binaryName);
|
|
163
184
|
|
|
164
185
|
// Skip if already installed
|
|
@@ -225,6 +246,10 @@ async function setup() {
|
|
|
225
246
|
// Initialize secrets
|
|
226
247
|
initSecrets();
|
|
227
248
|
|
|
249
|
+
// Initialize database
|
|
250
|
+
console.log('\nInitializing database...');
|
|
251
|
+
initDatabase();
|
|
252
|
+
|
|
228
253
|
console.log('\n✓ RUDI setup complete!\n');
|
|
229
254
|
console.log('Get started:');
|
|
230
255
|
console.log(' rudi search --all # See available stacks');
|