Skip to content

Publishing a npm package won't store dependencies information #21013

Closed
@joecarl

Description

@joecarl

Description

The main reason I ended up here is because I published a npm package to my local gitea registry and then, when I tried to install it into another project I realized peerDependencies were not being installed. This didn't happen when I was using another registry, like verdaccio. So I decided to investigate why was this happening on Gitea only.

After publishing my package, if I access the url https://mygiteahost/api/packages/<owner>/npm/@scope%2Fpackage I get the following json:

{
	"_id": "@scope/package",
	"name": "@scope/package",
	"description": "description",
	"dist-tags": {
		"latest": "4.0.18"
	},
	"versions": {
		"4.0.18": {
			"_id": "@scope/package@4.0.18",
			"name": "@scope/package",
			"version": "4.0.18",
			"description": "description",
			"author": {
				"name": "Author"
			},
			"license": "ISC",
			"repository": {
				"type": "",
				"url": ""
			},
			"readme": "## package",
			"dist": {
				"integrity": "sha512-xBTkbkYxBgVcottHDlF0gp/wflbZ1Im7g2x8AJf7P+Qz/wxVMzYWMci3ilTEBN1+ZQea7TAppgBGrjKC/ZCIag==",
				"shasum": "a20233713f6fdc6f10fa6b0e8addca837b98f011",
				"tarball": "https://host.dev/api/packages/owner/npm/%scope%2Fpackage/-/4.0.18/package-4.0.18.tgz"
			}
		}
	},
	"readme": "## package",
	"repository": {
		"type": "",
		"url": ""
	},
	"author": {
		"name": "Author"
	},
	"license": "ISC"
}

As you can see it is missing information about dependencies.

This is the equivalent in verdaccio:

{
	"name": "@scope/package",
	"versions": {
		"4.0.18": {
			"name": "@scope/package",
			"version": "4.0.18",
			"description": "description",
			"author": {
				"name": "Author",
				"url": "https://Author.es"
			},
			"license": "ISC",
			"main": "dist/frontend/pkg/main.mjs",
			"scripts": {
				"test": "echo \"Error: no test specified\" && exit 1",
				"start": "echo \"Error: no dev mode available\" && exit 1",
				"build": "rm -rf dist/frontend && NODE_ENV=production ./node_modules/.bin/babel sources/frontend --keep-file-extension --out-dir dist/frontend --copy-files"
			},
			"files": [
				"dist/frontend"
			],
			"devDependencies": {
				"@babel/cli": "^7.17.10",
				"@babel/core": "^7.18.2",
				"@babel/eslint-parser": "^7.18.2",
				"@babel/plugin-transform-runtime": "^7.18.2",
				"@babel/preset-env": "^7.18.2",
				"@babel/preset-react": "^7.17.12",
				"@babel/runtime": "^7.18.3",
				"eslint": "^8.17.0",
				"eslint-plugin-react": "^7.30.0",
				"sass": "^1.52.2"
			},
			"peerDependencies": {
				"react": "^18.1.0",
				"react-dom": "^18.1.0"
			},
			"readmeFilename": "README.md",
			"_id": "@scope/package@4.0.148",
			"_nodeVersion": "18.6.0",
			"_npmVersion": "8.18.0",
			"dist": {
				"integrity": "sha512-R032NpKnDw00M9CczYnT59UacbKNM0MQt2npVKV3fOWmoaJSVZ0SESakb72xbQiRcxBiy2GoU2rXy2E+ZiFrXA==",
				"shasum": "9560390f7aa3ec972ad3868481db94d457d46d8d",
				"tarball": "http://verdaccio-host.dev/@scope/package/-/@scope/package-4.0.148.tgz"
			},
			"contributors": []
		}
	},
	"time": {
		"modified": "2022-09-01T00:34:55.326Z",
		"created": "2022-09-01T00:34:55.326Z",
		"4.0.148": "2022-09-01T00:34:55.326Z"
	},
	"users": {},
	"dist-tags": {
		"latest": "4.0.148"
	},
	"_uplinks": {
		"cs": {
			"fetched": 1661992481981
		}
	},
	"_distfiles": {
		"package-4.0.18.tgz": {
			"url": "https://host.dev/api/packages/Author/npm/%40Author%2Fpackage/-/4.0.18/package-4.0.18.tgz",
			"sha": "c9b7d524618c780ccf2b43457462379c465fb108",
			"registry": "cs"
		}
	},
	"_attachments": {
		"package-4.0.18.tgz": {
			"shasum": "c9b7d524618c780ccf2b43457462379c465fb108"
		},
		"package-4.0.148.tgz": {
			"shasum": "9560390f7aa3ec972ad3868481db94d457d46d8d",
			"version": "4.0.148"
		}
	},
	"_rev": "6-0fac5b9cbba016ba",
	"_id": "@scope/package",
	"readme": "## package"
}

I don't even know if npm uses this information to install peerDependencies, the only thing I know is that peers were installed when I downloaded the package from verdaccio and they were not when I did it from Gitea.

I know that I can install peer deps manually, but I don't wanna go through that process everytime.

I really want to use Gitea because it's awesome!!

Is this a bug or am I doing something wrong??

Thanks in advance.

Gitea Version

1.17.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

I'm running Gitea using the latest docker image.

Database

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions