npm

package
v0.0.0-...-4d8c88f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2021 License: MPL-2.0 Imports: 13 Imported by: 0

README

npm

Utilities for downloading and extracting packages from NPM. This is used in build scripts to pull a certain version of starboard-notebook and friends.

Documentation

Overview

This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.

This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.

This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadPackageIntoFolder

func DownloadPackageIntoFolder(packageName string, version string, outFolder string) (string, error)

* * DownloadPackageIntoFolder downloads given NPM package into the outfolder, it puts it in a subfolder * called <packageName>@<version>, this function returns that folder name.

func PackageIdToPackageAndVersion

func PackageIdToPackageAndVersion(pn string) (string, string)

starboard-notebook@1.2.3 -> starboard-notebook 1.2.3

Types

type NPMRegistryEntry

type NPMRegistryEntry struct {
	ID       string `json:"_id"`
	Rev      string `json:"_rev"`
	Name     string `json:"name"`
	DistTags struct {
		Latest string `json:"latest"`
	} `json:"dist-tags"`
	Versions map[string]struct {
		Name        string `json:"name"`
		Version     string `json:"version"`
		Description string `json:"description"`
		Author      struct {
			Name  string `json:"name"`
			Email string `json:"email"`
		} `json:"author"`
		Funding struct {
			Type string `json:"type"`
			URL  string `json:"url"`
		} `json:"funding"`
		License    string `json:"license"`
		Repository struct {
			Type string `json:"type"`
			URL  string `json:"url"`
		} `json:"repository"`
		Keywords        []string          `json:"keywords"`
		Scripts         map[string]string `json:"scripts"`
		Main            string            `json:"main"`
		DevDependencies map[string]string `json:"devDependencies"`
		Dependencies    map[string]string `json:"dependencies"`
		GitHead         string            `json:"gitHead"`
		ID              string            `json:"_id"`
		NodeVersion     string            `json:"_nodeVersion"`
		NpmVersion      string            `json:"_npmVersion"`
		Dist            struct {
			Integrity    string `json:"integrity"`
			Shasum       string `json:"shasum"`
			Tarball      string `json:"tarball"`
			FileCount    int    `json:"fileCount"`
			UnpackedSize int    `json:"unpackedSize"`
			NpmSignature string `json:"npm-signature"`
		} `json:"dist"`
		Maintainers []struct {
			Name  string `json:"name"`
			Email string `json:"email"`
		} `json:"maintainers"`
		NpmUser struct {
			Name  string `json:"name"`
			Email string `json:"email"`
		} `json:"_npmUser"`
		Directories struct {
		} `json:"directories"`
		NpmOperationalInternal struct {
			Host string `json:"host"`
			Tmp  string `json:"tmp"`
		} `json:"_npmOperationalInternal"`
		HasShrinkwrap bool `json:"_hasShrinkwrap"`
	} `json:"versions"`
	Time        map[string]time.Time `json:"time"`
	Maintainers []struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"maintainers"`
	Description string   `json:"description"`
	Keywords    []string `json:"keywords"`
	Repository  struct {
		Type string `json:"type"`
		URL  string `json:"url"`
	} `json:"repository"`
	Author struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"author"`
	License        string `json:"license"`
	Readme         string `json:"readme"`
	ReadmeFilename string `json:"readmeFilename"`
}

func GetRegistryEntry

func GetRegistryEntry(packageName string) (NPMRegistryEntry, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL