boilersuit
Advanced tools
Comparing version 0.2.10 to 0.2.11
@@ -28,3 +28,3 @@ const colors = require('colors'); // eslint-disable-line | ||
const up = (schemaFile, { quiet = false } = {}) => { | ||
const up = (schemaFile, { quiet = false, force = false } = {}) => { | ||
const schemaBuf = fs.readFileSync(schemaFile).toString(); | ||
@@ -77,5 +77,5 @@ /** Gives us the folder where the schema file lives */ | ||
/** Check for a previous suit file in folder */ | ||
/** Check for a previous suit file in folder - force prevents this check */ | ||
if (fs.existsSync(`./.suit/${dotSuitFolder}/suit.old.json`)) { | ||
if (fs.existsSync(`./.suit/${dotSuitFolder}/suit.old.json`) && !force) { | ||
if ( | ||
@@ -82,0 +82,0 @@ fs.readFileSync(`./.suit/${dotSuitFolder}/suit.old.json`).toString() === |
60
index.js
@@ -9,27 +9,12 @@ #!/usr/bin/env node | ||
program.version('0.2.10'); | ||
program.version('0.2.11'); | ||
program.command('up').action(() => { | ||
gaze(['**/suit.json', '!node_modules/**/*'], (err, watcher) => { | ||
// Resets the console | ||
process.stdout.write('\x1Bc'); | ||
const watchedFiles = Object.keys(watcher.relative()).length; | ||
console.log( | ||
`Watching ${watchedFiles} suit.json ${ | ||
watchedFiles > 1 && watchedFiles !== 0 ? 'files' : 'file' | ||
}...`.yellow, | ||
); | ||
/** This does it the first time */ | ||
Object.entries(watcher.relative()).forEach(entry => { | ||
// This bit of fidgeting allows for suiting up from the same folder | ||
const schemaFile = (entry[0] === '.' ? './' : entry[0]) + entry[1][0]; | ||
up(schemaFile); | ||
}); | ||
const relativePaths = watcher.relative(); | ||
/** Then this watches further changes */ | ||
watcher.on('changed', () => { | ||
program | ||
.command('up') | ||
.option('-f, --force', 'Force suit to re-render') | ||
.action(cmd => { | ||
gaze(['**/suit.json', '!node_modules/**/*'], (err, watcher) => { | ||
// Resets the console | ||
process.stdout.write('\x1Bc'); | ||
const watchedFiles = Object.keys(watcher.relative()).length; | ||
console.log( | ||
@@ -40,12 +25,35 @@ `Watching ${watchedFiles} suit.json ${ | ||
); | ||
// Gets the relative path | ||
/** This does it the first time */ | ||
Object.entries(relativePaths).forEach(entry => { | ||
Object.entries(watcher.relative()).forEach(entry => { | ||
// This bit of fidgeting allows for suiting up from the same folder | ||
const schemaFile = (entry[0] === '.' ? './' : entry[0]) + entry[1][0]; | ||
up(schemaFile, { quiet: true }); | ||
up(schemaFile, { force: cmd.force }); | ||
}); | ||
let relativePaths = watcher.relative(); | ||
/** Add new suit.json files to the watched files */ | ||
watcher.on('added', () => { | ||
relativePaths = watcher.relative(); | ||
}); | ||
/** Then this watches further changes */ | ||
watcher.on('changed', () => { | ||
// Resets the console | ||
process.stdout.write('\x1Bc'); | ||
console.log( | ||
`Watching ${watchedFiles} suit.json ${ | ||
watchedFiles > 1 && watchedFiles !== 0 ? 'files' : 'file' | ||
}...`.yellow, | ||
); | ||
// Gets the relative path | ||
/** This does it the first time */ | ||
Object.entries(relativePaths).forEach(entry => { | ||
// This bit of fidgeting allows for suiting up from the same folder | ||
const schemaFile = (entry[0] === '.' ? './' : entry[0]) + entry[1][0]; | ||
up(schemaFile, { quiet: true, force: cmd.force }); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -52,0 +60,0 @@ program.command('ajax <folder> <name>').action((folder, name) => { |
{ | ||
"name": "boilersuit", | ||
"description": "A CLI tool for generating selectors, reducers, actions, constants and sagas in react-boilerplate", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "author": "matt <matt.pocock@thevirtualforge.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
274097
2138