Skip to content

Commit

Permalink
update web building
Browse files Browse the repository at this point in the history
  • Loading branch information
proddy committed Oct 17, 2023
1 parent 5be1482 commit c150c57
Show file tree
Hide file tree
Showing 12 changed files with 95 additions and 1,224 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pre_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
run: |
cd interface
yarn install
yarn run typesafe-i18n --no-watch
yarn typesafe-i18n --no-watch
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn run build
yarn build
- name: Build firmware
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tagged_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
run: |
cd interface
yarn install
yarn run typesafe-i18n --no-watch
yarn typesafe-i18n --no-watch
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn run build
yarn build
- name: Build firmware
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
run: |
cd interface
yarn install
yarn run typesafe-i18n --no-watch
yarn typesafe-i18n --no-watch
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
yarn run build
yarn build
- name: Build firmware
run: |
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ stats.html
!.yarn/releases
!.yarn/sdks
!.yarn/versions
yarn.lock
interface/analyse.html

# scripts
test.sh
Expand All @@ -59,4 +61,3 @@ bw-output/
# dump_entities.csv
# dump_entities.xls*

yarn.lock
893 changes: 0 additions & 893 deletions interface/.yarn/releases/yarn-4.0.0-rc.53.cjs

This file was deleted.

2 changes: 0 additions & 2 deletions interface/.yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ compressionLevel: mixed
enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.0-rc.53.cjs
9 changes: 4 additions & 5 deletions interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
"build": "vite build",
"preview": "vite preview",
"build-hosted": "typesafe-i18n --no-watch && vite build --mode hosted",
"preview-standalone": "typesafe-i18n --no-watch && vite build && concurrently -c \"auto\" \"npm:mock-api\" \"vite preview\"",
"preview-standalone": "typesafe-i18n --no-watch && vite build && concurrently -c \"auto\" \"npm:mock-api\" \"vite preview\"",
"mock-api": "node --watch ../mock-api ../mock-api/server.js",
"standalone": "concurrently -c \"auto\" \"typesafe-i18n\" \"npm:mock-api\" \"vite\"",
"standalone": "concurrently -c \"auto\" \"typesafe-i18n\" \"npm:mock-api\" \"vite\"",
"typesafe-i18n": "typesafe-i18n --no-watch",
"webUI": "node progmem-generator.js",
"format": "prettier --write '**/*.{ts,tsx,js,css,json,md}'",
"lint": "eslint . --cache --fix"
},
"dependencies": {
"@alova/adapter-xhr": "^1.0.1",
"@babel/core": "^7.23.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.14",
Expand All @@ -32,6 +33,7 @@
"@types/react-router-dom": "^5.3.3",
"alova": "^2.13.1",
"async-validator": "^4.2.5",
"dev": "^0.1.3",
"history": "^5.3.0",
"jwt-decode": "^3.1.2",
"lodash-es": "^4.17.21",
Expand All @@ -47,10 +49,8 @@
"typescript": "^5.2.2"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@preact/compat": "^17.1.2",
"@preact/preset-vite": "^2.6.0",
"@types/babel__core": "^7",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"concurrently": "^8.2.1",
Expand All @@ -71,7 +71,6 @@
"terser": "^5.22.0",
"vite": "^4.4.11",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-svgr": "^4.1.0",
"vite-tsconfig-paths": "^4.2.1"
},
"packageManager": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion interface/progmem-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var mime = require('mime-types');
const ARDUINO_INCLUDES = '#include <Arduino.h>\n\n';
const INDENT = ' ';
const outputPath = '../lib/framework/WWWData.h';
const sourcePath = './build';
const sourcePath = './dist';
const bytesPerLine = 20;
var totalSize = 0;

Expand Down
38 changes: 19 additions & 19 deletions interface/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { visualizer } from 'rollup-plugin-visualizer';
export default defineConfig(({ command, mode }) => {
// standalone build for development - runs the server
if (command === 'serve') {
console.log('Building for standalone');
console.log('Preparing for standalone build with server, mode=' + mode);
return {
plugins: [preact(), viteTsconfigPaths(), visualizer()],
plugins: [preact(), viteTsconfigPaths()],
server: {
open: true,
port: mode === 'production' ? 4173 : 3000,
port: mode == 'production' ? 4173 : 3000,
proxy: {
'/rest': 'http://localhost:3080',
'/api': {
Expand All @@ -32,7 +32,7 @@ export default defineConfig(({ command, mode }) => {

// production build, both for hosted and building the firmware
if (command === 'build') {
console.log('Building for production, mode ' + mode);
console.log('Preparing for production build, mode is ' + mode);
return {
plugins: [
preact(),
Expand Down Expand Up @@ -67,40 +67,39 @@ export default defineConfig(({ command, mode }) => {
}
}),
enforce: 'pre'
}
},
visualizer({
template: 'treemap', // or sunburst
open: false,
gzipSize: true,
brotliSize: true,
filename: 'analyse.html' // will be saved in project's root
})
],

build: {
outDir: mode === 'hosted' ? 'dist' : 'build',
target: 'es2022',
outDir: 'dist',
reportCompressedSize: false,
chunkSizeWarningLimit: 1024,
sourcemap: false,
manifest: false,
minify: 'terser',
terserOptions: {
parse: {
// parse options
},
compress: {
// compress options
passes: 4,
arrows: true,
drop_console: true,
drop_debugger: true,
sequences: true
},
mangle: {
// mangle options
eval: true,
toplevel: true,
module: true,
properties: {
// mangle property options
regex: /^_/
}
},
format: {
// format options (can also use `output` for backwards compatibility)
},
sourceMap: {
// source map options
},
ecma: 5,
enclose: false,
keep_classnames: false,
Expand All @@ -111,6 +110,7 @@ export default defineConfig(({ command, mode }) => {
safari10: false,
toplevel: false
},

rollupOptions: {
// Ignore "use client" waning since we are not using SSR
onwarn(warning, warn) {
Expand Down
Loading

0 comments on commit c150c57

Please sign in to comment.