stdlib: rename js/react.#App to js/yarn.#Package
Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
parent
56ef4c1928
commit
16edfc4fec
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
"dagger.io/netlify"
|
"dagger.io/netlify"
|
||||||
"dagger.io/js/react"
|
"dagger.io/js/yarn"
|
||||||
"dagger.io/git"
|
"dagger.io/git"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ frontend: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
frontend: {
|
frontend: {
|
||||||
app: react.#App & {
|
app: yarn.#Package & {
|
||||||
source: frontend.source
|
source: frontend.source
|
||||||
env: frontend.environment
|
env: frontend.environment
|
||||||
|
|
||||||
@ -38,10 +38,8 @@ frontend: {
|
|||||||
writeEnvFile: frontend.writeEnvFile
|
writeEnvFile: frontend.writeEnvFile
|
||||||
}
|
}
|
||||||
|
|
||||||
yarn: {
|
script: frontend.yarn.script
|
||||||
script: frontend.yarn.script
|
buildDir: frontend.yarn.buildDir
|
||||||
buildDir: frontend.yarn.buildDir
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Host the application with Netlify
|
// Host the application with Netlify
|
||||||
|
@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/netlify"
|
"dagger.io/netlify"
|
||||||
"dagger.io/js/react"
|
"dagger.io/js/yarn"
|
||||||
"dagger.io/git"
|
"dagger.io/git"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,6 +22,6 @@ www: netlify.#Site & {
|
|||||||
contents: app.build
|
contents: app.build
|
||||||
}
|
}
|
||||||
|
|
||||||
app: react.#App & {
|
app: yarn.#Package & {
|
||||||
source: repo
|
source: repo
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
package react
|
// Yarn is a package manager for Javascript applications
|
||||||
|
// https://yarnpkg.com
|
||||||
|
package yarn
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
@ -8,9 +10,8 @@ import (
|
|||||||
"dagger.io/os"
|
"dagger.io/os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A ReactJS application
|
// A Yarn package.
|
||||||
// FIXME: move this to a 'yarn' package for clarity
|
#Package: {
|
||||||
#App: {
|
|
||||||
// Application source code
|
// Application source code
|
||||||
source: dagger.#Artifact
|
source: dagger.#Artifact
|
||||||
|
|
||||||
@ -21,15 +22,12 @@ import (
|
|||||||
// in the "envfile" format.
|
// in the "envfile" format.
|
||||||
writeEnvFile: string | *""
|
writeEnvFile: string | *""
|
||||||
|
|
||||||
// Yarn-specific settings
|
// Read build output from this directory
|
||||||
yarn: {
|
// (path must be relative to working directory).
|
||||||
// Read build output from this directory
|
buildDir: string | *"build"
|
||||||
// (path must be relative to working directory).
|
|
||||||
buildDir: string | *"build"
|
|
||||||
|
|
||||||
// Run this yarn script
|
// Run this yarn script
|
||||||
script: string | *"build"
|
script: string | *"build"
|
||||||
}
|
|
||||||
|
|
||||||
build: os.#Dir & {
|
build: os.#Dir & {
|
||||||
from: ctr
|
from: ctr
|
||||||
@ -51,9 +49,9 @@ import (
|
|||||||
mv "$YARN_BUILD_DIRECTORY" /build
|
mv "$YARN_BUILD_DIRECTORY" /build
|
||||||
"""
|
"""
|
||||||
"env": env & {
|
"env": env & {
|
||||||
YARN_BUILD_SCRIPT: yarn.script
|
YARN_BUILD_SCRIPT: script
|
||||||
YARN_CACHE_FOLDER: "/cache/yarn"
|
YARN_CACHE_FOLDER: "/cache/yarn"
|
||||||
YARN_BUILD_DIRECTORY: yarn.buildDir
|
YARN_BUILD_DIRECTORY: buildDir
|
||||||
if writeEnvFile != "" {
|
if writeEnvFile != "" {
|
||||||
ENVFILE_NAME: writeEnvFile
|
ENVFILE_NAME: writeEnvFile
|
||||||
ENVFILE: strings.Join([ for k, v in env {"\(k)=\(v)"}], "\n")
|
ENVFILE: strings.Join([ for k, v in env {"\(k)=\(v)"}], "\n")
|
@ -8,8 +8,8 @@ setup() {
|
|||||||
"$DAGGER" compute "$TESTDIR"/stdlib/alpine
|
"$DAGGER" compute "$TESTDIR"/stdlib/alpine
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "stdlib: react" {
|
@test "stdlib: yarn" {
|
||||||
"$DAGGER" compute "$TESTDIR"/stdlib/js/react --input-dir TestData="$TESTDIR"/stdlib/js/react/testdata
|
"$DAGGER" compute "$TESTDIR"/stdlib/js/yarn --input-dir TestData="$TESTDIR"/stdlib/js/yarn/testdata
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "stdlib: go" {
|
@test "stdlib: go" {
|
||||||
|
@ -2,7 +2,7 @@ package react
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
"dagger.io/js/react"
|
"dagger.io/js/yarn"
|
||||||
"dagger.io/alpine"
|
"dagger.io/alpine"
|
||||||
"dagger.io/os"
|
"dagger.io/os"
|
||||||
)
|
)
|
||||||
@ -10,7 +10,7 @@ import (
|
|||||||
TestData: dagger.#Artifact
|
TestData: dagger.#Artifact
|
||||||
|
|
||||||
TestReact: {
|
TestReact: {
|
||||||
app: react.#App & {
|
pkg: yarn.#Package & {
|
||||||
source: TestData
|
source: TestData
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ TestReact: {
|
|||||||
image: alpine.#Image & {
|
image: alpine.#Image & {
|
||||||
package: bash: "=5.1.0-r0"
|
package: bash: "=5.1.0-r0"
|
||||||
}
|
}
|
||||||
mount: "/build": from: app.build
|
mount: "/build": from: pkg.build
|
||||||
command: """
|
command: """
|
||||||
test "$(cat /build/test)" = "output"
|
test "$(cat /build/test)" = "output"
|
||||||
"""
|
"""
|
Reference in New Issue
Block a user