npmc

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package npmc defines the parser, the writer and utility functions for the package.json file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteToFile

func WriteToFile(appFS afero.Fs, pkg *PackageJSON, saveAs string, prefix string, indent string) error

WriteToFile saves a json string to a file on the file system

Types

type Bugs

type Bugs struct {
	URL string `json:"url"`
}

Bugs is a struct representing the bugs section of a package.json file

type Dependency

type Dependency map[string]string

Dependency is a map representing the dependency section of a package.json file

type Engine

type Engine map[string]string

Engine is a map representing the engine section of a package.json file

type NPMClient

type NPMClient struct {
	Name    string
	Desc    string
	Version string
}

NPMClient is the struct representing an npm client with name and version.

func (NPMClient) ToString

func (n NPMClient) ToString() string

ToString returns a valid string representing the package manager name and version <pm_name@pm_version>

type NPMClientInfoStr

type NPMClientInfoStr string

NPMClientInfoStr is an alias for string

func (NPMClientInfoStr) ToNPMClient

func (s NPMClientInfoStr) ToNPMClient() NPMClient

ToNPMClient takes an NPMClientInfoStr string alias and returns the relative NPMClient struct

type PackageJSON

type PackageJSON struct {
	Name            string        `json:"name"`
	Version         string        `json:"version"`
	Description     string        `json:"description"`
	Author          string        `json:"author"`
	License         string        `json:"license"`
	Keywords        []string      `json:"keywords"`
	Private         bool          `json:"private"`
	PackageManager  string        `json:"packageManager"`
	PublishConfig   PublishConfig `json:"publishConfig"`
	Engines         Engine        `json:"engines"`
	Workspace       []string      `json:"workspace"`
	Scripts         Script        `json:"scripts"`
	DevDependencies Dependency    `json:"devDependencies"`
	Dependencies    Dependency    `json:"dependencies"`
	Homepage        string        `json:"homepage"`
	Repository      Repository    `json:"repository"`
	Bugs            Bugs          `json:"bugs"`
	Type            string        `json:"type"`
}

PackageJSON is a struct representing a package.json file

func Parse

func Parse(content []byte) *PackageJSON

Parse parses the JSON-encoded data and stores the result in the value pointed to by v.

type PublishConfig

type PublishConfig map[string]string

PublishConfig is a map representing the publishConfig section of a package.json file

type Repository

type Repository struct {
	Type string `json:"type"`
	URL  string `json:"url"`
}

Repository is a struct representing the repository section of a package.json file

type Script

type Script map[string]string

Script is a map representing the script section of a package.json file

Jump to

Keyboard shortcuts

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