Skip to content

Commit

Permalink
release 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
linda-rian committed Feb 29, 2016
1 parent 168e24a commit 414e574
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 0.7.0
* Banks separated by country
* Removed manual requires of each bank JSON
* Normalized color format (HEX, lowercase) and add linter to check and fix it in future
* Added:
* Gazprombank (RU)
* Updated:
* Alfabank (RU)
* Raiffeisen (RU)
* Sberbank (RU)

## 0.6.0
* Added `result.code` for easier usage [from [#34](https://github.com/ramoona/banks-db/issues/34)]
* Added fix for undefined card number [from [#33](https://github.com/ramoona/banks-db/issues/33)]
Expand Down
36 changes: 19 additions & 17 deletions lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,45 @@ function showError(filePath, error) {
fs.readdir(path.join(__dirname, 'banks'), (err, files) => {
if (err) throw err;

const countries = files.filter(file => fs.lstatSync(path.join(__dirname,
'banks/' + file)).isDirectory());
const countries = files.filter(file =>
fs.lstatSync(path.join(__dirname, 'banks/' + file)).isDirectory());

countries.forEach(country => {
const banks = fs.readdirSync(path.join(__dirname, 'banks/' +
country)).filter(file => /\.json$/.test(file));
const banks = fs.readdirSync(
path.join(__dirname, 'banks/' + country)).filter(file => /\.json$/.test(file)
);

jsonfile.readFile(path.join(__dirname, 'schema.json'), (err4, schema) => {
if (err4) throw err4;
jsonfile.readFile(path.join(__dirname, 'schema.json'), (err1, schema) => {
if (err1) throw err1;

banks.forEach(name => {
const bankPath = 'banks/' + country + '/' + name;
jsonfile.readFile(path.join(__dirname, bankPath), (err5, bank) => {
if (err5) throw err5;

jsonfile.readFile(path.join(__dirname, bankPath), (err2, bank) => {
if (err2) throw err2;

const report = linter.validate(bank, schema);
name = name.replace(/\.json$/, '');

if (report.errors.length === 0 && bank.country === country && bank.name === name) {
console.log(chalk.green('OK ') + chalk.white('banks/' + country + '/' + name));
if (report.errors.length > 0) {
showError(bankPath);
report.errors.forEach(i => console.error(i));
process.exit(1);
} else if (bank.country !== country) {
showError(bankPath, ':\ncountry folder doesn\'t match with bank country');
process.exit(1);
} else if (bank.name !== name) {
showError(bankPath, ':\nJSON filename doesn\'t match with bank name');
process.exit(1);
} else {
showError(bankPath);
report.errors.forEach(i => console.error(i));
process.exit(1);
console.log(chalk.green('OK ') + chalk.white('banks/' + country + '/' + name));
}

if (/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(bank.color)) {
if (/[A-F]\w*/.test(bank.color)) {
bank.color = bank.color.toLowerCase();
jsonfile.writeFile(path.join(__dirname, bankPath), bank, { spaces: 2 }, err1 => {
if (err1) throw err1;
jsonfile.writeFile(path.join(__dirname, bankPath), bank, { spaces: 2 }, err3 => {
if (err3) throw err3;
});
}
} else {
Expand All @@ -62,8 +64,8 @@ fs.readdir(path.join(__dirname, 'banks'), (err, files) => {
});
});

fs.readdir(path.join(__dirname, 'banks'), (err2, items) => {
if (err2) throw err2;
fs.readdir(path.join(__dirname, 'banks'), (err4, items) => {
if (err4) throw err4;

if (/\.json/.test(items.join())) {
showError('banks/', ': JSON must not be placed straght in banks folder');
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "banks-db",
"version": "0.6.0",
"version": "0.7.0",
"description": "Bankcards BIN database",
"author": "Linda Rian <[email protected]>",
"repository": "Ramoona/banks-db",
Expand All @@ -22,7 +22,9 @@
"jsonfile" : "2.2.3"
},
"scripts": {
"test": "ava && node lint.js && eslint *.js"
"test": "ava && node lint.js && eslint *.js",
"build": "node build-indexes.js",
"prepublish": "npm run build && npm test"
},
"license": "CC-BY-4.0"
}

0 comments on commit 414e574

Please sign in to comment.