diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 000000000..31354ec13 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..f91359dc2 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install pretty-quick --staged diff --git a/.prettierrc b/.prettierrc index d81dbaeb5..3baced411 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,4 @@ { "singleQuote": true, - "trailingComma": "es5", "endOfLine": "auto" } diff --git a/package.json b/package.json index 17be6b991..b35078a90 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "eslint-config-prettier": "^6.0.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-prettier": "^3.1.0", - "prettier": "^1.14.3", "lerna": "3.17.0", - "pretty-quick": "^1.11.1", "auto": "^9.40.5", - "@auto-it/released": "^9.40.5" + "@auto-it/released": "^9.40.5", + "prettier": "^2.2.1", + "pretty-quick": "^3.1.0" }, "repository": { "type": "git", @@ -41,7 +41,8 @@ "publish": "npx lerna publish -m \"[skip travis] chore(release): publish %s\"", "postpublish": "auto release", "preview:docs": "cd packages/docs && yarn production", - "preview:hbs": "cd packages/development-edition-engine-handlebars && yarn pl:starterkit && yarn pl:build" + "preview:hbs": "cd packages/development-edition-engine-handlebars && yarn pl:starterkit && yarn pl:build", + "prepare": "husky install" }, "nyc": { "exclude": [ @@ -50,5 +51,8 @@ "packages/core/test", "packages/live-server" ] + }, + "devDependencies": { + "husky": "^6.0.0" } } diff --git a/packages/cli/package.json b/packages/cli/package.json index 2f248a275..12fe319d0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -34,7 +34,7 @@ "eslint": "4.18.2", "eslint-config-prettier": "2.9.0", "eslint-plugin-prettier": "2.6.0", - "prettier": "1.11.1", + "prettier": "2.2.1", "proxyquire": "2.1.3", "tap": "14.11.0" }, diff --git a/packages/core/package.json b/packages/core/package.json index e47775975..e885b86d7 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -30,10 +30,8 @@ "eslint-config-prettier": "^6.0.0", "eslint-plugin-import": "^2.18.2", "eslint-plugin-prettier": "^3.1.0", - "husky": "0.14.3", "jsdoc-to-markdown": "5.0.1", - "prettier": "^1.14.3", - "pretty-quick": "^1.11.1", + "prettier": "^2.2.1", "rewire": "2.5.2", "standard-version": "9.1.1", "tap": "14.11.0" diff --git a/packages/core/src/lib/addPattern.js b/packages/core/src/lib/addPattern.js index 12c0c9429..0534c5dfd 100644 --- a/packages/core/src/lib/addPattern.js +++ b/packages/core/src/lib/addPattern.js @@ -2,7 +2,7 @@ const logger = require('./log'); -module.exports = function(pattern, patternlab) { +module.exports = function (pattern, patternlab) { //add the link to the global object if (!patternlab.data.link) { patternlab.data.link = {}; diff --git a/packages/core/src/lib/annotation_exporter.js b/packages/core/src/lib/annotation_exporter.js index 7ed86da28..dffb01253 100644 --- a/packages/core/src/lib/annotation_exporter.js +++ b/packages/core/src/lib/annotation_exporter.js @@ -6,7 +6,7 @@ const _ = require('lodash'); const mp = require('./markdown_parser'); const logger = require('./log'); -const annotations_exporter = function(pl) { +const annotations_exporter = function (pl) { const paths = pl.config.paths; let oldAnnotations; @@ -68,7 +68,7 @@ const annotations_exporter = function(pl) { //let annotations = annotations; const markdown_parser = parser; - return function(filePath) { + return function (filePath) { const annotationsMD = fs.readFileSync(path.resolve(filePath), 'utf8'); //take the annotation snippets and split them on our custom delimiter @@ -110,13 +110,13 @@ const annotations_exporter = function(pl) { } return { - gather: function() { + gather: function () { return gatherAnnotations(); }, - gatherJS: function() { + gatherJS: function () { return parseAnnotationsJS(); }, - gatherMD: function() { + gatherMD: function () { return parseAnnotationsMD(); }, }; diff --git a/packages/core/src/lib/buildFooter.js b/packages/core/src/lib/buildFooter.js index 1a4a56652..6d0c4351c 100644 --- a/packages/core/src/lib/buildFooter.js +++ b/packages/core/src/lib/buildFooter.js @@ -13,7 +13,7 @@ let render = require('./render'); //eslint-disable-line prefer-const * @param patternPartial - the partial key to build this for, either viewall-patternPartial or a viewall-patternGroup-all * @returns A promise which resolves with the HTML */ -module.exports = function(patternlab, patternPartial, uikit) { +module.exports = function (patternlab, patternPartial, uikit) { //first render the general footer return render(Pattern.createEmpty({ extendedTemplate: uikit.footer }), { patternData: JSON.stringify({ @@ -21,7 +21,7 @@ module.exports = function(patternlab, patternPartial, uikit) { }), cacheBuster: patternlab.cacheBuster, }) - .then(footerPartial => { + .then((footerPartial) => { let allFooterData; try { allFooterData = jsonCopy( @@ -36,7 +36,7 @@ module.exports = function(patternlab, patternPartial, uikit) { return render(patternlab.userFoot, allFooterData); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error building buildFooterHTML'); }); diff --git a/packages/core/src/lib/buildListItems.js b/packages/core/src/lib/buildListItems.js index af9ba783d..7eb214f12 100644 --- a/packages/core/src/lib/buildListItems.js +++ b/packages/core/src/lib/buildListItems.js @@ -26,7 +26,7 @@ const items = [ 'twenty', ]; -module.exports = function(container) { +module.exports = function (container) { //combine all list items into one structure const list = []; for (const item in container.listitems) { diff --git a/packages/core/src/lib/buildPatterns.js b/packages/core/src/lib/buildPatterns.js index ca5e4d1e3..476a373c6 100644 --- a/packages/core/src/lib/buildPatterns.js +++ b/packages/core/src/lib/buildPatterns.js @@ -119,7 +119,7 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => { cacheBuster: patternlab.cacheBuster, } ) - .then(results => { + .then((results) => { patternlab.data.patternLabHead = results; // If deletePatternDir == true or graph needs to be updated @@ -133,7 +133,7 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => { if (patternlab.incrementalBuildsEnabled) { // When the graph was loaded from file, some patterns might have been moved/deleted between runs // so the graph data become out of sync - patternlab.graph.sync().forEach(n => { + patternlab.graph.sync().forEach((n) => { logger.info('[Deleted/Moved] ' + n); }); @@ -150,10 +150,10 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => { } //render all patterns last, so lineageR works const allPatternsPromise = patternsToBuild.map( - async pattern => await compose(pattern, patternlab) + async (pattern) => await compose(pattern, patternlab) ); //copy non-pattern files like JavaScript - const allJS = patternsToBuild.map(pattern => { + const allJS = patternsToBuild.map((pattern) => { const { name, patternPartial, subdir } = pattern; const { source: { patterns: sourceDir }, @@ -161,7 +161,7 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => { } = patternlab.config.paths; const src = path.join(sourceDir, subdir); const dest = path.join(publicDir, name); - return map(patternlab.uikits, uikit => { + return map(patternlab.uikits, (uikit) => { return copy( src, path.resolve(process.cwd(), uikit.outputDir, dest), @@ -199,27 +199,27 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => { //export patterns if necessary pattern_exporter.export_patterns(patternlab); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error rendering patterns'); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error rendering pattern lab header'); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error processing meta patterns'); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error processing patterns recursively'); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error in buildPatterns()'); }); diff --git a/packages/core/src/lib/changes_hunter.js b/packages/core/src/lib/changes_hunter.js index 038be8b41..ee4a4d52c 100644 --- a/packages/core/src/lib/changes_hunter.js +++ b/packages/core/src/lib/changes_hunter.js @@ -12,7 +12,7 @@ let fs = require('fs-extra'); //eslint-disable-line prefer-const * For detecting changed patterns. * @constructor */ -const ChangesHunter = function() {}; +const ChangesHunter = function () {}; ChangesHunter.prototype = { /** @@ -25,7 +25,7 @@ ChangesHunter.prototype = { * * @see {@link CompileState} */ - checkBuildState: function(pattern, patternlab) { + checkBuildState: function (pattern, patternlab) { //write the compiled template to the public patterns directory const renderedTemplatePath = patternlab.config.paths.public.patterns + @@ -40,12 +40,12 @@ ChangesHunter.prototype = { pattern.compileState = CompileState.NEEDS_REBUILD; } - _.each(patternlab.uikits, uikit => { + _.each(patternlab.uikits, (uikit) => { try { // renderedTemplatePath required to display a single element // Markup only is required for "View All" pages. It will get loaded later on. // If any of these is missing, mark pattern for recompile - [renderedTemplatePath, markupOnlyPath].forEach(renderedFile => { + [renderedTemplatePath, markupOnlyPath].forEach((renderedFile) => { // Prevent error message if file does not exist fs.accessSync( path.join(process.cwd(), uikit.outputDir, renderedFile), @@ -94,7 +94,7 @@ ChangesHunter.prototype = { * @param {Pattern} currentPattern * @param {string} file */ - checkLastModified: function(currentPattern, file) { + checkLastModified: function (currentPattern, file) { if (file && fs.pathExistsSync(file)) { try { const stat = fs.statSync(file); @@ -110,7 +110,7 @@ ChangesHunter.prototype = { } }, - needsRebuild: function(lastModified, p) { + needsRebuild: function (lastModified, p) { if (p.compileState !== CompileState.CLEAN || !p.lastModified) { return true; } diff --git a/packages/core/src/lib/cleanBuildDirectory.js b/packages/core/src/lib/cleanBuildDirectory.js index 11d78c01e..0cfc300e0 100644 --- a/packages/core/src/lib/cleanBuildDirectory.js +++ b/packages/core/src/lib/cleanBuildDirectory.js @@ -15,12 +15,12 @@ module.exports = (incrementalBuildsEnabled, patternlab) => { return Promise.resolve(); } else { return Promise.all( - _.map(patternlab.uikits, uikit => { + _.map(patternlab.uikits, (uikit) => { return fs.emptyDir( path.join(process.cwd(), uikit.outputDir, paths.public.patterns) ); }) - ).catch(reason => { + ).catch((reason) => { logger.error(reason); }); } diff --git a/packages/core/src/lib/compose.js b/packages/core/src/lib/compose.js index 1816b1dfc..6eeeb50fd 100644 --- a/packages/core/src/lib/compose.js +++ b/packages/core/src/lib/compose.js @@ -15,7 +15,7 @@ const pluginManager = new pm(); const Pattern = require('./object_factory').Pattern; const CompileState = require('./object_factory').CompileState; -module.exports = async function(pattern, patternlab) { +module.exports = async function (pattern, patternlab) { // Pattern does not need to be built and recompiled more than once if (!pattern.isPattern || pattern.compileState === CompileState.CLEAN) { return Promise.resolve(false); @@ -41,7 +41,7 @@ module.exports = async function(pattern, patternlab) { ); return Promise.all( - _.map(patternlab.uikits, uikit => { + _.map(patternlab.uikits, (uikit) => { // exclude pattern from uikit rendering if (uikitExcludePattern(pattern, uikit)) { return Promise.resolve(); @@ -154,7 +154,7 @@ module.exports = async function(pattern, patternlab) { patternPartialPromise, footerPartialPromise, ]) - .then(intermediateResults => { + .then((intermediateResults) => { // retrieve results of promises const headHTML = intermediateResults[0]; //headPromise pattern.patternPartialCode = intermediateResults[1]; //patternPartialPromise @@ -178,7 +178,7 @@ module.exports = async function(pattern, patternlab) { allFooterData.patternLabFoot = footerPartial; return render(patternlab.userFoot, allFooterData).then( - async footerHTML => { + async (footerHTML) => { /////////////// // WRITE FILES /////////////// @@ -212,7 +212,7 @@ module.exports = async function(pattern, patternlab) { } ); }) - .catch(reason => { + .catch((reason) => { console.log(reason); }); }) diff --git a/packages/core/src/lib/copier.js b/packages/core/src/lib/copier.js index 441ffdf5b..ef7990ec5 100644 --- a/packages/core/src/lib/copier.js +++ b/packages/core/src/lib/copier.js @@ -8,7 +8,7 @@ const watchAssets = require('./watchAssets'); const watchPatternLabFiles = require('./watchPatternLabFiles'); const copier = () => { - const transform_paths = directories => { + const transform_paths = (directories) => { //create array with all source keys minus our blacklist const dirs = {}; const blackList = [ @@ -66,7 +66,7 @@ const copier = () => { } else { //just copy copyPromises.push( - _.map(patternlab.uikits, uikit => { + _.map(patternlab.uikits, (uikit) => { copyFile( dir.source, path.join(basePath, uikit.outputDir, dir.public), @@ -79,7 +79,7 @@ const copier = () => { // copy the styleguide copyPromises.push( - _.map(patternlab.uikits, uikit => { + _.map(patternlab.uikits, (uikit) => { copyFile( path.join(uikit.modulePath, assetDirectories.source.styleguide), path.join(basePath, uikit.outputDir, assetDirectories.public.root), @@ -90,7 +90,7 @@ const copier = () => { // copy the favicon copyPromises.push( - _.map(patternlab.uikits, uikit => { + _.map(patternlab.uikits, (uikit) => { copyFile( `${assetDirectories.source.root}/favicon.ico`, path.join( @@ -116,7 +116,7 @@ const copier = () => { copyAndWatch: (assetDirectories, patternlab, options) => { return copyAndWatch(assetDirectories, patternlab, options); }, - transformConfigPaths: paths => { + transformConfigPaths: (paths) => { return transform_paths(paths); }, }; diff --git a/packages/core/src/lib/copyFile.js b/packages/core/src/lib/copyFile.js index ce1bc056a..c8202afe1 100644 --- a/packages/core/src/lib/copyFile.js +++ b/packages/core/src/lib/copyFile.js @@ -7,10 +7,10 @@ let copy = require('recursive-copy'); // eslint-disable-line prefer-const const copyFile = (p, dest, options) => { return copy(p, dest, options) - .on(copy.events.ERROR, function(error, copyOperation) { + .on(copy.events.ERROR, function (error, copyOperation) { logger.error('Unable to copy ' + copyOperation.dest); }) - .on(copy.events.COPY_FILE_ERROR, error => { + .on(copy.events.COPY_FILE_ERROR, (error) => { logger.error(error); }) .on(copy.events.COPY_FILE_COMPLETE, () => { diff --git a/packages/core/src/lib/dataMerger.js b/packages/core/src/lib/dataMerger.js index 5ebdd21bb..08544c320 100644 --- a/packages/core/src/lib/dataMerger.js +++ b/packages/core/src/lib/dataMerger.js @@ -9,7 +9,11 @@ const _ = require('lodash'); * @param {*} dataToMergeWithObject the object that should be merged with the original data * @param {*} patternlabConfig the patternlab configuration object */ -module.exports = function(dataObject, dataToMergeWithObject, patternlabConfig) { +module.exports = function ( + dataObject, + dataToMergeWithObject, + patternlabConfig +) { return _.mergeWith( {}, dataObject, diff --git a/packages/core/src/lib/data_loader.js b/packages/core/src/lib/data_loader.js index f1ac874c2..594f4b700 100644 --- a/packages/core/src/lib/data_loader.js +++ b/packages/core/src/lib/data_loader.js @@ -53,7 +53,7 @@ function loadDataFromFolder(dataFilesPath, excludeFileNames, fsDep) { const dataFiles = glob.sync(dataFilesFullPath, globOptions); let mergeObject = {}; - dataFiles.forEach(function(filePath) { + dataFiles.forEach(function (filePath) { try { const jsonData = yaml.safeLoad( fsDep.readFileSync(path.resolve(filePath), 'utf8') diff --git a/packages/core/src/lib/decompose.js b/packages/core/src/lib/decompose.js index e541708b5..4c35cd694 100644 --- a/packages/core/src/lib/decompose.js +++ b/packages/core/src/lib/decompose.js @@ -16,7 +16,7 @@ const list_item_hunter = new lih(); * @param patternlab - global data store * @param ignoreLineage - whether or not to hunt for lineage for this pattern */ -module.exports = function(pattern, patternlab, ignoreLineage) { +module.exports = function (pattern, patternlab, ignoreLineage) { //set the extendedTemplate to operate on later if we find partials to replace if (!pattern.extendedTemplate) { pattern.extendedTemplate = pattern.template; @@ -51,7 +51,7 @@ module.exports = function(pattern, patternlab, ignoreLineage) { expandPartialPromise, lineagePromise, addPromise, - ]).catch(reason => { + ]).catch((reason) => { logger.error(reason); }); }; diff --git a/packages/core/src/lib/expandPartials.js b/packages/core/src/lib/expandPartials.js index 01dfd10ec..908b6377a 100644 --- a/packages/core/src/lib/expandPartials.js +++ b/packages/core/src/lib/expandPartials.js @@ -9,7 +9,7 @@ const getPartial = require('./get'); const parameter_hunter = new ph(); const style_modifier_hunter = new smh(); -module.exports = function(currentPattern, patternlab) { +module.exports = function (currentPattern, patternlab) { const processRecursive = require('./processRecursive'); //find how many partials there may be for the given pattern @@ -31,7 +31,7 @@ module.exports = function(currentPattern, patternlab) { .find_parameters(currentPattern, patternlab) .then(() => { //do something with the regular old partials - foundPatternPartials.forEach(foundPartial => { + foundPatternPartials.forEach((foundPartial) => { const partial = currentPattern.findPartial(foundPartial); const partialPattern = getPartial(partial, patternlab); @@ -76,13 +76,13 @@ module.exports = function(currentPattern, patternlab) { return Promise.resolve(); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error(reason); }); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error(reason); }); diff --git a/packages/core/src/lib/exportData.js b/packages/core/src/lib/exportData.js index 034f1f294..a229cc815 100644 --- a/packages/core/src/lib/exportData.js +++ b/packages/core/src/lib/exportData.js @@ -11,7 +11,7 @@ let fs = require('fs-extra'); //eslint-disable-line prefer-const * Write out our pattern information for use by the front end * @param patternlab - global data store */ -module.exports = function(patternlab, uikit) { +module.exports = function (patternlab, uikit) { const annotation_exporter = new ae(patternlab); const paths = patternlab.config.paths; diff --git a/packages/core/src/lib/findModules.js b/packages/core/src/lib/findModules.js index 246612ec8..f54f80d4f 100644 --- a/packages/core/src/lib/findModules.js +++ b/packages/core/src/lib/findModules.js @@ -6,7 +6,7 @@ const isScopedPackage = require('./isScopedPackage'); let fs = require('fs-extra'); // eslint-disable-line -const isDir = fPath => { +const isDir = (fPath) => { const stats = fs.lstatSync(fPath); return stats.isDirectory() || stats.isSymbolicLink(); }; @@ -27,7 +27,7 @@ module.exports = (dir, filter) => { */ const dirList = fs .readdirSync(fPath) - .filter(p => isDir(path.join(fPath, p))); + .filter((p) => isDir(path.join(fPath, p))); /** * @name m @@ -35,7 +35,7 @@ module.exports = (dir, filter) => { * @type {Array} */ const m = foundModules.concat( - dirList.filter(filter).map(mod => { + dirList.filter(filter).map((mod) => { return { name: filter(mod), modulePath: path.join(fPath, mod), @@ -52,7 +52,7 @@ module.exports = (dir, filter) => { ...m, ...dirList .filter(isScopedPackage) // 2 - .map(scope => findModules(path.join(fPath, scope), m)) // 3 + .map((scope) => findModules(path.join(fPath, scope), m)) // 3 ); }; diff --git a/packages/core/src/lib/get.js b/packages/core/src/lib/get.js index 2feccc135..4852670eb 100644 --- a/packages/core/src/lib/get.js +++ b/packages/core/src/lib/get.js @@ -2,7 +2,7 @@ const logger = require('./log'); -module.exports = function(partialName, patternlab, reportWarning = true) { +module.exports = function (partialName, patternlab, reportWarning = true) { //look for exact partial matches for (let i = 0; i < patternlab.patterns.length; i++) { if (patternlab.patterns[i].patternPartial === partialName) { diff --git a/packages/core/src/lib/isScopedPackage.js b/packages/core/src/lib/isScopedPackage.js index cffd1d811..53b607ad7 100644 --- a/packages/core/src/lib/isScopedPackage.js +++ b/packages/core/src/lib/isScopedPackage.js @@ -10,7 +10,7 @@ const scopeMatch = /^@(.*)$/; * @param {string} filePath - The pathname to check * @return {Boolean} - Returns a bool when found, false othersie */ -module.exports = filePath => { +module.exports = (filePath) => { const baseName = path.basename(filePath); return scopeMatch.test(baseName); }; diff --git a/packages/core/src/lib/lineage_hunter.js b/packages/core/src/lib/lineage_hunter.js index 657897d21..3a90a0f65 100644 --- a/packages/core/src/lib/lineage_hunter.js +++ b/packages/core/src/lib/lineage_hunter.js @@ -2,7 +2,7 @@ const getPartial = require('./get'); const logger = require('./log'); -const lineage_hunter = function() { +const lineage_hunter = function () { function findlineage(pattern, patternlab) { // As we are adding edges from pattern to ancestor patterns, ensure it is known to the graph patternlab.graph.add(pattern); @@ -10,7 +10,7 @@ const lineage_hunter = function() { //find the {{> template-name }} within patterns const matches = pattern.findPartials(); if (matches !== null) { - matches.forEach(function(match) { + matches.forEach(function (match) { //get the ancestorPattern const ancestorPattern = getPartial( pattern.findPartial(match), @@ -158,10 +158,10 @@ const lineage_hunter = function() { } return { - find_lineage: function(pattern, patternlab) { + find_lineage: function (pattern, patternlab) { findlineage(pattern, patternlab); }, - cascade_pattern_states: function(patternlab) { + cascade_pattern_states: function (patternlab) { cascadePatternStates(patternlab); }, }; diff --git a/packages/core/src/lib/list_item_hunter.js b/packages/core/src/lib/list_item_hunter.js index e6fd3818b..7d6346161 100644 --- a/packages/core/src/lib/list_item_hunter.js +++ b/packages/core/src/lib/list_item_hunter.js @@ -1,6 +1,6 @@ 'use strict'; -const list_item_hunter = function() { +const list_item_hunter = function () { const logger = require('./log'); function processListItemPartials(pattern) { @@ -39,7 +39,7 @@ const list_item_hunter = function() { } return { - process_list_item_partials: function(pattern) { + process_list_item_partials: function (pattern) { return processListItemPartials(pattern); }, }; diff --git a/packages/core/src/lib/loadPattern.js b/packages/core/src/lib/loadPattern.js index 17cf088bd..7753d5bd4 100644 --- a/packages/core/src/lib/loadPattern.js +++ b/packages/core/src/lib/loadPattern.js @@ -19,7 +19,7 @@ let fs = require('fs-extra'); //eslint-disable-line prefer-const // loads a pattern from disk, creates a Pattern object from it and // all its associated files, and records it in patternlab.patterns[] -module.exports = function(relPath, patternlab) { +module.exports = function (relPath, patternlab) { const fileObject = path.parse(relPath); //extract some information @@ -146,7 +146,7 @@ module.exports = function(relPath, patternlab) { `${listJsonFileName}.json`, `${listJsonFileName}.yml`, `${listJsonFileName}.yaml`, - ].forEach(file => { + ].forEach((file) => { changes_hunter.checkLastModified(currentPattern, file); }); diff --git a/packages/core/src/lib/loaduikits.js b/packages/core/src/lib/loaduikits.js index b83f94dcb..79de4556f 100644 --- a/packages/core/src/lib/loaduikits.js +++ b/packages/core/src/lib/loaduikits.js @@ -24,11 +24,11 @@ const readModuleFile = (uikitLocation, subPath) => { * [4] Reads files from uikit that apply to every template * @param {object} patternlab */ -module.exports = patternlab => { +module.exports = (patternlab) => { const paths = patternlab.config.paths; const uikitConfigs = _.filter(patternlab.config.uikits, 'enabled'); // [1] - uikitConfigs.forEach(uikitConfig => { + uikitConfigs.forEach((uikitConfig) => { let uikitLocation = null; if ('package' in uikitConfig) { try { diff --git a/packages/core/src/lib/log.js b/packages/core/src/lib/log.js index 87a7cd587..f55ff4aa1 100644 --- a/packages/core/src/lib/log.js +++ b/packages/core/src/lib/log.js @@ -63,8 +63,8 @@ const error = log.error.bind(log); * @param {string} - a message to report * @returns {function} - a callback to be passed to a Promise's .catch() */ -const reportError = function(message) { - return function(err) { +const reportError = function (message) { + return function (err) { console.log(message); console.log(err); }; diff --git a/packages/core/src/lib/markModifiedPatterns.js b/packages/core/src/lib/markModifiedPatterns.js index aa80b25bb..6eede313e 100644 --- a/packages/core/src/lib/markModifiedPatterns.js +++ b/packages/core/src/lib/markModifiedPatterns.js @@ -17,7 +17,7 @@ let fs = require('fs-extra'); //eslint-disable-line prefer-const * @param lastModified * @param patternlab */ -module.exports = function(lastModified, patternlab) { +module.exports = function (lastModified, patternlab) { /** * If the given array exists, apply a function to each of its elements * @param {Array} array @@ -28,13 +28,13 @@ module.exports = function(lastModified, patternlab) { array.forEach(func); } }; - const modifiedOrNot = _.groupBy(patternlab.patterns, p => + const modifiedOrNot = _.groupBy(patternlab.patterns, (p) => changes_hunter.needsRebuild(lastModified, p) ? 'modified' : 'notModified' ); // For all unmodified patterns load their rendered template output - forEachExisting(modifiedOrNot.notModified, cleanPattern => { - _.each(patternlab.uikits, uikit => { + forEachExisting(modifiedOrNot.notModified, (cleanPattern) => { + _.each(patternlab.uikits, (uikit) => { const xp = path.join( process.cwd(), uikit.outputDir, @@ -50,7 +50,7 @@ module.exports = function(lastModified, patternlab) { // For all patterns that were modified, schedule them for rebuild forEachExisting( modifiedOrNot.modified, - p => (p.compileState = CompileState.NEEDS_REBUILD) + (p) => (p.compileState = CompileState.NEEDS_REBUILD) ); return modifiedOrNot; }; diff --git a/packages/core/src/lib/markdown_parser.js b/packages/core/src/lib/markdown_parser.js index 19dcb7a9d..ec962e89e 100644 --- a/packages/core/src/lib/markdown_parser.js +++ b/packages/core/src/lib/markdown_parser.js @@ -3,7 +3,7 @@ const md = require('markdown-it')(); const yaml = require('js-yaml'); const logger = require('./log'); -const markdown_parser = function() { +const markdown_parser = function () { /** * Converts a markdown block with frontmatter (each is optional, technically) to a well-formed object. * @param block - the ".md" file, which can contain frontmatter or not, or only frontmatter. @@ -47,7 +47,7 @@ const markdown_parser = function() { } return { - parse: function(block) { + parse: function (block) { return parseMarkdownBlock(block); }, }; diff --git a/packages/core/src/lib/object_factory.js b/packages/core/src/lib/object_factory.js index efb6e1b4e..0b0337dfc 100644 --- a/packages/core/src/lib/object_factory.js +++ b/packages/core/src/lib/object_factory.js @@ -27,7 +27,7 @@ const prefixMatcherDeprecationCheckHidden = /^_.+/; * @param {Patternlab} patternlab The actual pattern lab instance * @param {boolean} isPromoteToFlatPatternRun specifies if the pattern needs to be removed from its deep nesting folder */ -const Pattern = function( +const Pattern = function ( relPath, jsonFileData, patternlab, @@ -201,7 +201,7 @@ const Pattern = function( Pattern.prototype = { // render function - acts as a proxy for the PatternEngine's - render: function(data, partials) { + render: function (data, partials) { if (!this.extendedTemplate) { this.extendedTemplate = this.template; } @@ -213,17 +213,17 @@ Pattern.prototype = { partials ); return promise - .then(results => { + .then((results) => { return results; }) - .catch(reason => { + .catch((reason) => { return Promise.reject(reason); }); } return Promise.reject('where is the engine?'); }, - registerPartial: function() { + registerPartial: function () { if (this.engine && typeof this.engine.registerPartial === 'function') { this.engine.registerPartial(this); } @@ -239,7 +239,7 @@ Pattern.prototype = { * @param {string} suffixType File suffix * @param {string} customFileExtension Custom extension */ - getPatternLink: function(patternlab, suffixType, customFileExtension) { + getPatternLink: function (patternlab, suffixType, customFileExtension) { // if no suffixType is provided, we default to rendered const suffixConfig = patternlab.config.outputFileSuffixes; const suffix = suffixType @@ -261,23 +261,23 @@ Pattern.prototype = { * The finders all delegate to the PatternEngine, which also * encapsulates all appropriate regex's */ - findPartials: function() { + findPartials: function () { return this.engine.findPartials(this); }, - findPartialsWithStyleModifiers: function() { + findPartialsWithStyleModifiers: function () { return this.engine.findPartialsWithStyleModifiers(this); }, - findPartialsWithPatternParameters: function() { + findPartialsWithPatternParameters: function () { return this.engine.findPartialsWithPatternParameters(this); }, - findListItems: function() { + findListItems: function () { return this.engine.findListItems(this); }, - findPartial: function(partialString) { + findPartial: function (partialString) { return this.engine.findPartial(partialString); }, @@ -287,7 +287,7 @@ Pattern.prototype = { * @param {Number} level Level of folder to get * @param {Object} pInfo general information about the pattern */ - getDirLevel: function(level, pInfo) { + getDirLevel: function (level, pInfo) { const items = this.subdir.split(path.sep); pInfo && pInfo.patternHasOwnDir && items.pop(); @@ -309,7 +309,7 @@ Pattern.prototype = { * * @param {Patternlab} patternlab Current patternlab instance */ - promoteFromDirectoryToFlatPattern: function(patternlab) { + promoteFromDirectoryToFlatPattern: function (patternlab) { const p = new Pattern(this.relPath, this.jsonFileData, patternlab, true); // Only reset the specific fields, not everything Object.assign(this, { @@ -330,7 +330,7 @@ Pattern.prototype = { * @param {*} pathStr the path that needs to be checked for number prefixes * @returns the order number or 0 when no prefix is available */ - setPatternOrderDataForInfo: pathStr => { + setPatternOrderDataForInfo: (pathStr) => { const match = pathStr.match(prefixMatcherDeprecationCheckOrder); return match && match.length >= 1 ? pathStr.match(prefixMatcherDeprecationCheckOrder)[1].replace('-', '') @@ -358,7 +358,7 @@ Pattern.prototype = { }; info.dir = info.patternHasOwnDir ? pathObj.dir.split(path.sep).pop() : ''; - info.dirLevel = pathObj.dir.split(path.sep).filter(s => !!s).length; + info.dirLevel = pathObj.dir.split(path.sep).filter((s) => !!s).length; // Only relevant for deprecation check and message if (path.parse(pathObj.dir).base === '_meta') { @@ -399,7 +399,7 @@ Pattern.prototype = { .replace(new RegExp(`-${info.dir}$`), ''); info.verbosePartial = pathObj.dir .split(/\/|\\/, 2) - .map(o => o.replace(prefixMatcher, '')) + .map((o) => o.replace(prefixMatcher, '')) .join('/') .replace(new RegExp(`-${info.dir}$`), ''); } @@ -417,7 +417,7 @@ Pattern.prototype = { * @param {Object} customProps Properties to apply to new pattern * @param {Patternlab} patternlab Current patternlab instance */ -Pattern.createEmpty = function(customProps, patternlab) { +Pattern.createEmpty = function (customProps, patternlab) { let relPath = ''; if (customProps) { if (customProps.relPath) { @@ -436,7 +436,7 @@ Pattern.createEmpty = function(customProps, patternlab) { * parameters that replace the positional parameters that the Pattern * constructor takes. */ -Pattern.create = function(relPath, data, customProps, patternlab) { +Pattern.create = function (relPath, data, customProps, patternlab) { const newPattern = new Pattern(relPath || '', data || null, patternlab); return Object.assign(newPattern, customProps); }; diff --git a/packages/core/src/lib/parameter_hunter.js b/packages/core/src/lib/parameter_hunter.js index aa2ce38dc..748c113d4 100644 --- a/packages/core/src/lib/parameter_hunter.js +++ b/packages/core/src/lib/parameter_hunter.js @@ -9,7 +9,7 @@ const parseLink = require('./parseLink'); const jsonCopy = require('./json_copy'); const replaceParameter = require('./replaceParameter'); -const parameter_hunter = function() { +const parameter_hunter = function () { /** * This function is really to accommodate the lax JSON-like syntax allowed by * Pattern Lab PHP for parameter submissions to partials. Unfortunately, no @@ -331,7 +331,7 @@ const parameter_hunter = function() { //todo: this no longer needs to be a promise return Promise.resolve(); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error(reason); }); @@ -342,7 +342,7 @@ const parameter_hunter = function() { } return { - find_parameters: function(pattern, patternlab) { + find_parameters: function (pattern, patternlab) { return findparameters(pattern, patternlab); }, }; diff --git a/packages/core/src/lib/parseAllLinks.js b/packages/core/src/lib/parseAllLinks.js index 894ad6f83..e69383bd7 100644 --- a/packages/core/src/lib/parseAllLinks.js +++ b/packages/core/src/lib/parseAllLinks.js @@ -4,7 +4,7 @@ const parseLink = require('./parseLink'); //look for pattern links included in data files. //these will be in the form of link.* WITHOUT {{}}, which would still be there from direct pattern inclusion -module.exports = function(patternlab) { +module.exports = function (patternlab) { //look for link.* such as link.pages-blog as a value patternlab.data = parseLink(patternlab, patternlab.data, 'data.json'); diff --git a/packages/core/src/lib/parseLink.js b/packages/core/src/lib/parseLink.js index 0193144b3..5b383b45e 100644 --- a/packages/core/src/lib/parseLink.js +++ b/packages/core/src/lib/parseLink.js @@ -5,7 +5,7 @@ const path = require('path'); const logger = require('./log'); const getPartial = require('./get'); -module.exports = function(patternlab, obj, key) { +module.exports = function (patternlab, obj, key) { //check for 'link.patternPartial' const linkRE = /(?:'|")(link\.[A-z0-9-_]+)(?:'|")/g; @@ -20,7 +20,7 @@ module.exports = function(patternlab, obj, key) { const linkMatches = dataObjAsString.match(linkRE); if (linkMatches) { - linkMatches.forEach(dataLink => { + linkMatches.forEach((dataLink) => { if (dataLink && dataLink.split('.').length >= 2) { //get the partial the link refers to const linkPatternPartial = dataLink.split('.')[1].replace(/'|"/g, ''); @@ -34,7 +34,7 @@ module.exports = function(patternlab, obj, key) { .replace('viewall-', '') .replace('-all', ''); const pattern = patternlab.patterns.find( - p => p.patternGroup === partial + (p) => p.patternGroup === partial ); if (pattern) { @@ -45,7 +45,7 @@ module.exports = function(patternlab, obj, key) { // group and subgroup there will be a view all page for that group) const partial = linkPatternPartial.replace('viewall-', ''); const pattern = patternlab.patterns.find( - p => `${p.patternGroup}-${p.patternSubgroup}` === partial + (p) => `${p.patternGroup}-${p.patternSubgroup}` === partial ); if (pattern) { diff --git a/packages/core/src/lib/pattern_engines.js b/packages/core/src/lib/pattern_engines.js index cde010125..9049cacbb 100644 --- a/packages/core/src/lib/pattern_engines.js +++ b/packages/core/src/lib/pattern_engines.js @@ -77,12 +77,12 @@ const PatternEngines = Object.create({ * @param patternLabConfig * @memberof PatternEngines */ - loadAllEngines: function(patternLabConfig) { + loadAllEngines: function (patternLabConfig) { const self = this; // Try to load engines! We scan for engines at each path specified above. This // function is kind of a big deal. - enginesDirectories.forEach(function(engineDirectory) { + enginesDirectories.forEach(function (engineDirectory) { const enginesInThisDir = findEngineModulesInDirectory( engineDirectory.path ); @@ -91,7 +91,7 @@ const PatternEngines = Object.create({ // find all engine-named things in this directory and try to load them, // unless it's already been loaded. - enginesInThisDir.forEach(function(engineDiscovery) { + enginesInThisDir.forEach(function (engineDiscovery) { let errorMessage; const successMessage = 'good to go'; @@ -138,7 +138,7 @@ const PatternEngines = Object.create({ * @param pattern * @returns engine name matching pattern */ - getEngineNameForPattern: function(pattern) { + getEngineNameForPattern: function (pattern) { // avoid circular dependency by putting this in here. TODO: is this slow? const of = require('./object_factory'); if ( @@ -175,7 +175,7 @@ const PatternEngines = Object.create({ * @param pattern * @returns name of engine for pattern */ - getEngineForPattern: function(pattern) { + getEngineForPattern: function (pattern) { if (pattern.isPseudoPattern) { return this.getEngineForPattern(pattern.basePattern); } else { @@ -189,9 +189,9 @@ const PatternEngines = Object.create({ * @memberof PatternEngines * @returns Array all supported file extensions */ - getSupportedFileExtensions: function() { + getSupportedFileExtensions: function () { const engineNames = Object.keys(PatternEngines); - const allEnginesExtensions = engineNames.map(engineName => { + const allEnginesExtensions = engineNames.map((engineName) => { return PatternEngines[engineName].engineFileExtension; }); return [].concat.apply([], allEnginesExtensions); @@ -203,7 +203,7 @@ const PatternEngines = Object.create({ * @param fileExtension * @returns Boolean */ - isFileExtensionSupported: function(fileExtension) { + isFileExtensionSupported: function (fileExtension) { const supportedExtensions = PatternEngines.getSupportedFileExtensions(); return supportedExtensions.lastIndexOf(fileExtension) !== -1; }, @@ -214,7 +214,7 @@ const PatternEngines = Object.create({ * @param filename * @return boolean */ - isPseudoPatternJSON: function(filename) { + isPseudoPatternJSON: function (filename) { const extension = path.extname(filename); return extension === '.json' && filename.indexOf('~') > -1; }, @@ -229,7 +229,7 @@ const PatternEngines = Object.create({ * @param filename * @returns boolean */ - isPatternFile: function(filename) { + isPatternFile: function (filename) { // skip hidden patterns/files without a second thought const extension = path.extname(filename); if ( diff --git a/packages/core/src/lib/pattern_exporter.js b/packages/core/src/lib/pattern_exporter.js index 8eb4e1a88..221415bf8 100644 --- a/packages/core/src/lib/pattern_exporter.js +++ b/packages/core/src/lib/pattern_exporter.js @@ -14,10 +14,7 @@ function exportSinglePattern(patternlab, pattern) { // Extract the first part of the pattern partial as the directory in which // it should go. patternDir = path.join(patternDir, pattern.patternPartial.split('-')[0]); - patternName = pattern.patternPartial - .split('-') - .slice(1) - .join('-'); + patternName = pattern.patternPartial.split('-').slice(1).join('-'); } if (patternlab.config.patternExportRaw) { @@ -31,7 +28,7 @@ function exportSinglePattern(patternlab, pattern) { ); } -const pattern_exporter = function() { +const pattern_exporter = function () { /** * Exports all pattern's final HTML as defined in patternlab-config.json to desired location. * Originally created to help facilitate easier consumption by jekyll. @@ -66,7 +63,7 @@ const pattern_exporter = function() { } return { - export_patterns: function(patternlab) { + export_patterns: function (patternlab) { exportPatterns(patternlab); }, }; diff --git a/packages/core/src/lib/pattern_graph.js b/packages/core/src/lib/pattern_graph.js index 4c1d568cb..a5320292d 100644 --- a/packages/core/src/lib/pattern_graph.js +++ b/packages/core/src/lib/pattern_graph.js @@ -35,7 +35,7 @@ const PATTERN_GRAPH_VERSION = 1; * @see PatternGraph#fromJson * @see #540 */ -const PatternGraph = function(graph, timestamp, version) { +const PatternGraph = function (graph, timestamp, version) { this.graph = graph || new Graph({ @@ -51,7 +51,7 @@ const PatternGraph = function(graph, timestamp, version) { }; // shorthand. Use relPath as it is always unique, even with subPatternGroup -const nodeName = p => (p instanceof Pattern ? p.relPath : p); +const nodeName = (p) => (p instanceof Pattern ? p.relPath : p); PatternGraph.prototype = { /** @@ -61,11 +61,11 @@ PatternGraph.prototype = { * * @see {@link https://github.com/pattern-lab/patternlab-node/issues/580|Issue #580} */ - sync: function() { + sync: function () { // Remove any patterns that are in the graph data, but that haven't been discovered when // walking all patterns iteratively - const nodesToRemove = this.nodes().filter(n => !this.patterns.has(n)); - nodesToRemove.forEach(n => this.remove(n)); + const nodesToRemove = this.nodes().filter((n) => !this.patterns.has(n)); + nodesToRemove.forEach((n) => this.remove(n)); return nodesToRemove; }, @@ -73,7 +73,7 @@ PatternGraph.prototype = { * Creates an independent copy of the graph where nodes and edges can be modified without * affecting the source. */ - clone: function() { + clone: function () { const json = graphlib.json.write(this.graph); const graph = graphlib.json.read(json); return new PatternGraph(graph, this.timestamp, this.version); @@ -85,7 +85,7 @@ PatternGraph.prototype = { * * @param {Pattern} pattern */ - add: function(pattern) { + add: function (pattern) { const n = nodeName(pattern); if (!this.patterns.has(n)) { this.graph.setNode(n, { @@ -96,7 +96,7 @@ PatternGraph.prototype = { } }, - remove: function(pattern) { + remove: function (pattern) { const n = nodeName(pattern); this.graph.removeNode(n); this.patterns.remove(n); @@ -106,8 +106,8 @@ PatternGraph.prototype = { * Removes nodes from this graph for which the given predicate function returns false. * @param {function} fn which takes a node name as argument */ - filter: function(fn) { - this.graph.nodes().forEach(n => { + filter: function (fn) { + this.graph.nodes().forEach((n) => { if (!fn(n)) { this.remove(n); } @@ -123,7 +123,7 @@ PatternGraph.prototype = { * * @throws {Error} If the pattern is unknown */ - link: function(patternFrom, patternTo) { + link: function (patternFrom, patternTo) { const nameFrom = nodeName(patternFrom); const nameTo = nodeName(patternTo); for (const name of [nameFrom, nameTo]) { @@ -141,7 +141,7 @@ PatternGraph.prototype = { * * @return {boolean} */ - hasLink: function(patternFrom, patternTo) { + hasLink: function (patternFrom, patternTo) { const nameFrom = nodeName(patternFrom); const nameTo = nodeName(patternTo); return this.graph.hasEdge(nameFrom, nameTo); @@ -157,8 +157,8 @@ PatternGraph.prototype = { * @return {Array} An Array of {@link Pattern}s in the order by which the changed patters must be * compiled. */ - compileOrder: function() { - const compileStateFilter = function(patterns, n) { + compileOrder: function () { + const compileStateFilter = function (patterns, n) { const node = patterns.get(n); return node.compileState !== CompileState.CLEAN; }; @@ -173,10 +173,10 @@ PatternGraph.prototype = { }); const nodes = this.graph.nodes(); - const changedNodes = nodes.filter(n => + const changedNodes = nodes.filter((n) => compileStateFilter(this.patterns, n) ); - this.nodes2patterns(changedNodes).forEach(pattern => { + this.nodes2patterns(changedNodes).forEach((pattern) => { const patternNode = nodeName(pattern); if (!compileGraph.hasNode(patternNode)) { compileGraph.setNode(patternNode); @@ -211,7 +211,7 @@ PatternGraph.prototype = { * @param fn A function that takes the currently viewed pattern and node data. Allows synching data * between patterns and node metadata. */ - applyReverse: function(pattern, fn) { + applyReverse: function (pattern, fn) { for (const p of this.lineageR(pattern)) { fn(p, pattern); this.applyReverse(p, fn); @@ -225,7 +225,7 @@ PatternGraph.prototype = { * * @return [null|Pattern] */ - node: function(pattern) { + node: function (pattern) { return this.graph.node(nodeName(pattern)); }, @@ -234,8 +234,8 @@ PatternGraph.prototype = { * @param nodes {Array} * @return {Array} An Array of Patterns */ - nodes2patterns: function(nodes) { - return nodes.map(n => this.patterns.get(n)); + nodes2patterns: function (nodes) { + return nodes.map((n) => this.patterns.get(n)); }, // TODO cache result in a Map[String, Array]? @@ -246,7 +246,7 @@ PatternGraph.prototype = { * @param pattern * @return {*|Array} */ - lineage: function(pattern) { + lineage: function (pattern) { const nodes = this.graph.successors(nodeName(pattern)); return this.nodes2patterns(nodes); }, @@ -256,7 +256,7 @@ PatternGraph.prototype = { * @param {Pattern} pattern * @return {*|Array} */ - lineageR: function(pattern) { + lineageR: function (pattern) { const nodes = this.graph.predecessors(nodeName(pattern)); return this.nodes2patterns(nodes); }, @@ -267,9 +267,9 @@ PatternGraph.prototype = { * * @see {@link PatternGraph.lineage(pattern)} */ - lineageIndex: function(pattern) { + lineageIndex: function (pattern) { const lineage = this.lineage(pattern); - return lineage.map(p => p.patternPartial); + return lineage.map((p) => p.patternPartial); }, /** @@ -280,16 +280,16 @@ PatternGraph.prototype = { * * @see {@link PatternGraph.lineageRIndex(pattern)} */ - lineageRIndex: function(pattern) { + lineageRIndex: function (pattern) { const lineageR = this.lineageR(pattern); - return lineageR.map(p => p.patternPartial); + return lineageR.map((p) => p.patternPartial); }, /** * Creates an object representing the graph and meta data. * @returns {{timestamp: number, graph}} */ - toJson: function() { + toJson: function () { return { version: this.version, timestamp: this.timestamp, @@ -300,14 +300,14 @@ PatternGraph.prototype = { /** * @return {Array} An array of all node names. */ - nodes: function() { + nodes: function () { return this.graph.nodes(); }, /** * Updates the version to the most recent one */ - upgradeVersion: function() { + upgradeVersion: function () { this.version = PATTERN_GRAPH_VERSION; }, }; @@ -317,7 +317,7 @@ PatternGraph.prototype = { * @param {int} [version=PATTERN_GRAPH_VERSION] * @return {PatternGraph} */ -PatternGraph.empty = function(version) { +PatternGraph.empty = function (version) { return new PatternGraph(null, 0, version || PATTERN_GRAPH_VERSION); }; @@ -326,7 +326,7 @@ PatternGraph.empty = function(version) { * @param {PatternGraph|Object} graphOrJson * @return {boolean} */ -PatternGraph.checkVersion = function(graphOrJson) { +PatternGraph.checkVersion = function (graphOrJson) { return graphOrJson.version === PATTERN_GRAPH_VERSION; }; @@ -346,7 +346,7 @@ function VersionMismatch(oldVersion) { * @param {object} o The JSON object to read from * @return {PatternGraph} */ -PatternGraph.fromJson = function(o) { +PatternGraph.fromJson = function (o) { if (!PatternGraph.checkVersion(o)) { throw new VersionMismatch(o.version); } @@ -360,7 +360,7 @@ PatternGraph.fromJson = function(o) { * @param {string} [fileName='dependencyGraph.json'] Name of the graph file * @return {string} */ -PatternGraph.resolveJsonGraphFile = function( +PatternGraph.resolveJsonGraphFile = function ( filePath = process.cwd(), fileName = 'dependencyGraph.json' ) { @@ -377,7 +377,7 @@ PatternGraph.resolveJsonGraphFile = function( * @see {@link PatternGraph.fromJson} * @see {@link PatternGraph.resolveJsonGraphFile} */ -PatternGraph.loadFromFile = function(filePath, fileName) { +PatternGraph.loadFromFile = function (filePath, fileName) { const jsonGraphFile = this.resolveJsonGraphFile(filePath, fileName); // File is fresh, so simply construct an empty graph in memory @@ -399,7 +399,7 @@ PatternGraph.loadFromFile = function(filePath, fileName) { * * @see {@link PatternGraph.resolveJsonGraphFile} */ -PatternGraph.storeToFile = function(patternlab) { +PatternGraph.storeToFile = function (patternlab) { if (process.env.PATTERNLAB_ENV === 'CI') { return; } @@ -413,7 +413,7 @@ PatternGraph.storeToFile = function(patternlab) { * @param patternlab @ @param {string} fileName Output filename */ -PatternGraph.exportToDot = function(patternlab, fileName) { +PatternGraph.exportToDot = function (patternlab, fileName) { const dotFile = this.resolveJsonGraphFile(undefined, fileName); const g = PatternGraphDot.generate(patternlab.graph); fs.outputFileSync(dotFile, g); diff --git a/packages/core/src/lib/pattern_graph_dot.js b/packages/core/src/lib/pattern_graph_dot.js index 14bd7a64f..f4da40e18 100644 --- a/packages/core/src/lib/pattern_graph_dot.js +++ b/packages/core/src/lib/pattern_graph_dot.js @@ -23,7 +23,7 @@ function header() { * @param name * @return {string} */ -const niceKey = function(name) { +const niceKey = function (name) { return 'O' + name.replace('-', ''); }; @@ -84,7 +84,7 @@ const PatternGraphDot = {}; * @param patternGraph * @return {string} */ -PatternGraphDot.generate = function(patternGraph) { +PatternGraphDot.generate = function (patternGraph) { const g = patternGraph.graph; const patterns = patternGraph.patterns; const buckets = new Map(); diff --git a/packages/core/src/lib/pattern_registry.js b/packages/core/src/lib/pattern_registry.js index 95145234c..041cb109e 100644 --- a/packages/core/src/lib/pattern_registry.js +++ b/packages/core/src/lib/pattern_registry.js @@ -4,7 +4,7 @@ * Allows lookups for patterns via a central registry. * @constructor */ -const PatternRegistry = function() { +const PatternRegistry = function () { this.key2pattern = new Map(); /** For lookups by {@link Pattern#partialKey} */ @@ -12,15 +12,15 @@ const PatternRegistry = function() { }; PatternRegistry.prototype = { - allPatterns: function() { + allPatterns: function () { return Array.from(this.key2pattern.values()); }, - has: function(name) { + has: function (name) { return this.key2pattern.has(name); }, - get: function(name) { + get: function (name) { return this.key2pattern.get(name); }, @@ -28,18 +28,18 @@ PatternRegistry.prototype = { * Adds the given pattern to the registry. If a pattern with the same key exists, it is replaced. * @param pattern {Pattern|*} */ - put: function(pattern) { + put: function (pattern) { const name = PatternRegistry.partialName(pattern); this.partials.set(name, pattern); const key = PatternRegistry.patternKey(pattern); this.key2pattern.set(key, pattern); }, - remove: function(name) { + remove: function (name) { this.key2pattern.delete(name); }, - getPartial: function(partialName) { + getPartial: function (partialName) { /* Code in here has been moved from getPartial() to prepare for some refactoring. There are a few advantages to this method: @@ -83,7 +83,7 @@ PatternRegistry.prototype = { }, }; -PatternRegistry.patternKey = function(pattern) { +PatternRegistry.patternKey = function (pattern) { return pattern.relPath; }; @@ -93,7 +93,7 @@ PatternRegistry.patternKey = function(pattern) { * @param pattern {Pattern} * @return {string} */ -PatternRegistry.partialName = function(pattern) { +PatternRegistry.partialName = function (pattern) { return pattern.patternPartial; }; diff --git a/packages/core/src/lib/patternlab.js b/packages/core/src/lib/patternlab.js index ce0be9ca6..405da4fc9 100644 --- a/packages/core/src/lib/patternlab.js +++ b/packages/core/src/lib/patternlab.js @@ -215,10 +215,10 @@ module.exports = class PatternLab { } writePatternFiles(headHTML, pattern, footerHTML, outputBasePath) { - const nullFormatter = str => str; - const defaultFormatter = codeString => + const nullFormatter = (str) => str; + const defaultFormatter = (codeString) => cleanHtml(codeString, { indent_size: 2 }); - const makePath = type => + const makePath = (type) => path.join( this.config.paths.public.patterns, pattern.getPatternLink(this, type) @@ -258,7 +258,7 @@ module.exports = class PatternLab { ); //write the compiled template to the public patterns directory - outputFiles.forEach(outFile => + outputFiles.forEach((outFile) => fs.outputFileSync( path.join(process.cwd(), outputBasePath, outFile.path), outFile.content @@ -274,22 +274,22 @@ module.exports = class PatternLab { */ registerLogger(logLevel) { if (logLevel === undefined) { - logger.log.on('info', msg => console.info(msg)); - logger.log.on('warning', msg => console.info(msg)); - logger.log.on('error', msg => console.info(msg)); + logger.log.on('info', (msg) => console.info(msg)); + logger.log.on('warning', (msg) => console.info(msg)); + logger.log.on('error', (msg) => console.info(msg)); } else { if (logLevel === 'quiet') { return; } switch (logLevel) { case 'debug': - logger.log.on('debug', msg => console.info(msg)); + logger.log.on('debug', (msg) => console.info(msg)); case 'info': - logger.log.on('info', msg => console.info(msg)); + logger.log.on('info', (msg) => console.info(msg)); case 'warning': - logger.log.on('warning', msg => console.info(msg)); + logger.log.on('warning', (msg) => console.info(msg)); case 'error': - logger.log.on('error', msg => console.info(msg)); + logger.log.on('error', (msg) => console.info(msg)); } } } @@ -312,7 +312,7 @@ module.exports = class PatternLab { // deleted pattern would still be present in the patterns array this.patterns = []; - const promiseAllPatternFiles = new Promise(function(resolve) { + const promiseAllPatternFiles = new Promise(function (resolve) { dive( patterns_dir, (err, file) => { @@ -338,7 +338,7 @@ module.exports = class PatternLab { }); return promiseAllPatternFiles.then(() => { return Promise.all( - this.patterns.map(pattern => { + this.patterns.map((pattern) => { return processIterative(pattern, self); }) ).then(() => { @@ -353,7 +353,7 @@ module.exports = class PatternLab { processAllPatternsRecursive(patterns_dir) { const self = this; - const promiseAllPatternFiles = new Promise(function(resolve) { + const promiseAllPatternFiles = new Promise(function (resolve) { dive( patterns_dir, (err, file) => { diff --git a/packages/core/src/lib/plugin_manager.js b/packages/core/src/lib/plugin_manager.js index aabaf965e..f79307beb 100644 --- a/packages/core/src/lib/plugin_manager.js +++ b/packages/core/src/lib/plugin_manager.js @@ -1,6 +1,6 @@ 'use strict'; -const plugin_manager = function() { +const plugin_manager = function () { const logger = require('./log'); /** @@ -9,7 +9,7 @@ const plugin_manager = function() { */ function initializePlugins(patternlab) { const foundPlugins = Object.keys(patternlab.config.plugins || {}); - foundPlugins.forEach(plugin => { + foundPlugins.forEach((plugin) => { logger.info(`Found plugin: ${plugin}`); logger.info(`Attempting to load and initialize plugin.`); const pluginModule = require(plugin); @@ -19,8 +19,8 @@ const plugin_manager = function() { async function raiseEvent(patternlab, eventName, args) { patternlab.events.emit(eventName, args); - await (async function() { - const hookHandlers = (patternlab.hooks[eventName] || []).map(h => + await (async function () { + const hookHandlers = (patternlab.hooks[eventName] || []).map((h) => h(args) ); @@ -29,7 +29,7 @@ const plugin_manager = function() { } return { - intialize_plugins: patternlab => { + intialize_plugins: (patternlab) => { initializePlugins(patternlab); }, raiseEvent: async (patternlab, eventName, ...args) => { diff --git a/packages/core/src/lib/processIterative.js b/packages/core/src/lib/processIterative.js index 1c65c85ca..e2433b1c8 100644 --- a/packages/core/src/lib/processIterative.js +++ b/packages/core/src/lib/processIterative.js @@ -5,7 +5,7 @@ const pph = require('./pseudopattern_hunter'); // This is now solely for analysis; loading of the pattern file is // above, in loadPatternIterative() -module.exports = function(pattern, patternlab) { +module.exports = function (pattern, patternlab) { //look for a pseudo pattern by checking if there is a file //containing same name, with ~ in it, ending in .json return pph diff --git a/packages/core/src/lib/processMetaPattern.js b/packages/core/src/lib/processMetaPattern.js index f793a103a..dea8fbe70 100644 --- a/packages/core/src/lib/processMetaPattern.js +++ b/packages/core/src/lib/processMetaPattern.js @@ -9,7 +9,7 @@ const logger = require('./log'); //this may be mocked in unit tests, so let it be overridden let fs = require('fs-extra'); // eslint-disable-line -module.exports = function(fileName, metaType, patternlab) { +module.exports = function (fileName, metaType, patternlab) { const metaPath = path.resolve(patternlab.config.paths.source.meta, fileName); const metaPattern = new Pattern(metaPath, null, patternlab); metaPattern.template = fs.readFileSync(metaPath, 'utf8'); @@ -19,7 +19,7 @@ module.exports = function(fileName, metaType, patternlab) { .then(() => { patternlab[metaType] = metaPattern; }) - .catch(reason => { + .catch((reason) => { logger.warning( `Could not find the user-editable template ${fileName}, currently configured to be at ${patternlab.config.paths.source.meta}. Your configured path may be incorrect (check paths.source.meta in your config file), the file may have been deleted, or it may have been left in the wrong place during a migration or update.` ); diff --git a/packages/core/src/lib/processRecursive.js b/packages/core/src/lib/processRecursive.js index 97c4ac560..3c541c85c 100644 --- a/packages/core/src/lib/processRecursive.js +++ b/packages/core/src/lib/processRecursive.js @@ -4,7 +4,7 @@ const logger = require('./log'); const decompose = require('./decompose'); const getPartial = require('./get'); -module.exports = function(file, patternlab) { +module.exports = function (file, patternlab) { //find current pattern in patternlab object using file as a partial const currentPattern = getPartial(file, patternlab, false); @@ -19,7 +19,7 @@ module.exports = function(file, patternlab) { } //call our helper method to actually unravel the pattern with any partials - return decompose(currentPattern, patternlab).catch(reason => { + return decompose(currentPattern, patternlab).catch((reason) => { console.log(reason); logger.error(reason); }); diff --git a/packages/core/src/lib/pseudopattern_hunter.js b/packages/core/src/lib/pseudopattern_hunter.js index 1d1ee92a3..1f3a9f530 100644 --- a/packages/core/src/lib/pseudopattern_hunter.js +++ b/packages/core/src/lib/pseudopattern_hunter.js @@ -15,9 +15,9 @@ const changes_hunter = new ch(); const yaml = require('js-yaml'); const dataMerger = require('./dataMerger'); -const pseudopattern_hunter = function() {}; +const pseudopattern_hunter = function () {}; -pseudopattern_hunter.prototype.find_pseudopatterns = function( +pseudopattern_hunter.prototype.find_pseudopatterns = function ( currentPattern, patternlab ) { @@ -70,10 +70,7 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function( const variantName = pseudoPatterns[i] .substring(pseudoPatterns[i].indexOf('~') + 1) .split('.')[0]; - const variantExtension = pseudoPatterns[i] - .split('.') - .slice(-1) - .pop(); + const variantExtension = pseudoPatterns[i].split('.').slice(-1).pop(); const variantFilePath = path.join( currentPattern.subdir, currentPattern.fileName + '~' + variantName + '.' + variantExtension diff --git a/packages/core/src/lib/readDocumentation.js b/packages/core/src/lib/readDocumentation.js index d17364d61..efb6f6cd9 100644 --- a/packages/core/src/lib/readDocumentation.js +++ b/packages/core/src/lib/readDocumentation.js @@ -14,7 +14,7 @@ const markdown_parser = new mp(); const FILE_EXTENSION = '.md'; const GROUP_DOC_PREFIX = '_'; -module.exports = function(pattern, patternlab, isVariant) { +module.exports = function (pattern, patternlab, isVariant) { try { const markdownFileName = path.resolve( patternlab.config.paths.source.patterns, diff --git a/packages/core/src/lib/render.js b/packages/core/src/lib/render.js index 3ba1f2589..b73d5369f 100644 --- a/packages/core/src/lib/render.js +++ b/packages/core/src/lib/render.js @@ -2,7 +2,7 @@ const logger = require('./log'); -module.exports = function(pattern, data, partials) { +module.exports = function (pattern, data, partials) { logger.debug( `render: ${ pattern.patternPartial !== '-.' diff --git a/packages/core/src/lib/replaceParameter.js b/packages/core/src/lib/replaceParameter.js index 7b0cd6734..b045b58b2 100644 --- a/packages/core/src/lib/replaceParameter.js +++ b/packages/core/src/lib/replaceParameter.js @@ -2,7 +2,7 @@ const logger = require('./log'); -module.exports = function(template, prop, data) { +module.exports = function (template, prop, data) { let t = template; const valueRE = new RegExp(`{{{?\\s*[${prop}]+\\s*}?}}`); diff --git a/packages/core/src/lib/resolver.js b/packages/core/src/lib/resolver.js index ae0bc9fee..d70961413 100644 --- a/packages/core/src/lib/resolver.js +++ b/packages/core/src/lib/resolver.js @@ -34,7 +34,7 @@ const resolveFileInPackage = (packageName, ...pathElements) => { * @func resolvePackageFolder * Resolves the location of a package on disc */ -const resolvePackageFolder = packageName => { +const resolvePackageFolder = (packageName) => { return path.dirname(resolveFileInPackage(packageName, 'package.json')); }; diff --git a/packages/core/src/lib/server.js b/packages/core/src/lib/server.js index c55e2c4ab..3f71e1bba 100644 --- a/packages/core/src/lib/server.js +++ b/packages/core/src/lib/server.js @@ -6,7 +6,7 @@ const liveServer = require('@pattern-lab/live-server'); const events = require('./events'); const logger = require('./log'); -const server = patternlab => { +const server = (patternlab) => { const _module = { serve: () => { let serverReady = false; @@ -20,7 +20,7 @@ const server = patternlab => { port: 3000, }; - const servers = Object.keys(patternlab.uikits).map(kit => { + const servers = Object.keys(patternlab.uikits).map((kit) => { const uikit = patternlab.uikits[kit]; defaults.root = path.resolve( path.join( @@ -104,7 +104,7 @@ const server = patternlab => { return Promise.all(servers); }, - reload: data => { + reload: (data) => { const _data = data || { file: '', action: '', diff --git a/packages/core/src/lib/starterkit_manager.js b/packages/core/src/lib/starterkit_manager.js index f355a8f55..737aadd9a 100644 --- a/packages/core/src/lib/starterkit_manager.js +++ b/packages/core/src/lib/starterkit_manager.js @@ -1,6 +1,6 @@ 'use strict'; -const starterkit_manager = function(config) { +const starterkit_manager = function (config) { const path = require('path'); const fetch = require('node-fetch'); const fs = require('fs-extra'); @@ -78,7 +78,7 @@ const starterkit_manager = function(config) { }, } ) - .then(function(res) { + .then(function (res) { const contentType = res.headers.get('content-type'); if (contentType && contentType.indexOf('application/json') === -1) { throw new TypeError( @@ -87,15 +87,15 @@ const starterkit_manager = function(config) { } return res.json(); }) - .then(function(json) { + .then(function (json) { if (!json.items || !Array.isArray(json.items)) { return false; } - return json.items.map(function(repo) { + return json.items.map(function (repo) { return { name: repo.name, url: repo.html_url }; }); }) - .catch(function(err) { + .catch(function (err) { logger.error(err); return false; }); @@ -111,27 +111,29 @@ const starterkit_manager = function(config) { //TODO review for deletion or convert callers to use findModules() function detectStarterKits() { const node_modules_path = path.join(process.cwd(), 'node_modules'); - const npm_modules = fs.readdirSync(node_modules_path).filter(function(dir) { - const module_path = path.join(process.cwd(), 'node_modules', dir); - return ( - fs.statSync(module_path).isDirectory() && - dir.indexOf('starterkit-') === 0 - ); - }); + const npm_modules = fs + .readdirSync(node_modules_path) + .filter(function (dir) { + const module_path = path.join(process.cwd(), 'node_modules', dir); + return ( + fs.statSync(module_path).isDirectory() && + dir.indexOf('starterkit-') === 0 + ); + }); return npm_modules; } return { - load_starterkit: function(starterkitName, clean) { + load_starterkit: function (starterkitName, clean) { loadStarterKit(starterkitName, clean); }, - list_starterkits: function() { + list_starterkits: function () { return listStarterkits(); }, - pack_starterkit: function() { + pack_starterkit: function () { packStarterkit(); }, - detect_starterkits: function() { + detect_starterkits: function () { return detectStarterKits(); }, }; diff --git a/packages/core/src/lib/style_modifier_hunter.js b/packages/core/src/lib/style_modifier_hunter.js index 13a7ff2d1..bd62c773a 100644 --- a/packages/core/src/lib/style_modifier_hunter.js +++ b/packages/core/src/lib/style_modifier_hunter.js @@ -2,7 +2,7 @@ const logger = require('./log'); -const style_modifier_hunter = function() { +const style_modifier_hunter = function () { /** * Modifies a patterns partial with any styleModifiers found on the supplied partial * @@ -36,7 +36,7 @@ const style_modifier_hunter = function() { } return { - consume_style_modifier: function(pattern, partial, patternlab) { + consume_style_modifier: function (pattern, partial, patternlab) { consumestylemodifier(pattern, partial, patternlab); }, }; diff --git a/packages/core/src/lib/ui_builder.js b/packages/core/src/lib/ui_builder.js index 1d20fd218..c994f724b 100644 --- a/packages/core/src/lib/ui_builder.js +++ b/packages/core/src/lib/ui_builder.js @@ -13,7 +13,7 @@ let fs = require('fs-extra'); //eslint-disable-line prefer-const let buildFooter = require('./buildFooter'); //eslint-disable-line prefer-const let exportData = require('./exportData'); //eslint-disable-line prefer-const -const ui_builder = function() { +const ui_builder = function () { /** * Registers the pattern to the patternPaths object for the appropriate patternGroup and basename * patternGroup + patternBaseName are what comprise the patternPartial (atoms-colors) @@ -361,7 +361,7 @@ const ui_builder = function() { patternGroups: {}, }; - _.forEach(patternlab.patterns, function(pattern) { + _.forEach(patternlab.patterns, function (pattern) { // ignore patterns we can omit from rendering directly pattern.omitFromStyleguide = isPatternExcluded( pattern, @@ -432,7 +432,8 @@ const ui_builder = function() { function getFlatPatternItems(patternlab, patternGroup) { const patterns = _.filter( patternlab.patterns, - pattern => pattern.patternGroup === patternGroup && pattern.isFlatPattern + (pattern) => + pattern.patternGroup === patternGroup && pattern.isFlatPattern ); if (patterns) { return getSortedPatterns(patterns); @@ -462,7 +463,7 @@ const ui_builder = function() { patternSection: uikit.patternSection, patternSectionSubgroup: uikit.patternSectionSubgroup, } - ).catch(reason => { + ).catch((reason) => { console.log(reason); logger.error('Error building buildViewAllHTML'); }); @@ -482,15 +483,15 @@ const ui_builder = function() { patternlab ) { return _.sortBy(_.values(patternGroup), [ - pSubgroup => { + (pSubgroup) => { const group = patternlab.patternGroups.find( - g => g.patternGroup === patternGroupName + (g) => g.patternGroup === patternGroupName ); if (group) { - const sg = group.patternGroupItems.find(item => { + const sg = group.patternGroupItems.find((item) => { const firstPattern = _.first( - _.values(pSubgroup).filter(p => p.patternBaseName !== '.') + _.values(pSubgroup).filter((p) => p.patternBaseName !== '.') ); return ( item && @@ -526,7 +527,7 @@ const ui_builder = function() { // loop through the grouped styleguide patterns, building at each level const allPatternGroupPromises = _.map( patternlab.patternGroups, - patternGroup => { + (patternGroup) => { const patternGroupName = patternGroup.patternGroup; const group = styleguidePatterns.patternGroups[patternGroupName]; let groupedPatterns = []; @@ -542,7 +543,7 @@ const ui_builder = function() { let p; const samplePattern = _.find( patternSubgroups, - st => !st.patternPartial.startsWith('viewall-') + (st) => !st.patternPartial.startsWith('viewall-') ); const patternName = Object.keys( _.values(originalPatternGroup)[patternSubgroup] @@ -560,14 +561,14 @@ const ui_builder = function() { // render the footer needed for the viewall template return buildFooter(patternlab, `viewall-${patternPartial}`, uikit) - .then(footerHTML => { + .then((footerHTML) => { // render the viewall template by finding these smallest subgroup-grouped patterns const subgroupPatterns = getSortedPatterns( _.values(patternSubgroups) ); // determine if we should write at this time by checking if these are flat patterns or grouped patterns - p = _.find(subgroupPatterns, function(pat) { + p = _.find(subgroupPatterns, function (pat) { return pat.isDocPattern; }); @@ -577,7 +578,8 @@ const ui_builder = function() { styleGuideExcludes.length && _.some( styleGuideExcludes, - exclude => exclude === `${patternGroupName}/${patternName}` + (exclude) => + exclude === `${patternGroupName}/${patternName}` ); if (omitPatternGroup) { logger.debug( @@ -598,7 +600,7 @@ const ui_builder = function() { patternPartial, uikit ) - .then(viewAllHTML => { + .then((viewAllHTML) => { return fs.outputFile( path.join( process.cwd(), @@ -611,12 +613,12 @@ const ui_builder = function() { mainPageHeadHtml + viewAllHTML + footerHTML ); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error building ViewAllHTML'); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error building footer HTML'); }); @@ -634,7 +636,7 @@ const ui_builder = function() { `viewall-${patternGroupName}-all`, uikit ) - .then(footerHTML => { + .then((footerHTML) => { const sortedFlatPatterns = getFlatPatternItems( patternlab, patternGroupName @@ -646,9 +648,12 @@ const ui_builder = function() { } // get the appropriate patternGroup - const anyPatternOfType = _.find(groupedPatterns, function(pat) { - return pat.patternGroup && pat.patternGroup !== ''; - }); + const anyPatternOfType = _.find( + groupedPatterns, + function (pat) { + return pat.patternGroup && pat.patternGroup !== ''; + } + ); if (!anyPatternOfType || !groupedPatterns.length) { logger.debug( @@ -664,7 +669,7 @@ const ui_builder = function() { patternGroupName, uikit ) - .then(viewAllHTML => { + .then((viewAllHTML) => { fs.outputFileSync( path.join( process.cwd(), @@ -681,7 +686,7 @@ const ui_builder = function() { const omitPatternGroup = styleGuideExcludes && styleGuideExcludes.length && - _.some(styleGuideExcludes, function(exclude) { + _.some(styleGuideExcludes, function (exclude) { return exclude === patternGroupName; }); if (omitPatternGroup) { @@ -698,17 +703,17 @@ const ui_builder = function() { } return Promise.resolve(patterns); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error building ViewAllHTML'); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error building footerHTML'); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error during buildViewAllPages'); }); @@ -716,10 +721,10 @@ const ui_builder = function() { ); return Promise.all(allPatternGroupPromises) - .then(allPatterns => - Promise.resolve(_.filter(allPatterns, p => p.length)) + .then((allPatterns) => + Promise.resolve(_.filter(allPatterns, (p) => p.length)) ) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('Error during buildViewAllPages'); }); @@ -746,15 +751,15 @@ const ui_builder = function() { function uniqueAllPatterns(allPatterns, patternlab) { return _.uniq( _.flatMapDeep( - _.map(allPatterns, patterns => [ + _.map(allPatterns, (patterns) => [ injectDocumentationBlock( - _.find(patterns, p => !p.patternPartial.startsWith('viewall-')), + _.find(patterns, (p) => !p.patternPartial.startsWith('viewall-')), patternlab, false ), ...patterns, ]), - pattern => pattern + (pattern) => pattern ) ); } @@ -767,7 +772,7 @@ const ui_builder = function() { function buildFrontend(patternlabGlobal) { const paths = patternlabGlobal.config.paths; - const uikitPromises = _.map(patternlabGlobal.uikits, uikit => { + const uikitPromises = _.map(patternlabGlobal.uikits, (uikit) => { //we need to make sure the patternlab object gets manipulated per uikit const patternlab = Object.assign({}, patternlabGlobal); @@ -775,7 +780,7 @@ const ui_builder = function() { //determine which patterns should be included in the front-end rendering const styleguidePatterns = groupPatterns(patternlab, uikit); - return new Promise(resolve => { + return new Promise((resolve) => { // set the pattern-specific header by compiling the general-header with data, and then adding it to the meta header const headerPromise = render( Pattern.createEmpty({ extendedTemplate: uikit.header }, patternlab), @@ -783,13 +788,13 @@ const ui_builder = function() { cacheBuster: patternlab.cacheBuster, } ) - .then(headerPartial => { + .then((headerPartial) => { const headFootData = patternlab.data; headFootData.patternLabHead = headerPartial; headFootData.cacheBuster = patternlab.cacheBuster; return render(patternlab.userHead, headFootData); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('error during header render()'); }); @@ -802,18 +807,18 @@ const ui_builder = function() { cacheBuster: patternlab.cacheBuster, } ) - .then(footerPartial => { + .then((footerPartial) => { const headFootData = patternlab.data; headFootData.patternLabFoot = footerPartial; return render(patternlab.userFoot, headFootData); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('error during footer render()'); }); return Promise.all([headerPromise, footerPromise]).then( - headFootPromiseResults => { + (headFootPromiseResults) => { // build the viewall pages return buildViewAllPages( @@ -822,7 +827,7 @@ const ui_builder = function() { styleguidePatterns, uikit ) - .then(allPatterns => { + .then((allPatterns) => { // todo track down why we need to make this unique in the first place const uniquePatterns = uniqueAllPatterns( allPatterns, @@ -851,7 +856,7 @@ const ui_builder = function() { patternSectionSubgroup: uikit.patternSectionSubgroup, } ) - .then(styleguideHtml => { + .then((styleguideHtml) => { fs.outputFileSync( path.resolve( path.join( @@ -902,12 +907,12 @@ const ui_builder = function() { exportData(patternlab, uikit); resolve(); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('error during buildFrontend()'); }); }) - .catch(reason => { + .catch((reason) => { console.log(reason); logger.error('error during buildViewAllPages()'); }); diff --git a/packages/core/src/lib/watchAssets.js b/packages/core/src/lib/watchAssets.js index f087b8a28..6f07626e7 100644 --- a/packages/core/src/lib/watchAssets.js +++ b/packages/core/src/lib/watchAssets.js @@ -10,7 +10,7 @@ let copyFile = require('./copyFile'); // eslint-disable-line prefer-const function onWatchTripped(patternlab, p, assetBase, basePath, dir, copyOptions) { const subPath = p.replace(assetBase, ''); - _.each(patternlab.uikits, uikit => { + _.each(patternlab.uikits, (uikit) => { const destination = path.resolve( basePath, uikit.outputDir, @@ -57,10 +57,10 @@ const watchAssets = ( //watch for changes and copy assetWatcher - .on('add', p => { + .on('add', (p) => { onWatchTripped(patternlab, p, assetBase, basePath, dir, copyOptions); }) - .on('change', p => { + .on('change', (p) => { onWatchTripped(patternlab, p, assetBase, basePath, dir, copyOptions); }); diff --git a/packages/core/src/lib/watchPatternLabFiles.js b/packages/core/src/lib/watchPatternLabFiles.js index 6af0bcbb8..c2eb681ab 100644 --- a/packages/core/src/lib/watchPatternLabFiles.js +++ b/packages/core/src/lib/watchPatternLabFiles.js @@ -20,11 +20,11 @@ const watchPatternLabFiles = ( assetDirectories.source.data, assetDirectories.source.meta, ]; - const globalPaths = globalSources.map(globalSource => + const globalPaths = globalSources.map((globalSource) => path.join(path.resolve(basePath, globalSource), '*') ); - _.each(globalPaths, globalPath => { + _.each(globalPaths, (globalPath) => { logger.debug(`Pattern Lab is watching ${globalPath} for changes!`); if (patternlab.watchers[globalPath]) { @@ -43,7 +43,7 @@ const watchPatternLabFiles = ( //watch for changes and rebuild globalWatcher - .on('addDir', async p => { + .on('addDir', async (p) => { await pluginMananger.raiseEvent( patternlab, events.PATTERNLAB_GLOBAL_CHANGE, @@ -52,7 +52,7 @@ const watchPatternLabFiles = ( } ); }) - .on('add', async p => { + .on('add', async (p) => { await pluginMananger.raiseEvent( patternlab, events.PATTERNLAB_GLOBAL_CHANGE, @@ -61,7 +61,7 @@ const watchPatternLabFiles = ( } ); }) - .on('change', async p => { + .on('change', async (p) => { await pluginMananger.raiseEvent( patternlab, events.PATTERNLAB_GLOBAL_CHANGE, @@ -78,13 +78,13 @@ const watchPatternLabFiles = ( const baseFileExtensions = ['.json', '.yml', '.yaml', '.md']; const patternWatches = baseFileExtensions .concat(patternlab.engines.getSupportedFileExtensions()) - .map(dotExtension => + .map((dotExtension) => path.join( path.resolve(basePath, assetDirectories.source.patterns), `/**/*${dotExtension}` ) ); - _.each(patternWatches, patternWatchPath => { + _.each(patternWatches, (patternWatchPath) => { logger.debug( `Pattern Lab is watching ${patternWatchPath} for changes - local!` ); @@ -105,7 +105,7 @@ const watchPatternLabFiles = ( //watch for changes and rebuild patternWatcher - .on('addDir', async p => { + .on('addDir', async (p) => { await pluginMananger.raiseEvent( patternlab, events.PATTERNLAB_PATTERN_CHANGE, @@ -114,7 +114,7 @@ const watchPatternLabFiles = ( } ); }) - .on('add', async p => { + .on('add', async (p) => { await pluginMananger.raiseEvent( patternlab, events.PATTERNLAB_PATTERN_CHANGE, @@ -123,7 +123,7 @@ const watchPatternLabFiles = ( } ); }) - .on('change', async p => { + .on('change', async (p) => { await pluginMananger.raiseEvent( patternlab, events.PATTERNLAB_PATTERN_CHANGE, @@ -134,7 +134,7 @@ const watchPatternLabFiles = ( }) // the watcher does not react on unlink and unlinkDir // events, so patterns are never removed - .on('unlink', async p => { + .on('unlink', async (p) => { patternlab.graph.sync(); patternlab.graph.upgradeVersion(); await pluginMananger.raiseEvent( @@ -145,7 +145,7 @@ const watchPatternLabFiles = ( } ); }) - .on('unlinkDir', async p => { + .on('unlinkDir', async (p) => { patternlab.graph.sync(); patternlab.graph.upgradeVersion(); await pluginMananger.raiseEvent( diff --git a/packages/docs/package.json b/packages/docs/package.json index 56edcd1f3..a15387616 100755 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -23,7 +23,7 @@ "chokidar-cli": "^2.1.0", "cross-env": "^5.2.0", "make-dir-cli": "^2.0.0", - "prettier": "^1.18.2", + "prettier": "^2.2.1", "rollup": "^1.16.1", "rollup-plugin-commonjs": "^10.0.0", "rollup-plugin-json": "^4.0.0", diff --git a/packages/engine-twig/lib/engine_twig.js b/packages/engine-twig/lib/engine_twig.js index e2c31c7a3..31a0c9f27 100644 --- a/packages/engine-twig/lib/engine_twig.js +++ b/packages/engine-twig/lib/engine_twig.js @@ -151,7 +151,7 @@ var engine_twig = { var matches = pattern.template.match(this.findPartialsRE); return matches; }, - findPartialsWithStyleModifiers: function() { + findPartialsWithStyleModifiers: function () { // TODO: make the call to this from oPattern objects conditional on their // being implemented here. return []; @@ -159,26 +159,26 @@ var engine_twig = { // returns any patterns that match {{> value(foo:"bar") }} or {{> // value:mod(foo:"bar") }} within the pattern - findPartialsWithPatternParameters: function() { + findPartialsWithPatternParameters: function () { // TODO: make the call to this from oPattern objects conditional on their // being implemented here. return []; }, - findListItems: function(pattern) { + findListItems: function (pattern) { var matches = pattern.template.match(this.findListItemsRE); return matches; }, // given a pattern, and a partial string, tease out the "pattern key" and // return it. - findPartial: function(partialString) { + findPartial: function (partialString) { var partial = partialString.match(this.findPartialKeyRE)[0]; partial = partial.replace(/"/g, ''); return partial; }, - spawnFile: function(config, fileName) { + spawnFile: function (config, fileName) { const paths = config.paths; const metaFilePath = path.resolve(paths.source.meta, fileName); try { @@ -200,7 +200,7 @@ var engine_twig = { * @param {object} config - the global config object from core, since we won't * assume it's already present */ - spawnMeta: function(config) { + spawnMeta: function (config) { this.spawnFile(config, '_head.twig'); this.spawnFile(config, '_foot.twig'); }, @@ -211,7 +211,7 @@ var engine_twig = { * * @param {object} config - the global config object from core */ - usePatternLabConfig: function(config) { + usePatternLabConfig: function (config) { metaPath = path.resolve(config.paths.source.meta); // Global paths fileSystemLoader.addPath(config.paths.source.meta); @@ -223,7 +223,7 @@ var engine_twig = { config['engines']['twig']['namespaces'] ) { var namespaces = config['engines']['twig']['namespaces']; - Object.keys(namespaces).forEach(function(key, index) { + Object.keys(namespaces).forEach(function (key, index) { fileSystemLoader.addPath(namespaces[key], key); }); } diff --git a/yarn.lock b/yarn.lock index 61a806657..97cdf2745 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2185,7 +2185,7 @@ resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-1.26.2.tgz#656c24c1af3d41b8854700dc94ed556b9b6ce2f8" integrity sha512-2pvzy4LuxBMBBLAbml6PDcJPiIeZQ0Hqj3PE31IxkNI250qeoRMDovTrHXeDkIL4auvtarSdpTkLHs+st43EYQ== -"@types/minimatch@*": +"@types/minimatch@*", "@types/minimatch@^3.0.3": version "3.0.4" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21" integrity sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA== @@ -2926,6 +2926,11 @@ array-differ@^2.0.3: resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" integrity sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w== +array-differ@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b" + integrity sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg== + array-each@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" @@ -2974,6 +2979,11 @@ array-union@^1.0.1, array-union@^1.0.2: dependencies: array-uniq "^1.0.1" +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + array-uniq@^1.0.1, array-uniq@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" @@ -4366,11 +4376,6 @@ chrome-trace-event@^1.0.2: dependencies: tslib "^1.9.0" -ci-info@^1.5.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.6.0.tgz#2ca20dbb9ceb32d4524a683303313f0304b1e497" - integrity sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A== - ci-info@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" @@ -5425,7 +5430,7 @@ cross-spawn@^4: lru-cache "^4.0.1" which "^1.2.9" -cross-spawn@^5.0.1, cross-spawn@^5.1.0: +cross-spawn@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= @@ -6996,19 +7001,6 @@ execa@4.0.3: signal-exit "^3.0.2" strip-final-newline "^2.0.0" -execa@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" - integrity sha1-2NdrvBtVIX7RkP1t1J08d07PyNo= - dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" - is-stream "^1.1.0" - npm-run-path "^2.0.0" - p-finally "^1.0.0" - signal-exit "^3.0.0" - strip-eof "^1.0.0" - execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" @@ -9016,14 +9008,10 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@0.14.3: - version "0.14.3" - resolved "https://registry.yarnpkg.com/husky/-/husky-0.14.3.tgz#c69ed74e2d2779769a17ba8399b54ce0b63c12c3" - integrity sha512-e21wivqHpstpoiWA/Yi8eFti8E+sQDSS53cpJsPptPs295QTOQR0ZwnHo2TXy1XOpZFD9rPOd3NpmqTK6uMLJA== - dependencies: - is-ci "^1.0.10" - normalize-path "^1.0.0" - strip-indent "^2.0.0" +husky@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e" + integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ== iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.19, iconv-lite@^0.4.24: version "0.4.24" @@ -9068,7 +9056,7 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.3, ignore@^3.3.5, ignore@^3.3.7: +ignore@^3.3.3, ignore@^3.3.5: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== @@ -9078,6 +9066,11 @@ ignore@^4.0.3, ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== +ignore@^5.1.4: + version "5.1.8" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57" + integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw== + image-size@^0.5.1: version "0.5.5" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" @@ -9495,13 +9488,6 @@ is-callable@^1.1.4, is-callable@^1.2.3: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== -is-ci@^1.0.10: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" - integrity sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg== - dependencies: - ci-info "^1.5.0" - is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" @@ -11845,7 +11831,7 @@ move-concurrently@^1.0.1: rimraf "^2.5.4" run-queue "^1.0.3" -mri@^1.1.0: +mri@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.6.tgz#49952e1044db21dbf90f6cd92bc9c9a777d415a6" integrity sha512-oi1b3MfbyGa7FJMP9GmLTttni5JoICpYBRlq+x5V16fZbLsnL9N3wFqqIm/nIG43FjUFkFh9Epzp/kzUGUnJxQ== @@ -11880,6 +11866,17 @@ multimatch@^3.0.0: arrify "^1.0.1" minimatch "^3.0.4" +multimatch@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3" + integrity sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ== + dependencies: + "@types/minimatch" "^3.0.3" + array-differ "^3.0.0" + array-union "^2.1.0" + arrify "^2.0.1" + minimatch "^3.0.4" + multipipe@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-0.1.2.tgz#2a8f2ddf70eed564dff2d57f1e1a137d9f05078b" @@ -12194,11 +12191,6 @@ normalize-package-data@^3.0.0: semver "^7.3.4" validate-npm-package-license "^3.0.1" -normalize-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-1.0.0.tgz#32d0e472f91ff345701c15a8311018d3b0a90379" - integrity sha1-MtDkcvkf80VwHBWoMRAY07CpA3k= - normalize-path@^2.0.0, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -13658,15 +13650,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@1.11.1: - version "1.11.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.11.1.tgz#61e43fc4cd44e68f2b0dfc2c38cd4bb0fccdcc75" - integrity sha512-T/KD65Ot0PB97xTrG8afQ46x3oiVhnfGjGESSI9NWYcG92+OUPZKkwHqGWXH2t9jK1crnQjubECW0FuOth+hxw== - -prettier@^1.14.3, prettier@^1.18.2: - version "1.19.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" - integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== +prettier@2.2.1, prettier@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" + integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== pretty-error@^2.0.2, pretty-error@^2.1.1: version "2.1.2" @@ -13700,17 +13687,17 @@ pretty-ms@^7.0.0: dependencies: parse-ms "^2.1.0" -pretty-quick@^1.11.1: - version "1.11.1" - resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.11.1.tgz#462ffa2b93d24c05b7a0c3a001e08601a0c55ee4" - integrity sha512-kSXCkcETfak7EQXz6WOkCeCqpbC4GIzrN/vaneTGMP/fAtD8NerA9bPhCUqHAks1geo7biZNl5uEMPceeneLuA== +pretty-quick@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-3.1.0.tgz#cb172e9086deb57455dea7c7e8f136cd0a4aef6c" + integrity sha512-DtxIxksaUWCgPFN7E1ZZk4+Aav3CCuRdhrDSFZENb404sYMtuo9Zka823F+Mgeyt8Zt3bUiCjFzzWYE9LYqkmQ== dependencies: - chalk "^2.3.0" - execa "^0.8.0" - find-up "^2.1.0" - ignore "^3.3.7" - mri "^1.1.0" - multimatch "^3.0.0" + chalk "^3.0.0" + execa "^4.0.0" + find-up "^4.1.0" + ignore "^5.1.4" + mri "^1.1.5" + multimatch "^4.0.0" pretty-time@^1.1.0: version "1.1.0"