Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coins-validate

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coins-validate - npm Package Compare versions

Comparing version 1.1.15 to 2.0.0

templates/.eslintrc

130

index.js

@@ -1,66 +0,92 @@

var validate = require('git-validate');
var validateUtils = require('git-validate/lib/utils');
var path = require('path');
var cp = require('child_process');
var root = validateUtils.findProjectRoot();
var packages = [
'istanbul',
'gh-pages',
'jsdoc',
'jshint',
'jscs',
'use strict';
const validate = require('git-validate');
const validateUtils = require('git-validate/lib/utils');
const path = require('path');
const cp = require('child_process');
const root = validateUtils.findProjectRoot();
const devPackages = [
'eslint',
'eslint-config-airbnb',
'eslint-plugin-react',
'gh-pages',
'jsdoc',
'istanbul',
'minami'
];
var lintDirs = 'src/ test/';
const lintDirs = 'src/ test/';
const pkgJSON = require(path.resolve(root, 'package.json'));
var projPkg = require(path.resolve(root, 'package.json'));
console.log('installing coins-validate hooks and scripts into your project...');
cp.execSync('rm -f .jshintrc .jscsrc', { cwd: root });
validate.copy('templates/.jshintrc', '.jshintrc');
validate.copy('templates/.jscsrc', '.jscsrc');
cp.execSync('rm -f .eslint* .jshintrc .jscsrc', { cwd: root });
if (!projPkg.scripts || !projPkg.scripts['test']) validate.installScript('test', 'istanbul cover test/');
if (!projPkg.scripts || !projPkg.scripts['lint']) validate.installScript('lint', 'jscs ' + lintDirs);
if (!projPkg.scripts || !projPkg.scripts['lintfix']) validate.installScript('lintfix', 'jscs --fix ' + lintDirs);
if (!projPkg.scripts || !projPkg.scripts['postlint']) validate.installScript('postlint', 'jshint ' + lintDirs);
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/* && git commit -m "stage docs" && git push');
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 docs && 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']);
if (!pkgJSON.scripts) {
pkgJSON.scripts = {};
}
// installs packages into root project package
var installDev = function(packages) {
cp.exec('npm install --save-dev ' + packages.join(' '), { cwd: root }, function(err, stdout, stderr) {
if (err) {
console.error(err);
return;
}
console.log(stdout);
});
const scripts = {
'test': 'istanbul cover test/',
'lint': 'eslint ' + lintDirs,
'lintfix': 'eslint --fix ' + lintDirs,
'validate': 'npm ls',
'preversion': 'git checkout master && git pull && npm ls',
'docs': [
'mkdir -p docs &&',
'jsdoc -t ./node_modules/minami -d docs -R README.md -r src/'
].join(' '),
'deploy-docs': 'gh-pages -d docs && rm -rf docs',
'postpublish': 'npm run docs && npm run deploy-docs',
'publish-patch': 'npm run preversion && npm version patch && git push origin master --tags && npm publish',
'publish-minor': 'npm run preversion && npm version minor && git push origin master --tags && npm publish',
'publish-major': 'npm run preversion && npm version major && git push origin master --tags && npm publish',
};
getMissingDevDependencies = function(packages) {
if (!projPkg.devDependencies) {
return packages;
// add scripts if they do not already exist
// user edits to scripts will _not_ be squashed
var scriptValue;
for (var scriptKey in scripts) {
if (scripts.hasOwnProperty(scriptKey)) {
scriptValue = scripts[scriptValue];
if (!pkgJSON.scripts[scriptKey]) {
pkgJSON.scripts[scriptKey] = scriptValue;
}
if (!packages || !packages.hasOwnProperty('length')) {
console.warn('no requested devDependency packages detected');
}
}
validate.installHooks('pre-commit');
validate.configureHook('pre-commit', [ 'validate', 'lint', 'test' ]);
// install packages into root project package
const installDev = (packages) => {
cp.exec(
'npm install --save-dev ' + packages.join(' '),
{ cwd: root },
(err, stdout, stderr) => {
if (err) {
console.error(err);
return;
}
console.log(stdout);
}
return packages.filter(function(pkg) {
return !(projPkg.devDependencies && projPkg.devDependencies[pkg]);
});
);
};
const getMissingDevDependencies = (packages) => {
if (!pkgJSON.devDependencies) {
return packages;
}
if (!packages || !packages.hasOwnProperty('length')) {
console.warn('no requested devDependency packages detected');
}
return packages.filter(function(pkg) {
return !(pkgJSON.devDependencies && pkgJSON.devDependencies[pkg]);
});
}
var toInstall = getMissingDevDependencies(packages);
if (toInstall && toInstall.length) {
console.log('installing coins-* ecosystem dep pkgs into your project...');
installDev(toInstall);
const toInstallDev = getMissingDevDependencies(devPackages);
if (toInstallDev && toInstallDev.length) {
console.log('installing coins-* ecosystem dep pkgs into your project...');
installDev(toInstallDev);
} else {
console.log('project has all coins-* dev packages installed :)');
console.log('project has all coins-* dev packages installed :)');
}

19

package.json
{
"name": "coins-validate",
"version": "1.1.15",
"version": "2.0.0",
"description": "configures a package to fall inline with coins standards",

@@ -13,3 +13,11 @@ "main": "index.js",

},
"devDependencies": {},
"devDependencies": {
"eslint": "^2.4.0",
"eslint-config-airbnb": "^6.1.0",
"eslint-plugin-react": "^4.2.3",
"gh-pages": "^0.11.0",
"istanbul": "^0.4.2",
"jsdoc": "^3.4.0",
"minami": "^1.1.1"
},
"scripts": {

@@ -23,3 +31,8 @@ "install": "node index.js",

"author": "cdaringe",
"license": "ISC"
"license": "ISC",
"pre-commit": [
"validate",
"lint",
"test"
]
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc