npm
A module for Example functions
Installation
dagger install github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638Entrypoint
Return Type
Npm !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Context directory with a package.json |
| baseImage | String ! | "node:24" | Container to use for all tasks |
Example
dagger -m github.com/kpenfound/blueprints/npm@2bb1d301e87cbe218b65c99f4e74618cda252638 call \
--base-image stringfunc (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 basefunc (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 lintfunc (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 testfunc (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 buildfunc (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
| Name | Type | Default Value | Description |
|---|---|---|---|
| run | String ! | - | 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 stringfunc (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)
}