Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Updates Security Vulnerabilities #392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"rules": {
"curly": [
2,
"all"
],
"keyword-spacing": [
2,
{}
],
"wrap-iife": 2,
"space-before-function-paren": [
2,
"never"
],
"one-var": [
2,
"never"
],
"array-bracket-spacing": [
2,
"never",
{
"singleValue": true
}
],
"space-in-parens": [
2,
"never"
],
"key-spacing": [
2,
{
"beforeColon": false,
"afterColon": true
}
],
"comma-style": [
2,
"last"
],
"operator-linebreak": [
2,
"after"
],
"space-unary-ops": [
2,
{
"words": false,
"nonwords": false
}
],
"space-infix-ops": 2,
"camelcase": [
2,
{
"properties": "never"
}
],
"no-with": 2,
"no-multi-str": 2,
"linebreak-style": [
2,
"unix"
],
"indent": [
2,
"tab",
{
"SwitchCase": 1
}
],
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 2,
"brace-style": [
2,
"stroustrup",
{
"allowSingleLine": true
}
],
"eol-last": 2,
"max-len": [
2,
140
],
"consistent-this": [
2,
"that"
],
"dot-notation": 2
}
}
38 changes: 0 additions & 38 deletions .jscs.json

This file was deleted.

8 changes: 4 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,16 @@ module.exports = function(grunt) {
watch: {
scripts: {
files: '<%= jshint.all %>',
tasks: ['jshint', 'jscs'],
tasks: ['jshint', 'eslint'],
options: {
debounceDelay: 100,
nospawn: true
}
},
},
jscs: {
eslint: {
options: {
config: ".jscs.json",
configFile: ".eslint.json",
},
all: ['tasks/*.js']
},
Expand All @@ -390,6 +390,6 @@ module.exports = function(grunt) {
grunt.loadTasks('tasks');

grunt.registerTask('test', ['nodeunit']);
grunt.registerTask('default', ['jshint', 'jscs', 'clean', 'webfont', 'test', 'clean']);
grunt.registerTask('default', ['jshint', 'eslint', 'clean', 'webfont', 'test', 'clean']);

};
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,32 @@
"dependencies": {
"async": "~1.5.2",
"chalk": "~1.1.1",
"fontforge": "0.0.4",
"glob": "~7.0.0",
"lodash": "~4.17.10",
"lodash": "~4.17.11",
"memorystream": "~0.3.1",
"mkdirp": "~0.5.1",
"svg2ttf": "~2.1.1",
"svg2ttf": "~4.3.0",
"svgicons2svgfont": "~1.1.0",
"svgo": "~0.6.1",
"svgo": "~1.2.2",
"temp": "~0.8.3",
"ttf2eot": "~1.3.0",
"ttf2woff": "~1.3.0",
"ttf2eot": "~2.0.0",
"ttf2woff": "~2.0.1",
"ttf2woff2": "~2.0.3",
"underscore.string": "~3.2.3",
"underscore.string": "~3.3.5",
"winston": "~2.1.1"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt": "~1.0.4",
"grunt-cli": "~1.3.2",
"grunt-contrib-clean": "~1.0.0",
"grunt-contrib-jshint": "~0.11.3",
"grunt-contrib-nodeunit": "~0.4.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-jscs": "~1.0.0",
"grunt-contrib-jshint": "~2.0.0",
"grunt-contrib-nodeunit": "~2.0.0",
"grunt-contrib-watch": "~1.1.0",
"grunt-eslint": "~21.1.0",
"load-grunt-tasks": "~3.4.0",
"stylus": "~0.53.0",
"xml2js": "~0.4.16"
"stylus": "~0.54.5",
"xml2js": "~0.4.19"
},
"peerDependencies": {
"grunt": ">=0.4.0"
Expand Down
45 changes: 23 additions & 22 deletions tasks/webfont.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ module.exports = function(grunt) {
* Check for `dest` param on either target config or global options object
*/
if (_.isUndefined(params.dest) && _.isUndefined(options.dest)) {
logger.warn('Required property ' + [this.name, this.target, 'dest'].join('.')
+ ' or ' + [this.name, this.target, 'options.dest'].join('.') + ' missing.');
logger.warn('Required property ' + [this.name, this.target, 'dest'].join('.') +
' or ' + [this.name, this.target, 'options.dest'].join('.') + ' missing.');
}

if (options.skip) {
Expand Down Expand Up @@ -93,14 +93,14 @@ module.exports = function(grunt) {
template: options.template,
syntax: options.syntax || 'bem',
templateOptions: options.templateOptions || {},
stylesheets: options.stylesheets || [options.stylesheet || path.extname(options.template).replace(/^\./, '') || 'css'],
stylesheets: options.stylesheets || [ options.stylesheet || path.extname(options.template).replace(/^\./, '') || 'css' ],
htmlDemo: options.htmlDemo !== false,
htmlDemoTemplate: options.htmlDemoTemplate,
htmlDemoFilename: options.htmlDemoFilename,
styles: optionToArray(options.styles, 'font,icon'),
types: optionToArray(options.types, 'eot,woff,ttf'),
order: optionToArray(options.order, wf.fontFormats),
embed: options.embed === true ? ['woff'] : optionToArray(options.embed, false),
embed: options.embed === true ? [ 'woff' ] : optionToArray(options.embed, false),
rename: options.rename || path.basename,
engine: options.engine || 'fontforge',
autoHint: options.autoHint !== false,
Expand Down Expand Up @@ -150,14 +150,14 @@ module.exports = function(grunt) {
// Check or generate codepoints
// @todo Codepoint can be a Unicode code or character.
var currentCodepoint = o.startCodepoint;
if (!o.codepoints) o.codepoints = {};
if (o.codepointsFile) o.codepoints = readCodepointsFromFile();
if (!o.codepoints) {o.codepoints = {};}
if (o.codepointsFile) {o.codepoints = readCodepointsFromFile();}
o.glyphs.forEach(function(name) {
if (!o.codepoints[name]) {
o.codepoints[name] = getNextCodepoint();
}
});
if (o.codepointsFile) saveCodepointsToFile();
if (o.codepointsFile) {saveCodepointsToFile();}

// Check if we need to generate font
var previousHash = readHash(this.name, this.target);
Expand All @@ -177,7 +177,7 @@ module.exports = function(grunt) {
});

regenerationNeeded = _.some(generatedFiles, function(filename) {
if (!filename) return false;
if (!filename) {return false;}
if (!fs.existsSync(filename)) {
logger.verbose('File', filename, ' is missed.');
return true;
Expand Down Expand Up @@ -355,7 +355,7 @@ module.exports = function(grunt) {
// Generate font URLs to use in @font-face
var fontSrcs = [[], []];
o.order.forEach(function(type) {
if (!has(o.types, type)) return;
if (!has(o.types, type)) {return;}
wf.fontsSrcsMap[type].forEach(function(font, idx) {
if (font) {
fontSrcs[idx].push(generateFontSrc(type, font, stylesheet));
Expand All @@ -367,16 +367,16 @@ module.exports = function(grunt) {
var fontSrcSeparator = option(wf.fontSrcSeparators, stylesheet);
fontSrcs.forEach(function(font, idx) {
// o.fontSrc1, o.fontSrc2
o['fontSrc'+(idx+1)] = font.join(fontSrcSeparator);
o['fontSrc' + (idx + 1)] = font.join(fontSrcSeparator);
});
o.fontRawSrcs = fontSrcs;

// Read JSON file corresponding to CSS template
var templateJson = readTemplate(o.template, o.syntax, '.json', true);
if (templateJson) o = _.extend(o, JSON.parse(templateJson.template));
if (templateJson) {o = _.extend(o, JSON.parse(templateJson.template));}

// Now override values with templateOptions
if (o.templateOptions) o = _.extend(o, o.templateOptions);
if (o.templateOptions) {o = _.extend(o, o.templateOptions);}

// Generate CSS
var ext = path.extname(o.template) || '.css'; // Use extension of o.template file if given, or default to .css
Expand All @@ -401,7 +401,7 @@ module.exports = function(grunt) {
* Gets the codepoints from the set filepath in o.codepointsFile
*/
function readCodepointsFromFile(){
if (!o.codepointsFile) return {};
if (!o.codepointsFile) {return {};}
if (!fs.existsSync(o.codepointsFile)){
logger.verbose('Codepoints file not found');
return {};
Expand All @@ -415,12 +415,13 @@ module.exports = function(grunt) {
* Saves the codespoints to the set file
*/
function saveCodepointsToFile(){
if (!o.codepointsFile) return;
if (!o.codepointsFile) {return;}
var codepointsToString = JSON.stringify(o.codepoints, null, 4);
try {
fs.writeFileSync(o.codepointsFile, codepointsToString);
logger.verbose('Codepoints saved to file "' + o.codepointsFile + '".');
} catch (err) {
}
catch (err) {
logger.error(err.message);
}
}
Expand Down Expand Up @@ -665,7 +666,7 @@ module.exports = function(grunt) {
* @return {String}
*/
function normalizePath(filepath) {
if (!filepath.length) return filepath;
if (!filepath.length) {return filepath;}

// Make all slashes forward
filepath = filepath.replace(/\\/g, '/');
Expand Down Expand Up @@ -730,7 +731,7 @@ module.exports = function(grunt) {
}
}

if (font.format) src += ' format("' + font.format + '")';
if (font.format) {src += ' format("' + font.format + '")';}

return src;
}
Expand All @@ -744,9 +745,9 @@ module.exports = function(grunt) {
* @return {Object} {filename: 'Template filename', template: 'Template code'}
*/
function readTemplate(template, syntax, ext, optional) {
var filename = template
? path.resolve(template.replace(path.extname(template), ext))
: path.join(__dirname, 'templates/' + syntax + ext)
var filename = template ?
path.resolve(template.replace(path.extname(template), ext)) :
path.join(__dirname, 'templates/' + syntax + ext)
;
if (fs.existsSync(filename)) {
return {
Expand Down Expand Up @@ -816,7 +817,7 @@ module.exports = function(grunt) {
* @return {String}
*/
function getDemoFilePath() {
if (!o.htmlDemo) return null;
if (!o.htmlDemo) {return null;}
var name = o.htmlDemoFilename || o.fontBaseName;
return path.join(o.destHtml, name + '.html');
}
Expand All @@ -825,7 +826,7 @@ module.exports = function(grunt) {
* Return path of HTML demo file or `null` if feature was disabled
*/
function getDemoPath() {
if (!o.htmlDemo) return null;
if (!o.htmlDemo) {return null;}
return o.destHtml;
}

Expand Down
Loading