Dagger
Search

node

A Nodejs module for managing package, oci image, static website, running run script ...

Installation

dagger install github.com/Dudesons/daggerverse/node@v0.6.0

Entrypoint

Return Type
Node
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
	)
@func()
example(): Node {
	return dag
		.node()
}

Types

Node 🔗

container() 🔗

Return the current container state

Return Type
Container !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 container
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Node().
			Container()
}
@function
def example() -> dagger.Container:
	return (
		dag.node()
		.container()
	)
@func()
example(): Container {
	return dag
		.node()
		.container()
}

directory() 🔗

Return the current working directory

Return Type
Directory !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 directory
func (m *MyModule) Example() *dagger.Directory  {
	return dag.
			Node().
			Directory()
}
@function
def example() -> dagger.Directory:
	return (
		dag.node()
		.directory()
	)
@func()
example(): Directory {
	return dag
		.node()
		.directory()
}

shell() 🔗

Open a shell in the current container or execute a command inside it, like node

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
cmd[String ! ] -

The command to execute in the terminal

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 shell
func (m *MyModule) Example() *dagger.Container  {
	return dag.
			Node().
			Shell()
}
@function
def example() -> dagger.Container:
	return (
		dag.node()
		.shell()
	)
@func()
example(): Container {
	return dag
		.node()
		.shell()
}

serve() 🔗

Expose the container as a service

Return Type
Service !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 serve
func (m *MyModule) Example() *dagger.Service  {
	return dag.
			Node().
			Serve()
}
@function
def example() -> dagger.Service:
	return (
		dag.node()
		.serve()
	)
@func()
example(): Service {
	return dag
		.node()
		.serve()
}

pipeline() 🔗

Execute the whole pipeline in general used with the function ‘with-auto-setup’

Return Type
String !
Arguments
NameTypeDefault ValueDescription
preHooks[List ! ] -

Define hooks to execute before all

postHooks[List ! ] -

Define hooks to execute after tests and before build

isOciBoolean -

Indicate if the artifact is an oci build or not

dryRunBoolean "false"

Indicate to dry run the publishing

packageAccessString "true"

Define permission on the package in the registry

packageDevTagString -

Indicate if the package is publishing as development version

fileContainerArtifacts[String ! ] -

Define path to file to fetch from the build container

directoryContainerArtifacts[String ! ] -

Define path to directories to fetch from the build container

ociRegistries[String ! ] -

Define registries where to push the image

ttlRegistryString "ttl.sh"

Define the ttl registry to use

ttlString "60m"

Define the ttl in the ttl registry

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 pipeline
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Node().
			Pipeline(ctx)
}
@function
async def example() -> str:
	return await (
		dag.node()
		.pipeline()
	)
@func()
async example(): Promise<string> {
	return dag
		.node()
		.pipeline()
}

ociBuild() 🔗

Build a production image and push to one or more registries

Return Type
[String ! ] !
Arguments
NameTypeDefault ValueDescription
fileContainerArtifacts[String ! ] -

Define path to fo file to fetch from the build container

directoryContainerArtifacts[String ! ] -

Define path to fo directories to fetch from the build container

registries[String ! ] !-

Define registries where to push the image

isTtlBoolean -

Define the ttl registry to use

ttlRegistryString "ttl.sh"

Define the ttl registry to use

ttlString "60m"

Define the ttl in the ttl registry

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 oci-build --registries string1 --registries string2
func (m *MyModule) Example(ctx context.Context, registries []string) []string  {
	return dag.
			Node().
			OciBuild(ctxregistries)
}
@function
async def example(registries: List[str]) -> List[str]:
	return await (
		dag.node()
		.oci_build(registries)
	)
@func()
async example(registries: string[]): Promise<string[]> {
	return dag
		.node()
		.ociBuild(registries)
}

withAutoSetup() 🔗

Allow to let the pipeline to be setup automatically based on the package.json aka lazy mode

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
pipelineIdString !-

A name to use in the pipeline and injected in cache keys

srcDirectory !-

The code to mount in the node container

patternExclusions[String ! ] -

Patterns to exclude in the analysis for the auto-detection

imageString "node"

The image name to use

isAlpineBoolean "true"

Define if the image to use is an alpine or not

containerPlatformScalar "linux/amd64"

Container options

systemSetupCmds[List ! ] -

Indicate attempted system package to install

packageManagerVersionString -

Define a specific version of the package manager.

workspaces[String ! ] -

Node workspaces to use during the pipeline

internalImageString "alpine:latest"

Used for autodiscovery to overwrite the default image used for internal action (mainly used to avoid rate limit with dockerhub)

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-auto-setup --pipeline-id string --src DIR_PATH
func (m *MyModule) Example(pipelineId string, src *dagger.Directory) *dagger.Node  {
	return dag.
			Node().
			WithAutoSetup(pipelineId, src)
}
@function
def example(pipeline_id: str, src: dagger.Directory) -> dagger.Node:
	return (
		dag.node()
		.with_auto_setup(pipeline_id, src)
	)
@func()
example(pipelineId: string, src: Directory): Node {
	return dag
		.node()
		.withAutoSetup(pipelineId, src)
}

withPipelineId() 🔗

Define the pipeline id to use

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
pipelineIdString !-

The name to give to the pipeline

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-pipeline-id --pipeline-id string
func (m *MyModule) Example(pipelineId string) *dagger.Node  {
	return dag.
			Node().
			WithPipelineId(pipelineId)
}
@function
def example(pipeline_id: str) -> dagger.Node:
	return (
		dag.node()
		.with_pipeline_id(pipeline_id)
	)
@func()
example(pipelineId: string): Node {
	return dag
		.node()
		.withPipelineId(pipelineId)
}

setupSystem() 🔗

Setup system component like installing packages

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
systemSetupCmds[List ! ] -

Indicate attempted system package to install

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 setup-system
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			SetupSystem()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.setup_system()
	)
@func()
example(): Node {
	return dag
		.node()
		.setupSystem()
}

do() 🔗

Execute all commands

Return Type
String !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 do
func (m *MyModule) Example(ctx context.Context) string  {
	return dag.
			Node().
			Do(ctx)
}
@function
async def example() -> str:
	return await (
		dag.node()
		.do()
	)
@func()
async example(): Promise<string> {
	return dag
		.node()
		.do()
}

withVersion() 🔗

Return the Node container with the right base image

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
imageString "node"

The image name to use

versionString !-

The version of the image to use

isAlpineBoolean "true"

Define if the image to use is an alpine or not

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-version --version string
func (m *MyModule) Example(version string) *dagger.Node  {
	return dag.
			Node().
			WithVersion(version)
}
@function
def example(version: str) -> dagger.Node:
	return (
		dag.node()
		.with_version(version)
	)
@func()
example(version: string): Node {
	return dag
		.node()
		.withVersion(version)
}

withNpmrcTokenEnv() 🔗

Return the Node container with an environment variable to use in your npmrc file

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
nameString !-

The name of the environment variable where the npmrc token is stored

valueSecret !-

The value of the token

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-npmrc-token-env --name string --value env:MYSECRET
func (m *MyModule) Example(name string, value *dagger.Secret) *dagger.Node  {
	return dag.
			Node().
			WithNpmrcTokenEnv(name, value)
}
@function
def example(name: str, value: dagger.Secret) -> dagger.Node:
	return (
		dag.node()
		.with_npmrc_token_env(name, value)
	)
@func()
example(name: string, value: Secret): Node {
	return dag
		.node()
		.withNpmrcTokenEnv(name, value)
}

withNpmrcTokenFile() 🔗

Return the Node container with npmrc file

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
npmrcFileSecret !-

The npmrc file to inject in the container

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-npmrc-token-file --npmrc-file env:MYSECRET
func (m *MyModule) Example(npmrcFile *dagger.Secret) *dagger.Node  {
	return dag.
			Node().
			WithNpmrcTokenFile(npmrcFile)
}
@function
def example(npmrc_file: dagger.Secret) -> dagger.Node:
	return (
		dag.node()
		.with_npmrc_token_file(npmrc_file)
	)
@func()
example(npmrcFile: Secret): Node {
	return dag
		.node()
		.withNpmrcTokenFile(npmrcFile)
}

withPackageManager() 🔗

Return the Node container setup with the right package manager and optionaly cache setup

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
packageManagerString !-

The package manager to use

disableCacheBoolean -

Disable mounting cache volumes.

versionString -

Define a specific version of the package manager.

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-package-manager --package-manager string
func (m *MyModule) Example(packageManager string) *dagger.Node  {
	return dag.
			Node().
			WithPackageManager(packageManager)
}
@function
def example(package_manager: str) -> dagger.Node:
	return (
		dag.node()
		.with_package_manager(package_manager)
	)
@func()
example(packageManager: string): Node {
	return dag
		.node()
		.withPackageManager(packageManager)
}

withNpm() 🔗

Return the Node container with npm setup as an entrypoint and npm cache setup

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
disableCacheBoolean -

Disable mounting cache volumes.

versionString -

Define a specific version of npm.

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-npm
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			WithNpm()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.with_npm()
	)
@func()
example(): Node {
	return dag
		.node()
		.withNpm()
}

withYarn() 🔗

Return the Node container with yarn setup as an entrypoint and yarn cache setup

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
disableCacheBoolean -

Disable mounting cache volumes.

versionString -

Define a specific version of npm.

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-yarn
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			WithYarn()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.with_yarn()
	)
@func()
example(): Node {
	return dag
		.node()
		.withYarn()
}

withSource() 🔗

Return the Node container with the source code, ‘node_modules’ cache set up and workdir set

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-

The source code

persistedBoolean -

Indicate if the directory is mounted or persisted in the container

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-source --src DIR_PATH
func (m *MyModule) Example(src *dagger.Directory) *dagger.Node  {
	return dag.
			Node().
			WithSource(src)
}
@function
def example(src: dagger.Directory) -> dagger.Node:
	return (
		dag.node()
		.with_source(src)
	)
@func()
example(src: Directory): Node {
	return dag
		.node()
		.withSource(src)
}

withFile() 🔗

Return the Node container with an additional file in the working dir

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
fileFile !-

The file to use

pathString !-

The path where the file should be mounted

persistedBoolean -

Indicate if the file is mounted or persisted in the container

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-file --file file:path --path string
func (m *MyModule) Example(file *dagger.File, path string) *dagger.Node  {
	return dag.
			Node().
			WithFile(file, path)
}
@function
def example(file: dagger.File, path: str) -> dagger.Node:
	return (
		dag.node()
		.with_file(file, path)
	)
@func()
example(file: File, path: string): Node {
	return dag
		.node()
		.withFile(file, path)
}

withDirectory() 🔗

Return the Node container with an additional directory in the working dir

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
dirDirectory !-

The directory to use

pathString !-

The path where the directory should be mounted

persistedBoolean -

Indicate if the directory is mounted or persisted in the container

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-directory --dir DIR_PATH --path string
func (m *MyModule) Example(dir *dagger.Directory, path string) *dagger.Node  {
	return dag.
			Node().
			WithDirectory(dir, path)
}
@function
def example(dir: dagger.Directory, path: str) -> dagger.Node:
	return (
		dag.node()
		.with_directory(dir, path)
	)
@func()
example(dir: Directory, path: string): Node {
	return dag
		.node()
		.withDirectory(dir, path)
}

withCache() 🔗

Return the Node container with an additional cache volume in the working dir

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
cacheCacheVolume !-

The cache volume to use

pathString !-

The path where the cache volume should be mounted

persistedBoolean -

Indicate if the cache volume is mounted or persisted in the container

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-cache --cache VOLUME_NAME --path string
func (m *MyModule) Example(cache *dagger.CacheVolume, path string) *dagger.Node  {
	return dag.
			Node().
			WithCache(cache, path)
}
@function
def example(cache: dagger.CacheVolume, path: str) -> dagger.Node:
	return (
		dag.node()
		.with_cache(cache, path)
	)
@func()
example(cache: CacheVolume, path: string): Node {
	return dag
		.node()
		.withCache(cache, path)
}

production() 🔗

Return a node container with the ‘NODE_ENV’ set to production

Return Type
Node !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 production
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			Production()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.production()
	)
@func()
example(): Node {
	return dag
		.node()
		.production()
}

withWorkspace() 🔗

Prepare the command to inject workspaces

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
workspaceString !-No description provided
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 with-workspace --workspace string
func (m *MyModule) Example(workspace string) *dagger.Node  {
	return dag.
			Node().
			WithWorkspace(workspace)
}
@function
def example(workspace: str) -> dagger.Node:
	return (
		dag.node()
		.with_workspace(workspace)
	)
@func()
example(workspace: string): Node {
	return dag
		.node()
		.withWorkspace(workspace)
}

run() 🔗

Execute a command from the package.json

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
command[String ! ] !-

Command from the package.json to run

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 run --command string1 --command string2
func (m *MyModule) Example(command []string) *dagger.Node  {
	return dag.
			Node().
			Run(command)
}
@function
def example(command: List[str]) -> dagger.Node:
	return (
		dag.node()
		.run(command)
	)
@func()
example(command: string[]): Node {
	return dag
		.node()
		.run(command)
}

install() 🔗

Install node modules

Return Type
Node !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 install
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			Install()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.install()
	)
@func()
example(): Node {
	return dag
		.node()
		.install()
}

lint() 🔗

Execute lint command

Return Type
Node !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 lint
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			Lint()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.lint()
	)
@func()
example(): Node {
	return dag
		.node()
		.lint()
}

test() 🔗

Execute test command

Return Type
Node !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 test
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			Test()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.test()
	)
@func()
example(): Node {
	return dag
		.node()
		.test()
}

parallelTest() 🔗

Execute test commands in parallel

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
cmds[List ! ] !-No description provided
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 parallel-test --cmds list1 --cmds list2
func (m *MyModule) Example(ctx context.Context, cmds [])   {
	return dag.
			Node().
			ParallelTest(ctx, cmds)
}
@function
async def example(cmds: List[]) -> None:
	return await (
		dag.node()
		.parallel_test(cmds)
	)
@func()
async example(cmds: []): Promise<void> {
	return dag
		.node()
		.parallelTest(cmds)
}

clean() 🔗

Execute clean command

Return Type
Node !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 clean
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			Clean()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.clean()
	)
@func()
example(): Node {
	return dag
		.node()
		.clean()
}

build() 🔗

Execute the build command

Return Type
Node !
Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 build
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			Build()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.build()
	)
@func()
example(): Node {
	return dag
		.node()
		.build()
}

publish() 🔗

Execute the publish which push a package to a registry

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
accessString -

Define permission on the package in the registry

devTagString -

Indicate if the package is publishing as development version

dryRunBoolean -

Indicate to dry run the publishing

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 publish
func (m *MyModule) Example() *dagger.Node  {
	return dag.
			Node().
			Publish()
}
@function
def example() -> dagger.Node:
	return (
		dag.node()
		.publish()
	)
@func()
example(): Node {
	return dag
		.node()
		.publish()
}

bumpVersion() 🔗

Bump the package version

Return Type
Node !
Arguments
NameTypeDefault ValueDescription
strategyString !-

Define the bump version strategy (major | minor | patch | premajor | preminor | prepatch | prerelease)

messageString -

The message will use it as a commit message when creating a version commit. If the message config contains %s then that will be replaced with the resulting version number

Example
dagger -m github.com/Dudesons/daggerverse/node@9348808c60af026c9ad036e9c8ce37da962dc979 call \
 bump-version --strategy string
func (m *MyModule) Example(strategy string) *dagger.Node  {
	return dag.
			Node().
			BumpVersion(strategy)
}
@function
def example(strategy: str) -> dagger.Node:
	return (
		dag.node()
		.bump_version(strategy)
	)
@func()
example(strategy: string): Node {
	return dag
		.node()
		.bumpVersion(strategy)
}