diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index aefbdeb..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,60 +0,0 @@ -module.exports = function(grunt) { - require('load-grunt-tasks')(grunt); - const project_name = 'Plasmon' - const electron_version = '0.30.1'; - const is_development = process.argv[2] !== 'build'; - grunt.initConfig({ - browserify: { - options: { - browserifyOptions: { - ignoreMissing: true, - debug: is_development - }, - watch: is_development, - transform: [require("strictify")], - keepAlive: is_development - }, - app: { - src: 'app.js', - dest:'script.js' - } - }, - copy: { - main: { - files: [{ - expand: true, - src: ['index.html', 'script.js', 'main.js', 'package.json'], - dest: 'build/app/' - }] - } - }, - electron: { - linux: { - options: { - name: project_name, - dir: 'build/app/', - out: 'build/', - version: electron_version, - platform: 'linux', - arch: 'x64', - overwrite: true, - asar: true - } - }, - osx: { - options: { - name: project_name, - dir: 'build/app/', - out: 'build/', - version: electron_version, - platform: 'darwin', - arch: 'x64', - overwrite: true, - asar: true - } - } - } - }); - grunt.registerTask('default', ['browserify']); - grunt.registerTask('build', ['browserify', 'copy', 'electron']); -} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1f88069 --- /dev/null +++ b/Makefile @@ -0,0 +1,53 @@ +NAME := $(shell node -e "console.log(require('./package').name)") +VERSION := $(shell node -e "console.log(require('./package').version)") +ELECTRON_VERSION := 0.30.1 + +# +# Binaries. +# + +BIN := node_modules/.bin +ELECTRON := $(BIN)/electron +BROWSERIFY := $(BIN)/browserify +PACKAGER := $(BIN)/electron-packager + +# +# Files. +# + +SRC := $(shell find lib -type f -name '*.js') +SCRIPT := build/script.js +ENTRY := lib/app.js + +# +# Tasks. +# + +start: clean build + @$(ELECTRON) . + +pack: clean build + @$(PACKAGER) . $(NAME) \ + --platform=darwin \ + --arch=x64 \ + --version=$(ELECTRON_VERSION) \ + --out build + +build: $(SCRIPT) + +clean: + @rm -rf build + +# +# Targets. +# + +$(SCRIPT): $(SRC) + @-mkdir -p $(@D) + @$(BROWSERIFY) $(ENTRY) \ + --ignore-missing \ + -t strictify \ + -t babelify \ + --outfile $@ + +.PHONY: build test diff --git a/index.html b/index.html index 6065400..0dfeb1a 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@