* Step 1: move electorn into `app/`.

This is to comply with the suggested directory format of
`electron-builder`: https://github.com/electron-userland/electron-builder#two-packagejson-structure

* Step 2: add build directory with icon files for mac / windows

* Step 3: move all development (web) assets into main directory

* Step 4: add `build` namespace to dev `package.json`

* Step 5: move all dev dependencies into dev file and get rid of
old electron packagers in favor of `eletorn-builder`

* Step 6: target build inside `app/` as everything else is excluded at build time

* Step 7: remove old stuff!

* Step 8: update README

* turn off asar for `child_pty`
This commit is contained in:
Guillermo Rauch 2016-07-24 10:59:21 -07:00 committed by GitHub
parent bacb60193f
commit aaed99abac
66 changed files with 87 additions and 173 deletions

View file

@ -1,4 +1 @@
app/dist
app/node_modules
build
dist dist

1
.gitignore vendored
View file

@ -1,6 +1,5 @@
# build output # build output
dist dist
build
# dependencies # dependencies
node_modules node_modules

View file

@ -21,27 +21,24 @@ brew cask install hyperterm
## Contribute ## Contribute
To install `package.json` dependencies in a way where the native To test a certain git tree, clone and then run:
modules are built with `electron`, run:
```bash ```bash
./scripts/install.sh npm install
npm run pack
``` ```
Then, you want to make sure `app/dist` is populated. I recommend then open the `./dist` folder to find the built binaries!
running `webpack` with `--watch` so that any changes you make
to the app are detected.
```bash If you want to develop, run the above, and then you want to
cd app/ run webpack in `watch` mode:
npm install
```
npm run dev npm run dev
``` ```
Then you can run in the main directory: and to load the application simply run:
```bash
npm start
``` ```
electron app/index.js
...to launch the app! ```

View file

@ -1 +1,4 @@
app/dist
app/node_modules
build
dist dist

View file

@ -28,9 +28,6 @@ if (isDev) {
const url = 'file://' + resolve( const url = 'file://' + resolve(
isDev ? __dirname : app.getAppPath(), isDev ? __dirname : app.getAppPath(),
// in prod version, we copy over index.html and dist from 'app'
// into one dist folder to avoid unwanted files in package
isDev ? 'app' : 'build',
'index.html' 'index.html'
); );

View file

@ -1,46 +1,25 @@
{ {
"name": "hyperterm-web", "name": "hyperterm",
"version": "0.0.1", "productName": "HyperTerm",
"description": "Web app that runs in the renderer process", "version": "0.7.0-beta",
"license": "MIT", "license": "MIT",
"author": "rauchg",
"repository": "zeit/hyperterm", "repository": "zeit/hyperterm",
"description": "HTML/JS/CSS Terminal",
"dependencies": { "dependencies": {
"aphrodite-simple": "0.4.1", "child_pty": "3.0.1",
"color": "^0.11.3", "convert-css-color-name-to-hex": "0.1.1",
"hterm-umdjs": "1.1.3", "default-shell": "1.0.1",
"json-loader": "0.5.4", "electron-config": "0.2.1",
"mousetrap": "1.6.0", "electron-is-dev": "0.1.1",
"gaze": "1.1.0",
"mkdirp": "0.5.1",
"ms": "0.7.1", "ms": "0.7.1",
"object-values": "1.0.0", "shell-env": "0.1.2",
"react": "15.2.1", "uid2": "0.0.3"
"react-addons-pure-render-mixin": "15.2.1",
"react-deep-force-update": "2.0.1",
"react-dom": "15.2.1",
"react-redux": "4.4.5",
"redux": "3.5.2",
"redux-thunk": "2.1.0",
"reselect": "2.5.3",
"seamless-immutable": "6.1.1"
},
"devDependencies": {
"babel-cli": "6.10.1",
"babel-core": "6.10.4",
"babel-eslint": "6.1.2",
"babel-loader": "6.2.4",
"babel-preset-es2015-native-modules": "6.9.0",
"babel-preset-react": "6.11.1",
"eslint": "3.1.1",
"eslint-config-standard": "5.3.5",
"eslint-plugin-promise": "2.0.0",
"eslint-plugin-react": "5.2.2",
"eslint-plugin-standard": "2.0.0",
"webpack": "2.1.0-beta.15"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "standard", "extends": "standard",
"plugins": [
"react"
],
"rules": { "rules": {
"yoda": 0, "yoda": 0,
"semi": [ "semi": [
@ -55,26 +34,7 @@
"before": false, "before": false,
"after": true "after": true
} }
], ]
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
} }
},
"babel": {
"presets": [
"es2015-native-modules",
"react"
]
},
"scripts": {
"dev": "webpack --watch",
"lint": "eslint .",
"build": "NODE_ENV=production webpack",
"test": "npm run lint"
} }
} }

