mirror of
				https://github.com/Mibew/simple-icons.git
				synced 2025-10-31 10:31:06 +03:00 
			
		
		
		
	Add license data to NPM package and documenation (#5106)
This commit is contained in:
		
							parent
							
								
									765345cc87
								
							
						
					
					
						commit
						95109ad629
					
				
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							| @ -65,8 +65,14 @@ console.log(icon); | |||||||
|     hex: '111111', |     hex: '111111', | ||||||
|     source: 'https://simpleicons.org/', |     source: 'https://simpleicons.org/', | ||||||
|     svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>', |     svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>', | ||||||
|     path: 'M12 12v-1.5c-2.484 ...' |     path: 'M12 12v-1.5c-2.484 ...', | ||||||
|  |     license: { | ||||||
|  |         type: '...', | ||||||
|  |         url: 'https://example.com/' | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | NOTE: the `license` entry will be `undefined` if we do not yet have license data for the icon. | ||||||
| */ | */ | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| @ -89,8 +95,14 @@ console.log(icon); | |||||||
|     hex: '111111', |     hex: '111111', | ||||||
|     source: 'https://simpleicons.org/', |     source: 'https://simpleicons.org/', | ||||||
|     svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>', |     svg: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>', | ||||||
|     path: 'M12 12v-1.5c-2.484 ...' |     path: 'M12 12v-1.5c-2.484 ...', | ||||||
|  |     license: { | ||||||
|  |         type: '...', | ||||||
|  |         url: 'https://example.com/' | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | NOTE: the license may be `undefined` if there is no license data for the icon. | ||||||
| */ | */ | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -39,13 +39,24 @@ function iconToKeyValue(icon) { | |||||||
| 
 | 
 | ||||||
|   return `'${iconName}':${iconToObject(icon)}`; |   return `'${iconName}':${iconToObject(icon)}`; | ||||||
| } | } | ||||||
|  | function licenseToObject(license) { | ||||||
|  |   if (license === undefined) { | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   if (license.url === undefined) { | ||||||
|  |     license.url = `https://spdx.org/licenses/${license.type}.html`; | ||||||
|  |   } | ||||||
|  |   return license; | ||||||
|  | } | ||||||
| function iconToObject(icon) { | function iconToObject(icon) { | ||||||
|   return util.format(iconObjectTemplate, |   return util.format(iconObjectTemplate, | ||||||
|     escape(icon.title), |     escape(icon.title), | ||||||
|     escape(icon.slug), |     escape(icon.slug), | ||||||
|     escape(icon.svg), |     escape(icon.svg), | ||||||
|     escape(icon.source), |     escape(icon.source), | ||||||
|     escape(icon.hex) |     escape(icon.hex), | ||||||
|  |     licenseToObject(icon.license), | ||||||
|   ); |   ); | ||||||
| } | } | ||||||
| function minifyAndWrite(filepath, rawJavaScript) { | function minifyAndWrite(filepath, rawJavaScript) { | ||||||
|  | |||||||
| @ -7,4 +7,5 @@ | |||||||
|   }, |   }, | ||||||
|   source: '%s', |   source: '%s', | ||||||
|   hex: '%s', |   hex: '%s', | ||||||
|  |   license: %s, | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user