Skip to content

Commit

Permalink
Refactor pull-images script to use TypeScript file instead of JavaScript
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelo-schreiber committed May 1, 2024
1 parent f756ae3 commit 4733632
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"test": "vitest",
"dev": "node --watch -r ts-node/register src/index.ts",
"start": "tsc && node dist/src/index.js",
"pull-images": "bun pull-images.ts"
"pull-images": "ts-node pull-images.ts"
},
"dependencies": {
"dockerode": "^4.0.2",
Expand All @@ -24,7 +24,6 @@
"@types/node": "^20.12.8",
"ts-node": "^10.9.2",
"vitest": "^1.5.3",
"typescript": "^5.4.5",
"bun": "latest"
"typescript": "^5.4.5"
}
}
8 changes: 4 additions & 4 deletions pull-images.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { $ } from "bun";

import { execSync } from "node:child_process";
import { codeConfig } from "./src/utils/createContainerConfig";

async function pullImages() {
Expand All @@ -8,12 +7,13 @@ async function pullImages() {
for (key in codeConfig) {
const image = codeConfig[key].image;
try {
await $`docker pull ${codeConfig[key].image}`;
execSync(`docker pull ${image}`);
console.log(`Pulled image: ${image}`);
} catch (error) {
console.error(`Error pulling image: ${image}`, error);
}
}
}

pullImages();
// Path: pull-images.ts
// Path: pull-images.js

0 comments on commit 4733632

Please sign in to comment.