Skip to content

Commit

Permalink
Merge pull request #86 from architecture-building-systems/vite
Browse files Browse the repository at this point in the history
Change from electron-forge to electron-builder and vite
  • Loading branch information
reyery committed Mar 21, 2024
2 parents d4f922c + f49cd29 commit 3053927
Show file tree
Hide file tree
Showing 128 changed files with 11,159 additions and 8,526 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_CEA_URL=""
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_CEA_URL="http://localhost:5050"
1 change: 1 addition & 0 deletions .env.electron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_CEA_URL="http://localhost:5050"
26 changes: 3 additions & 23 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,6 @@
# Logs
logs
*.log

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
.eslintcache

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# OSX
.DS_Store

# App packaged
release
dist

.idea
npm-debug.log.*
__snapshots__

# Package.json
package.json
.travis.yml
dist-ssr
*.local
node_modules/*
74 changes: 46 additions & 28 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,59 @@
module.exports = {
/* your base configuration of choice */
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:prettier/recommended',
],
parser: '@babel/eslint-parser',
parserOptions: {
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-react'],
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
paths: ['src'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
env: {
browser: true,
es2021: true,
node: true,
},
globals: {
MAIN_WINDOW_WEBPACK_ENTRY: true,
MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: true,
},
settings: {
react: {
version: 'detect',
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:import/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended', // Make sure this is always the last element in the array.
],
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
},
},
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['react-refresh', 'simple-import-sort'],
rules: {
// allow anonymous component functions
'react/display-name': 0,
// disallow console and debugger in production mode
'no-console': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
// allow spreading out properties from an object without warnings
// 'no-unused-vars': [1, { ignoreRestSiblings: true }],
'no-unused-vars': 'off',
'prettier/prettier': ['error', {}, { usePrettierrc: true }],
'react/react-in-jsx-scope': 'off',
'jsx-a11y/accessible-emoji': 'off',
'react/prop-types': 'off',
// 'simple-import-sort/imports': 'error',
// 'simple-import-sort/exports': 'error',
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton'],
},
],
'react-refresh/only-export-components': 'warn',
},
};
94 changes: 16 additions & 78 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,24 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
node_modules
dist
dist-ssr
*.local
out

# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Webpack
.webpack/

# Electron-Forge
out/
dependencies
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"overrides": [
{
"files": [".prettierrc", ".babelrc"],
"files": [".prettierrc"],
"options": {
"parser": "json"
}
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"editor.formatOnSave": true,
"eslint.packageManager": "yarn",
"search.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/yarn.lock": true
}
},
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:current-alpine

WORKDIR /app
COPY package.json .

RUN yarn
COPY . .

RUN yarn build
EXPOSE 4173

CMD [ "yarn", "preview", "--host" ]
38 changes: 32 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
# City Energy Analyst GUI

This is the new interface of CEA in Electron.
Made with the help of [`electron-builder`](https://www.electron.build).

Made with the help of [`electron-forge`](https://www.electronforge.io/).
There are currently two possible build targets for the GUI. One for desktop (using Electron) and one for the web.

## Getting Started (development)

Simply clone down this repository, install dependencies, and get started on your application.

The use of the [yarn](https://yarnpkg.com/) package manager and [VS Code](https://code.visualstudio.com/) editor is recommended for development.

e.g.

```bash
git clone https://github.com/architecture-building-systems/CityEnergyAnalyst-GUI.git

cd CityEnergyAnalyst-GUI

# install dependencies
yarn
```

### Development Scripts

For desktop version

```bash
# app will be launched using electron
yarn electron:dev
```

For web version

```bash
# run application in development mode
yarn start
# web app will be accessible from the browser on http://localhost:5173/
yarn dev
```

# compile source code and create the OS specific application in the `out` folder
yarn package
### Build Scripts

For desktop version

```bash
# compiles source code and creates the OS specific application in the `out` folder
yarn electron:build
```

For web version

```bash
# bundles source code and creates the web files in the `dist` folder
yarn build
```
Loading

0 comments on commit 3053927

Please sign in to comment.