Skip to content

Commit

Permalink
updating dependencies (and fixing build script to match)
Browse files Browse the repository at this point in the history
  • Loading branch information
getify committed Apr 26, 2021
1 parent f16f35e commit f9036ca
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 61 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
sudo: false
language: node_js
node_js:
- 13
- 12
- 14
- 16

git:
depth: 5
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getify/eslint-plugin-proper-arrows",
"version": "11.0.2",
"version": "11.0.3",
"description": "ESLint rules to ensure proper arrow function definitions",
"main": "./lib/index.js",
"scripts": {
Expand All @@ -18,12 +18,12 @@
},
"devDependencies": {
"coveralls": "~3.1.0",
"eslint": "~7.4.0",
"qunit": "~2.10.1",
"terser": "~4.6.12"
"eslint": "~7.25.0",
"qunit": "~2.15.0",
"terser": "~5.7.0"
},
"peerDependencies": {
"eslint": ">= 7.25"
"eslint": ">= 7.25.0"
},
"repository": "getify/eslint-plugin-proper-arrows",
"keywords": [
Expand Down
112 changes: 57 additions & 55 deletions scripts/build-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

var fs = require("fs"),
path = require("path"),
ugly = require("terser"),
terser = require("terser"),
year = (new Date()).getFullYear(),

ROOT_DIR = path.join(__dirname,".."),
Expand All @@ -24,69 +24,71 @@ var fs = require("fs"),

console.log("*** Building ESLint Plugin 'proper-arrows' ***");

// read version number from package.json
var packageJSON = JSON.parse(
fs.readFileSync(
path.join(ROOT_DIR,"package.json"),
(async function main(){
// try to make the dist directory, if needed
try {
fs.mkdirSync(DIST_DIR,0o755);
}
catch (err) { }

// read version number from package.json
var packageJSON = JSON.parse(
fs.readFileSync(
path.join(ROOT_DIR,"package.json"),
{ encoding: "utf8", }
)
);
var version = packageJSON.version;

// read copyright-header text, render with version and year
var copyrightHeader = fs.readFileSync(
path.join(SRC_DIR,"copyright-header.txt"),
{ encoding: "utf8", }
)
);
var version = packageJSON.version;
).replace(/`/g,"");
copyrightHeader = Function("version","year",`return \`${copyrightHeader}\`;`)( version, year );

// read copyright-header text, render with version and year
var copyrightHeader = fs.readFileSync(
path.join(SRC_DIR,"copyright-header.txt"),
{ encoding: "utf8", }
).replace(/`/g,"");
copyrightHeader = Function("version","year",`return \`${copyrightHeader}\`;`)( version, year );

// ***************************

// ***************************
for (let [idx,SRC,] of LIB_SRC.entries()) {
let DIST = LIB_DIST[idx];

// try to make the dist directory, if needed
try {
fs.mkdirSync(DIST_DIR,0o755);
}
catch (err) { }
console.log(`Building: ${DIST}`);

for (let [idx,SRC,] of LIB_SRC.entries()) {
let DIST = LIB_DIST[idx];
try {
let result = "";

console.log(`Building: ${DIST}`);
result += fs.readFileSync(SRC,{ encoding: "utf8", });

try {
let result = "";

result += fs.readFileSync(SRC,{ encoding: "utf8", });

result = ugly.minify(result,{
mangle: {
keep_fnames: true,
},
compress: {
keep_fnames: true,
},
output: {
comments: /^!/,
},
});

// was compression successful?
if (!(result && result.code)) {
if (result.error) throw result.error;
else throw result;
}
result = await terser.minify(result,{
mangle: {
keep_fnames: true,
},
compress: {
keep_fnames: true,
},
output: {
comments: /^!/,
},
});

// append copyright-header text
result = `${copyrightHeader}${result.code}`;
// was compression successful?
if (!(result && result.code)) {
if (result.error) throw result.error;
else throw result;
}

// write dist
fs.writeFileSync( DIST, result, { encoding: "utf8", } );
}
catch (err) {
console.error(err);
process.exit(1);
// append copyright-header text
result = `${copyrightHeader}${result.code}`;

// write dist
fs.writeFileSync( DIST, result, { encoding: "utf8", } );
}
catch (err) {
console.error(err);
process.exit(1);
}
}
}

console.log("Complete.");
console.log("Complete.");
})();

0 comments on commit f9036ca

Please sign in to comment.