mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-10-31 05:24:13 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			514 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			514 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /**
 | |
|  * Inject license
 | |
|  */
 | |
| 
 | |
| import * as fs from 'fs';
 | |
| const StringReplacePlugin = require('string-replace-webpack-plugin');
 | |
| 
 | |
| const license = fs.readFileSync(__dirname + '/../../../LICENSE', 'utf-8')
 | |
| 	.replace(/\r\n/g, '\n')
 | |
| 	.replace(/(.)\n(.)/g, '$1 $2')
 | |
| 	.replace(/(^|\n)(.*?)($|\n)/g, '<p>$2</p>');
 | |
| 
 | |
| export default () => ({
 | |
| 	enforce: 'pre',
 | |
| 	test: /\.(tag|js)$/,
 | |
| 	exclude: /node_modules/,
 | |
| 	loader: StringReplacePlugin.replace({
 | |
| 		replacements: [{
 | |
| 			pattern: '%license%', replacement: () => license
 | |
| 		}]
 | |
| 	})
 | |
| });
 |