Skip to content

Commit 7714a2a

Browse files
committed
chore: test pre-commit
1 parent ac6c3ca commit 7714a2a

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

scripts/generate-bundle-script.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
// scripts/build-and-copy.js
2-
const { exec } = require('child_process');
3-
const fs = require('fs');
4-
const path = require('path');
51

6-
// Define paths relative to the root directory
7-
const rootDir = path.resolve(__dirname, '..');
8-
const srcFile = path.join(rootDir, 'dist/js/footer_scripts.min.js');
9-
const destFile = path.join(rootDir, 'src/bundle-script.min.js');
2+
const { exec } = require("child_process");
3+
const fs = require("fs");
4+
const path = require("path");
5+
6+
const rootDir = path.resolve(__dirname, "..");
7+
const srcFile = path.join(rootDir, "dist/js/footer_scripts.min.js");
8+
const destFile = path.join(rootDir, "src/bundle-script.min.js");
109

1110
// Step 1: Run the build command
12-
exec('npm run build', { cwd: rootDir }, (err, stdout, stderr) => {
11+
exec("npm run build", { cwd: rootDir }, (err, stdout, stderr) => {
1312
if (err) {
1413
console.error(`Error during build: ${stderr}`);
1514
process.exit(1);
@@ -22,17 +21,17 @@ exec('npm run build', { cwd: rootDir }, (err, stdout, stderr) => {
2221
console.error(`Error copying file: ${copyErr.message}`);
2322
process.exit(1);
2423
}
25-
console.log(`File copied to ${destFile}`);
2624

2725
// Step 3: Add the file to git
28-
exec(`git add ${destFile}`, { cwd: rootDir }, (gitErr, gitStdout, gitStderr) => {
29-
if (gitErr) {
30-
console.error(`Error adding file to git: ${gitStderr}`);
31-
process.exit(1);
26+
exec(
27+
`git add ${destFile}`,
28+
{ cwd: rootDir },
29+
(gitErr, gitStdout, gitStderr) => {
30+
if (gitErr) {
31+
console.error(`Error adding file to git: ${gitStderr}`);
32+
process.exit(1);
33+
}
3234
}
33-
console.log(`File added to git: ${destFile}`);
34-
});
35+
);
3536
});
3637
});
37-
38-

0 commit comments

Comments
 (0)