Skip to content

Commit

Permalink
third commit
Browse files Browse the repository at this point in the history
  • Loading branch information
goo951019 committed Dec 15, 2022
1 parent a31ced6 commit bdc6cac
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 84 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GITHUB_ACCESS_KEY=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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

# production
/build
/dist
*.exe

# misc
.DS_Store
Expand Down
72 changes: 2 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,2 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
To make the auth update enabled, your need gitHub Personal Access Token in your PC.
windowPower Shell -> [Environment]::SetEnvironmentVariable("GH_TOKEN", <yOUR token>, "User")
1 change: 1 addition & 0 deletions logs/main.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[2022-12-15 14:07:59.063] [info] App Version: 0.1.1
15 changes: 13 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "electron-react-app",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"description": "Electron React App",
"author": "Jerry Jang",
"build": {
"publish": [{
"provider": "github",
"owner": "goo951019",
"repo": "electron-react-app"
}],
"appId": ""
"publish": [
{
"provider": "github",
"owner": "goo951019",
"repo": "electron-react-app"
}
],
"appId": "com.jerry.electron-react-app"
},
"main": "public/electron.js",
"homepage": "./",
Expand All @@ -21,6 +23,7 @@
"bootstrap": "^5.2.3",
"cross-env": "^7.0.3",
"electron-is-dev": "^2.0.0",
"electron-log": "^4.4.8",
"electron-updater": "^5.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -37,7 +40,7 @@
"release": "npm run build && electron-builder --linux --win --mac --x64 --ia32 --publish never",
"build": "npm run react-build && npm run electron-build",
"start": "concurrently \"cross-env BROWSER=none yarn react-start\" \"wait-on http://localhost:3000 && electron .\"",
"publish": "react-scripts build && electron-builder --win --publish always"
"publish": "react-scripts build && electron-builder --win -p always"
},
"eslintConfig": {
"extends": [
Expand Down
17 changes: 15 additions & 2 deletions public/electron.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
const { app, BrowserWindow, dialog } = require("electron");
const { autoUpdater } = require("electron-updater");
const log = require('electron-log');
const path = require("path");
const isDev = require("electron-is-dev");

log.transports.file.resolvePath = () => isDev ? `./logs/dev.log` : path.join(app.getPath("userData"), "./logs/prod.log");
log.log("App Version: "+app.getVersion());

let mainWindow;

function createWindow(){
Expand All @@ -17,10 +21,11 @@ function createWindow(){
mainWindow.loadURL(isDev ? "http://localhost:3000": `file://${path.join(__dirname, "../build/index.html")}`);

if(isDev){
window.webContents.openDevTools({mode: "detach"});
mainWindow.webContents.openDevTools({mode: "detach"});
}

if(!isDev){
autoUpdater.setFeedURL({ provider: 'github', owner: 'goo951019', repo: 'electron-react-app', token: process.env.GITHUB_ACCESS_KEY })
autoUpdater.checkForUpdates();
}

Expand All @@ -41,7 +46,10 @@ app.on("activate", () => {
}
});

autoUpdater.on("checking-for-update", () => { log.info("Checking for an update..."); })

autoUpdater.on("update-available", (_event, releaseNotes, releaseName) => {
log.info("Update Available!");
const dialogOptions = {
type: "info",
buttons: ['OK'],
Expand All @@ -54,7 +62,10 @@ autoUpdater.on("update-available", (_event, releaseNotes, releaseName) => {
})
});

autoUpdater.on("download-progress", (progressTrack) => { log.info("Downloading..."+progressTrack); })

autoUpdater.on("update-downloaded", (_event, releaseNotes, releaseName) => {
log.info("Update Downloaded.");
const dialogOptions = {
type: "info",
buttons: ['Restart', 'Later'],
Expand All @@ -65,4 +76,6 @@ autoUpdater.on("update-downloaded", (_event, releaseNotes, releaseName) => {
dialog.showMessageBox(dialogOptions).then((returnValue) => {
if(returnValue.response === 0) autoUpdater.quitAndInstall();
})
});
});

autoUpdater.on("error", (err) => {log.info("Update Error: "+ err)})
3 changes: 1 addition & 2 deletions src/pages/Page_Landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import React from 'react';
export default function Page_Landing() {
return (
<div className="container" style={{width: '100wh'}}>
<h1>BCS V-2.0.0</h1>
<button>hello</button>
<h1>Electron React Template</h1>
</div>
)
}

0 comments on commit bdc6cac

Please sign in to comment.