Skip to content

Commit b932002

Browse files
AskAliceJason Stangroome
andauthored
Update commands/deploy.go
Co-authored-by: Jason Stangroome <jason@section.io>
1 parent 37bdc1d commit b932002

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

commands/deploy.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,13 @@ func (c *DeployCmd) Run(ctx *kong.Context, logWriters *LogWriters) (err error) {
171171
// IsValidNodeApp detects if a Node.js app is present in a given directory
172172
func IsValidNodeApp(dir string) (errs []error) {
173173
packageJSONPath := filepath.Join(dir, "package.json")
174-
if _, err := os.Open(packageJSONPath); os.IsNotExist(err) {
175-
log.Debug().Msg(fmt.Sprintf("[WARN] %s is not a file", packageJSONPath))
176-
} else {
177-
packageJSONContents, err := ioutil.ReadFile(packageJSONPath)
178-
if err != nil {
174+
if packageJSONContents, err := ioutil.ReadFile(packageJSONPath); err != nil {
175+
if os.IsNotExist(err) {
176+
log.Debug().Msg(fmt.Sprintf("[WARN] %s is not a file", packageJSONPath))
177+
} else {
179178
log.Info().Err(err).Msg("Error reading your package.json")
180-
}
179+
}
180+
} else {
181181
packageJSON, err := ParsePackageJSON(string(packageJSONContents))
182182
if err != nil {
183183
log.Info().Err(err).Msg("Error parsing your package.json")

0 commit comments

Comments
 (0)