Fix build and dist folders

This commit is contained in:
Gregory Schier 2016-07-18 13:10:18 -07:00
parent 30f5e10750
commit ca5a6bec4d
8 changed files with 27 additions and 103 deletions

View File

@ -10,7 +10,7 @@
<script>
(function () {
const script = document.createElement('script');
script.src = (process.env.HOT) ? 'http://localhost:3333/dist/bundle.js' : './bundle.js';
script.src = (process.env.HOT) ? 'http://localhost:3333/build/bundle.js' : './bundle.js';
document.write(script.outerHTML);
}());
</script>

View File

@ -1,12 +1,11 @@
{
"private": true,
"name": "insomnia",
"version": "3.0.1",
"version": "3.0.2",
"productName": "Insomnia",
"description": "The best REST API Client",
"homepage": "http://insomnia.rest",
"author": "Gregory Schier <support@insomnia.rest>",
"licence": "GPL-3.0",
"main": "app.js",
"dependencies": {
"electron-squirrel-startup": "^1.0.0",

View File

@ -15,13 +15,12 @@
"dev": "concurrently --kill-others \"npm run hot-server\" \"npm run start-hot\"",
"test": "jest $@",
"build": "bash scripts/build.sh",
"package": "npm run build && bash scripts/package.sh",
"release": "npm run build && bash scripts/release.sh"
"package": "npm run build && bash scripts/package.sh"
},
"build": {
"appId": "com.insomnia.app",
"app-category-type": "public.app-category.developer-tools",
"compression": "maximum",
"compression": "normal",
"win": {
"iconUrl": "https://trello-logos.s3.amazonaws.com/06507f4661a7bb6375a8cf5beeaa48be/170.png",
"icon": "build/icon.ico",
@ -30,8 +29,8 @@
}
},
"directories": {
"app": "dist",
"output": "build"
"app": "build",
"output": "dist"
},
"dependencies": {
"classnames": "^2.2.3",

View File

@ -1,8 +1,10 @@
#!/bin/bash
#? Package the app
BUILD_DIR='./build'
echo "-- REMOVING DIST FOLDER --"
rm -r dist/*
rm -r "$BUILD_DIR/*"
echo "-- BUILDING PRODUCTION APP --"
NODE_ENV=production node -r babel-register ./node_modules/.bin/webpack --config ./webpack/webpack.config.production.js
@ -10,14 +12,14 @@ NODE_ENV=production node -r babel-register ./node_modules/.bin/webpack --config
echo "-- COPYING REMAINING FILES --"
# Copy some things
cp app/package.json dist/package.json
cp app/app.js dist/
cp -r app/images dist/
cp -r app/external dist/
cp app/package.json "$BUILD_DIR/package.json"
cp app/app.js "$BUILD_DIR/"
cp -r app/images "$BUILD_DIR/"
cp -r app/external "$BUILD_DIR/"
echo "-- INSTALLING PACKAGES --"
cd dist/
cd "$BUILD_DIR"/
NODE_ENV=production npm install
echo "-- BUILD COMPLETE --"

View File

@ -1,44 +1,17 @@
#!/bin/bash
#? Package the app
#? Package and generate installers
APP_NAME="Insomnia"
APP_ID="com.insomnia.app"
APP_VERSION=$(node -e "console.log(require('./dist/package.json').version)")
COMPANY_NAME="Gregory Schier"
OUT_DIR="build/v$APP_VERSION"
echo "-- STARTING PACKAGING PROCESS... --"
cp assets/* build/
echo "-- PACKAGING v$APP_VERSION TO $OUT_DIR/... --"
echo "-- PACKAGING MAC --"
node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --mac
node -r babel-register node_modules/electron-packager/cli.js \
dist \
"$APP_NAME" \
--platform=win32 \
--arch=x64 \
--asar \
--app-version="$APP_VERSION" \
--version-string.CompanyName="$COMPANY_NAME" \
--version-string.ProductName="$APP_NAME" \
--version-string.FileDescription="Beautiful HTTP Client" \
--version-string.OriginalFilename="$APP_ID" \
--version-string.InternalName="$APP_ID" \
--download.strictSSL=true \
--icon=assets/icon \
--out="$OUT_DIR" \
--app-bundle-id="$APP_ID" \
--app-category-type='public.app-category.developer-tools' \
--sign='Developer ID Application: Gregory Schier (7PU3P6ELJ8)' \
--osx-sign \
--overwrite
echo "-- PACKAGING WINDOWS --"
node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --win
# TODO: Move this to new script
#cd "$OUT_DIR"
#DARWIN_DIR="$APP_NAME-darwin-x64"
#ZIP_NAME="$APP_NAME-v$APP_VERSION.zip"
#
#mv "$DARWIN_DIR/$APP_NAME.app" "./$APP_NAME.app"
#rm -r "$DARWIN_DIR"
#
#zip -rqyX9 "$ZIP_NAME" "$APP_NAME.app"
#rm -r "$APP_NAME.app"
# TODO: This
#echo "-- PACKAGING LINUX --"
#node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --linux
echo "-- PACKAGED $APP_VERSION TO $OUT_DIR --"
echo "-- PACKAGING COMPLETE --"

View File

@ -1,49 +0,0 @@
#!/bin/bash
#? Package and ready the app
echo "-- PACKAGING APP... --"
cp assets/* build/
#node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --mac
node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --win
# TODO: Sort Linux builds out
#node node_modules/electron-builder/out/build-cli.js --publish='never' --x64 --linux
#Building:
# --mac, -m, -o, --osx, --macos Build for MacOS, accepts target list (see
# https://goo.gl/HAnnq8). [array]
# --linux, -l Build for Linux, accepts target list (see
# https://goo.gl/O80IL2) [array]
# --win, -w, --windows Build for Windows, accepts target list (see
# https://goo.gl/dL4i8i) [array]
# --x64 Build for x64 [boolean]
# --ia32 Build for ia32 [boolean]
# --dir Build unpacked dir. Useful to test. [boolean]
#
#Publishing:
# --publish, -p Publish artifacts (to GitHub Releases), see
# https://goo.gl/WMlr4n
# [choices: "onTag", "onTagOrDraft", "always", "never"]
# --draft Create a draft (unpublished) release [boolean]
# --prerelease Identify the release as a prerelease [boolean]
#
#Deprecated:
# --platform The target platform (preferred to use --mac, --win or --linux)
# [choices: "mac", "osx", "win", "linux", "darwin", "win32", "all"]
# --arch The target arch (preferred to use --x64 or --ia32)
# [choices: "ia32", "x64", "all"]
#
#Other:
# --help Show help [boolean]
# --version Show version number [boolean]
#
#Examples:
# build -mwl build for MacOS, Windows and Linux
# build --linux deb tar.xz build deb and tar.xz for Linux
# build --win --ia32 build for Windows ia32
#
#See the Wiki (https://github.com/electron-userland/electron-builder/wiki) for
#more documentation.
echo "-- PACKAGED --"

View File

@ -9,7 +9,7 @@ export default {
'./app.html'
],
output: {
path: path.join(__dirname, '../dist'),
path: path.join(__dirname, '../build'),
filename: 'bundle.js',
libraryTarget: 'commonjs2'
},

View File

@ -12,7 +12,7 @@ export default {
],
output: {
...baseConfig.output,
publicPath: 'http://localhost:3333/dist/'
publicPath: 'http://localhost:3333/build/'
},
plugins: [
...baseConfig.plugins,