Skip to content

Commit

Permalink
Replace create-react-app with vite (#2)
Browse files Browse the repository at this point in the history
* Init new vite project

* Add rendition 35.1.0

* Add browserslist-to-esbuild

* Add browsersListToEsbuild config

* Add styled-components 6.1.0

* Add whatwg-fetch 3.6.19

* Add husky and lint-staged

* Add @types/json-schema

* Add promise-polyfill

* Copy src from old ui

- copy src directory
- move public/index.html to index.html
- remove %PUBLIC_URL%
- add module script to the bottom of the body tag

* Use util instead of Node.js util

Reference: APIDevTools/json-schema-ref-parser#257 (comment)

* Add `start` script to run as old ui

* Set default port to 3000 and auto open browser

* Remove redundant vite.svg logo

* Use `build` instead of `dist` as build output

Reason: to match create-react-app output

* Only output sourcemap in development mode

* Use eslint instead of @balena/lint with lintstaged

* Rename project and version

* Downgrade husky to v4, lint-staged to v10

* Replace old ui with new vite ui
  • Loading branch information
thienandangthanh committed Nov 7, 2023
1 parent 3fa0767 commit 0d5d0b3
Show file tree
Hide file tree
Showing 25 changed files with 9,563 additions and 23,658 deletions.
18 changes: 18 additions & 0 deletions ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
45 changes: 20 additions & 25 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
# Generated by Cargo
# will have compiled files and executables
/target/

# These are backup files generated by rustfmt
**/*.rs.bk

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
# /build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
10 changes: 3 additions & 7 deletions ui/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"*.ts": [
"balena-lint --typescript --fix"
"*.{ts,tsx}": [
"eslint --fix"
],

"*.tsx": [
"balena-lint --typescript --fix"
],
}
}
19 changes: 0 additions & 19 deletions ui/build/asset-manifest.json

This file was deleted.

22 changes: 21 additions & 1 deletion ui/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/static/favicon.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/static/manifest.json"/><title>WiFi Connect</title><link href="/static/css/2.c38cd9da.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,f=t[0],l=t[1],c=t[2],p=0,s=[];p<f.length;p++)i=f[p],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&s.push(o[i][0]),o[i]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(a&&a(t);s.length;)s.shift()();return u.push.apply(u,c||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,f=1;f<r.length;f++){var l=r[f];0!==o[l]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/";var f=this["webpackJsonpwifi-connect-ui"]=this["webpackJsonpwifi-connect-ui"]||[],l=f.push.bind(f);f.push=t,f=f.slice();for(var c=0;c<f.length;c++)t(f[c]);var a=l;r()}([])</script><script src="/static/js/2.ef060f46.chunk.js"></script><script src="/static/js/main.2b22a9e9.chunk.js"></script></body></html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/static/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="manifest" href="/static/manifest.json" />
<title>WiFi Connect</title>
<script type="module" crossorigin src="/static/assets/index-f000a586.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>

<script>
globalThis.global = globalThis;
globalThis.process = { env: {} };
</script>
</body>
</html>
30 changes: 0 additions & 30 deletions ui/build/precache-manifest.96ed21ec05e3b25e96ee640119b0334b.js

This file was deleted.

39 changes: 0 additions & 39 deletions ui/build/service-worker.js

This file was deleted.

Loading

0 comments on commit 0d5d0b3

Please sign in to comment.