Dagger
Search

npm

A module for Example functions

Installation

dagger install github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638

Entrypoint

Return Type
Npm !
Arguments
NameTypeDefault ValueDescription
sourceDirectory -Context directory with a package.json
baseImageString !"node:24"Container to use for all tasks
Example
dagger -m github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638 call \
 --base-image string
func (m *MyModule) Example(baseImage string) *dagger.Npm  {
	return dag.
			Npm(baseImage)
}
@function
def example(base_image: str) -> dagger.Npm:
	return (
		dag.npm(base_image)
	)
@func()
example(baseImage: string): Npm {
	return dag
		.npm(baseImage)
}

Types

Npm 🔗

base() 🔗

Returns the node base image with the project setup

Return Type
Container !
Example
dagger -m github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638 call \
 --base-image string base
func (m *MyModule) Example(baseImage string) *dagger.Container  {
	return dag.
			Npm(baseImage).
			Base()
}
@function
def example(base_image: str) -> dagger.Container:
	return (
		dag.npm(base_image)
		.base()
	)
@func()
example(baseImage: string): Container {
	return dag
		.npm(baseImage)
		.base()
}

lint() 🔗

Runs the linter

Return Type
String !
Example
dagger -m github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638 call \
 --base-image string lint
func (m *MyModule) Example(ctx context.Context, baseImage string) string  {
	return dag.
			Npm(baseImage).
			Lint(ctx)
}
@function
async def example(base_image: str) -> str:
	return await (
		dag.npm(base_image)
		.lint()
	)
@func()
async example(baseImage: string): Promise<string> {
	return dag
		.npm(baseImage)
		.lint()
}

test() 🔗

Runs the test

Return Type
String !
Example
dagger -m github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638 call \
 --base-image string test
func (m *MyModule) Example(ctx context.Context, baseImage string) string  {
	return dag.
			Npm(baseImage).
			Test(ctx)
}
@function
async def example(base_image: str) -> str:
	return await (
		dag.npm(base_image)
		.test()
	)
@func()
async example(baseImage: string): Promise<string> {
	return dag
		.npm(baseImage)
		.test()
}

build() 🔗

Returns the completed build directory at ./dist

Return Type
Directory !
Example
dagger -m github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638 call \
 --base-image string build
func (m *MyModule) Example(baseImage string) *dagger.Directory  {
	return dag.
			Npm(baseImage).
			Build()
}
@function
def example(base_image: str) -> dagger.Directory:
	return (
		dag.npm(base_image)
		.build()
	)
@func()
example(baseImage: string): Directory {
	return dag
		.npm(baseImage)
		.build()
}

npm() 🔗

Run any npm command

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
runString !-The npm script to run
flags[String ! ] -Extra flags to pass to npm
Example
dagger -m github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638 call \
 --base-image string npm --run string
func (m *MyModule) Example(baseImage string, run string) *dagger.Container  {
	return dag.
			Npm(baseImage).
			Npm(run)
}
@function
def example(base_image: str, run: str) -> dagger.Container:
	return (
		dag.npm(base_image)
		.npm(run)
	)
@func()
example(baseImage: string, run: string): Container {
	return dag
		.npm(baseImage)
		.npm(run)
}