Skip to content

Commit

Permalink
chore: improved licensing and bundle size report
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Apr 25, 2024
1 parent 124deda commit a50a1af
Show file tree
Hide file tree
Showing 13 changed files with 2,629 additions and 250 deletions.
1 change: 0 additions & 1 deletion .deploy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export default {
],
copy: [
'README.md',
'LICENSE',
'docs/',
'fxmanifest.lua',
'entrypoint.js',
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
db/*
cache/*
dist/*
.reports/*
license_report/*
tmp_core_tsc/*
*.ignore.*
Expand Down
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint": "eslint ./**",
"lint:count": "eslint ./** -f ../scripts/lint-formatter.js",
"lint:fix": "eslint ./** --fix",
"license_report": "npx license-report > ../license_report/core.html"
"license:report": "npx license-report > ../.reports/license/core.html"
},
"keywords": [],
"author": "André Tabarra",
Expand Down
2 changes: 1 addition & 1 deletion nui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev": "vite build --watch --mode development",
"browser": "vite dev --port 40121 --strictPort --mode devNuiBrowser",
"typecheck": "tsc -p tsconfig.json --noEmit",
"license_report": "npx license-report > ../license_report/nui.html"
"license:report": "npx license-report > ../.reports/license/nui.html"
},
"keywords": [],
"author": "André Tabarra",
Expand Down
17 changes: 11 additions & 6 deletions nui/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'node:path';
import { defineConfig } from 'vite';
import { visualizer } from "rollup-plugin-visualizer";
import { PluginOption, UserConfig, defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import tsconfigPaths from 'vite-tsconfig-paths';
import { getFxsPaths } from '../scripts/scripts-utils.js';
Expand All @@ -12,13 +13,13 @@ const baseConfig = {
emptyOutDir: true,
reportCompressedSize: false,
outDir: '../dist/nui',
minify: true,
minify: true as boolean,
target: 'chrome103',
sourcemap: false,

rollupOptions: {
output: {
banner: licenseBanner('..'),
banner: licenseBanner('..', true),
//Doing this because fxserver's cicd doesn't wipe the dist folder
entryFileNames: `[name].js`,
chunkFileNames: `[name].js`,
Expand All @@ -32,9 +33,13 @@ const baseConfig = {
tsconfigPaths({
projects: ['./', '../shared']
}),
react()
]
}
react(),
visualizer({
// template: 'flamegraph',
filename: '../.reports/nui_bundle.html',
}),
] as PluginOption[], //i gave up
} satisfies UserConfig;

// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
Expand Down
Loading

0 comments on commit a50a1af

Please sign in to comment.