diff --git a/marvin256x256.png b/marvin256x256.png new file mode 100644 index 0000000..1c861b8 Binary files /dev/null and b/marvin256x256.png differ diff --git a/package.json b/package.json index 3fe99d2..806692f 100644 --- a/package.json +++ b/package.json @@ -33,18 +33,30 @@ "prod": "cross-env NODE_ENV=production webpack --mode production --config webpack.build.config.js && electron --noDevServer .", "start": "cross-env NODE_ENV=development webpack serve --hot --host 0.0.0.0 --config=./webpack.dev.config.js --mode development", "build": "cross-env NODE_ENV=production webpack --config webpack.build.config.js --mode production", - "installer": "electron-builder", + "installer": "electron-builder -lw", "package": "npm run build", "postpackage": "electron-packager ./ --ignore 'resources/files' --out=./builds --asar --overwrite --platform win32,linux --icon marvin.ico --extra-resource 'resources/files'" }, "build": { - "appId": "marvin", + "appId": "org.nasarek.marvin", + "extraResources": [{ + "from": "resources/files", + "to": "files" + }], "win": { "target": [ "nsis" ], "icon": "marvin256x256.ico" }, + "linux": { + + "target": [ + "deb" + ], + "icon": "marvin256x256.png", + "category": "Utility" + }, "nsis": { "oneClick": false, "installerIcon": "marvin.ico", diff --git a/resources/files/config/config.json b/resources/files/config/config.json index 4ca2d73..b0b532a 100644 --- a/resources/files/config/config.json +++ b/resources/files/config/config.json @@ -1,3 +1,3 @@ { - "rootDir": "C:\\Users\\Robert\\Desktop\\marvin" + "rootDir": "/home/rbrt/Schreibtisch/marvin" } \ No newline at end of file diff --git a/src/DocxInserter.js b/src/DocxInserter.js index c20e80f..9a8f04e 100644 --- a/src/DocxInserter.js +++ b/src/DocxInserter.js @@ -92,10 +92,17 @@ export async function fillTemplate(log, objectData) { // Write document to disk. if (buffer) { - const normCharacterObjectId = replaceSpecialCharacters(objectData.inventarnummer) - const normCharacterTitle = replaceSpecialCharacters(objectData.titel) - const normSpacingTitle = normCharacterTitle.replace(/[^A-Z0-9]+/ig, "_"); - const filename = objectData.datum + '_' + normCharacterObjectId + '_' + normSpacingTitle + '.docx' + // ObjectId normalisation. + const normCharacterObjectId = replaceSpecialCharacters(objectData.inventarnummer); + const normSpacingObjectId = normCharacterObjectId.replace("__", "_"); + // Title normalisation + const replaceEszettTitle = objectData.titel.replace("ß", "ss"); + const normCharacterTitle = replaceSpecialCharacters(replaceEszettTitle); + const normSingleSpaceTitle = normCharacterTitle.replace("__", "_"); + const normSpacingTitle = normSingleSpaceTitle.replace(/[^A-Z0-9\-]+/ig, "_"); + const normLengthTitle = normSpacingTitle.slice(0,50); + + const filename = normSpacingObjectId + '__' + normLengthTitle + '__' + objectData.datum + '__' + objectData.dokumenttyp + '.docx' fs.writeFileSync(path.join(documentPath, filename), buffer) log = { ...log,