Giter VIP home page Giter VIP logo

Comments (13)

cookpete avatar cookpete commented on August 23, 2024

Looks like you have a typo in your version script. As long as there is changelog.hbs in the templates directory, this should work:

"version": "auto-changelog -p -t templates/changelog.hbs"

Note templates and not .templates

from auto-changelog.

gazzwi86 avatar gazzwi86 commented on August 23, 2024

@cookpete I had intended for it to be a hidden folder. Is there no support for such a capability?

from auto-changelog.

cookpete avatar cookpete commented on August 23, 2024

Ah I see. There's no reason why it wouldn't work in a hidden folder. The library just runs pathExists on the -t option and uses that template if there's a file there.

I noticed in your error it says changelog-template.hbs was not found, but that's not the name of the file you passed in for the example above it. Are you sure -t is pointing to a file that exists?

from auto-changelog.

gazzwi86 avatar gazzwi86 commented on August 23, 2024

@cookpete yes, certainly. I had added the file to the folder and on Windows, it was unable to find the file. not sure about unix. I had opted to remove the '-template' portion, but it wouldnt work either way when ran from cli and from npm scripts

from auto-changelog.

jeffkpayne avatar jeffkpayne commented on August 23, 2024

Not sure if it's related, but I did notice that the --template flag is ignored if one is defined in package.json. Was going to open an issue around that, but thought that might be the problem here...

from auto-changelog.

cookpete avatar cookpete commented on August 23, 2024

@gazzwi86 I've tried to reproduce the problem in 1995b29 using the exact same template path you were using, but the fake version commit after these changes is using the template correctly: 42deb8e

@jeffkpayne you are correct that the package options override the command line options currently, which is a bit backwards. This is due to the fact that commander handles the command line options as well as applying the default options, so doing it the other way round would override the package options with the defaults. This could be better.

from auto-changelog.

gazzwi86 avatar gazzwi86 commented on August 23, 2024

@cookpete very strange. I shall take another look at my implementation, and see why might be happening.

from auto-changelog.

gazzwi86 avatar gazzwi86 commented on August 23, 2024

@cookpete no luck. Logs below - node version is v8.9.2, npm v5.5.1

➜  udf-core git:(development) ✗ npm run version

> [email protected] version /Users/a8604437/Sites/udf-core
> auto-changelog -p -t .templates/changelog.hbs && git add CHANGELOG.md

Error: Template 'changelog-template.hbs' was not found
    at _callee$ (/Users/a8604437/Sites/udf-core/node_modules/auto-changelog/lib/template.js:39:19)
    at tryCatch (/Users/a8604437/Sites/udf-core/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/Users/a8604437/Sites/udf-core/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/a8604437/Sites/udf-core/node_modules/babel-polyfill/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/Users/a8604437/Sites/udf-core/node_modules/auto-changelog/lib/template.js:107:191)
    at /Users/a8604437/Sites/udf-core/node_modules/auto-changelog/lib/template.js:107:361
    at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] version: `auto-changelog -p -t .templates/changelog.hbs && git add CHANGELOG.md`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] version script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/a8604437/.npm/_logs/2017-12-08T13_36_49_307Z-debug.log
➜  udf-core git:(development) ✗ cat .templates/changelog.hbs
# Changelog

All notable changes to this `cwa-core` will be documented in this file.
{{#each releases}}

  # [{{title}}[({{href}}) - {{niceDate}}

  {{#each commits}}
    - [{{subject}}]({{href}})
  {{/each}}
{{/each}}
➜  udf-core git:(development) ✗

from auto-changelog.

cookpete avatar cookpete commented on August 23, 2024

@gazzwi86 I'm really confused as to why the error says changelog-template.hbs can't be found when you are passing in .templates/changelog.hbs as the template. Where is changelog-template.hbs coming from?

from auto-changelog.

cookpete avatar cookpete commented on August 23, 2024

The line of code that spits out this error is outputting the template option exactly as it was passed in. If the error is Template 'changelog-template.hbs' was not found, then the script thinks the template option passed in is changelog-template.hbs, and can't find it.

$ auto-changelog
9121 bytes written to CHANGELOG.md

$ auto-changelog -t changelog-template.hbs
Error: Template 'changelog-template.hbs' was not found
    at _callee$ (C:\Program Files (x86)\Nodist\bin\node_modules\auto-changelog\lib\template.js:39:19)
    at tryCatch (C:\Program Files (x86)\Nodist\bin\node_modules\auto-changelog\node_modules\regenerator-runtime\runtime.js:65:40)
    at Generator.invoke [as _invoke] (C:\Program Files (x86)\Nodist\bin\node_modules\auto-changelog\node_modules\regenerator-runtime\runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (C:\Program Files (x86)\Nodist\bin\node_modules\auto-changelog\node_modules\regenerator-runtime\runtime.js:117:21)
    at step (C:\Program Files (x86)\Nodist\bin\node_modules\auto-changelog\lib\template.js:107:191)
    at C:\Program Files (x86)\Nodist\bin\node_modules\auto-changelog\lib\template.js:107:361
    at <anonymous>

$ echo "Test" > changelog-template.hbs

$ auto-changelog -t changelog-template.hbs
9 bytes written to CHANGELOG.md

from auto-changelog.

cookpete avatar cookpete commented on August 23, 2024

Also @gazzwi86 take heed of Jeff's comment above – do you have "template": "changelog-template.hbs" in your package.json by chance?

from auto-changelog.

gazzwi86 avatar gazzwi86 commented on August 23, 2024

Sorry! It was me being stupid. I hadn't realised the package.json config was in control her. I thought the command would take precedence.

Sorry to trouble you

from auto-changelog.

cookpete avatar cookpete commented on August 23, 2024

Sorry! It was me being stupid. I hadn't realised the package.json config was in control her. I thought the command would take precedence.

I think the command should take precedence, so I'll look into fixing that.

from auto-changelog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.