Thinkmill / manypkg

☔️ An umbrella for your monorepo
MIT License
884 stars 48 forks source link

Respository field set to invalid URL by @manypkg/cli #94

Open dpisani opened 3 years ago

dpisani commented 3 years ago

After running manypkg fix the repository field was set to a URL will nulls in it.

Git diff:

-  "repository": "git@github.com:dpisani/gengarden.git",
+  "repository": "null//github.com/null/github.com",

This also happened in child workspaces

-  "repository": "git@github.com:dpisani/gengarden.git",
+  "repository": "null//github.com/null/github.com/tree/master/packages/examples",

@manypkg/cli version: 0.17.0 node version: v10.14.2 OS: Linux (KDE Neon)

with-heart commented 3 years ago

That's weird. I created a rough reproduction of the code for that check in RunKit, and I'm able to see the first null but dpisani shows up correctly in both.

The first null occurs because the check relies on parse-github-url which returns null for the protocol when git@ is used.

I'm not sure what the best way to handle this case would be. It may not even be worth resolving. I have seen the use of git@ in repository fields before, but none of the documentation I can find around that field shows that as a valid use. Does anyone know more about the expected formats here?

prisis commented 3 years ago

Found the same issue with all the examples from https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository

Im using a monorepo for some project and have this inside my package.json

    "repository": {
        "type": "git",
        "url": "https://github.com/anolilab/cerebro.git",
        "directory": "packages/cerebro-patching-extension"
    },

then im getting the kind of the same error:

error @anolilab/cerebro-core has a repository field of {"type":"git","url":"https://github.com/anolilab/cerebro.git","directory":"packages/cerebro-core"} when it should be "null//github.com/null/github.com/tree/master/packages/cerebro-core"

the next interesting part is that i dont have a master branch at all