Skip to content

Commit

Permalink
🚀Released v0.1 (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rllyyy committed Feb 1, 2022
1 parent 34b8f89 commit 28c819d
Show file tree
Hide file tree
Showing 4 changed files with 903 additions and 43 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

# production
/build
/dist

# misc
.DS_Store
Expand Down
48 changes: 44 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"description": "Repeatio is a program for practicing and memorizing tasks",
"author": "Niklas Fischer",
"private": true,
"main": "public/electron.js",
"homepage": "./",
"dependencies": {
"@electron/remote": "^1.2.1",
"@emotion/react": "^11.5.0",
Expand All @@ -15,8 +17,8 @@
"@testing-library/user-event": "^12.8.3",
"concurrently": "^6.2.1",
"cross-env": "^7.0.3",
"electron": "^14.0.0",
"electron-devtools-installer": "^3.2.0",
"electron-is-dev": "^2.0.0",
"is-electron": "^2.2.1",
"lodash": "^4.17.21",
"react": "^17.0.2",
Expand All @@ -27,14 +29,48 @@
"wait-on": "^6.0.0",
"web-vitals": "^1.1.2"
},
"main": "public/app.js",
"homepage": "./",
"build": {
"appId": "repeatio",
"productName": "repeatio",
"files": [
"build/**/*",
"node_modules/**/*"
],
"directories": {
"buildResources": "assets"
},
"win": {
"target": [
"nsis"
]
},
"nsis": {
"oneClick": "false",
"uninstallDisplayName": "repeatio-uninstaller",
"license": "LICENSE",
"allowToChangeInstallationDirectory": true
},
"mac": {
"target": "tar.gz"
},
"linux": {
"category": "Utils",
"packageCategory": "utils",
"maintainer": "Niklas Fischer",
"asar": true,
"target": [
"deb",
"tar.xz"
],
"synopsis": "Basically same as description but shorter"
}
},
"scripts": {
"start-react": "react-scripts start",
"build-react": "react-scripts build",
"test-react": "react-scripts test --env=jsdom",
"eject-react": "react-scripts eject",
"build": "yarn build-react && electron-builder -c.extraMetadata.app=build-react/app.js",
"build": "yarn build-react && electron-builder",
"start": "concurrently -k \"cross-env BROWSER=none yarn start-react\" \"wait-on http://localhost:3000 && electron .\"",
"test": "yarn test-react"
},
Expand All @@ -55,5 +91,9 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"electron": "^17.0.0",
"electron-builder": "^22.14.5"
}
}
12 changes: 5 additions & 7 deletions public/app.js → public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { app, BrowserWindow, Menu, ipcMain } = require("electron");
const { default: installExtension, REACT_DEVELOPER_TOOLS } = require("electron-devtools-installer");
const path = require("path");
const fs = require("fs");
const isDev = require("electron-is-dev");

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
Expand Down Expand Up @@ -33,16 +34,13 @@ function createWindow() {
}
});

win.loadURL("http://localhost:3000"); //TODO remove this (see below)
//Start on localhost if using development else run build folder
win.loadURL(isDev ? "http://localhost:3000" : `file://${path.join(__dirname, "../build/index.html")}`);

win.maximize();
win.show();

//TODO Only run on port 3000 when in development
//https://github.com/willjw3/react-electron/blob/master/public/electron.js
//https://www.youtube.com/watch?v=Cdu2O6o2DCg
/*yard add electron-is-dev
mainWindow.loadURL(isDev ? "http://localhost:3000" : `file://${path.join(__dirname, "../build/index.html")}`);
*/
win.on("closed", () => (win = null));
}

//Hide the menu bar
Expand Down
Loading

0 comments on commit 28c819d

Please sign in to comment.