You've already forked sap-jenkins-library
							
							
				mirror of
				https://github.com/SAP/jenkins-library.git
				synced 2025-10-30 23:57:50 +02:00 
			
		
		
		
	Add support for yarn (#2721)
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
		| @@ -129,7 +129,7 @@ func GetArtifact(buildTool, buildDescriptorFilePath string, opts *Options, utils | ||||
| 			versionField:    "version", | ||||
| 			artifactIDField: "ID", | ||||
| 		} | ||||
| 	case "npm": | ||||
| 	case "npm", "yarn": | ||||
| 		if len(buildDescriptorFilePath) == 0 { | ||||
| 			buildDescriptorFilePath = "package.json" | ||||
| 		} | ||||
|   | ||||
| @@ -118,6 +118,18 @@ func TestGetArtifact(t *testing.T) { | ||||
| 		assert.Equal(t, "semver2", npm.VersioningScheme()) | ||||
| 	}) | ||||
|  | ||||
| 	t.Run("yarn", func(t *testing.T) { | ||||
| 		npm, err := GetArtifact("yarn", "", &Options{VersionField: "theversion"}, nil) | ||||
|  | ||||
| 		assert.NoError(t, err) | ||||
|  | ||||
| 		theType, ok := npm.(*JSONfile) | ||||
| 		assert.True(t, ok) | ||||
| 		assert.Equal(t, "package.json", theType.path) | ||||
| 		assert.Equal(t, "version", theType.versionField) | ||||
| 		assert.Equal(t, "semver2", npm.VersioningScheme()) | ||||
| 	}) | ||||
|  | ||||
| 	t.Run("pip", func(t *testing.T) { | ||||
| 		fileExists = func(string) (bool, error) { return true, nil } | ||||
| 		pip, err := GetArtifact("pip", "", &Options{}, nil) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user