NPM.Pack (NPM v0.6.0)

Copy Markdown View Source

Creates npm-compatible tarballs from local projects.

Implements the npm pack functionality — reads files from package.json, applies default exclusions, and generates a publishable tarball.

Summary

Functions

Checks if a file should always be included regardless of files field.

Returns the default files list when no files field is specified.

Checks if a file should be excluded from the tarball.

Lists files that would be included in the tarball.

Generates the tarball filename from package.json data.

Functions

always_included?(path)

@spec always_included?(String.t()) :: boolean()

Checks if a file should always be included regardless of files field.

default_files(project_dir)

@spec default_files(String.t()) :: [String.t()]

Returns the default files list when no files field is specified.

excluded?(path)

@spec excluded?(String.t()) :: boolean()

Checks if a file should be excluded from the tarball.

list_files(project_dir)

@spec list_files(String.t()) :: {:ok, [String.t()]} | {:error, term()}

Lists files that would be included in the tarball.

tarball_name(map)

@spec tarball_name(map()) :: String.t()

Generates the tarball filename from package.json data.