Socket
Socket
Sign inDemoInstall

esbnb

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbnb - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

18

bin/help.js
const colors = require('colors/safe');
module.exports = `
${colors.bgYellow.gray('--------------------------------------- HELP ---------------------------------------')}
${colors.bgYellow.gray('------------------------------------------ HELP ------------------------------------------')}
${colors.bold.yellow('ESBNB, the eslint airbnb config installer')}
- INSTALL A CONFIG (airbnb by default, airbnb-base or airbnb-base/legacy)
Install ESLint with the Airbnb ESLint rules, including ECMAScript 6+ and React (default)
${colors.bold('$ esbnb')}
$ esbnb
${colors.gray('eslint-config-airbnb@latest will be installed')}
Install ESLint with the Airbnb ESLint rules, including ECMAScript 6+ (base)
${colors.bold('$ esbnb base')}
$ esbnb base
${colors.gray('eslint-config-airbnb-base@latest will be installed')}
Install ESLint with the Airbnb ESLint rules, including ECMAScript 5 and below (legacy)
${colors.bold('$ esbnb legacy')}
$ esbnb legacy
${colors.gray('eslint-config-airbnb-base will be installed')}
${colors.gray('.eslintrc file will be created if not already and properly configured.')}
${colors.bgYellow.gray('------------------------------------- END HELP -------------------------------------')}
${colors.bgYellow.gray('---------------------------------------- END HELP ----------------------------------------')}
`;

@@ -11,8 +11,7 @@ #! /usr/bin/env node

const configsDirectory = path.join(__dirname, '../configs/');
const packageJson = './package.json';
const eslintrc = './.eslintrc';
const anonymousProject = 'anonymous';
const eslintConfig = 'eslint-config';
const eslintExtends = [

@@ -23,5 +22,3 @@ 'airbnb',

];
const is = Object.prototype.isPrototypeOf;
const [,, config] = [...process.argv];

@@ -36,2 +33,12 @@ const helpIsNeeded = (config === '-help' || config === '-h');

// check internal 'configs' directory exists or create it to save user .eslintrc files
try {
fs.mkdirSync(configsDirectory);
} catch (e) {
if (e.code !== 'EEXIST') {
console.error(colors.red(`esbnb cannot continue installation. The internal "configs" directory is missing and cannot be created:\n${e}`));
process.exit(1);
}
}
// check package.json file and get project name (consider no package if bad JSON)

@@ -86,3 +93,3 @@ try {

console.info(`${colors.yellow('esbnb')} is installing "${eslintExtend}" config...`);
console.info(colors.yellow(`esbnb is installing "${eslintExtend}" config...`));

@@ -92,3 +99,3 @@ try {

} catch (e) {
console.error(`${colors.red(e)}`);
console.error(colors.red(e));
process.exit(1);

@@ -101,4 +108,3 @@ }

if (stdoutString === '') {
const error = new Error(`installion failed with command ${command}. Be sure you are on macOS/Linux and npm is installed.`);
console.error(`${colors.red(error)}`);
console.error(colors.red(`esbnb installion failed with command ${command}. Be sure you are on macOS/Linux and npm is installed.`));
process.exit(1);

@@ -109,3 +115,3 @@ }

console.info(`${colors.yellow('esbnb')} is configuring "${eslintrc}" file...`);
console.info(colors.yellow(`esbnb is configuring "${eslintrc}" file...`));

@@ -134,3 +140,2 @@ // check if a .eslintrc exists at the root of the app

const eslintrcCopyName = `${projectName}.${nowFormat}.eslintrc`;
const pathToConfigsDirectory = path.join(__dirname, '../configs/');

@@ -140,3 +145,3 @@ let hasDirectoryProject = true;

try {
hasDirectoryProject = fs.statSync(path.join(pathToConfigsDirectory, projectName))
hasDirectoryProject = fs.statSync(path.join(configsDirectory, projectName))
.isDirectory();

@@ -148,6 +153,6 @@ } catch (e) {

if (!hasDirectoryProject) {
fs.mkdirSync(path.join(pathToConfigsDirectory, projectName));
fs.mkdirSync(path.join(configsDirectory, projectName));
}
fs.linkSync(eslintrc, path.join(pathToConfigsDirectory, projectName, eslintrcCopyName));
fs.linkSync(eslintrc, path.join(configsDirectory, projectName, eslintrcCopyName));

@@ -154,0 +159,0 @@

{
"name": "esbnb",
"version": "1.0.1",
"version": "1.0.2",
"author": "Adrien Valcke",

@@ -5,0 +5,0 @@ "description": "the ESLint with Airbnb configuration installer",

@@ -15,19 +15,19 @@ /**

const outputHelp = `
--------------------------------------- HELP ---------------------------------------
------------------------------------------ HELP ------------------------------------------
ESBNB, the eslint airbnb config installer
- INSTALL A CONFIG (airbnb by default, airbnb-base or airbnb-base/legacy)
Install ESLint with the Airbnb ESLint rules, including ECMAScript 6+ and React (default)
$ esbnb
eslint-config-airbnb@latest will be installed
Install ESLint with the Airbnb ESLint rules, including ECMAScript 6+ (base)
$ esbnb base
eslint-config-airbnb-base@latest will be installed
Install ESLint with the Airbnb ESLint rules, including ECMAScript 5 and below (legacy)
$ esbnb legacy
eslint-config-airbnb-base will be installed
------------------------------------- END HELP -------------------------------------
.eslintrc file will be created if not already and properly configured.
---------------------------------------- END HELP ----------------------------------------
`;

@@ -34,0 +34,0 @@

@@ -5,8 +5,4 @@ {

"repository": {},
"devDependencies": {
"eslint": "3.15.0",
"eslint-config-airbnb-base": "11.1.0",
"eslint-plugin-import": "2.2.0"
},
"devDependencies": {},
"license": "UNLICENSED"
}

Sorry, the diff of this file is not supported yet

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