Skip to content

Commit

Permalink
Chore: Update version replace script to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed Jan 9, 2025
1 parent 7698504 commit 87b766d
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* eslint-disable no-console */
const replace = require('replace-in-file');
const packageJson = require('../package.json');
import { replaceInFile } from 'replace-in-file';
import packageJson from '../package.json' with { type: 'json' };

const newVersion = packageJson.version.match(/([0-9])\.[0-9]\.[0-9]/)[1];
const newVersion = packageJson.version.match(/([0-9])\.[0-9]\.[0-9]/)?.[1];

const options = {
files: 'README.md',
from: /cookie-consent-manager@([0-9])/gm,
to: `cookie-consent-manager@${newVersion}`,
};

replace(options)
.then((results: unknown) => {
replaceInFile(options)
.then((results) => {
console.log('Replacement results:', results);
})
.catch((error: unknown) => {
.catch((error) => {
console.error('Error occurred:', error);
});

Expand Down

0 comments on commit 87b766d

Please sign in to comment.