Skip to content

Creating git tags fails #196

Closed
Closed

Description

@maiertech

Problem

I'm using changesets in this repo: https://github.com/UNDataForum/components. When running yarn changeset publish (on Debian) I get this error:

🦋  info npm info @undataforum/components
🦋  info npm info @undataforum/tokens
🦋  info @undataforum/components is being published because our local version (0.44.0) is ahead of npm's (0.43.0)
🦋  info @undataforum/tokens is being published because our local version (0.4.1) is ahead of npm's (0.4.0)
🦋  info Publishing "@undataforum/components" at "0.44.0"
🦋  info Publishing "@undataforum/tokens" at "0.4.1"
🦋  error SyntaxError: Unexpected token > in JSON at position 1
🦋  error     at JSON.parse (<anonymous>)
🦋  error     at internalPublish (/home/google/Projects/undataforum/components/node_modules/@changesets/cli/dist/cli.cjs.dev.js:661:19)
🦋  error     at processTicksAndRejections (internal/process/task_queues.js:93:5)

The packages are published to npm, but creating git tags fails. Line 661 in cli.cjs.dev.js is

let json = JSON.parse(stdout.toString());

I will console log stdout next time I'm publishing and amend this issue. For now I'm tagging manually.

Activity

  1. maiertech commented on Oct 18, 2019

    @maiertech
    Author

    I logged stdout.toString() and it looks like the logs of my prepublishOnly task end up in the JSON. This is what is see when I log stdout.toString() (I added the ========== separators):

    ==========
    > @undataforum/[email protected] prepublishOnly .
    > npm run build
    
    > @undataforum/[email protected] build /home/google/Projects/undataforum/components/packages/tokens
    > rm -rf ./dist && cross-env NODE_ENV=production babel ./src -d ./dist --ignore 'src/**/*.stories.js'
    
    Successfully compiled 4 files with Babel.
    {
      "id": "@undataforum/[email protected]",
      "name": "@undataforum/tokens",
      "version": "0.5.0",
      "size": 13528,
      "unpackedSize": 35601,
      "shasum": "82757a685fdf4ca45f8947a6896497430f615ee2",
      "integrity": "sha512-l7wup7ad8ySzO2LTBlr2kTF35AHTfbb91+ULhTxqBw+rsPwn4UbYVtblqhbvyB/rj385MhItv2cAvO8xxch3MQ==",
      "filename": null,
      "files": [
        {
          "path": "dist/index.js",
          "size": 356,
          "mode": 420
        },
        {
          "path": "dist/Logo/index.js",
          "size": 359,
          "mode": 420
        },
        {
          "path": "dist/Logo/Logo.js",
          "size": 31618,
          "mode": 420
        },
        {
          "path": "dist/types.js",
          "size": 389,
          "mode": 420
        },
        {
          "path": "package.json",
          "size": 1639,
          "mode": 420
        },
        {
          "path": "CHANGELOG.md",
          "size": 374,
          "mode": 420
        },
        {
          "path": "README.md",
          "size": 866,
          "mode": 420
        }
      ],
      "entryCount": 7,
      "bundled": []
    }
    ==========
    
  2. Noviny commented on Oct 19, 2019

    @Noviny
    Contributor

    Good catch! Looks like we haven't tested it with prepublish scripts in packages (we tend to have a build script we call from the root before running publish)

    The file is npm-utils - I'll try and find some time to dig into what we should do when there are prepublish scripts.

  3. Noviny commented on Oct 19, 2019

    @Noviny
    Contributor

    Related post from the npm forums. Solution will be to try and parse the json, stripping the string before the { - I'll also likely add some better logging/error handling when we fail to parse.

  4. Noviny commented on Oct 19, 2019

    @Noviny
    Contributor

    Should be fixed in 2.1.2 - let me know if you're still have struggles.

  5. maiertech commented on Oct 21, 2019

    @maiertech
    Author

    Awesome, works like a charm! Thanks for the fixing this so quickly, @Noviny.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions