Skip to content

Commit

Permalink
install local encore.dev in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
eandre committed Dec 22, 2024
1 parent 8d5c1c1 commit 6d2c643
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cli/cmd/encore/app/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,17 +391,19 @@ func gogetEncore(dir string) error {
}

func npmInstallEncore(dir string) error {
verToInstall := version.Version
args := []string{"install"}
if version.Channel == version.DevBuild {
verToInstall = "latest"
args = append(args, filepath.Join(env.EncoreRuntimesPath(), "js", "encore.dev"))
} else {
args = append(args, fmt.Sprintf("encore.dev@%s", version.Version))
}

// First install the 'encore.dev' package.
cmd := exec.Command("npm", "install", fmt.Sprintf("encore.dev@%s", verToInstall))
cmd := exec.Command("npm", args...)
cmd.Dir = dir
out, err := cmd.CombinedOutput()
if err != nil {
err = fmt.Errorf("'npm install encore.dev@%s' failed: %v: %s", verToInstall, err, out)
err = fmt.Errorf("installing encore.dev package failed: %v: %s", err, out)
}

// Then run 'npm install'.
Expand Down

0 comments on commit 6d2c643

Please sign in to comment.