Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using ${name} the release-it fails #641

Closed
ghost opened this issue Apr 16, 2020 · 8 comments
Closed

When using ${name} the release-it fails #641

ghost opened this issue Apr 16, 2020 · 8 comments

Comments

@ghost
Copy link

ghost commented Apr 16, 2020

I have the regular variables in my package.json

{
"name": "collections-common-mm",
"version": "1.0.17",
"release-it": {
"hooks": {},
"git": {
"changelog": "git log --pretty=format:"* %s (%h)" ${latestTag}...HEAD",
"requireCleanWorkingDir": false,
"requireUpstream": false,
"requireCommits": true,
"addUntrackedFiles": false,
"commit": true,
"commitMessage": "Release ${name}-${version}",
"commitArgs": "",
"tag": true,
"tagName": "${version}",
"tagAnnotation": "${name}-${version}",
"tagArgs": "",
"push": true,
"pushArgs": ["--follow-tags"],
"pushRepo": ""
}

Release it fails with the following error

ERROR ReferenceError: name is not defined
at eval (lodash.templateSources[12]:9:10)
at format (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/util.js:26:32)
at Git.commit (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/plugin/git/Git.js:136:40)
at task (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/plugin/git/Git.js:60:57)
at Spinner.show (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/spinner.js:14:23)
at Git.step (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/plugin/Plugin.js:66:44)
at Git.release (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/plugin/git/Git.js:60:16)
at runLifeCycleHook (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/tasks.js:56:25)
at process._tickCallback (internal/process/next_tick.js:178:7)
ERROR name is not defined

@webpro
Copy link
Collaborator

webpro commented Apr 16, 2020

That's a bug. Try npm.name for now.

@ghost
Copy link
Author

ghost commented Apr 16, 2020

you are awesome. I am trying to do it as $npm.name or ${npm.name}

@webpro
Copy link
Collaborator

webpro commented Apr 16, 2020

It's always ${...} style in release-it config :)

@ghost
Copy link
Author

ghost commented Apr 16, 2020

Thank you webpro for helping. So i tried to use this " $npm_package_name-$npm_package_version" earlier and this would not work too. SO i am trying with the workaround you mentioned.

@ghost
Copy link
Author

ghost commented Apr 16, 2020

@webpro I have tried using ${npm.name} and it fails again with

ERROR ReferenceError: npm is not defined
at eval (lodash.templateSources[12]:9:10)
at format (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/util.js:26:32)
at Git.commit (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/plugin/git/Git.js:136:40)
at task (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/plugin/git/Git.js:60:57)
at Spinner.show (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/spinner.js:14:23)
at Git.step (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/plugin/Plugin.js:66:44)
at Git.release (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/plugin/git/Git.js:60:16)
at runLifeCycleHook (/var/lib/jenkins/workspace/s-common-mm-testmigration_master/node_modules/release-it/lib/tasks.js:56:25)
at process._tickCallback (internal/process/next_tick.js:178:7)
ERROR npm is not defined

@ghost
Copy link
Author

ghost commented Apr 16, 2020

After the above step fails and it also fails at git push

✖ Git push
ERROR error: The destination you provided is not a full refname (i.e.,
starting with "refs/"). We tried to guess what you meant by:

  • Looking for a ref that matches 'HEAD' on the remote side.
  • Checking if the being pushed ('HEAD')
    is a ref in "refs/{heads,tags}/". If so we add a corresponding
    refs/{heads,tags}/ prefix on the remote side.

@webpro
Copy link
Collaborator

webpro commented Apr 17, 2020

I dug into this ${name} issue and I'll have a fix today. It's not documented to use e.g. name outside of hooks, so it's not really a bug, imho, but to prevent any confusion in the future I plan to improve the implementation and documentation regarding this.

@webpro
Copy link
Collaborator

webpro commented Apr 17, 2020

The available context variables have been extended in v13.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant