mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Speed up licenses.txt build during development, add additionalModules (#12510)
- Emit static string for licenses.txt during development for faster builds - Manually add @primer/octicons to licenses.txt because it's never directy imported. Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		
							
								
								
									
										5
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1505,6 +1505,11 @@
 | 
			
		||||
      "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
 | 
			
		||||
      "dev": true
 | 
			
		||||
    },
 | 
			
		||||
    "add-asset-webpack-plugin": {
 | 
			
		||||
      "version": "1.0.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/add-asset-webpack-plugin/-/add-asset-webpack-plugin-1.0.0.tgz",
 | 
			
		||||
      "integrity": "sha512-Pg6UTxMPmVpGobpBTBmTO54aKvZfnY/rm7YvY86BXv4toE8I29ail6kAzsf0GyEMK6MgvGVDxs4IZXPTCUooNw=="
 | 
			
		||||
    },
 | 
			
		||||
    "aggregate-error": {
 | 
			
		||||
      "version": "3.0.1",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@
 | 
			
		||||
    "@babel/runtime": "7.11.2",
 | 
			
		||||
    "@claviska/jquery-minicolors": "2.3.5",
 | 
			
		||||
    "@primer/octicons": "10.0.0",
 | 
			
		||||
    "add-asset-webpack-plugin": "1.0.0",
 | 
			
		||||
    "babel-loader": "8.1.0",
 | 
			
		||||
    "clipboard": "2.0.6",
 | 
			
		||||
    "core-js": "3.6.5",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
const fastGlob = require('fast-glob');
 | 
			
		||||
const wrapAnsi = require('wrap-ansi');
 | 
			
		||||
const AddAssetPlugin = require('add-asset-webpack-plugin');
 | 
			
		||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
 | 
			
		||||
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
 | 
			
		||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
 | 
			
		||||
@@ -273,7 +274,7 @@ module.exports = {
 | 
			
		||||
    new MonacoWebpackPlugin({
 | 
			
		||||
      filename: 'js/monaco-[name].worker.js',
 | 
			
		||||
    }),
 | 
			
		||||
    new LicenseWebpackPlugin({
 | 
			
		||||
    isProduction ? new LicenseWebpackPlugin({
 | 
			
		||||
      outputFilename: 'js/licenses.txt',
 | 
			
		||||
      perChunkOutput: false,
 | 
			
		||||
      addBanner: false,
 | 
			
		||||
@@ -281,6 +282,9 @@ module.exports = {
 | 
			
		||||
      modulesDirectories: [
 | 
			
		||||
        resolve(__dirname, 'node_modules'),
 | 
			
		||||
      ],
 | 
			
		||||
      additionalModules: [
 | 
			
		||||
        '@primer/octicons',
 | 
			
		||||
      ].map((name) => ({name, directory: resolve(__dirname, `node_modules/${name}`)})),
 | 
			
		||||
      renderLicenses: (modules) => {
 | 
			
		||||
        const line = '-'.repeat(80);
 | 
			
		||||
        return modules.map((module) => {
 | 
			
		||||
@@ -294,7 +298,7 @@ module.exports = {
 | 
			
		||||
        warnings: false,
 | 
			
		||||
        errors: true,
 | 
			
		||||
      },
 | 
			
		||||
    }),
 | 
			
		||||
    }) : new AddAssetPlugin('js/licenses.txt', `Licenses are disabled during development`),
 | 
			
		||||
  ],
 | 
			
		||||
  performance: {
 | 
			
		||||
    hints: false,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user