mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 06:03:51 +03: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:
parent
d461591aac
commit
9b804f4ed4
3 changed files with 12 additions and 2 deletions
5
package-lock.json
generated
5
package-lock.json
generated
|
@ -1505,6 +1505,11 @@
|
||||||
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
|
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
|
||||||
"dev": true
|
"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": {
|
"aggregate-error": {
|
||||||
"version": "3.0.1",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.0.1.tgz",
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
"@babel/runtime": "7.11.2",
|
"@babel/runtime": "7.11.2",
|
||||||
"@claviska/jquery-minicolors": "2.3.5",
|
"@claviska/jquery-minicolors": "2.3.5",
|
||||||
"@primer/octicons": "10.0.0",
|
"@primer/octicons": "10.0.0",
|
||||||
|
"add-asset-webpack-plugin": "1.0.0",
|
||||||
"babel-loader": "8.1.0",
|
"babel-loader": "8.1.0",
|
||||||
"clipboard": "2.0.6",
|
"clipboard": "2.0.6",
|
||||||
"core-js": "3.6.5",
|
"core-js": "3.6.5",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const fastGlob = require('fast-glob');
|
const fastGlob = require('fast-glob');
|
||||||
const wrapAnsi = require('wrap-ansi');
|
const wrapAnsi = require('wrap-ansi');
|
||||||
|
const AddAssetPlugin = require('add-asset-webpack-plugin');
|
||||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||||
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
|
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
@ -273,7 +274,7 @@ module.exports = {
|
||||||
new MonacoWebpackPlugin({
|
new MonacoWebpackPlugin({
|
||||||
filename: 'js/monaco-[name].worker.js',
|
filename: 'js/monaco-[name].worker.js',
|
||||||
}),
|
}),
|
||||||
new LicenseWebpackPlugin({
|
isProduction ? new LicenseWebpackPlugin({
|
||||||
outputFilename: 'js/licenses.txt',
|
outputFilename: 'js/licenses.txt',
|
||||||
perChunkOutput: false,
|
perChunkOutput: false,
|
||||||
addBanner: false,
|
addBanner: false,
|
||||||
|
@ -281,6 +282,9 @@ module.exports = {
|
||||||
modulesDirectories: [
|
modulesDirectories: [
|
||||||
resolve(__dirname, 'node_modules'),
|
resolve(__dirname, 'node_modules'),
|
||||||
],
|
],
|
||||||
|
additionalModules: [
|
||||||
|
'@primer/octicons',
|
||||||
|
].map((name) => ({name, directory: resolve(__dirname, `node_modules/${name}`)})),
|
||||||
renderLicenses: (modules) => {
|
renderLicenses: (modules) => {
|
||||||
const line = '-'.repeat(80);
|
const line = '-'.repeat(80);
|
||||||
return modules.map((module) => {
|
return modules.map((module) => {
|
||||||
|
@ -294,7 +298,7 @@ module.exports = {
|
||||||
warnings: false,
|
warnings: false,
|
||||||
errors: true,
|
errors: true,
|
||||||
},
|
},
|
||||||
}),
|
}) : new AddAssetPlugin('js/licenses.txt', `Licenses are disabled during development`),
|
||||||
],
|
],
|
||||||
performance: {
|
performance: {
|
||||||
hints: false,
|
hints: false,
|
||||||
|
|
Loading…
Reference in a new issue