Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tlentz electron/init #77

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# Logs
logs
*.log
.idea
npm-debug.log*


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

# Dependency directory
node_modules

# Optional npm cache directory
.npm
yarn.lock

# Optional REPL history
.node_repl_history

# elm-package generated files
elm-stuff/
# elm-repl generated files
repl-temp-*

.DS_Store
example/dist

ignore
dist
tests/VerifyExamples
package-lock.json

## Other

*.pyc
notebooks/
enquettar/
Expand Down
21 changes: 21 additions & 0 deletions electron-app/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Simon Hampton

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.
122 changes: 122 additions & 0 deletions electron-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Elm 0.19.1 with Webpack 4, Hot Reloading & Babel 7

[![CircleCI](https://circleci.com/gh/simonh1000/elm-webpack-starter.svg?style=svg)](https://circleci.com/gh/simonh1000/elm-webpack-starter)

Elm dev environment with hot-loading (i.e. state is retained as you edit your code - Hot Module Reloading, HMR)). I use this daily for my professional work. Like elm-community/elm-webpack-starter but using Webpack 4.

## Installation

Clone this repo into a new project folder and run install script.
(You will probably want to delete the .git/ directory and start version control afresh.)

With npm

```sh
$ git clone [email protected]:simonh1000/elm-webpack-starter.git new-project
$ cd new-project
$ npm install
```

## Developing

Start with Elm debug tool with either
```sh
$ npm start
or
$ npm start --nodebug
```

the `--nodebug` removes the Elm debug tool. This can become valuable when your model becomes very large.

Open http://localhost:3000 and start modifying the code in /src. **Note** that this starter expects you have installed [elm-format globally](https://github.com/avh4/elm-format#installation-).

An example using Routing is provided in the `navigation` branch

## Production

Build production assets (js and css together) with:

```sh
npm run prod
```

## Static assets

Just add to `src/assets/` and the production build copies them to `/dist`

## Testing

[Install elm-test globally](https://github.com/elm-community/elm-test#running-tests-locally)

`elm-test init` is run when you install your dependencies. After that all you need to do to run the tests is

```
npm test
```

Take a look at the examples in `tests/`

If you add dependencies to your main app, then run `elm-test --add-dependencies`

<!-- I have also added [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples) and provided an example in the definition of `add1` in App.elm. -->

## Elm-analyse

Elm-analyse is a "tool that allows you to analyse your Elm code, identify deficiencies and apply best practices." Its built into this starter, just run the following to see how your code is getting on:

```sh
$ npm run analyse
```

## Circle CI

```sh
$ circleci local execute --job build
```

<hr />

## ES6

This starter includes [Babel](https://babeljs.io/) so you can directly use ES6 code.

## Changelog

- 3.10.4 - Use better webpack defaults in dev mode
- 3.10.0 - Css minify
- 3.9.3 - Update deps
- 3.9.2 - Update elm/core and other deps
- 3.9.1 - Version 0.19.1
- 3.9.0 - Switch the closure compiler for minification in prod
- 3.8.0 - Update deps
- 3.7.0 - Add elm-analyse
- 3.6.0 - Add CI script
- 3.5.0 - Simpler means to work with/out the debug window
- 3.4.0 - Add ability to start dev mode without debug window
- 3.3.0 - Switch to elm/http 2.0.0 (and other deps updates)
- 3.2.0 - Add elm-minify to prod builds (thanks Asger)
- 3.1.0 - Revert to webpack-dev-server with example
- 3.0.2 - bugfixes (mostly for tests)
- 3.0.1 - use publicPath to ensure compatibility with more complex routes
- 3.0.0 - Version 0.19
- 2.1.0 - switch to webpack-serve (from webpack dev server)
- 2.0.0
- Remove Bootstrap (use purecss as simple alternative - you don't want me choosing your css framework after all)
- Compile CSS into separate file
- 1.2.0 - Webpack 4, Babel 7
- 1.1.0 - add elm-verify-examples

## How it works

`npm run dev` maps to `webpack-dev-server --hot --colors --port 3000` where

- `--hot` Enable webpack's Hot Module Replacement feature
- `--port 3000` - use port 3000 instead of default 8000
- inline (default) a script will be inserted in your bundle to take care of reloading, and build messages will appear in the browser console.
- `--colors` should show the colours created in the original Elm errors, but does not (To Fix)

One alternative is to run `npx webpack-dev-server --hot --colors --host=0.0.0.0 --port 3000` which will enable your dev server to be reached from other computers on your local network

## Credits

A long time ago this code was forked from https://github.com/fluxxu/elm-hot-loader
31 changes: 31 additions & 0 deletions electron-app/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"type": "application",
"source-directories": [
"src"
],
"elm-version": "0.19.1",
"dependencies": {
"direct": {
"elm/browser": "1.0.2",
"elm/core": "1.0.4",
"elm/html": "1.0.0",
"elm/http": "2.0.0",
"elm/json": "1.1.3"
},
"indirect": {
"elm/bytes": "1.0.8",
"elm/file": "1.0.5",
"elm/time": "1.0.0",
"elm/url": "1.0.0",
"elm/virtual-dom": "1.0.2"
}
},
"test-dependencies": {
"direct": {
"elm-explorations/test": "1.2.2"
},
"indirect": {
"elm/random": "1.0.0"
}
}
}
56 changes: 56 additions & 0 deletions electron-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"author": "Tyler Lentz",
"name": "d2modmaker",
"version": "1.0.0",
"description": "A cross platform desktop app to modify Diablo 2 text files in order to make changes to how the game can be played.",
"main": "index.js",
"scripts": {
"test": "elm-test",
"start": "npm run dev",
"dev": "webpack-dev-server --hot --colors --port 3000",
"build": "webpack",
"prod": "webpack -p",
"analyse": "elm-analyse -s -p 3001 -o"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tlentz/d2modmaker.git"
},
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/preset-env": "^7.11.5",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"closure-webpack-plugin": "^2.3.0",
"copy-webpack-plugin": "^6.1.1",
"css-loader": "^4.3.0",
"electron": "^10.1.5",
"elm": "^0.19.1-3",
"elm-analyse": "^0.16.5",
"elm-hot-webpack-loader": "^1.1.7",
"elm-test": "^0.19.1-revision4",
"elm-webpack-loader": "^6.0.1",
"file-loader": "^6.1.0",
"google-closure-compiler": "^20200920.0.0",
"html-webpack-plugin": "^4.5.0",
"mini-css-extract-plugin": "^0.11.2",
"node-sass": "^4.14.1",
"optimize-css-assets-webpack-plugin": "^5.0.4",
"resolve-url-loader": "^3.1.1",
"sass-loader": "^10.0.2",
"style-loader": "^1.2.1",
"url-loader": "^4.1.0",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.1.4"
},
"dependencies": {
"elm-format": "^0.8.3",
"purecss": "^2.0.3"
},
"prettier": {
"tabWidth": 4
}
}
Loading