Comparing version 1.1.1 to 1.1.2
@@ -7,4 +7,4 @@ #! /usr/bin/env node | ||
const path = require('path'); | ||
const { execSync } = require('child_process'); | ||
const colors = require('colors/safe'); | ||
const { execSync } = require('child_process'); | ||
const help = require('./help'); | ||
@@ -34,3 +34,3 @@ | ||
try { | ||
fs.mkdirSync(configsDirectory); | ||
fs.mkdirSync(configsDirectory, { recursive: true }); | ||
} catch (e) { | ||
@@ -134,8 +134,8 @@ if (e.code !== 'EEXIST') { | ||
const eslintrcCopyName = `${projectName}.${nowFormat}.eslintrc`; | ||
const eslintrcCopyName = `${projectName}.${nowFormat}.eslintrc`.replace('/', '-'); | ||
const configDirectory = path.join(configsDirectory, projectName); | ||
let hasDirectoryProject = true; | ||
try { | ||
hasDirectoryProject = fs.statSync(path.join(configsDirectory, projectName)).isDirectory(); | ||
hasDirectoryProject = fs.statSync(configDirectory).isDirectory(); | ||
} catch (e) { | ||
@@ -146,6 +146,6 @@ hasDirectoryProject = false; | ||
if (!hasDirectoryProject) { | ||
fs.mkdirSync(path.join(configsDirectory, projectName)); | ||
fs.mkdirSync(configDirectory, { recursive: true }); | ||
} | ||
fs.linkSync(eslintrc, path.join(configsDirectory, projectName, eslintrcCopyName)); | ||
fs.linkSync(eslintrc, path.join(configDirectory, eslintrcCopyName)); | ||
@@ -222,3 +222,3 @@ // get eslint config in JSON format | ||
try { | ||
fs.writeFileSync(eslintrc, JSON.stringify({ extends: eslintExtend }, null, 2)); | ||
fs.writeFileSync(eslintrc, `${JSON.stringify({ extends: eslintExtend }, null, 2)}\n`); | ||
console.info(`"${eslintrc}" has been created and configured.`); | ||
@@ -225,0 +225,0 @@ console.info(colors.green(`eslint with "${eslintExtend}" config ready to be used.`)); |
# CHANGELOG | ||
## 1.1.2 - delivery @27/12/2021 | ||
- update dependencies | ||
- fix directory creation to be recursive to support scoped dependencies | ||
## 1.1.1 - delivery @12/06/2021 | ||
@@ -4,0 +9,0 @@ |
*esbnb* is released under the MIT license. | ||
Copyright (C) 2021 Adrien Valcke | ||
Copyright (C) 2022 Adrien Valcke | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
{ | ||
"name": "esbnb", | ||
"version": "1.1.1", | ||
"author": "Adrien Valcke", | ||
"version": "1.1.2", | ||
"author": "Adrien Valcke <adrienvalcke@icloud.com> (https://github.com/adrienv1520)", | ||
"description": "The ESLint with Airbnb configuration installer", | ||
@@ -19,5 +19,2 @@ "bin": { | ||
}, | ||
"os": [ | ||
"!win32" | ||
], | ||
"engines": { | ||
@@ -40,6 +37,6 @@ "node": ">=8.17.0", | ||
"chai": "4.3.4", | ||
"eslint": "7.28.0", | ||
"eslint-config-airbnb-base": "14.2.1", | ||
"eslint-plugin-import": "2.23.4", | ||
"mocha": "9.0.0" | ||
"eslint": "8.5.0", | ||
"eslint-config-airbnb-base": "15.0.0", | ||
"eslint-plugin-import": "2.25.3", | ||
"mocha": "9.1.3" | ||
}, | ||
@@ -46,0 +43,0 @@ "preferGlobal": true, |
@@ -35,2 +35,9 @@ /** | ||
}, | ||
withScopedProjectName: { | ||
name: '@scope/my-project', | ||
description: 'my project', | ||
repository: {}, | ||
devDependencies: {}, | ||
license: 'UNLICENSED', | ||
}, | ||
withNoProjectName: { | ||
@@ -260,2 +267,16 @@ description: 'my project', | ||
context('when the project has a name and a scope', function() { | ||
before(function() { | ||
createPackageJson(packageConfig.withScopedProjectName); | ||
createEslintrc(eslintConfig.extendsStrAirbnb); | ||
esbnb(); | ||
}); | ||
it('should copy the current .eslintrc to the esbnb "configs" directory and in a subdirectory in the name of the project', function() { | ||
const savedConfigsDirectory = fs.readdirSync(configsDirectory); | ||
expect(savedConfigsDirectory).to.contain(packageConfig.withScopedProjectName.name.split('/')[0]); | ||
}); | ||
}); | ||
context('when the project has no name', function() { | ||
@@ -262,0 +283,0 @@ before(function() { |
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
56971
894