Skip to content

Commit

Permalink
chore: update comments in fixup.cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nesopie committed Aug 9, 2024
1 parent 36ec4b4 commit 1c9bbfb
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions fixup.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@ const path = require('path');

// Function to update require statements in a file
const updateRequires = (filePath) => {
// Read the content of the file
let content = fs.readFileSync(filePath, 'utf8');

// Define the regex pattern to match local require statements
// const regex = /require\((['"])(\.\/[^'"]*)\1\)/g;

// Replace the matched patterns with the updated path
//replace local imports eg. require('./ecpair') to require('ecpair.cjs')
content = content.replace(/require\('\.\/([^']*)'\)/g, "require('./$1.cjs')");

// Write the updated content back to the file
fs.writeFileSync(filePath, content, 'utf8');
};

// Function to process all .cjs files in the src/cjs directory
const processFiles = (dir) => {
fs.readdirSync(dir).forEach((file) => {
const filePath = path.join(dir, file);
Expand All @@ -28,6 +21,5 @@ const processFiles = (dir) => {
});
};

// Directory to process
const dir = path.join(__dirname, 'src', 'cjs');
processFiles(dir);

0 comments on commit 1c9bbfb

Please sign in to comment.