diff --git a/buffalo/cmd/generate/docker.go b/buffalo/cmd/generate/docker.go index 3c99e97af..b8cfe84e0 100644 --- a/buffalo/cmd/generate/docker.go +++ b/buffalo/cmd/generate/docker.go @@ -31,6 +31,11 @@ var DockerCmd = &cobra.Command{ "docker": dockerOptions.Style, "asWeb": webpack, "withWepack": webpack, + "withYarn": false, + } + + if _, err := os.Stat("yarn.lock"); err == nil { + data["withYarn"] = true } g, err := docker.New() diff --git a/buffalo/cmd/new.go b/buffalo/cmd/new.go index ad8c3ddd7..a69a833c1 100644 --- a/buffalo/cmd/new.go +++ b/buffalo/cmd/new.go @@ -153,6 +153,7 @@ func genNewFiles() error { "withPop": !app.SkipPop, "withDep": app.WithDep, "withWebpack": !app.SkipWebpack && !app.API, + "withYarn": app.WithYarn, "dbType": app.DBType, "version": Version, "ciProvider": app.CIProvider, diff --git a/buffalo/cmd/setup.go b/buffalo/cmd/setup.go index 920bfa269..e5ad78d10 100644 --- a/buffalo/cmd/setup.go +++ b/buffalo/cmd/setup.go @@ -195,7 +195,7 @@ func yarnCheck() error { return errors.Errorf("This application require yarn, and we could not find it installed on your system. We tried to install it for you, but ran into the following error:\n%s", err) } } - err = run(exec.Command("yarn", "install")) + err = run(exec.Command("yarn", "--no-progress", "install")) if err != nil { return errors.Errorf("We encountered the following error when trying to install your asset dependencies using yarn:\n%s", err) } diff --git a/generators/docker/multi/templates/Dockerfile.tmpl b/generators/docker/multi/templates/Dockerfile.tmpl index 8c969eb71..84bee01eb 100644 --- a/generators/docker/multi/templates/Dockerfile.tmpl +++ b/generators/docker/multi/templates/Dockerfile.tmpl @@ -8,7 +8,11 @@ WORKDIR $GOPATH/src/{{.packagePath}} {{if .withWebpack -}} # this will cache the npm install step, unless package.json changes ADD package.json . -RUN npm install +{{if .withYarn -}} +RUN yarn install --no-progress +{{else -}} +RUN npm install --no-progress +{{end -}} {{end -}} ADD . . diff --git a/generators/docker/standard/templates/Dockerfile.tmpl b/generators/docker/standard/templates/Dockerfile.tmpl index 1df853f5e..b1b7a2775 100644 --- a/generators/docker/standard/templates/Dockerfile.tmpl +++ b/generators/docker/standard/templates/Dockerfile.tmpl @@ -7,7 +7,11 @@ WORKDIR $GOPATH/src/{{.packagePath}} {{if .withWebpack -}} # this will cache the npm install step, unless package.json changes ADD package.json . -RUN npm install +{{if .withYarn -}} +RUN yarn install --no-progress +{{else -}} +RUN npm install --no-progress +{{end -}} {{end -}} {{end -}}