Initial commit

master
Sven Slootweg 5 years ago
commit 949264fcdc

1
.gitignore vendored

@ -0,0 +1 @@
node_modules

@ -0,0 +1,19 @@
# abn-amro-mt940-fix
Fixes ABN AMRO's broken MT940 export files, so that they can be imported into GnuCash without changing the importer configuration.
## Installation
Make sure you have Node.js installed.
```sh
npm install -g abn-amro-mt940-fix
```
## Usage
```sh
abn-amro-mt940-fix YOUR-FILE.STA
```
A new file is created, with `-fixed` suffixed to the name, containing the fixed version of the export file. The new path is also printed to the terminal.

@ -0,0 +1,27 @@
#!/usr/bin/env node
"use strict";
const fs = require("fs");
const chalk = require("chalk");
const path = require("path");
if (process.argv[2] == null) {
console.error(chalk.red("You must specify one or more MT940 (.STA) files to fix, like so:\n abn-amro-mt940-fix YOUR-FILE.STA"));
} else {
process.argv.slice(2).forEach((file) => {
let absolutePath = path.resolve(file);
let contents = fs.readFileSync(absolutePath, { encoding: "utf8" });
let parsedPath = path.parse(absolutePath);
delete parsedPath.base;
parsedPath.name += "-fixed";
let fixedContents = contents.replace(/(^|\r\n-\r\n)ABNANL2A\r\n940\r\nABNANL2A\r\n/g, "$1");
let fixedFilename = path.format(parsedPath);
fs.writeFileSync(fixedFilename, fixedContents, { encoding: "utf8" })
console.log(file, "->", fixedFilename);
});
}

@ -0,0 +1,16 @@
{
"name": "abn-amro-mt940-fix",
"description": "Fixes ABN AMRO-created MT940 export files, so they work in GnuCash",
"version": "1.0.0",
"main": "fix.js",
"bin": {
"abn-amro-mt940-fix": "./fix.js"
},
"repository": "http://git.cryto.net/joepie91/abn-amro-mt940-fix.git",
"author": "Sven Slootweg <admin@cryto.net>",
"license": "WTFPL OR CC0-1.0",
"dependencies": {
"bluebird": "^3.5.5",
"chalk": "^2.4.2"
}
}

@ -0,0 +1,53 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
dependencies:
color-convert "^1.9.0"
bluebird@^3.5.5:
version "3.5.5"
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f"
integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==
chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
dependencies:
ansi-styles "^3.2.1"
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
color-convert@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
dependencies:
color-name "1.1.3"
color-name@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
has-flag@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
supports-color@^5.3.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
dependencies:
has-flag "^3.0.0"
Loading…
Cancel
Save