Skip to content

Commit

Permalink
fix: logfile cleared each time
Browse files Browse the repository at this point in the history
  • Loading branch information
akosbalasko authored Apr 23, 2021
2 parents b153ca9 + 8458948 commit e0002fd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![logo](screens/yarle-logo.png)

![Last Commit](https://img.shields.io/github/last-commit/akosbalasko/yarle?style=for-the-badge)
![Version](https://img.shields.io/badge/version-4.0.8-blue?style=for-the-badge)
![Version](https://img.shields.io/badge/version-4.0.9-blue?style=for-the-badge)
[![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen?style=for-the-badge)](https://github.com/akosbalasko/yarle#readme)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green?style=for-the-badge)](https://github.com/akosbalasko/yarle/graphs/commit-activity)
[![License: MIT](https://img.shields.io/github/license/akosbalasko/yarle?style=for-the-badge)](https://github.com/akosbalasko/yarle/blob/master/LICENSE)
Expand Down Expand Up @@ -38,13 +38,13 @@ Yarle is the ultimate converter of Evernote notes to Markdown.

## Binaries:

[Windows](https://github.com/akosbalasko/yarle/releases/download/v4.0.8/yarle-evernote-to-md-4.0.8.Setup.exe)
[Windows](https://github.com/akosbalasko/yarle/releases/download/v4.0.9/yarle-evernote-to-md-4.0.9.Setup.exe)

[Linux](https://github.com/akosbalasko/yarle/releases/download/v4.0.8/yarle-evernote-to-md-4.0.8-1.x86_64.rpm)
[Linux](https://github.com/akosbalasko/yarle/releases/download/v4.0.9/yarle-evernote-to-md-4.0.9-1.x86_64.rpm)

[Debian](https://github.com/akosbalasko/yarle/releases/download/v4.0.8/yarle-evernote-to-md_4.0.8_amd64.deb)
[Debian](https://github.com/akosbalasko/yarle/releases/download/v4.0.9/yarle-evernote-to-md_4.0.9_amd64.deb)

[Mac](https://github.com/akosbalasko/yarle/releases/download/v4.0.8/yarle-evernote-to-md-darwin-x64-4.0.8.zip)
[Mac](https://github.com/akosbalasko/yarle/releases/download/v4.0.9/yarle-evernote-to-md-darwin-x64-4.0.9.zip)



Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yarle-evernote-to-md",
"version": "4.0.8",
"version": "4.0.9",
"description": "Yet Another Rope Ladder from Evernote",
"keywords": [
"evernote",
Expand Down
6 changes: 5 additions & 1 deletion src/utils/clearLogFile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import * as fs from 'fs';

import * as fsextra from 'fs-extra';

import { LOGFILE } from './loggerInfo';
export const clearLogFile = () => {
console.log('clearing log: ' + LOGFILE);
if (fs.existsSync(LOGFILE))
fs.unlinkSync(LOGFILE);
fsextra.removeSync(LOGFILE);
}
10 changes: 5 additions & 5 deletions src/utils/folder-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ export const clearMdNotesDistDir = (): void => {
};

export const setPaths = (): void => {
loggerInfo('setting paths');
// loggerInfo('setting paths');
const enexFolder = yarleOptions.enexSource.split(path.sep);
loggerInfo(`enex folder split: ${JSON.stringify(enexFolder)}`);
// loggerInfo(`enex folder split: ${JSON.stringify(enexFolder)}`);
const enexFile = (enexFolder.length >= 1 ? enexFolder[enexFolder.length - 1] : enexFolder[0]).split('.')[0];
loggerInfo(`enex file: ${enexFile}`);
// loggerInfo(`enex file: ${enexFile}`);

const outputDir = path.isAbsolute(yarleOptions.outputDir)
? yarleOptions.outputDir
: `${process.cwd()}${path.sep}${yarleOptions.outputDir}`;

paths.mdPath = `${outputDir}${path.sep}notes${path.sep}`;
paths.resourcePath = `${outputDir}${path.sep}notes${path.sep}_resources`;
loggerInfo(`Skip enex filename from output? ${yarleOptions.skipEnexFileNameFromOutputPath}`);
// loggerInfo(`Skip enex filename from output? ${yarleOptions.skipEnexFileNameFromOutputPath}`);
if (!yarleOptions.skipEnexFileNameFromOutputPath) {
paths.mdPath = `${paths.mdPath}${enexFile}`;
loggerInfo(`mdPath: ${paths.mdPath}`);
// loggerInfo(`mdPath: ${paths.mdPath}`);

paths.resourcePath = `${outputDir}${path.sep}notes${path.sep}${enexFile}${path.sep}_resources`;
}
Expand Down
4 changes: 3 additions & 1 deletion src/yarle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { hasCreationTimeInTemplate, hasLocationInTemplate, hasSourceURLInTemplat
import { defaultTemplate } from './utils/templates/default-template';
import { OutputFormat } from './output-format';
import * as path from 'path';
import { clearLogFile } from './utils/clearLogFile';

export const defaultYarleOptions: YarleOptions = {
enexSource: 'notebook.enex',
Expand Down Expand Up @@ -59,7 +60,7 @@ const setOptions = (options: YarleOptions): void => {

yarleOptions.currentTemplate = template;

loggerInfo(`Current config is: ${JSON.stringify(yarleOptions)}`);
loggerInfo(`Current config is: ${JSON.stringify(yarleOptions, null, 4)}`);
loggerInfo(`Path separator:${path.sep}`)
/*}*/
};
Expand Down Expand Up @@ -125,6 +126,7 @@ export const parseStream = async (options: YarleOptions): Promise<void> => {
};

export const dropTheRope = async (options: YarleOptions): Promise<void> => {
clearLogFile();
setOptions(options);
utils.setPaths();

Expand Down

0 comments on commit e0002fd

Please sign in to comment.