markdown-magic
Advanced tools
Comparing version 0.1.9 to 0.1.10
11
cli.js
@@ -13,3 +13,4 @@ #!/usr/bin/env node | ||
var callbackFunction = defaultCallback // eslint-disable-line | ||
var ignorePath | ||
var ignorePath // eslint-disable-line | ||
// start commander.js | ||
@@ -31,3 +32,3 @@ program | ||
if (!foundConfig) { | ||
console.log('no config set using empty object') | ||
// console.log('No markdown magic config set using {empty object}') | ||
} | ||
@@ -38,3 +39,2 @@ const configuration = foundConfig || {} | ||
if (path) { | ||
console.log('path', path) | ||
filePaths = path | ||
@@ -50,3 +50,3 @@ } | ||
// exact node_module match. Ignore entire DIR | ||
return `!node_modules/**` | ||
return '!node_modules/**' | ||
} | ||
@@ -74,2 +74,3 @@ if (!fp.match(/^!/)) { | ||
// console.log('callbackFunction', callbackFunction) | ||
console.log('Starting markdown-magic', filePaths) | ||
markdownMagic(filePaths, configuration, callbackFunction) | ||
@@ -82,3 +83,3 @@ | ||
if (msg) { | ||
console.log('files processed') | ||
console.log('Files processed. markdown-magic Finished! ⊂◉‿◉つ') | ||
} | ||
@@ -85,0 +86,0 @@ } |
@@ -28,3 +28,3 @@ const fs = require('fs-extra') | ||
callback && callback('No files matched') | ||
console.log('no files matched pattern', filePaths) | ||
console.log('No files matched pattern', filePaths) | ||
return false | ||
@@ -31,0 +31,0 @@ } |
@@ -8,2 +8,3 @@ const fs = require('fs-extra') | ||
const updateContents = require('./updateContents') | ||
const cwd = process.cwd() | ||
@@ -67,3 +68,3 @@ module.exports = function processFile(filePath, config) { | ||
} | ||
const command = `Transform ${commentMatches[1]}` | ||
const command = `Transform ${commentMatches[1]}` // eslint-disable-line | ||
// console.log(command) | ||
@@ -79,5 +80,11 @@ transformsFound.push({ | ||
const transformsToRun = pluginSortOrder(registeredTransforms, transformsFound) | ||
// console.log('transformsToRun', transformsToRun) | ||
if (mergedConfig.DEBUG) { | ||
console.log('↓ transformsToRun') // eslint-disable-line | ||
console.log(transformsToRun) // eslint-disable-line | ||
} | ||
// run sort | ||
let transformMsg = '' | ||
transformsToRun.forEach((element) => { | ||
transformMsg += ` ⁕ ${element.transform} \n` | ||
// console.log('order', element.transform) | ||
@@ -89,8 +96,2 @@ const newContent = updateContents(element.match, mergedConfig) | ||
// console.log('match', match) | ||
// match.forEach((element) => { | ||
// //console.log('element', element) | ||
// const newContent = updateContents(element, mergedConfig) | ||
// content = content.replace(element, newContent) | ||
// }) | ||
// then write to file | ||
@@ -104,4 +105,9 @@ const fileName = path.basename(filePath) | ||
fs.writeFileSync(outputFilePath, content) | ||
console.log(`${outputFilePath} updated`) // eslint-disable-line | ||
const msg = outputFilePath.replace(cwd, '') | ||
console.log(`✔ ${msg} Updated`) // eslint-disable-line | ||
console.log(` Transforms run`) | ||
console.log(transformMsg) // eslint-disable-line | ||
// set return values | ||
@@ -113,5 +119,10 @@ mergedConfig.outputFilePath = outputFilePath | ||
} | ||
if (mergedConfig.DEBUG) { | ||
console.log(`↓ ${filePath}`) // eslint-disable-line | ||
console.log(`[No match] <!-- ${mergedConfig.matchWord} --> comment found`) // eslint-disable-line | ||
} | ||
// no match return original contents | ||
console.log(`[No match] <!-- ${mergedConfig.matchWord} --> comment found in ${filePath}`) // eslint-disable-line | ||
return mergedConfig | ||
} |
{ | ||
"name": "markdown-magic", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "Automatically update markdown files with content from external sources", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
49985
782