mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-07-03 08:51:05 +01:00
chore: decaffeinate: convert error.coffee and 58 other files to JS
This commit is contained in:
@ -1,51 +1,56 @@
|
||||
###*
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
/**
|
||||
Definition of the JRSTheme class.
|
||||
@module core/jrs-theme
|
||||
@license MIT. See LICENSE.MD for details.
|
||||
###
|
||||
*/
|
||||
|
||||
|
||||
|
||||
_ = require 'underscore'
|
||||
PATH = require 'path'
|
||||
parsePath = require 'parse-filepath'
|
||||
pathExists = require('path-exists').sync
|
||||
errors = require './status-codes'
|
||||
const _ = require('underscore');
|
||||
const PATH = require('path');
|
||||
const parsePath = require('parse-filepath');
|
||||
const pathExists = require('path-exists').sync;
|
||||
const errors = require('./status-codes');
|
||||
|
||||
|
||||
|
||||
###*
|
||||
/**
|
||||
The JRSTheme class is a representation of a JSON Resume theme asset.
|
||||
@class JRSTheme
|
||||
###
|
||||
class JRSTheme
|
||||
*/
|
||||
class JRSTheme {
|
||||
|
||||
|
||||
|
||||
###*
|
||||
/**
|
||||
Open and parse the specified JRS theme.
|
||||
@method open
|
||||
###
|
||||
open: ( thFolder ) ->
|
||||
*/
|
||||
open( thFolder ) {
|
||||
|
||||
@folder = thFolder
|
||||
pathInfo = parsePath thFolder
|
||||
this.folder = thFolder;
|
||||
const pathInfo = parsePath(thFolder);
|
||||
|
||||
# Open and parse the theme's package.json file
|
||||
pkgJsonPath = PATH.join thFolder, 'package.json'
|
||||
if pathExists pkgJsonPath
|
||||
thApi = require thFolder # Requiring the folder yields whatever the package.json's "main" is set to
|
||||
thPkg = require pkgJsonPath # Get the package.json as JSON
|
||||
this.name = thPkg.name
|
||||
this.render = (thApi && thApi.render) || undefined
|
||||
this.engine = 'jrs'
|
||||
// Open and parse the theme's package.json file
|
||||
const pkgJsonPath = PATH.join(thFolder, 'package.json');
|
||||
if (pathExists(pkgJsonPath)) {
|
||||
const thApi = require(thFolder); // Requiring the folder yields whatever the package.json's "main" is set to
|
||||
const thPkg = require(pkgJsonPath); // Get the package.json as JSON
|
||||
this.name = thPkg.name;
|
||||
this.render = (thApi && thApi.render) || undefined;
|
||||
this.engine = 'jrs';
|
||||
|
||||
# Create theme formats (HTML and PDF). Just add the bare minimum mix of
|
||||
# properties necessary to allow JSON Resume themes to share a rendering
|
||||
# path with FRESH themes.
|
||||
this.formats =
|
||||
html:
|
||||
outFormat: 'html'
|
||||
// Create theme formats (HTML and PDF). Just add the bare minimum mix of
|
||||
// properties necessary to allow JSON Resume themes to share a rendering
|
||||
// path with FRESH themes.
|
||||
this.formats = {
|
||||
html: {
|
||||
outFormat: 'html',
|
||||
files: [{
|
||||
action: 'transform',
|
||||
render: this.render,
|
||||
@ -53,8 +58,9 @@ class JRSTheme
|
||||
ext: 'html',
|
||||
css: null
|
||||
}]
|
||||
pdf:
|
||||
outFormat: 'pdf'
|
||||
},
|
||||
pdf: {
|
||||
outFormat: 'pdf',
|
||||
files: [{
|
||||
action: 'transform',
|
||||
render: this.render,
|
||||
@ -62,25 +68,30 @@ class JRSTheme
|
||||
ext: 'pdf',
|
||||
css: null
|
||||
}]
|
||||
else
|
||||
throw fluenterror: errors.missingPackageJSON
|
||||
@
|
||||
}
|
||||
};
|
||||
} else {
|
||||
throw {fluenterror: errors.missingPackageJSON};
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
###*
|
||||
/**
|
||||
Determine if the theme supports the output format.
|
||||
@method hasFormat
|
||||
###
|
||||
hasFormat: ( fmt ) -> _.has this.formats, fmt
|
||||
*/
|
||||
hasFormat( fmt ) { return _.has(this.formats, fmt); }
|
||||
|
||||
|
||||
|
||||
###*
|
||||
/**
|
||||
Return the requested output format.
|
||||
@method getFormat
|
||||
###
|
||||
getFormat: ( fmt ) -> @formats[ fmt ]
|
||||
*/
|
||||
getFormat( fmt ) { return this.formats[ fmt ]; }
|
||||
}
|
||||
|
||||
|
||||
module.exports = JRSTheme;
|
||||
|
Reference in New Issue
Block a user