View file

View file

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

BIN
build/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -1,35 +1,48 @@
{ {
"name": "hyperterm", "name": "hyperterm-web",
"productName": "HyperTerm", "version": "0.0.1",
"version": "0.7.0-beta", "description": "Web app that runs in the renderer process",
"license": "MIT",
"repository": "zeit/hyperterm", "repository": "zeit/hyperterm",
"description": "HTML/JS/CSS Terminal",
"dependencies": { "dependencies": {
"child_pty": "3.0.1", "aphrodite-simple": "0.4.1",
"convert-css-color-name-to-hex": "0.1.1", "color": "^0.11.3",
"default-shell": "1.0.1", "hterm-umdjs": "1.1.3",
"electron-config": "0.2.1", "json-loader": "0.5.4",
"electron-is-dev": "0.1.1", "mousetrap": "1.6.0",
"gaze": "1.1.0",
"mkdirp": "0.5.1",
"ms": "0.7.1", "ms": "0.7.1",
"shell-env": "0.1.2", "object-values": "1.0.0",
"uid2": "0.0.3" "react": "15.2.1",
"react-addons-pure-render-mixin": "15.2.1",
"react-deep-force-update": "2.0.1",
"react-dom": "15.2.1",
"react-redux": "4.4.5",
"redux": "3.5.2",
"redux-thunk": "2.1.0",
"reselect": "2.5.3",
"seamless-immutable": "6.1.1"
}, },
"devDependencies": { "devDependencies": {
"electron-installer-debian": "0.3.0", "babel-cli": "6.10.1",
"electron-packager": "7.3.0", "babel-core": "6.10.4",
"babel-eslint": "6.1.2",
"babel-loader": "6.2.4",
"babel-preset-es2015-native-modules": "6.9.0",
"babel-preset-react": "6.11.1",
"electron-builder": "5.14.2",
"electron-prebuilt": "1.2.8", "electron-prebuilt": "1.2.8",
"eslint": "3.1.1", "eslint": "3.1.1",
"eslint-config-standard": "5.3.5", "eslint-config-standard": "5.3.5",
"eslint-plugin-promise": "2.0.0", "eslint-plugin-promise": "2.0.0",
"eslint-plugin-react": "5.2.2", "eslint-plugin-react": "5.2.2",
"eslint-plugin-standard": "2.0.0", "eslint-plugin-standard": "2.0.0",
"husky": "0.11.4" "husky": "0.11.4",
"webpack": "2.1.0-beta.15"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "standard", "extends": "standard",
"plugins": [
"react"
],
"rules": { "rules": {
"yoda": 0, "yoda": 0,
"semi": [ "semi": [
@ -44,14 +57,37 @@
"before": false, "before": false,
"after": true "after": true
} }
] ],
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
} }
}, },
"babel": {
"presets": [
"es2015-native-modules",
"react"
]
},
"build": {
"appId": "hyperterm",
"app-category-type": "public.app-category.developer-tools",
"asar": false
},
"scripts": { "scripts": {
"start": "electron index", "dev": "webpack --watch",
"lint": "eslint .", "lint": "eslint lib/ && eslint app/*.js",
"build": "NODE_ENV=production webpack",
"test": "npm run lint",
"start": "electron app",
"prepublish": "npm test", "prepublish": "npm test",
"prepush": "npm test", "prepush": "npm test",
"test": "npm run lint" "postinstall": "install-app-deps",
"pack": "npm run build && build --dir",
"dist": "npm run build && build"
} }
} }

