Skip to content

Custom template specified in config.json is ignored when run as a local npm script #675

@powyncify

Description

@powyncify

Hello,

I've encountered a persistent issue where YARLE ignores the template setting in a local config.json file when executed as an npm script. It consistently falls back to the built-in default template, resulting in incorrect output.

Environment:

  • OS: Windows 11
  • YARLE Version: [email protected]
  • Execution Method: npm run <script_name> from a local project.

Problem Description:
Even when providing a valid config.json via the --configFile flag, and after ensuring no global config exists in %APPDATA%, the conversion log shows that currentTemplate is the default YARLE template, not the content of the file specified in the template property.

Steps to Reproduce:

  1. Create a new folder and run npm init -y.
  2. Install YARLE: npm install --save-dev yarle-evernote-to-md
  3. Create config.json in the project root:
    {
      "enexSources": ["path/to/any.enex"],
      "outputDir": "./output",
      "template": "./yarle-template.tmpl",
      "isMetadataNeeded": true,
      "skipSubjectDate": false
    }
  4. Create yarle-template.tmpl in the project root:
    ---
    tags: [{tags}]
    created: "{created-at}"
    ---
    
    # {title}
    
    {content}
    
  5. Add a script to package.json:
    "scripts": {
      "convert": "yarle --configFile ./config.json"
    }
  6. Run the script: npm run convert

Expected Behavior:
The output Markdown files should be formatted according to yarle-template.tmpl. The conversion log should show the custom template string in the currentTemplate field.

Actual Behavior:
The output uses the default YARLE template. The conversion log shows the default template string in the currentTemplate field, proving the custom template file was not loaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions