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.2.1

Entrypoint

Return Type
Node
Example
dagger -m github.com/Dudesons/daggerverse/node@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
func (m *myModule) example() *Node  {
	return dag.
			Node()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 container
func (m *myModule) example() *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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 directory
func (m *myModule) example() *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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 shell
func (m *myModule) example() *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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 serve
func (m *myModule) example() *Service  {
	return dag.
			Node().
			Serve()
}
@function
def example() -> dagger.Service:
	return (
		dag.node()
		.serve()
	)
@func()
example(): Service {
	return dag
		.node()
		.serve()
}

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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-pipeline-id --pipeline-id string
func (m *myModule) example(pipelineId string) *Node  {
	return dag.
			Node().
			WithPipelineId(pipelineId)
}
@function
def example(pipeline_id: str) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 setup-system
func (m *myModule) example() *Node  {
	return dag.
			Node().
			SetupSystem()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec 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()
}

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

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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-version --version string
func (m *myModule) example(version string) *Node  {
	return dag.
			Node().
			WithVersion(version)
}
@function
def example(version: str) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-npmrc-token-env --name string --value env:MYSECRET
func (m *myModule) example(name string, value *Secret) *Node  {
	return dag.
			Node().
			WithNpmrcTokenEnv(name, value)
}
@function
def example(name: str, value: dagger.Secret) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-npmrc-token-file --npmrc-file env:MYSECRET
func (m *myModule) example(npmrcFile *Secret) *Node  {
	return dag.
			Node().
			WithNpmrcTokenFile(npmrcFile)
}
@function
def example(npmrc_file: dagger.Secret) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-package-manager --package-manager string
func (m *myModule) example(packageManager string) *Node  {
	return dag.
			Node().
			WithPackageManager(packageManager)
}
@function
def example(package_manager: str) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-npm
func (m *myModule) example() *Node  {
	return dag.
			Node().
			WithNpm()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-yarn
func (m *myModule) example() *Node  {
	return dag.
			Node().
			WithYarn()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-source --src DIR_PATH
func (m *myModule) example(src *Directory) *Node  {
	return dag.
			Node().
			WithSource(src)
}
@function
def example(src: dagger.Directory) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-file --file file:path --path string
func (m *myModule) example(file *File, path string) *Node  {
	return dag.
			Node().
			WithFile(file, path)
}
@function
def example(file: dagger.File, path: str) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-directory --dir DIR_PATH --path string
func (m *myModule) example(dir *Directory, path string) *Node  {
	return dag.
			Node().
			WithDirectory(dir, path)
}
@function
def example(dir: dagger.Directory, path: str) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 with-cache --cache VOLUME_NAME --path string
func (m *myModule) example(cache *CacheVolume, path string) *Node  {
	return dag.
			Node().
			WithCache(cache, path)
}
@function
def example(cache: dagger.CacheVolume, path: str) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 production
func (m *myModule) example() *Node  {
	return dag.
			Node().
			Production()
}
@function
def example() -> dag.Node:
	return (
		dag.node()
		.production()
	)
@func()
example(): Node {
	return dag
		.node()
		.production()
}

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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 run --command string1 --command string2
func (m *myModule) example(command []string) *Node  {
	return dag.
			Node().
			Run(command)
}
@function
def example(command: List[str]) -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 install
func (m *myModule) example() *Node  {
	return dag.
			Node().
			Install()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 lint
func (m *myModule) example() *Node  {
	return dag.
			Node().
			Lint()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 test
func (m *myModule) example() *Node  {
	return dag.
			Node().
			Test()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec 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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 clean
func (m *myModule) example() *Node  {
	return dag.
			Node().
			Clean()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 build
func (m *myModule) example() *Node  {
	return dag.
			Node().
			Build()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 publish
func (m *myModule) example() *Node  {
	return dag.
			Node().
			Publish()
}
@function
def example() -> dag.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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec call \
 bump-version --strategy string
func (m *myModule) example(strategy string) *Node  {
	return dag.
			Node().
			BumpVersion(strategy)
}
@function
def example(strategy: str) -> dag.Node:
	return (
		dag.node()
		.bump_version(strategy)
	)
@func()
example(strategy: string): Node {
	return dag
		.node()
		.bumpVersion(strategy)
}

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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec 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)
}

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@aa4374e0a17197ef1a0dfaaf77fbb50a66a7c0ec 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()
}