Skip to content

Commit

Permalink
Merge pull request #127 from AlyxMoon/develop
Browse files Browse the repository at this point in the history
Release v2.0.0
  • Loading branch information
AlyxMoon committed Jan 13, 2020
2 parents e8faaee + c823dec commit 70baf6d
Show file tree
Hide file tree
Showing 155 changed files with 14,291 additions and 6,749 deletions.
1 change: 1 addition & 0 deletions .eslintignore
@@ -0,0 +1 @@
node_modules
27 changes: 27 additions & 0 deletions .eslintrc.js
@@ -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',
}
};
2 changes: 2 additions & 0 deletions .gitattributes
@@ -0,0 +1,2 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
5 changes: 3 additions & 2 deletions .gitignore
@@ -1,6 +1,7 @@
# Project Files
data
/data
dist
build

# Compiled bundle from webpack
bundle.js
Expand Down Expand Up @@ -62,4 +63,4 @@ typings/
.yarn-integrity

# dotenv environment variables file
.env
.env
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
@@ -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
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
@@ -0,0 +1,3 @@
# Contributors
> A big thank you to those who have helped out with the project
- [mrdejong](https://github.com/mrdejong)
21 changes: 21 additions & 0 deletions LICENSE
@@ -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.
60 changes: 32 additions & 28 deletions README.md
Expand Up @@ -2,34 +2,38 @@
[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](http://standardjs.com/)
[![Total Downloads](https://img.shields.io/github/downloads/AlyxMoon/Lunars-Factorio-Mod-Manager/total.svg?label=Total%20Downloads)](https://github.com/AlyxMoon/Lunars-Factorio-Mod-Manager/releases)

LFMM is a tool for managing mods in Factorio. The aim is to make it easy to use many different sets of mods at a time.
Long-term, I would like to add tools that would be of use to power-users and modders.
LFMM is a tool for managing mods in Factorio. The aim is to make it easy to use many different sets of mods at a time.

**Disclaimer**: This is a pet project by a programmer still getting the hang of writing good code. While every attempt will be made to ensure this program is safe and does not have any harmful side-effects, caution should be taken. If you run into any issues, please leave an issue on this repo or post on this mod's page in the [Factorio forums](https://forums.factorio.com/viewtopic.php?f=137&t=30394).
**Disclaimer**: This is an old hobby project that is undergoing a rework. To be safe, you should backup any mods and saves that you might be worried about losing. If you run into any issues you can leave an issue on this repo or post on the [Factorio forums](https://forums.factorio.com/viewtopic.php?f=137&t=30394).

## Downloading / Installing
There are currently no compiled versions of the app. Instead, you can download a zip file from the releases page for a proper release version or near the top of this page for the most recent development version.

## Roadmap

**Base Functionality**

- [x] View all installed Factorio mods
- [x] Activate or deactivate mods
- [x] Manage a collection of mods as a single profile
- [x] Start Factorio from the app
- [x] View or download mods from online mod portal
- [x] Manually or automatically update downloaded mods
- [ ] Update or download all mods listed in a profile at once
- [ ] Have compiled packages for Windows, Mac, and Linux

**Server / Save Management**

- [ ] Export a profile for easy sharing
- [ ] View mods in use by saved games and create a profile based on them
- [ ] View server list and create a profile based on mods used in selected server

**Advanced Functionality / Tools for Modders**
- [ ] Allow using a specific Factorio version in profile (for when multiple versions are installed at once)
- [ ] Allow having multiple versions of a mod at once, and in the profile select which version to use
- [ ] Allow editing of a mod and saving that custom version (at minimum, editing config options)
Check out [the releases page](https://github.com/AlyxMoon/lunar-factorio-mod-manager/releases) for the compiled packages.
Download the appropriate package for your operating system, unzip it wherever you like, and start the app by running the `lunar-mod-manager.exe` file.

The master branch on this repo will be updated for official version releases. You can download from that at any time for the source code on releases. The develop branch should be kept fairly stable if you wish to run from that as well.
If you wish to run from source code but aren't sure how, check out the [Contributing Guide](https://github.com/AlyxMoon/lunar-factorio-mod-manager/blob/develop/CONTRIBUTING.md) for info on how to set things up.

## Features
For a full roadmap and planned feature list, check out the [roadmap on the wiki](https://github.com/AlyxMoon/lunar-factorio-mod-manager/wiki/Design-Document-and-Roadmap). If you have any questions or feel like any information is missing, let me know and I'll get things updated.

These are the main planned features for the app, though not everything is implemented at the time of writing.
- __Modpacks__
Create and manage modpacks, easily swap between them
- __Export / Import modpacks__
Easily save the modpack configuration as a file that can be shared with others
- __Edit mod configuration__
Edit the individual mod configuration and save it as part of the modpack
- __Browse online mods__
View the mods on the official mod portal, download directly from the app
- __Manage mod updates and dependencies__
Check for available updates to mods as well as any missing dependencies.
- __Create modpacks from saves__
View save files and automatically create modpacks to match mods used in the save
- __Create modpacks from servers__
View online servers and automatically create modpacks to match mods used in the server
- __Copy and edit mods__
Need to make a tweak to a mod? No problem, make a copy and edit the files within the app

##### Credits
All credits for the authors of packages and tools used in the project
- Development scripts from the [vue-electron-template project](https://github.com/mubaidr/vue-electron-template)
Binary file added _icons/icon.icns
Binary file not shown.
Binary file added _icons/icon.ico
Binary file not shown.
Binary file added _icons/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions _scripts/build.js
@@ -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)
7 changes: 7 additions & 0 deletions _scripts/dev-client.js
@@ -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()
}
})
132 changes: 132 additions & 0 deletions _scripts/dev-runner.js
@@ -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()

0 comments on commit 70baf6d

Please sign in to comment.