diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/README.md | 62 | ||||
-rw-r--r-- | tools/deploy.bat | 130 | ||||
-rwxr-xr-x | tools/deploy.sh | 92 | ||||
-rw-r--r-- | tools/minify.bat | 7 | ||||
-rwxr-xr-x | tools/minify.sh | 11 | ||||
-rw-r--r-- | tools/package.js | 5 |
6 files changed, 0 insertions, 307 deletions
diff --git a/tools/README.md b/tools/README.md deleted file mode 100644 index c2923c6..0000000 --- a/tools/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# Minification and Deployment -## Understanding and Using Minification - -Enyo comes with a minification tool based on NodeJS and UglifyJS. - -This tool can be used to compress the framework, other libraries, and applications, and will keep load order intact as well as correct url paths in css. - -### Why compress? - -Compressing enyo apps greatly reduces load times of appliactions, as well as reducing overall code size. - -This way, you can be very verbose in the documentation of your source code, without that impacting the performance of your application in production. - -### What is compressed - -For enyo, the libraries, and your code: **external assets such as images will not be copied or moved**. - -Instead, the CSS url paths are fixed up to reference the new path from the build location. - -### How to compress - -To compress your application, you must enter the `minify` folder and run one of the scripts. -- On Windows, just double click on `minify.bat` -- On Mac and Linux, run `minify.sh` - -Both scripts will run the minification tool located in `enyo/tools/minify`, and make a build of enyo, then a build of your app. - -Any libraries referenced in your `package.js` manifest will be built into your app's built code. - -**NOTE:** The `package.js` file inside the `minify` folder is mandatory, and only references your app's `package.js` to keep paths correct. Do not modify this. - -### What comes out? - -After running the minify script, a new folder `build` will be located next to your `source` directory. - -In it will be 4 files: -- enyo.css -- enyo.js -- app.css -- app.js - -These files will be loaded in the given order by `index.html`. - -## Deployment - -The deploy scripts included here will make a production ready copy of your application, and copy it into a packeagable folder. - -### How to run - -Just execute the platform specific `deploy` script. - -### What comes out? - -The output of the `deploy` scripts will minify your appliaction, and copy the necessary files into `deploy/<appname>-<date>-<time>/`. - -If the libraries have a compatible `deploy` script, they will be executed, and a minimal copy will be placed in the deployment's lib folder. - -If no `deploy` script is found for the library, all of the library is copied into the lib folder to provide maximum safety. - -If you are adding a library, please add a `deploy.sh` file and `deploy.bat` file similar to the ones in `lib/onyx`. - -If no images or files are needed from the library, just include blank (and executable) copies of the deploy scripts. diff --git a/tools/deploy.bat b/tools/deploy.bat deleted file mode 100644 index 6e034c0..0000000 --- a/tools/deploy.bat +++ /dev/null @@ -1,130 +0,0 @@ -@ECHO OFF -setlocal enableDelayedExpansion - -:: the deploy target folder -SET FOLDER=deploy - -:: the deploy target suffix, i.e. <projectName>[suffix] -SET SUFFIX= - %date% - %time% - -:: remove spaces, convert / : to _, convert . to ~ -set SUFFIX=%SUFFIX: =% -set SUFFIX=%SUFFIX:/=-% -set SUFFIX=%SUFFIX::=-% -set SUFFIX=%SUFFIX:.=~% - -:: enyo location -SET ENYO=..\enyo - -:: the grandparent folder for this batch file -SET SOURCE=%~dp0..\ - -:: extract project folder name -FOR /D %%I IN ("%SOURCE%\.") DO SET NAME=%%~nxI - -:: prepare target name -SET DEPLOY=%NAME%%SUFFIX% - -:: make sure (deploy) FOLDER exists -SET TARGETROOT="%SOURCE%%FOLDER%" -IF NOT EXIST %TARGETROOT% mkdir %TARGETROOT% - -:: pull path for this deploy -IF NOT DEFINED TARGET SET TARGET="%SOURCE%%FOLDER%\%DEPLOY%" - -:: quotes around path that might have spaces -SET SOURCE="%SOURCE%" - -IF NOT EXIST %TARGET% GOTO deploy - -ECHO "%TARGET%" folder already exists, please rename or remove it and try again. -ECHO. - -PAUSE -GOTO end - -:DEPLOY - -SET USAGE="Usage: deploy.bat [-h] [-c] [-o output_dir]" - -:: Parse options -:: Thanks to http://stackoverflow.com/questions/3973824/windows-bat-file-optional-argument-parsing -set "options=-o:"" -h: -c:" -for %%O in (%options%) do for /f "tokens=1,* delims=:" %%A in ("%%O") do set "%%A=%%~B" -:parseloop -if not "%~1"=="" ( - set "test=!options:*%~1:=! " - if "!test!"=="!options! " ( - echo %USAGE% - goto end - ) else if "!test:~0,1!"==" " ( - set "%~1=1" - ) else ( - set "%~1=%~2" - shift - ) - shift - goto :parseloop -) - -:: Handle options -IF DEFINED -h ( - ECHO %USAGE% - GOTO end -) -IF DEFINED -c ( - SET NO_LESS="-no-less" -) else ( - SET NO_LESS="" -) -IF DEFINED -o ( - SET TARGET=%-o% -) -IF DEFINED -o ( - RMDIR /S /Q %TARGET% -) - -ECHO This script can create a deployment in %TARGET% -ECHO. - - -ECHO ========== -ECHO build step -ECHO ========== -ECHO. - -REM build enyo -CALL %ENYO%\minify\minify.bat - -REM build app -CALL %ENYO%\tools\minify.bat package.js -output ..\build\app - -ECHO ========= -ECHO copy step -ECHO ========= -ECHO. - -:: make deploy folder -MKDIR %TARGET% - -:: copy root folder files -COPY %SOURCE%index.html %TARGET% >NUL -COPY %SOURCE%icon.png %TARGET% >NUL - -:: copy assets and build -XCOPY %SOURCE%assets\*.* %TARGET%\assets\ /Q /E >NUL -XCOPY %SOURCE%build\*.* %TARGET%\build\ /Q /E >NUL - -:: copy library items -MKDIR %TARGET%\lib - -FOR /D %%G in (%SOURCE%lib\*) DO IF EXIST "%%G\deploy.bat" ECHO deploying "%%~nxG" -FOR /D %%G in (%SOURCE%lib\*) DO IF EXIST "%%G\deploy.bat" CALL "%%G\deploy.bat" %TARGET%\lib\"%%~nxG" - -FOR /D %%G in (%SOURCE%lib\*) DO IF NOT EXIST "%%G\deploy.bat" ECHO copying "%%~nxG" -FOR /D %%G in (%SOURCE%lib\*) DO IF NOT EXIST "%%G\deploy.bat" XCOPY "%%G" %TARGET%\lib\"%%~nxG"\ /Q /E >NUL - -ECHO. - -PAUSE -:end diff --git a/tools/deploy.sh b/tools/deploy.sh deleted file mode 100755 index e461bb2..0000000 --- a/tools/deploy.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash - -cd `dirname $0` - -# the deploy target folder -FOLDER=deploy - -# the deploy target suffix -SUFFIX=`date "+-%Y_%m_%d-%I_%M_%S%p"` - -# The grandparent folder for this script -SOURCE=$(cd `dirname $0`/../; pwd) - -# extract project folder name -NAME=${SOURCE##*/} - -# target names -if [ -z "${DEPLOY}" ]; then - DEPLOY="$NAME$SUFFIX" -fi - -if [ -z "${TARGET}" ]; then - TARGET="$SOURCE/$FOLDER/$DEPLOY" -fi - -if [ -d $TARGET ]; then - echo "$TARGET folder already exists, please rename or remove it and try again." - exit 1 -fi - -# use less by default -NO_LESS="" - -USAGE="Usage: `basename $0` [-h] [-c] [-o output_dir] args" - -# Parse command line options. -while getopts hco: OPT; do - case "$OPT" in - h) - echo $USAGE - exit 0 - ;; - o) - TARGET=$OPTARG - rm -rf $TARGET - ;; - c) - NO_LESS="-no-less" - ;; - \?) - # getopts issues an error message - echo $USAGE >&2 - exit 1 - ;; - esac -done - -echo "This script can create a deployment in $TARGET" - -cat <<EOF -========== -build step -========== -EOF - -./minify.sh $NO_LESS - -cat <<EOF -========= -copy step -========= -EOF - -# make deploy folder -mkdir -p "$TARGET/lib" - -# copy root folder files -cp "$SOURCE/index.html" "$SOURCE/icon.png" "$TARGET" - -# copy assets and build -cp -r "$SOURCE/assets" "$SOURCE/build" "$TARGET" - -for i in "$SOURCE/lib/"*; do - o=${i##*/} - if [ -x $i/deploy.sh ]; then - echo "Deploying $o" - $i/deploy.sh "$TARGET/lib/$o" - else - echo "Copying $o" - cp -r "$i" "$TARGET/lib" - fi -done diff --git a/tools/minify.bat b/tools/minify.bat deleted file mode 100644 index d977480..0000000 --- a/tools/minify.bat +++ /dev/null @@ -1,7 +0,0 @@ -REM build enyo -@CALL ..\enyo\minify\minify.bat %@ - -REM build app -@CALL ..\enyo\tools\minify.bat package.js -output ..\build\app %@ - -pause
\ No newline at end of file diff --git a/tools/minify.sh b/tools/minify.sh deleted file mode 100755 index 1d4cf2e..0000000 --- a/tools/minify.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -cd `dirname $0` - -# build enyo -pushd ../enyo/minify > /dev/null -./minify.sh $@ -popd > /dev/null - -# build app -../enyo/tools/minify.sh package.js -output ../build/app $@ diff --git a/tools/package.js b/tools/package.js deleted file mode 100644 index 37e7d5e..0000000 --- a/tools/package.js +++ /dev/null @@ -1,5 +0,0 @@ -/* - == DO NOT EDIT THIS FILE! == - This is necessary to keep paths correct for the minification process -*/ -enyo.depends("../source"); |