View file

@ -1,31 +0,0 @@
{
"name": "Hyperterm",
"description":"HTML/JS/CSS Terminal",
"dest": "./dist",
"icon": "./static/icon.png",
"version":"0.6.0",
"maintainer":"Guillermo Rauch",
"categories": [
"Utility"
],
"depends": [
"git",
"gconf2",
"gconf-service",
"gvfs-bin",
"libc6",
"libcap2",
"libgtk2.0-0",
"libudev0 | libudev1",
"libgcrypt11 | libgcrypt20",
"libappindicator1",
"libnotify4",
"libnss3",
"libxtst6",
"python",
"xdg-utils"
],
"lintianOverrides": [
"changelog-file-missing-in-native-package"
]
}

View file

@ -1,13 +0,0 @@
#!/usr/bin/env bash
# Electron's version.
export npm_config_target=1.2.3
# The architecture of Electron, can be ia32 or x64.
export npm_config_arch=x64
# Download headers for Electron.
export npm_config_disturl=https://atom.io/download/atom-shell
# Tell node-pre-gyp that we are building for Electron.
export npm_config_runtime=electron
# Tell node-pre-gyp to build module from source code.
export npm_config_build_from_source=true
# Install all dependencies, and store cache to ~/.electron-gyp.
HOME=~/.electron-gyp npm install

View file

@ -1,31 +0,0 @@
#!/usr/bin/env bash
VERSION=`node -e 'process.stdout.write(require("./package").version)'`
if [ -z "$HYPERTERM_OSX_SIGNING_IDENTITY" ]; then
echo "ENV var HYPERTERM_OSX_SIGNING_IDENTITY missing. Set it to the Common Name of the downloaded certificate from Apple."
exit 1
fi
rm -rf node_modules
rm -rf ./app/node_modules
rm -rf ./dist/*
rm -rf ./build/
mkdir build
./scripts/install.sh
npm run lint
cd app
npm install
npm run lint
npm run build
cd -
cp -r app/assets build/
cp app/index.html build/
cp -r app/dist build/
mkdir dist
electron-packager ./ --platform=darwin --out=dist --arch=x64 --app-bundle-id="co.zeit.hyperterm" --app-version="$VERSION" --extend-info=static/Info.plist --osx-sign.identity="$HYPERTERM_OSX_SIGNING_IDENTITY" --icon=static/icon.icns --prune --ignore=app/
electron-packager ./ --platform=linux --arch=all --out=dist --app-version="$VERSION" --icon=static/icon.png --prune --ignore=app/
electron-installer-debian --src ./dist/HyperTerm-linux-ia32/ --arch i386 --config ./scripts/config.json
electron-installer-debian --src ./dist/HyperTerm-linux-x64/ --arch amd64 --config ./scripts/config.json
cd dist/HyperTerm-darwin-x64/
zip -r -q -y ../hyperterm-macos-x64-$VERSION.zip .
cd -

View file

@ -8,7 +8,7 @@ module.exports = {
devtool: isProd ? 'hidden-source-map' : 'cheap-eval-source-map', devtool: isProd ? 'hidden-source-map' : 'cheap-eval-source-map',
entry: './lib/index.js', entry: './lib/index.js',
output: { output: {
path: path.join(__dirname, './dist'), path: path.join(__dirname, 'app', 'dist'),
filename: 'bundle.js' filename: 'bundle.js'
}, },
module: { module: {