Skip to content

Commit

Permalink
Adding suggestions from coderabbit
Browse files Browse the repository at this point in the history
  • Loading branch information
Suyash878 committed Nov 19, 2024
1 parent 124127b commit 0146c7f
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import dotenv from "dotenv";
import fs from "fs";
import inquirer from "inquirer";
import path from "path";
import * as os from "os";
import type { ExecException } from "child_process";
import { exec } from "child_process";
import { MongoClient } from "mongodb";
Expand Down Expand Up @@ -1192,36 +1193,28 @@ npm run import:sample-data
`;

const scriptPath = path.join(os.tmpdir(), `entrypoint-${Date.now()}.sh`);
```

import * as cryptolib from "crypto";
import dotenv from "dotenv";
import fs from "fs";
import inquirer from "inquirer";
import path from "path";
import * as os from 'os';
import type { ExecException } from "child_process";
try {
// Create script with proper permissions
fs.writeFileSync(scriptPath, entryPointScript, { mode: 0o755 });

// Execute script
exec(scriptPath, { timeout: 60000 }, (error, stdout, stderr) => {
// Clean up script file
fs.unlinkSync(scriptPath);

if (error) {
console.error("Error importing sample data:");
console.error(`Exit code: ${error.code}`);
console.error(`Error message: ${error.message}`);
return;
}

if (stderr) {
console.warn("Sample data import warnings:");
console.warn(stderr.trim());
}

if (stdout) {
console.log("Sample data import output:");
console.log(stdout.trim());
Expand Down

0 comments on commit 0146c7f

Please sign in to comment.