coins-validate
Advanced tools
Comparing version 1.1.0 to 1.1.1
61
index.js
var validate = require('git-validate'); | ||
var validateUtils = require('git-validate/lib/utils'); | ||
var path = require('path'); | ||
var exec = require('child_process').exec; | ||
var root = validateUtils.findProjectRoot(); | ||
var packages = [ | ||
@@ -10,26 +12,49 @@ 'gh-pages', | ||
]; | ||
var projPkg = require(path.resolve(root, 'package.json')); | ||
console.log('installing coins-validate hooks and scripts into your project...'); | ||
validate.copy('templates/.jshintrc', '.jshintrc'); | ||
validate.copy('templates/.jscscrc', '.jscsrc'); | ||
validate.installScript('lint', 'jscs .'); | ||
validate.installScript('postlint', 'jshint .'); | ||
validate.installScript('validate', 'npm ls'); | ||
validate.installScript('preversion', 'git checkout master && git pull && npm ls'); | ||
validate.installScript('docs', 'jsdoc -d docs -r -R README.md src/ && git add docs/*'); | ||
validate.installScript('deploy-docs', 'gh-pages -d docs'); | ||
validate.installScript('post-publish', 'npm run deploy-docs'); | ||
validate.installScript('publish-patch', 'npm run preversion && npm version patch && git push origin master --tags && npm publish'); | ||
validate.installScript('publish-minor', 'npm run preversion && npm version minor && git push origin master --tags && npm publish'); | ||
validate.installScript('publish-major', 'npm run preversion && npm version major && git push origin master --tags && npm publish'); | ||
if (!projPkg.scripts || !projPkg.scripts['lint']) validate.installScript('lint', 'jscs .'); | ||
if (!projPkg.scripts || !projPkg.scripts['postlint']) validate.installScript('postlint', 'jshint .'); | ||
if (!projPkg.scripts || !projPkg.scripts['validate']) validate.installScript('validate', 'npm ls'); | ||
if (!projPkg.scripts || !projPkg.scripts['preversion']) validate.installScript('preversion', 'git checkout master && git pull && npm ls'); | ||
if (!projPkg.scripts || !projPkg.scripts['docs']) validate.installScript('docs', 'jsdoc -d docs -r -R README.md src/ && git add docs/*'); | ||
if (!projPkg.scripts || !projPkg.scripts['deploy-docs']) validate.installScript('deploy-docs', 'gh-pages -d docs'); | ||
if (!projPkg.scripts || !projPkg.scripts['postpublish']) validate.installScript('postpublish', 'npm run deploy-docs'); | ||
if (!projPkg.scripts || !projPkg.scripts['publish-patch']) validate.installScript('publish-patch', 'npm run preversion && npm version patch && git push origin master --tags && npm publish'); | ||
if (!projPkg.scripts || !projPkg.scripts['publish-minor']) validate.installScript('publish-minor', 'npm run preversion && npm version minor && git push origin master --tags && npm publish'); | ||
if (!projPkg.scripts || !projPkg.scripts['publish-major']) validate.installScript('publish-major', 'npm run preversion && npm version major && git push origin master --tags && npm publish'); | ||
validate.installHooks('pre-commit'); | ||
validate.configureHook('pre-commit', ['validate', 'lint', 'test', 'docs']); | ||
var root = validateUtils.findProjectRoot(); | ||
console.log('installing coins-* ecosystem dep pkgs into your project...'); | ||
var install = exec('npm install --save-dev ' + packages.join(' '), { cwd: root }, function(err, stdout, stderr) { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
// installs packages into root project package | ||
var installDev = function(packages) { | ||
exec('npm install --save-dev ' + packages.join(' '), { cwd: root }, function(err, stdout, stderr) { | ||
if (err) { | ||
console.error(err); | ||
return; | ||
} | ||
console.log(stdout); | ||
}); | ||
}; | ||
getMissingDevDependencies = function(packages) { | ||
if (!projPkg.devDependencies) { | ||
return packages; | ||
} | ||
console.log(stdout); | ||
}); | ||
if (!packages || !packages.hasOwnProperty('length')) { | ||
console.warn('no requested devDependency packages detected'); | ||
} | ||
return packages.filter(function(pkg) { | ||
return !(projPkg.devDependencies && projPkg.devDependencies[pkg]); | ||
}); | ||
} | ||
var toInstall = getMissingDevDependencies(packages); | ||
if (toInstall && toInstall.length) { | ||
console.log('installing coins-* ecosystem dep pkgs into your project...'); | ||
installDev(toInstall); | ||
} else { | ||
console.log('project has all coins-* dev packages installed :)'); | ||
} |
{ | ||
"name": "coins-validate", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "configures a package to fall inline with coins standards", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
6102
55
1