@learnrudi/cli 1.8.3 → 1.8.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/package.json +1 -1
- package/scripts/postinstall.js +25 -0
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -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`;
|
|
@@ -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');
|