mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-01 20:59:45 +09:00
51b93d1d27
Aligns the npm registry with what npm, pnpm and yarn expect: 1. Raise the publish body cap from https://github.com/go-gitea/gitea/pull/37890 to 256 MiB like npmjs, larger bodies get 413 2. Pick the tarball attachment by name, `npm publish --provenance` failed at random 3. Store and serve `libc`, so mismatched glibc/musl optional binaries are skipped 4. Treat root `*.gyp` files as an install script, like npm does 5. Always serve a `latest` dist-tag, yarn and pnpm fail without it 6. Take top-level metadata from `latest` and drop the per-version readme 7. Serve tarballs at the npmjs path `/<name>/-/<file>`, former URLs keep working 8. Add ETag revalidation for metadata, `npm ping` and `npm whoami` Tested with npm 12.1, pnpm 12.4, yarn 1.22 and yarn 4.18. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
38 lines
2.1 KiB
Go
38 lines
2.1 KiB
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package npm
|
|
|
|
// TagProperty is the name of the property for tag management
|
|
const TagProperty = "npm.tag"
|
|
|
|
// Metadata represents the metadata of a npm package
|
|
type Metadata struct {
|
|
Scope string `json:"scope,omitempty"`
|
|
Name string `json:"name,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
Author string `json:"author,omitempty"`
|
|
License License `json:"license,omitempty"`
|
|
ProjectURL string `json:"project_url,omitempty"`
|
|
Keywords []string `json:"keywords,omitempty"`
|
|
Dependencies map[string]string `json:"dependencies,omitempty"`
|
|
BundleDependencies []string `json:"bundleDependencies,omitempty"`
|
|
DevelopmentDependencies map[string]string `json:"development_dependencies,omitempty"`
|
|
PeerDependencies map[string]string `json:"peer_dependencies,omitempty"`
|
|
PeerDependenciesMeta map[string]any `json:"peer_dependencies_meta,omitempty"`
|
|
OptionalDependencies map[string]string `json:"optional_dependencies,omitempty"`
|
|
Bin map[string]string `json:"bin,omitempty"`
|
|
Readme string `json:"readme,omitempty"`
|
|
Repository Repository `json:"repository"`
|
|
HasInstallScript bool `json:"has_install_script,omitempty"`
|
|
HasShrinkwrap bool `json:"has_shrinkwrap,omitempty"`
|
|
Engines map[string]string `json:"engines,omitempty"`
|
|
CPU []string `json:"cpu,omitempty"`
|
|
OS []string `json:"os,omitempty"`
|
|
Libc []string `json:"libc,omitempty"`
|
|
Directories map[string]string `json:"directories,omitempty"`
|
|
Funding any `json:"funding,omitempty"`
|
|
AcceptDependencies map[string]string `json:"accept_dependencies,omitempty"`
|
|
Deprecated string `json:"deprecated,omitempty"`
|
|
}
|