Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from AlyxMoon/develop
Release v2.0.0
- Loading branch information
Showing
155 changed files
with
14,291 additions
and
6,749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true | ||
}, | ||
extends: [ | ||
'standard', | ||
'plugin:vue/recommended', | ||
], | ||
globals: { | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly' | ||
}, | ||
parser: 'vue-eslint-parser', | ||
parserOptions: { | ||
parser: 'babel-eslint', | ||
ecmaVersion: 2018, | ||
sourceType: 'module' | ||
}, | ||
plugins: ['vue'], | ||
rules: { | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'vue/require-component-is': 'off', | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Welcome! | ||
|
||
Hello, and welcome to the app! This is a hobby project and I'm still figuring out how to best code well with others. So if you have any questions / comments / concerns feel free to reach out to me. You are welcome to help out however you wish. | ||
|
||
## Getting Started | ||
- Have both `node` and `yarn` installed. You can use npm instead of yarn of course but I'll pretend you're using yarn. | ||
- Make sure you have Factorio installed (app currently isn't smart enough to work without it) | ||
- Fork the repository and get it on your computer however you wish | ||
- Run `yarn install` while in the repository to initialize the project | ||
- Run `yarn run dev` or `yarn run debug` to start the app. If using debug mode, you can open a web browser on `http://localhost:9223` to access the dev inspector for the app | ||
|
||
## Making Changes | ||
- All work is based on develop, master branch is reserved for code that is ready to have a release made | ||
- If you want to make changes based on something that already exists in issues, please leave a comment on that issue to avoid potential duplicate work. If you don't see an issue that matches what you work on, please create one and I'll get things sorted. | ||
- Create a new branch with your work on it, based on develop or another sub branch of your choice | ||
- Please make sure your code is linted (I'm using [Standard.js](https://standardjs.com/) and [Vue](https://vuejs.github.io/eslint-plugin-vue/) rules). | ||
If your code editor is configured for it, linting will be done automatically, otherwise you can run `yarn run lint` to check your code or `yarn run lint:fix` to let lint try to automatically fix errors | ||
- To test your code, you can run the commands `yarn run test` or `yarn test:coverage`. Using the coverage option will generate a coverage report that can be viewed by opening the `index.html` file in a browser, found at `test/unit/coverage/lcov-report` | ||
- All tests go in the `test/unit/specs` folder. My plan is not to do e2e testing but unit test library functions that will be used in the renderer or main process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Contributors | ||
> A big thank you to those who have helped out with the project | ||
- [mrdejong](https://github.com/mrdejong) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Muhammad Ubaid Raza | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
const builder = require('electron-builder') | ||
|
||
const { Platform } = builder | ||
const { name, productName } = require('../package.json') | ||
|
||
const config = { | ||
appId: `com.alyxmoon.${name}`, | ||
copyright: `Copyright ${(new Date()).getFullYear()} - Allister Moon - allisterkmoon@gmail.com`, | ||
productName, | ||
directories: { | ||
output: 'build/', | ||
}, | ||
files: [ | ||
'dist/**/*', | ||
'src/data/**/*', | ||
], | ||
dmg: { | ||
contents: [ | ||
{ | ||
path: '/Applications', | ||
type: 'link', | ||
x: 410, | ||
y: 230, | ||
}, | ||
{ | ||
type: 'file', | ||
x: 130, | ||
y: 230, | ||
}, | ||
], | ||
window: { | ||
height: 800, | ||
width: 600, | ||
}, | ||
}, | ||
linux: { | ||
icon: '_icons/icon.png', | ||
target: ['deb'], | ||
}, | ||
mac: { | ||
category: 'public.app-category.utilities', | ||
icon: '_icons/icon.icns', | ||
target: ['zip'], | ||
type: 'distribution', | ||
}, | ||
win: { | ||
icon: '_icons/icon.ico', | ||
target: ['zip'], | ||
}, | ||
nsis: { | ||
allowToChangeInstallationDirectory: true, | ||
oneClick: false, | ||
}, | ||
} | ||
|
||
let targets | ||
|
||
if (process.argv[2] === 'linux') { | ||
targets = Platform.LINUX.createTarget() | ||
} else if (process.argv[2] === 'mac') { | ||
targets = Platform.MAC.createTarget() | ||
} else { | ||
targets = Platform.WINDOWS.createTarget() | ||
} | ||
|
||
builder.build({ | ||
targets, | ||
config, | ||
}).then(console.log).catch(console.error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') | ||
|
||
hotClient.subscribe(event => { | ||
if (event.action === 'reload') { | ||
window.location.reload() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
process.env.NODE_ENV = 'development' | ||
|
||
const electron = require('electron') | ||
const webpack = require('webpack') | ||
const webpackHotMiddleware = require('webpack-hot-middleware') | ||
const WebpackDevServer = require('webpack-dev-server') | ||
const treeKill = require('tree-kill') | ||
|
||
const path = require('path') | ||
const { spawn } = require('child_process') | ||
|
||
const mainConfig = require('./webpack.main.config') | ||
const rendererConfig = require('./webpack.renderer.config') | ||
|
||
let electronProcess = null | ||
let manualRestart = null | ||
const remoteDebugging = !!( | ||
process.argv[2] && process.argv[2] === '--remote-debug' | ||
) | ||
|
||
if (remoteDebugging) { | ||
process.env.RENDERER_REMOTE_DEBUGGING = true | ||
} | ||
|
||
const killElectron = (pid) => { | ||
return new Promise((resolve, reject) => { | ||
if (pid) { | ||
treeKill(pid, err => { | ||
if (err) reject(err) | ||
|
||
resolve() | ||
}) | ||
} else { | ||
resolve() | ||
} | ||
}) | ||
} | ||
|
||
const restartElectron = async () => { | ||
console.log('\nStarting electron...') | ||
|
||
const { pid } = electronProcess || {} | ||
await killElectron(pid) | ||
|
||
electronProcess = spawn(electron, [ | ||
'.', | ||
remoteDebugging ? '--inspect=9222' : '', | ||
remoteDebugging ? '--remote-debugging-port=9223' : '', | ||
], { | ||
cwd: path.join(__dirname, '..'), | ||
}) | ||
|
||
electronProcess.on('exit', (code, signal) => { | ||
if (!manualRestart) process.exit(0) | ||
}) | ||
|
||
electronProcess.stdout.setEncoding('utf8') | ||
electronProcess.stdout.on('data', data => console.log(`stdout: ${data}`)) | ||
electronProcess.stderr.setEncoding('utf8') | ||
electronProcess.stderr.on('data', data => console.log(`stderr: ${data}`)) | ||
} | ||
|
||
const startMain = async () => { | ||
const compiler = webpack(mainConfig) | ||
|
||
compiler.hooks.afterEmit.tap('afterEmit', async () => { | ||
console.log(`\nCompiled ${compiler.name} script!`) | ||
|
||
manualRestart = true | ||
await restartElectron() | ||
|
||
// I didn't want to use setTimeout, but if I don't the electronProcess 'exit' event is always called after manualRestart is set false | ||
setTimeout(() => { manualRestart = false }, 2000) | ||
|
||
console.log(`\nWatching file changes for ${compiler.name} script...`) | ||
}) | ||
|
||
compiler.watch( | ||
{ | ||
aggregateTimeout: 500, | ||
}, | ||
err => { | ||
if (err) console.error(err) | ||
} | ||
) | ||
} | ||
|
||
const startRenderer = () => { | ||
rendererConfig.entry.renderer = [ | ||
path.join(__dirname, 'dev-client'), | ||
rendererConfig.entry.renderer, | ||
] | ||
|
||
return new Promise(resolve => { | ||
const compiler = webpack(rendererConfig) | ||
const { name } = compiler | ||
const hotMiddleware = webpackHotMiddleware(compiler, { | ||
log: false, | ||
noInfo: true, | ||
quiet: true, | ||
}) | ||
|
||
compiler.hooks.afterEmit.tap('afterEmit', () => { | ||
console.log(`\nCompiled ${name} script!`) | ||
console.log(`\nWatching file changes for ${name} script...`) | ||
}) | ||
|
||
const server = new WebpackDevServer(compiler, { | ||
contentBase: path.join(__dirname, '../'), | ||
hot: true, | ||
noInfo: true, | ||
overlay: true, | ||
clientLogLevel: 'error', | ||
before (app, ctx) { | ||
app.use(hotMiddleware) | ||
|
||
ctx.middleware.waitUntilValid(() => { | ||
resolve() | ||
}) | ||
}, | ||
}) | ||
|
||
server.listen(9080) | ||
}) | ||
} | ||
|
||
const start = async () => { | ||
await startRenderer() | ||
await startMain() | ||
} | ||
|
||
start() |
Oops, something went wrong.