Skip to content

Commit

Permalink
Support running npm install without package.json (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi authored Oct 19, 2023
1 parent cc76175 commit a85aaa5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion artifactory/commands/npm/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func (npc *NpmPublishCommand) setPackageInfo() error {
}

if fileInfo.IsDir() {
npc.packageInfo, err = biutils.ReadPackageInfoFromPackageJson(npc.publishPath, npc.npmVersion)
npc.packageInfo, err = biutils.ReadPackageInfoFromPackageJsonIfExists(npc.publishPath, npc.npmVersion)
return err
}
log.Debug("The provided path is not a directory, we assume this is a compressed npm package")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ require (

// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.28.1-0.20231003120621-90e9d7ea05e9

// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go dev
replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.9-0.20231019085746-e1b192457664
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jedib0t/go-pretty/v6 v6.4.8 h1:HiNzyMSEpsBaduKhmK+CwcpulEeBrTmxutz4oX/oWkg=
github.com/jedib0t/go-pretty/v6 v6.4.8/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs=
github.com/jfrog/build-info-go v1.9.13 h1:OeoGzPVK/O4TOUYk35uL4bXg/hleyqMrjGjjmyLOYrg=
github.com/jfrog/build-info-go v1.9.13/go.mod h1:ujJ8XQZMdT2tMkLSMJNyDd1pCY+duwHdjV+9or9FLIg=
github.com/jfrog/build-info-go v1.8.9-0.20231019085746-e1b192457664 h1:6DIV7SpTEBD3xmOuUy9MoOaOw4bFhX0F3FgSyTTtgYQ=
github.com/jfrog/build-info-go v1.8.9-0.20231019085746-e1b192457664/go.mod h1:ujJ8XQZMdT2tMkLSMJNyDd1pCY+duwHdjV+9or9FLIg=
github.com/jfrog/gofrog v1.3.1 h1:QqAwQXCVReT724uga1AYqG/ZyrNQ6f+iTxmzkb+YFQk=
github.com/jfrog/gofrog v1.3.1/go.mod h1:IFMc+V/yf7rA5WZ74CSbXe+Lgf0iApEQLxRZVzKRUR0=
github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYLipdsOFMY=
Expand Down
2 changes: 1 addition & 1 deletion xray/commands/audit/sca/npm/npm.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func BuildDependencyTree(params utils.AuditParams) (dependencyTrees []*xrayUtils
if err != nil {
return
}
packageInfo, err := biutils.ReadPackageInfoFromPackageJson(currentDir, npmVersion)
packageInfo, err := biutils.ReadPackageInfoFromPackageJsonIfExists(currentDir, npmVersion)
if err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion xray/commands/audit/sca/yarn/yarn.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func BuildDependencyTree() (dependencyTrees []*xrayUtils.GraphNode, uniqueDeps [
return
}

packageInfo, err := biUtils.ReadPackageInfoFromPackageJson(currentDir, nil)
packageInfo, err := biUtils.ReadPackageInfoFromPackageJsonIfExists(currentDir, nil)
if errorutils.CheckError(err) != nil {
return
}
Expand Down

0 comments on commit a85aaa5

Please sign in to comment.