Fix nodeModules scope to avoid polluting TL namespace

Ref: https://github.com/dagger/dagger/issues/1711
Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
This commit is contained in:
Marcos Lilljedahl 2022-03-23 11:31:26 -03:00
parent 85b044ebf4
commit 2da7056ebe

View File

@ -8,16 +8,15 @@ import (
"universe.dagger.io/netlify" "universe.dagger.io/netlify"
) )
nodeModulesMount: "/src/node_modules": dagger.#Mount & { dagger.#Plan & {
_nodeModulesMount: "/src/node_modules": dagger.#Mount & {
dest: "/src/node_modules" dest: "/src/node_modules"
type: "cache" type: "cache"
contents: dagger.#CacheDir & { contents: dagger.#CacheDir & {
id: "todoapp-modules-cache" id: "todoapp-modules-cache"
} }
} }
dagger.#Plan & {
client: { client: {
filesystem: { filesystem: {
".": read: { ".": read: {
@ -63,7 +62,7 @@ dagger.#Plan & {
id: "todoapp-yarn-cache" id: "todoapp-yarn-cache"
} }
} }
nodeModulesMount _nodeModulesMount
} }
script: contents: #""" script: contents: #"""
yarn config set cache-folder /cache/yarn yarn config set cache-folder /cache/yarn
@ -76,7 +75,7 @@ dagger.#Plan & {
test: bash.#Run & { test: bash.#Run & {
input: deps.output input: deps.output
workdir: "/src" workdir: "/src"
mounts: nodeModulesMount mounts: _nodeModulesMount
script: contents: #""" script: contents: #"""
yarn run test yarn run test
"""# """#
@ -85,7 +84,7 @@ dagger.#Plan & {
build: { build: {
run: bash.#Run & { run: bash.#Run & {
input: test.output input: test.output
mounts: nodeModulesMount mounts: _nodeModulesMount
workdir: "/src" workdir: "/src"
script: contents: #""" script: contents: #"""
yarn run build yarn run build