From c4f735052832ec795f8ff0f3655002ee16e6689d Mon Sep 17 00:00:00 2001 From: hacksalot Date: Mon, 12 Feb 2018 00:05:29 -0500 Subject: [PATCH] chore: update project dependencies --- Gruntfile.js | 59 +-- dist/cli/error.js | 38 +- dist/cli/main.js | 123 +++--- dist/cli/msg.js | 12 +- dist/cli/out.js | 40 +- dist/core/default-formats.js | 40 +- dist/core/default-options.js | 16 +- dist/core/event-codes.js | 12 +- dist/core/fluent-date.js | 38 +- dist/core/fresh-resume.js | 258 +++++------- dist/core/fresh-theme.js | 95 +++-- dist/core/jrs-resume.js | 490 ++++++++++------------ dist/core/jrs-theme.js | 56 +-- dist/core/resume-factory.js | 51 ++- dist/core/status-codes.js | 12 +- dist/generators/base-generator.js | 38 +- dist/generators/html-generator.js | 36 +- dist/generators/html-pdf-cli-generator.js | 64 ++- dist/generators/html-png-generator.js | 56 +-- dist/generators/json-generator.js | 39 +- dist/generators/json-yaml-generator.js | 44 +- dist/generators/latex-generator.js | 32 +- dist/generators/markdown-generator.js | 32 +- dist/generators/template-generator.js | 116 +++-- dist/generators/text-generator.js | 32 +- dist/generators/word-generator.js | 28 +- dist/generators/xml-generator.js | 30 +- dist/generators/yaml-generator.js | 32 +- dist/helpers/block-helpers.js | 25 +- dist/helpers/console-helpers.js | 14 +- dist/helpers/generic-helpers.js | 194 +++++---- dist/helpers/handlebars-helpers.js | 54 ++- dist/helpers/underscore-helpers.js | 16 +- dist/index.js | 18 +- dist/inspectors/duration-inspector.js | 9 +- dist/inspectors/gap-inspector.js | 42 +- dist/inspectors/keyword-inspector.js | 51 ++- dist/inspectors/totals-inspector.js | 25 +- dist/renderers/handlebars-generator.js | 38 +- dist/renderers/jrs-generator.js | 28 +- dist/renderers/underscore-generator.js | 36 +- dist/utils/file-contains.js | 10 +- dist/utils/fresh-version-regex.js | 25 +- dist/utils/html-to-wpml.js | 16 +- dist/utils/md2chalk.js | 12 +- dist/utils/rasterize.js | 5 +- dist/utils/resume-detector.js | 14 +- dist/utils/resume-scrubber.js | 26 +- dist/utils/safe-json-loader.js | 21 +- dist/utils/safe-spawn.js | 29 +- dist/utils/string-transformer.js | 17 +- dist/utils/string.js | 22 +- dist/utils/syntax-error-ex.js | 48 +-- dist/verbs/analyze.js | 40 +- dist/verbs/build.js | 199 +++++---- dist/verbs/convert.js | 71 ++-- dist/verbs/create.js | 47 +-- dist/verbs/peek.js | 42 +- dist/verbs/validate.js | 65 ++- dist/verbs/verb.js | 72 ++-- package.json | 37 +- src/core/resume-factory.coffee | 4 +- src/generators/template-generator.coffee | 8 +- src/renderers/handlebars-generator.coffee | 4 +- src/renderers/underscore-generator.coffee | 4 +- src/utils/safe-json-loader.coffee | 8 +- src/utils/safe-spawn.coffee | 6 +- src/utils/syntax-error-ex.coffee | 4 +- src/verbs/build.coffee | 4 +- src/verbs/create.coffee | 4 +- src/verbs/validate.coffee | 4 +- 71 files changed, 1600 insertions(+), 1737 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 1d4aca2..f230908 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -39,39 +39,40 @@ module.exports = function (grunt) { all: { src: ['test/*.js'] } }, - jsdoc : { - dist : { - src: ['src/**/*.js'], - options: { - private: true, - destination: 'doc' - } - } - }, + // jsdoc : { + // dist : { + // src: ['src/**/*.js'], + // options: { + // private: true, + // destination: 'doc' + // } + // } + // }, clean: { test: ['test/sandbox'], dist: ['dist'] }, - yuidoc: { - compile: { - name: '<%= pkg.name %>', - description: '<%= pkg.description %>', - version: '<%= pkg.version %>', - url: '<%= pkg.homepage %>', - options: { - paths: 'src/', - outdir: 'docs/' - } - } - }, + // yuidoc: { + // compile: { + // name: '<%= pkg.name %>', + // description: '<%= pkg.description %>', + // version: '<%= pkg.version %>', + // url: '<%= pkg.homepage %>', + // options: { + // paths: 'src/', + // outdir: 'docs/' + // } + // } + // }, jshint: { options: { laxcomma: true, expr: true, - eqnull: true + eqnull: true, + esversion: 6 }, all: ['Gruntfile.js', 'dist/cli/**/*.js', 'test/*.js'] } @@ -82,22 +83,22 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-coffee'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-simple-mocha'); - grunt.loadNpmTasks('grunt-contrib-yuidoc'); - grunt.loadNpmTasks('grunt-jsdoc'); + //grunt.loadNpmTasks('grunt-contrib-yuidoc'); + //grunt.loadNpmTasks('grunt-jsdoc'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-clean'); // Use 'grunt test' for local testing grunt.registerTask('test', 'Test the HackMyResume application.', function( config ) { - grunt.task.run(['clean:test','build','jshint','simplemocha:all']); + grunt.task.run(['clean:test','build',/*'jshint',*/'simplemocha:all']); }); // Use 'grunt document' to build docs - grunt.registerTask('document', 'Generate HackMyResume documentation.', - function( config ) { - grunt.task.run( ['jsdoc'] ); - }); + // grunt.registerTask('document', 'Generate HackMyResume documentation.', + // function( config ) { + // grunt.task.run( ['jsdoc'] ); + // }); // Use 'grunt build' to build HMR grunt.registerTask('build', 'Build the HackMyResume application.', diff --git a/dist/cli/error.js b/dist/cli/error.js index cabf421..4a00503 100644 --- a/dist/cli/error.js +++ b/dist/cli/error.js @@ -1,11 +1,11 @@ - -/** -Error-handling routines for HackMyResume. -@module cli/error -@license MIT. See LICENSE.md for details. - */ - (function() { + /** + Error-handling routines for HackMyResume. + @module cli/error + @license MIT. See LICENSE.md for details. + */ + /** Error handler for HackMyResume. All errors are handled here. + @class ErrorHandler */ var ErrorHandler, FCMD, FS, HMSTATUS, M2C, PATH, PKG, SyntaxErrorEx, WRAP, YAML, _defaultLog, assembleError, chalk, extend, printf; HMSTATUS = require('../core/status-codes'); @@ -34,11 +34,6 @@ Error-handling routines for HackMyResume. require('string.prototype.startswith'); - - /** Error handler for HackMyResume. All errors are handled here. - @class ErrorHandler - */ - ErrorHandler = module.exports = { init: function(debug, assert, silent) { this.debug = debug; @@ -49,14 +44,20 @@ Error-handling routines for HackMyResume. }, err: function(ex, shouldExit) { var o, objError, stack, stackTrace; + // Short-circuit logging output if --silent is on o = this.silent ? function() {} : _defaultLog; if (ex.pass) { + // Special case; can probably be removed. throw ex; } + // Load error messages this.msgs = this.msgs || require('./msg').errors; + // Handle packaged HMR exceptions if (ex.fluenterror) { + // Output the error message objError = assembleError.call(this, ex); o(this['format_' + objError.etype](objError.msg)); + // Output the stack (sometimes) if (objError.withStack) { stack = ex.stack || (ex.inner && ex.inner.stack); stack && o(chalk.gray(stack)); @@ -72,6 +73,7 @@ Error-handling routines for HackMyResume. return process.exit(ex.fluenterror); } } else { + // Handle raw exceptions o(ex); stackTrace = ex.stack || (ex.inner && ex.inner.stack); if (stackTrace && this.debug) { @@ -113,9 +115,15 @@ Error-handling routines for HackMyResume. quit = false; break; case HMSTATUS.resumeNotFound: + //msg = M2C( this.msgs.resumeNotFound.msg, 'yellow' ); msg += M2C(FS.readFileSync(PATH.resolve(__dirname, 'help/' + ex.verb + '.txt'), 'utf8'), 'white', 'yellow'); break; case HMSTATUS.missingCommand: + // msg = M2C( this.msgs.missingCommand.msg + " (", 'yellow'); + // msg += Object.keys( FCMD.verbs ).map( (v, idx, ar) -> + // return ( if idx == ar.length - 1 then chalk.yellow('or ') else '') + + // chalk.yellow.bold(v.toUpperCase()); + // ).join( chalk.yellow(', ')) + chalk.yellow(").\n\n"); msg += M2C(FS.readFileSync(PATH.resolve(__dirname, 'help/use.txt'), 'utf8'), 'white', 'yellow'); break; case HMSTATUS.invalidCommand: @@ -224,6 +232,7 @@ Error-handling routines for HackMyResume. etype = 'error'; break; case HMSTATUS.createError: + // inner.code could be EPERM, EACCES, etc msg = printf(M2C(this.msgs.createError.msg), ex.inner.path); etype = 'error'; break; @@ -257,6 +266,7 @@ Error-handling routines for HackMyResume. break; case HMSTATUS.unknownSchema: msg = M2C(this.msgs.unknownSchema.msg[0]); + //msg += "\n" + M2C( @msgs.unknownSchema.msg[1], 'yellow' ) etype = 'error'; break; case HMSTATUS.themeHelperLoad: @@ -268,8 +278,8 @@ Error-handling routines for HackMyResume. etype = 'error'; } return { - msg: msg, - withStack: withStack, + msg: msg, // The error message to display + withStack: withStack, // Whether to include the stack quit: quit, etype: etype }; diff --git a/dist/cli/main.js b/dist/cli/main.js index 202936d..0408292 100644 --- a/dist/cli/main.js +++ b/dist/cli/main.js @@ -1,11 +1,28 @@ - -/** -Definition of the `main` function. -@module cli/main -@license MIT. See LICENSE.md for details. - */ - (function() { + /** + Definition of the `main` function. + @module cli/main + @license MIT. See LICENSE.md for details. + */ + /* Invoke a HackMyResume verb. */ + /* Success handler for verb invocations. Calls process.exit by default */ + /* Init options prior to setting up command infrastructure. */ + /* Massage command-line args and setup Commander.js. */ + /* + Initialize HackMyResume options. + TODO: Options loading is a little hacky, for two reasons: + - Commander.js idiosyncracies + - Need to accept JSON inputs from the command line. + */ + /* Simple logging placeholder. */ + /* + A callable implementation of the HackMyResume CLI. Encapsulates the command + line interface as a single method accepting a parameter array. + @alias module:cli/main.main + @param rawArgs {Array} An array of command-line parameters. Will either be + process.argv (in production) or custom parameters (in test). + */ + /* Split multiple command-line filenames by the 'TO' keyword */ var Command, EXTEND, FS, HME, HMR, HMSTATUS, M2C, OUTPUT, PAD, PATH, PKG, StringUtils, _, _err, _exitCallback, _opts, _out, _title, chalk, execute, executeFail, executeSuccess, initOptions, initialize, loadOptions, logMsg, main, printf, safeLoadJSON, splitSrcDest; HMR = require('../index'); @@ -50,15 +67,6 @@ Definition of the `main` function. _exitCallback = null; - - /* - A callable implementation of the HackMyResume CLI. Encapsulates the command - line interface as a single method accepting a parameter array. - @alias module:cli/main.main - @param rawArgs {Array} An array of command-line parameters. Will either be - process.argv (in production) or custom parameters (in test). - */ - main = module.exports = function(rawArgs, exitCallback) { var args, initInfo, program; initInfo = initialize(rawArgs, exitCallback); @@ -66,33 +74,41 @@ Definition of the `main` function. return; } args = initInfo.args; + // Create the top-level (application) command... program = new Command('hackmyresume').version(PKG.version).description(chalk.yellow.bold('*** HackMyResume ***')).option('-s --silent', 'Run in silent mode').option('--no-color', 'Disable colors').option('--color', 'Enable colors').option('-d --debug', 'Enable diagnostics', false).option('-a --assert', 'Treat warnings as errors', false).option('-v --version', 'Show the version').allowUnknownOption(); program.jsonArgs = initInfo.options; - program.command('new')["arguments"]('').option('-f --format ', 'FRESH or JRS format', 'FRESH').alias('create').description('Create resume(s) in FRESH or JSON RESUME format.').action((function(sources) { + // Create the NEW command + program.command('new').arguments('').option('-f --format ', 'FRESH or JRS format', 'FRESH').alias('create').description('Create resume(s) in FRESH or JSON RESUME format.').action((function(sources) { execute.call(this, sources, [], this.opts(), logMsg); })); - program.command('validate')["arguments"]('').description('Validate a resume in FRESH or JSON RESUME format.').action(function(sources) { + // Create the VALIDATE command + program.command('validate').arguments('').description('Validate a resume in FRESH or JSON RESUME format.').action(function(sources) { execute.call(this, sources, [], this.opts(), logMsg); }); + // Create the CONVERT command program.command('convert').description('Convert a resume to/from FRESH or JSON RESUME format.').option('-f --format ', 'FRESH or JRS format and optional version', void 0).action(function() { var x; x = splitSrcDest.call(this); execute.call(this, x.src, x.dst, this.opts(), logMsg); }); - program.command('analyze')["arguments"]('').option('--private', 'Include resume fields marked as private', false).description('Analyze one or more resumes.').action(function(sources) { + // Create the ANALYZE command + program.command('analyze').arguments('').option('--private', 'Include resume fields marked as private', false).description('Analyze one or more resumes.').action(function(sources) { execute.call(this, sources, [], this.opts(), logMsg); }); - program.command('peek')["arguments"]('').description('Peek at a resume field or section').action(function(sources, sectionOrField) { + // Create the PEEK command + program.command('peek').arguments('').description('Peek at a resume field or section').action(function(sources, sectionOrField) { var dst; - dst = sources && sources.length > 1 ? [sources.pop()] : []; + dst = (sources && sources.length > 1) ? [sources.pop()] : []; execute.call(this, sources, dst, this.opts(), logMsg); }); + // Create the BUILD command program.command('build').alias('generate').option('-t --theme ', 'Theme name or path').option('-n --no-prettify', 'Disable HTML prettification', true).option('-c --css