Skip to content

Commit

Permalink
fix ES modules
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gervang <[email protected]>
  • Loading branch information
chrisgervang committed Dec 8, 2023
1 parent 41e908d commit 1187303
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"gl": "^6.0.2",
"global": "^4.4.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jsdom": "^16.4.0",
Expand Down
11 changes: 5 additions & 6 deletions scripts/license-header/bin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
import readdirp from 'readdirp';
import minimist from 'minimist';
import {readFileSync} from 'fs';
import process from 'global/process';
import console from 'global/console';
import {logError} from '../log';
import process from 'global/process.js';
import console from 'global/console.js';

import LicenseFixer from './license-fixer';
import LicenseFixer from './license-fixer.mjs';

import VALID_LICENSES from './valid-licenses';
import VALID_LICENSES from './valid-licenses.mjs';

var argv = minimist(process.argv.slice(2));
var cwd = process.cwd();
Expand Down Expand Up @@ -112,7 +111,7 @@ function readTree(options, callback) {

function processFiles(err, files) {
if (err) {
logError(err.message);
console.error(err.message);
process.exit(1);
return;
}
Expand Down
16 changes: 8 additions & 8 deletions scripts/license-header/license-fixer.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Forked from uber-licence, MIT

import {readFileSync, writeFileSync} from 'fs';
import {logError, logProgress} from '../log';

module.exports = LicenseFixer;
import console from 'global/console.js';

function LicenseFixer(options) {
options = options || {};
Expand Down Expand Up @@ -113,7 +111,7 @@ LicenseFixer.prototype.fixContent = function fixContent(file, content) {
var license = this.getLicenseForFile(file);
if (license === null) {
if (!this.silent) {
logError(`unrecognized file type ${file}`);
console.error(`unrecognized file type ${file}`);
}
return null;
}
Expand All @@ -130,7 +128,7 @@ LicenseFixer.prototype.fixFile = function fixFile(file) {
if (original.length === 0) {
// Ignore empty files
if (this.verbose) {
logProgress(`empty ${file}`);
console.log(`empty ${file}`);
}
return false;
}
Expand All @@ -145,13 +143,13 @@ LicenseFixer.prototype.fixFile = function fixFile(file) {
if (original === content) {
// No change
if (this.verbose) {
logProgress(`skip ${file}`);
console.log(`skip ${file}`);
}
return false;
}

if (!this.silent) {
logProgress(`fix ${file}`);
console.log(`fix ${file}`);
}

if (this.dry) {
Expand All @@ -160,4 +158,6 @@ LicenseFixer.prototype.fixFile = function fixFile(file) {

writeFileSync(file, content, 'utf8');
return true;
};
};

export default LicenseFixer

0 comments on commit 1187303

Please sign in to comment.