stdlib: rename js/react.#App to js/yarn.#Package
Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
committed by
Solomon Hykes
parent
56ef4c1928
commit
16edfc4fec
64
stdlib/js/yarn/yarn.cue
Normal file
64
stdlib/js/yarn/yarn.cue
Normal file
@@ -0,0 +1,64 @@
|
||||
// Yarn is a package manager for Javascript applications
|
||||
// https://yarnpkg.com
|
||||
package yarn
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/alpine"
|
||||
"dagger.io/os"
|
||||
)
|
||||
|
||||
// A Yarn package.
|
||||
#Package: {
|
||||
// Application source code
|
||||
source: dagger.#Artifact
|
||||
|
||||
// Environment variables
|
||||
env: [string]: string
|
||||
|
||||
// Write the contents of `environment` to this file,
|
||||
// in the "envfile" format.
|
||||
writeEnvFile: string | *""
|
||||
|
||||
// Read build output from this directory
|
||||
// (path must be relative to working directory).
|
||||
buildDir: string | *"build"
|
||||
|
||||
// Run this yarn script
|
||||
script: string | *"build"
|
||||
|
||||
build: os.#Dir & {
|
||||
from: ctr
|
||||
path: "/build"
|
||||
}
|
||||
|
||||
ctr: os.#Container & {
|
||||
image: alpine.#Image & {
|
||||
package: {
|
||||
bash: "=~5.1"
|
||||
yarn: "=~1.22"
|
||||
}
|
||||
}
|
||||
shell: path: "/bin/bash"
|
||||
command: """
|
||||
[ -n "$ENVFILE_NAME" ] && echo "$ENVFILE" > "$ENVFILE_NAME"
|
||||
yarn install --production false
|
||||
yarn run "$YARN_BUILD_SCRIPT"
|
||||
mv "$YARN_BUILD_DIRECTORY" /build
|
||||
"""
|
||||
"env": env & {
|
||||
YARN_BUILD_SCRIPT: script
|
||||
YARN_CACHE_FOLDER: "/cache/yarn"
|
||||
YARN_BUILD_DIRECTORY: buildDir
|
||||
if writeEnvFile != "" {
|
||||
ENVFILE_NAME: writeEnvFile
|
||||
ENVFILE: strings.Join([ for k, v in env {"\(k)=\(v)"}], "\n")
|
||||
}
|
||||
}
|
||||
dir: "/src"
|
||||
mount: "/src": from: source
|
||||
cache: "/cache/yarn": true
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user