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

TypeError: Method Date.prototype.toString called on incompatible receiver [object Date] #675

Open
ethanneff opened this issue Jun 17, 2024 · 5 comments

Comments

@ethanneff
Copy link

I got this error

[5:40:14 PM] [semantic-release] › ✘  Failed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[5:40:14 PM] [semantic-release] › ✘  An error occurred while running semantic-release: TypeError: Method Date.prototype.toString called on incompatible receiver [object Date]
    at Proxy.toString (<anonymous>)
    at [Symbol.toPrimitive] (<anonymous>)
    at new Date (<anonymous>)
    at Object.formatDate (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/utils.js:8:12)
    at defaultCommitTransform (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/options.js:23:23)
    at transformCommit (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/commit.js:29:23)
    at write (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/writers.js:39:28)
    at async nextAsync (node:internal/streams/from:182:33) {
  pluginName: '@semantic-release/release-notes-generator'
}
TypeError: Method Date.prototype.toString called on incompatible receiver [object Date]
    at Proxy.toString (<anonymous>)
    at [Symbol.toPrimitive] (<anonymous>)
    at new Date (<anonymous>)
    at Object.formatDate (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/utils.js:8:12)
    at defaultCommitTransform (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/options.js:23:23)
    at transformCommit (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/commit.js:29:23)
    at write (file:///home/runner/work/mobile/mobile/node_modules/conventional-changelog-writer/dist/writers.js:39:28)
    at async nextAsync (node:internal/streams/from:182:33) {
  pluginName: '@semantic-release/release-notes-generator'
}error Command failed with exit code 1.

when upgrading:

  • from "@semantic-release/release-notes-generator": "13.0.0",
  • to "@semantic-release/release-notes-generator": "14.0.0",

my release config looks like this

module.exports = {
  branches: ['main'],
  plugins: [
    [
      '@semantic-release/commit-analyzer',
      {
        releaseRules: [
          { type: 'refactor', release: 'patch' },
          { type: 'docs', scope: 'README', release: 'patch' },
          { type: 'test', release: 'patch' },
          { type: 'style', release: 'patch' },
          { type: 'perf', release: 'patch' },
          { type: 'ci', release: 'patch' },
          { type: 'build', release: 'patch' },
          { type: 'chore', release: 'patch' },
          { type: 'no-release', release: false },
        ],
        parserOpts: {
          noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING'],
        },
      },
    ],
    [
      '@semantic-release/release-notes-generator',
      {
        preset: 'conventionalcommits',
        presetConfig: {
          types: [
            { type: 'feat', section: ':sparkles: Features', hidden: false },
            { type: 'fix', section: ':bug: Fixes', hidden: false },
            { type: 'docs', section: ':memo: Documentation', hidden: false },
            { type: 'style', section: ':barber: Code-style', hidden: false },
            { type: 'refactor', section: ':zap: Refactor', hidden: false },
            {
              type: 'perf',
              section: ':fast_forward: Performance',
              hidden: false,
            },
            {
              type: 'test',
              section: ':white_check_mark: Tests',
              hidden: false,
            },
            { type: 'ci', section: ':repeat: CI', hidden: false },
            { type: 'chore', section: ':repeat: Chore', hidden: false },
          ],
        },
      },
    ],
    ['@semantic-release/npm', { npmPublish: false }],
    ['@semantic-release/github', { successComment: false, failComment: false }],
    [
      '@semantic-release/changelog',
      { changelogFile: '.github/CHANGELOG.md', changelogTitle: '# Changelog' },
    ],
    [
      '@semantic-release/git',
      {
        assets: ['.github/CHANGELOG.md', 'package.json'],
        message: 'chore(release): ${nextRelease.version} [skip ci]',
      },
    ],
  ],
};
@travi
Copy link
Member

travi commented Jun 17, 2024

What version of semantic-release are you running? You likely need to upgrade that as well.

Also, you should not need to install the release-notes-generator separately since it is a dependency of semantic-release. You likely have multiple versions installed. Your safest option is to let semantic-release just use the one it includes as a dependency

@ethanneff
Copy link
Author

So I reverted the package version to get it working again. These are the dependencies I have installed:

    "semantic-release": "23.0.8",
    "@semantic-release/changelog": "6.0.3",
    "@semantic-release/commit-analyzer": "12.0.0",
    "@semantic-release/git": "10.0.1",
    "@semantic-release/github": "10.0.6",
    "@semantic-release/npm": "12.0.1",
    "@semantic-release/release-notes-generator": "13.0.0",

I thought I should have each individually installed based on the docs:

@Thaddeus-Mallow
Copy link

I am running into the same error using these versions

            [email protected]
            @semantic-release/[email protected]
            @semantic-release/[email protected]
            @semantic-release/[email protected]
            @semantic-release/[email protected]
            @semantic-release/[email protected]
            [email protected]

@Thaddeus-Mallow
Copy link

It does work if I also upgrade conventional-changelog-conventionalcommits to version 8. So I am good :D

@jasonschroeder-sfdc
Copy link

Looks like conventional-changelog/commitlint#4069 will help us 🤞 which bumps conventional-changelog-conventionalcommits to v8

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

4 participants