-
-
Save Keirathi/f0a194ac2eb8da1c2d85b4a122041174 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Command: deploy.cmd | |
Handling node.js deployment. | |
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot' | |
Copying file: 'package.json' | |
Copying file: 'node_modules\.bin\bower' | |
Copying file: 'node_modules\.bin\bower.cmd' | |
Copying file: 'node_modules\bower\CHANGELOG.md' | |
Copying file: 'node_modules\bower\LICENSE' | |
Copying file: 'node_modules\bower\package.json' | |
Copying file: 'node_modules\bower\README.md' | |
Copying file: 'node_modules\bower\bin\bower' | |
Copying file: 'node_modules\bower\lib\config.js' | |
Copying file: 'node_modules\bower\lib\index.js' | |
Copying file: 'node_modules\bower\lib\version.js' | |
Copying file: 'node_modules\bower\lib\bin\bower.js' | |
Copying file: 'node_modules\bower\lib\commands\help.js' | |
Copying file: 'node_modules\bower\lib\commands\home.js' | |
Copying file: 'node_modules\bower\lib\commands\index.js' | |
Copying file: 'node_modules\bower\lib\commands\info.js' | |
Copying file: 'node_modules\bower\lib\commands\init.js' | |
Copying file: 'node_modules\bower\lib\commands\install.js' | |
Copying file: 'node_modules\bower\lib\commands\link.js' | |
Copying file: 'node_modules\bower\lib\commands\list.js' | |
Copying file: 'node_modules\bower\lib\commands\login.js' | |
Copying file: 'node_modules\bower\lib\commands\lookup.js' | |
Copying file: 'node_modules\bower\lib\commands\prune.js' | |
Copying file: 'node_modules\bower\lib\commands\register.js' | |
Copying file: 'node_modules\bower\lib\commands\search.js' | |
Copying file: 'node_modules\bower\lib\commands\uninstall.js' | |
Copying file: 'node_modules\bower\lib\commands\unregister.js' | |
Copying file: 'node_modules\bower\lib\commands\update.js' | |
Copying file: 'node_modules\bower\lib\commands\version.js' | |
Copying file: 'node_modules\bower\lib\commands\cache\clean.js' | |
Copying file: 'node_modules\bower\lib\commands\cache\list.js' | |
Copying file: 'node_modules\bower\lib\core\Manager.js' | |
Copying file: 'node_modules\bower\lib\core\PackageRepository.js' | |
Copying file: 'node_modules\bower\lib\core\Project.js' | |
Copying file: 'node_modules\bower\lib\core\ResolveCache.js' | |
Copying file: 'node_modules\bower\lib\core\resolverFactory.js' | |
Copying file: 'node_modules\bower\lib\core\scripts.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\FsResolver.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\GitFsResolver.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\GitHubResolver.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\GitRemoteResolver.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\GitResolver.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\index.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\pluginResolverFactory.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\Resolver.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\SvnResolver.js' | |
Copying file: 'node_modules\bower\lib\core\resolvers\UrlResolver.js' | |
Copying file: 'node_modules\bower\lib\node_modules\abbrev\abbrev.js' | |
Copying file: 'node_modules\bower\lib\node_modules\abbrev\LICENSE' | |
Omitting next output lines... | |
Processed 1404 files... | |
Processed 2739 files... | |
Processed 4196 files... | |
Processed 5380 files... | |
Looking for app.js/server.js under site root. | |
Missing server.js/app.js files, web.config is not generated | |
Node.js versions available on the platform are: 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.8.27, 0.8.28, 0.10.5, 0.10.18, 0.10.21, 0.10.24, 0.10.26, 0.10.28, 0.10.29, 0.10.31, 0.10.32, 0.10.40, 0.12.0, 0.12.2, 0.12.3, 0.12.6, 4.0.0, 4.1.0, 4.1.2, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.3.0, 4.3.2, 4.4.0, 4.4.1, 4.4.6, 4.4.7, 4.5.0, 4.6.0, 4.6.1, 5.0.0, 5.1.1, 5.3.0, 5.4.0, 5.5.0, 5.6.0, 5.7.0, 5.7.1, 5.8.0, 5.9.1, 6.0.0, 6.1.0, 6.2.2, 6.3.0, 6.5.0, 6.6.0, 6.7.0, 6.9.0, 6.9.1, 6.9.2, 6.9.4, 6.9.5, 6.10.0, 7.0.0, 7.1.0, 7.2.0, 7.3.0, 7.4.0, 7.5.0, 7.6.0, 7.7.4, 7.10.0, 8.0.0. | |
Selected node.js version 8.0.0. Use package.json file to choose a different version. | |
Selected npm version 5.0.0 | |
Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml | |
npm WARN lifecycle The node binary used for scripts is D:\Program Files (x86)\nodejs\6.9.1\node.exe but npm is using D:\Program Files (x86)\nodejs\8.0.0\node.exe itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with. | |
removed 1 package in 35.129s | |
bower angular-bootstrap#~2.5.0 not-cached https://github.com/angular-ui/bootstrap-bower.git#~2.5.0 | |
bower angular-bootstrap#~2.5.0 resolve https://github.com/angular-ui/bootstrap-bower.git#~2.5.0 | |
bower bootstrap-sass-official#^3.2.0 cached https://github.com/twbs/bootstrap-sass.git#3.3.7 | |
bower bootstrap-sass-official#^3.2.0 validate 3.3.7 against https://github.com/twbs/bootstrap-sass.git#^3.2.0 | |
bower weather-icons#~1.3.2 cached https://github.com/erikflowers/weather-icons.git#1.3.2 | |
bower weather-icons#~1.3.2 validate 1.3.2 against https://github.com/erikflowers/weather-icons.git#~1.3.2 | |
bower angular-touch#^1.3.0 cached https://github.com/angular/bower-angular-touch.git#1.6.4 | |
bower angular-touch#^1.3.0 validate 1.6.4 against https://github.com/angular/bower-angular-touch.git#^1.3.0 | |
bower angular-underscore#~0.5.0 cached https://github.com/floydsoft/angular-underscore.git#0.5.0 | |
bower angular-underscore#~0.5.0 validate 0.5.0 against https://github.com/floydsoft/angular-underscore.git#~0.5.0 | |
bower angular-sanitize#^1.3.0 cached https://github.com/angular/bower-angular-sanitize.git#1.6.4 | |
bower angular-sanitize#^1.3.0 validate 1.6.4 against https://github.com/angular/bower-angular-sanitize.git#^1.3.0 | |
bower angular-cookies#^1.3.0 cached https://github.com/angular/bower-angular-cookies.git#1.6.4 | |
bower angular-cookies#^1.3.0 validate 1.6.4 against https://github.com/angular/bower-angular-cookies.git#^1.3.0 | |
bower angular#^1.3.0 cached https://github.com/angular/bower-angular.git#1.6.4 | |
bower angular#^1.3.0 validate 1.6.4 against https://github.com/angular/bower-angular.git#^1.3.0 | |
bower angular-resource#^1.3.0 cached https://github.com/angular/bower-angular-resource.git#1.6.4 | |
bower angular-resource#^1.3.0 validate 1.6.4 against https://github.com/angular/bower-angular-resource.git#^1.3.0 | |
bower angular-route#^1.3.0 cached https://github.com/angular/bower-angular-route.git#1.6.4 | |
bower angular-route#^1.3.0 validate 1.6.4 against https://github.com/angular/bower-angular-route.git#^1.3.0 | |
bower toastr#~2.1.1 cached https://github.com/johnpapa/toastr-bower.git#2.1.3 | |
bower toastr#~2.1.1 validate 2.1.3 against https://github.com/johnpapa/toastr-bower.git#~2.1.1 | |
bower underscore#~1.8.3 cached https://github.com/jashkenas/underscore.git#1.8.3 | |
bower underscore#~1.8.3 validate 1.8.3 against https://github.com/jashkenas/underscore.git#~1.8.3 | |
bower angular-bootstrap-contextmenu#~0.9.3 cached https://github.com/Templarian/ui.bootstrap.contextMenu.git#0.9.9 | |
bower angular-bootstrap-contextmenu#~0.9.3 validate 0.9.9 against https://github.com/Templarian/ui.bootstrap.contextMenu.git#~0.9.3 | |
bower bootstrap#~3.3.4 cached https://github.com/twbs/bootstrap.git#3.3.7 | |
bower bootstrap#~3.3.4 validate 3.3.7 against https://github.com/twbs/bootstrap.git#~3.3.4 | |
bower bootstrap-fileinput#~4.2.0 cached https://github.com/kartik-v/bootstrap-fileinput.git#4.2.9 | |
bower bootstrap-fileinput#~4.2.0 validate 4.2.9 against https://github.com/kartik-v/bootstrap-fileinput.git#~4.2.0 | |
bower angular-mask#~3.0.12 cached https://github.com/candreoliveira/ngMask.git#3.0.16 | |
bower angular-mask#~3.0.12 validate 3.0.16 against https://github.com/candreoliveira/ngMask.git#~3.0.12 | |
bower angular-animate#^1.3.0 cached https://github.com/angular/bower-angular-animate.git#1.6.4 | |
bower angular-animate#^1.3.0 validate 1.6.4 against https://github.com/angular/bower-angular-animate.git#^1.3.0 | |
bower angular-mocks#^1.3.0 cached https://github.com/angular/bower-angular-mocks.git#1.6.4 | |
bower angular-mocks#^1.3.0 validate 1.6.4 against https://github.com/angular/bower-angular-mocks.git#^1.3.0 | |
bower jquery#1.9.1 - 3 cached https://github.com/jquery/jquery-dist.git#3.2.1 | |
bower jquery#1.9.1 - 3 validate 3.2.1 against https://github.com/jquery/jquery-dist.git#1.9.1 - 3 | |
bower jquery#>=1.6.3 <3 cached https://github.com/jquery/jquery-dist.git#2.2.4 | |
bower jquery#>=1.6.3 <3 validate 2.2.4 against https://github.com/jquery/jquery-dist.git#>=1.6.3 <3 | |
bower jquery#>= 1.9.0 cached https://github.com/jquery/jquery-dist.git#3.2.1 | |
bower jquery#>= 1.9.0 validate 3.2.1 against https://github.com/jquery/jquery-dist.git#>= 1.9.0 | |
bower bootstrap#~3 cached https://github.com/twbs/bootstrap.git#3.3.7 | |
bower bootstrap#~3 validate 3.3.7 against https://github.com/twbs/bootstrap.git#~3 | |
bower angular-bootstrap#~2.5.0 checkout 2.5.0 | |
bower angular-bootstrap#~2.5.0 resolved https://github.com/angular-ui/bootstrap-bower.git#2.5.0 | |
bower bootstrap-sass-official#^3.2.0 install bootstrap-sass-official#3.3.7 | |
bower weather-icons#~1.3.2 install weather-icons#1.3.2 | |
bower angular-underscore#~0.5.0 install angular-underscore#0.5.0 | |
bower angular-touch#^1.3.0 install angular-touch#1.6.4 | |
bower angular-sanitize#^1.3.0 install angular-sanitize#1.6.4 | |
bower angular-resource#^1.3.0 install angular-resource#1.6.4 | |
bower angular#^1.3.0 install angular#1.6.4 | |
bower angular-cookies#^1.3.0 install angular-cookies#1.6.4 | |
bower angular-route#^1.3.0 install angular-route#1.6.4 | |
bower toastr#~2.1.1 install toastr#2.1.3 | |
bower bootstrap-fileinput#~4.2.0 install bootstrap-fileinput#4.2.9 | |
bower bootstrap#~3.3.4 install bootstrap#3.3.7 | |
bower angular-bootstrap-contextmenu#~0.9.3 install angular-bootstrap-contextmenu#0.9.9 | |
bower underscore#~1.8.3 install underscore#1.8.3 | |
bower angular-mask#~3.0.12 install angular-mask#3.0.16 | |
bower jquery#>=1.6.3 <3 install jquery#2.2.4 | |
bower angular-animate#^1.3.0 install angular-animate#1.6.4 | |
bower angular-mocks#^1.3.0 install angular-mocks#1.6.4 | |
bower angular-bootstrap#~2.5.0 install angular-bootstrap#2.5.0 | |
bootstrap-sass-official#3.3.7 bower_components\bootstrap-sass-official | |
└── jquery#2.2.4 | |
weather-icons#1.3.2 bower_components\weather-icons | |
angular-underscore#0.5.0 bower_components\angular-underscore | |
angular-touch#1.6.4 bower_components\angular-touch | |
└── angular#1.6.4 | |
angular-sanitize#1.6.4 bower_components\angular-sanitize | |
└── angular#1.6.4 | |
angular-resource#1.6.4 bower_components\angular-resource | |
└── angular#1.6.4 | |
angular#1.6.4 bower_components\angular | |
angular-cookies#1.6.4 bower_components\angular-cookies | |
└── angular#1.6.4 | |
angular-route#1.6.4 bower_components\angular-route | |
└── angular#1.6.4 | |
toastr#2.1.3 bower_components\toastr | |
└── jquery#2.2.4 | |
bootstrap-fileinput#4.2.9 bower_components\bootstrap-fileinput | |
├── bootstrap#3.3.7 | |
└── jquery#2.2.4 | |
bootstrap#3.3.7 bower_components\bootstrap | |
└── jquery#2.2.4 | |
angular-bootstrap-contextmenu#0.9.9 bower_components\angular-bootstrap-contextmenu | |
underscore#1.8.3 bower_components\underscore | |
angular-mask#3.0.16 bower_components\angular-mask | |
jquery#2.2.4 bower_components\jquery | |
angular-animate#1.6.4 bower_components\angular-animate | |
└── angular#1.6.4 | |
angular-mocks#1.6.4 bower_components\angular-mocks | |
└── angular#1.6.4 | |
angular-bootstrap#2.5.0 bower_components\angular-bootstrap | |
└── angular#1.6.4 | |
Finished successfully. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ourApp", | |
"version": "0.0.0", | |
"dependencies": { | |
"angular": "^1.3.0", | |
"bootstrap-sass-official": "^3.2.0", | |
"angular-animate": "^1.3.0", | |
"angular-cookies": "^1.3.0", | |
"angular-resource": "^1.3.0", | |
"angular-route": "^1.3.0", | |
"angular-sanitize": "^1.3.0", | |
"angular-touch": "^1.3.0", | |
"weather-icons": "~1.3.2", | |
"underscore": "~1.8.3", | |
"angular-underscore": "~0.5.0", | |
"bootstrap": "~3.3.4", | |
"angular-bootstrap": "~2.5.0", | |
"toastr": "~2.1.1", | |
"bootstrap-fileinput": "~4.2.0", | |
"angular-mask": "~3.0.12", | |
"angular-bootstrap-contextmenu": "~0.9.3" | |
}, | |
"devDependencies": { | |
"angular-mocks": "^1.3.0" | |
}, | |
"appPath": "app", | |
"moduleName": "ourApp" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off | |
:: ---------------------- | |
:: KUDU Deployment Script | |
:: Version: 1.0.15 | |
:: ---------------------- | |
:: Prerequisites | |
:: ------------- | |
:: Verify node.js installed | |
where node 2>nul >nul | |
IF %ERRORLEVEL% NEQ 0 ( | |
echo Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment. | |
goto error | |
) | |
:: Setup | |
:: ----- | |
setlocal enabledelayedexpansion | |
SET ARTIFACTS=%~dp0%..\artifacts | |
IF NOT DEFINED DEPLOYMENT_SOURCE ( | |
SET DEPLOYMENT_SOURCE=%~dp0%. | |
) | |
IF NOT DEFINED DEPLOYMENT_TARGET ( | |
SET DEPLOYMENT_TARGET=%ARTIFACTS%\wwwroot | |
) | |
IF NOT DEFINED NEXT_MANIFEST_PATH ( | |
SET NEXT_MANIFEST_PATH=%ARTIFACTS%\manifest | |
IF NOT DEFINED PREVIOUS_MANIFEST_PATH ( | |
SET PREVIOUS_MANIFEST_PATH=%ARTIFACTS%\manifest | |
) | |
) | |
IF NOT DEFINED KUDU_SYNC_CMD ( | |
:: Install kudu sync | |
echo Installing Kudu Sync | |
call npm install kudusync -g --silent | |
IF !ERRORLEVEL! NEQ 0 goto error | |
:: Locally just running "kuduSync" would also work | |
SET KUDU_SYNC_CMD=%appdata%\npm\kuduSync.cmd | |
) | |
goto Deployment | |
:: Utility Functions | |
:: ----------------- | |
:SelectNodeVersion | |
IF DEFINED KUDU_SELECT_NODE_VERSION_CMD ( | |
:: The following are done only on Windows Azure Websites environment | |
call %KUDU_SELECT_NODE_VERSION_CMD% "%DEPLOYMENT_SOURCE%" "%DEPLOYMENT_TARGET%" "%DEPLOYMENT_TEMP%" | |
IF !ERRORLEVEL! NEQ 0 goto error | |
IF EXIST "%DEPLOYMENT_TEMP%\__nodeVersion.tmp" ( | |
SET /p NODE_EXE=<"%DEPLOYMENT_TEMP%\__nodeVersion.tmp" | |
IF !ERRORLEVEL! NEQ 0 goto error | |
) | |
IF EXIST "%DEPLOYMENT_TEMP%\__npmVersion.tmp" ( | |
SET /p NPM_JS_PATH=<"%DEPLOYMENT_TEMP%\__npmVersion.tmp" | |
IF !ERRORLEVEL! NEQ 0 goto error | |
) | |
IF NOT DEFINED NODE_EXE ( | |
SET NODE_EXE=node | |
) | |
SET NPM_CMD="!NODE_EXE!" "!NPM_JS_PATH!" | |
) ELSE ( | |
SET NPM_CMD=npm | |
SET NODE_EXE=node | |
) | |
goto :EOF | |
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
:: Deployment | |
:: ---------- | |
:Deployment | |
echo Handling node.js deployment. | |
:: 1. KuduSync | |
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" ( | |
call :ExecuteCmd "%KUDU_SYNC_CMD%" -v 50 -f "%DEPLOYMENT_SOURCE%" -t "%DEPLOYMENT_TARGET%" -n "%NEXT_MANIFEST_PATH%" -p "%PREVIOUS_MANIFEST_PATH%" -i ".git;.hg;.deployment;deploy.cmd" | |
IF !ERRORLEVEL! NEQ 0 goto error | |
) | |
:: 2. Select node version | |
call :SelectNodeVersion | |
:: 3. Install npm packages | |
IF EXIST "%DEPLOYMENT_TARGET%\package.json" ( | |
pushd "%DEPLOYMENT_TARGET%" | |
call :ExecuteCmd !NPM_CMD! install --production | |
IF !ERRORLEVEL! NEQ 0 goto error | |
popd | |
) | |
:: I Added this manually. Tried without it first and got the same results | |
IF EXIST "%DEPLOYMENT_TARGET%\bower.json" ( | |
pushd "%DEPLOYMENT_TARGET%" | |
call bower install | |
IF !ERRORLEVEL! NEQ 0 goto error | |
popd | |
) | |
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
goto end | |
:: Execute command routine that will echo out when error | |
:ExecuteCmd | |
setlocal | |
set _CMD_=%* | |
call %_CMD_% | |
if "%ERRORLEVEL%" NEQ "0" echo Failed exitCode=%ERRORLEVEL%, command=%_CMD_% | |
exit /b %ERRORLEVEL% | |
:error | |
endlocal | |
echo An error has occurred during web site deployment. | |
call :exitSetErrorLevel | |
call :exitFromFunction 2>nul | |
:exitSetErrorLevel | |
exit /b 1 | |
:exitFromFunction | |
() | |
:end | |
endlocal | |
echo Finished successfully. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the directory structure of our code on the github repo branch that azure pulls from. I should maybe note that the basic app structure was generated using yeoman as far as I can tell, if that makes any difference. | |
-/app | |
--/scripts | |
---app.js | |
--/views | |
--/styles | |
--index.html | |
--etc | |
-/environment | |
--dev.config.js | |
--staging.config.js | |
--prod.config.js | |
-/test | |
--//testing stuff | |
-gruntfile.js | |
-bower.json | |
-package.json | |
-etcetc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated on 2015-04-23 using generator-angular 0.11.1 | |
'use strict'; | |
// # Globbing | |
// for performance reasons we're only matching one level down: | |
// 'test/spec/{,*/}*.js' | |
// use this if you want to recursively match all subfolders: | |
// 'test/spec/**/*.js' | |
var modRewrite = require('connect-modrewrite'); | |
module.exports = function (grunt) { | |
// Load grunt tasks automatically | |
require('load-grunt-tasks')(grunt); | |
// Time how long tasks take. Can help when optimizing build times | |
require('time-grunt')(grunt); | |
// Configurable paths for the application | |
var appConfig = { | |
app: require('./bower.json').appPath || 'app', | |
dist: 'dist' | |
}; | |
var packageConfig = require('./package.json'); | |
// Define the configuration for all the tasks | |
grunt.initConfig({ | |
// Project settings | |
yeoman: appConfig, | |
// Watches files for changes and runs tasks based on the changed files | |
watch: { | |
bower: { | |
files: ['bower.json'], | |
tasks: ['wiredep'] | |
}, | |
js: { | |
files: ['<%= yeoman.app %>/scripts/{,*/}*.js'], | |
tasks: ['newer:jshint:all'], | |
options: { | |
livereload: '<%= connect.options.livereload %>' | |
} | |
}, | |
jsTest: { | |
files: ['test/spec/{,*/}*.js'], | |
tasks: ['newer:jshint:test', 'karma'] | |
}, | |
compass: { | |
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], | |
tasks: ['compass:server', 'autoprefixer'] | |
}, | |
gruntfile: { | |
files: ['Gruntfile.js'] | |
}, | |
livereload: { | |
options: { | |
livereload: '<%= connect.options.livereload %>' | |
}, | |
files: [ | |
'<%= yeoman.app %>/{,*/}*.html', | |
'.tmp/styles/{,*/}*.css', | |
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' | |
] | |
} | |
}, | |
// The actual grunt server settings | |
connect: { | |
options: { | |
port: 9000, | |
// Change this to '0.0.0.0' to access the server from outside. | |
hostname: 'localhost', | |
livereload: 35729 | |
}, | |
livereload: { | |
options: { | |
open: true, | |
middleware: function (connect) { | |
return [ | |
modRewrite(['^[^\\.]*$ /index.html [L]']), | |
connect.static('.tmp'), | |
connect().use( | |
'/bower_components', | |
connect.static('./bower_components') | |
), | |
connect().use( | |
'/app/styles', | |
connect.static('./app/styles') | |
), | |
connect.static(appConfig.app) | |
]; | |
} | |
} | |
}, | |
test: { | |
options: { | |
port: 9001, | |
middleware: function (connect) { | |
return [ | |
connect.static('.tmp'), | |
connect.static('test'), | |
connect().use( | |
'/bower_components', | |
connect.static('./bower_components') | |
), | |
connect.static(appConfig.app) | |
]; | |
} | |
} | |
}, | |
dist: { | |
options: { | |
open: true, | |
base: '<%= yeoman.dist %>' | |
} | |
} | |
}, | |
// Make sure code styles are up to par and there are no obvious mistakes | |
jshint: { | |
options: { | |
jshintrc: '.jshintrc', | |
reporter: require('jshint-stylish') | |
}, | |
all: { | |
src: [ | |
'Gruntfile.js', | |
'<%= yeoman.app %>/scripts/{,*/}*.js' | |
] | |
}, | |
test: { | |
options: { | |
jshintrc: 'test/.jshintrc' | |
}, | |
src: ['test/spec/{,*/}*.js'] | |
} | |
}, | |
// Empties folders to start fresh | |
clean: { | |
dist: { | |
files: [{ | |
dot: true, | |
src: [ | |
'.tmp', | |
'<%= yeoman.dist %>/{,*/}*', | |
'!<%= yeoman.dist %>/.git{,*/}*' | |
] | |
}] | |
}, | |
server: '.tmp' | |
}, | |
// Add vendor prefixed styles | |
autoprefixer: { | |
options: { | |
browsers: ['last 1 version'] | |
}, | |
server: { | |
options: { | |
map: true, | |
}, | |
files: [{ | |
expand: true, | |
cwd: '.tmp/styles/', | |
src: '{,*/}*.css', | |
dest: '.tmp/styles/' | |
}] | |
}, | |
stage: { | |
options: { | |
map: true | |
}, | |
files: [{ | |
expand: true, | |
cwd: '.tmp/styles/', | |
src: '{,*/}*.css', | |
dest: '.tmp/styles/' | |
}] | |
}, | |
dist: { | |
files: [{ | |
expand: true, | |
cwd: '.tmp/styles/', | |
src: '{,*/}*.css', | |
dest: '.tmp/styles/' | |
}] | |
} | |
}, | |
// Automatically inject Bower components into the app | |
wiredep: { | |
app: { | |
src: ['<%= yeoman.app %>/index.html'], | |
ignorePath: /\.\.\// | |
}, | |
test: { | |
devDependencies: true, | |
src: '<%= karma.unit.configFile %>', | |
ignorePath: /\.\.\//, | |
fileTypes:{ | |
js: { | |
block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi, | |
detect: { | |
js: /'(.*\.js)'/gi | |
}, | |
replace: { | |
js: '\'{{filePath}}\',' | |
} | |
} | |
} | |
}, | |
sass: { | |
src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], | |
ignorePath: /(\.\.\/){1,2}bower_components\// | |
} | |
}, | |
// Compiles Sass to CSS and generates necessary files if requested | |
compass: { | |
options: { | |
sassDir: '<%= yeoman.app %>/styles', | |
cssDir: '.tmp/styles', | |
generatedImagesDir: '.tmp/images/generated', | |
imagesDir: '<%= yeoman.app %>/images', | |
javascriptsDir: '<%= yeoman.app %>/scripts', | |
fontsDir: '<%= yeoman.app %>/styles/fonts', | |
importPath: './bower_components', | |
httpImagesPath: '/images', | |
httpGeneratedImagesPath: '/images/generated', | |
httpFontsPath: '/styles/fonts', | |
relativeAssets: false, | |
assetCacheBuster: false, | |
raw: 'Sass::Script::Number.precision = 10\n' | |
}, | |
stage: { | |
options: { | |
sourcemap: true | |
} | |
}, | |
dist: { | |
options: { | |
generatedImagesDir: '<%= yeoman.dist %>/images/generated' | |
} | |
}, | |
server: { | |
options: { | |
sourcemap: true | |
} | |
} | |
}, | |
// Renames files for browser caching purposes | |
filerev: { | |
dist: { | |
src: [ | |
'<%= yeoman.dist %>/scripts/{,*/}*.js', | |
'<%= yeoman.dist %>/styles/{,*/}*.css', | |
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', | |
'<%= yeoman.dist %>/styles/fonts/*' | |
] | |
} | |
}, | |
// Reads HTML for usemin blocks to enable smart builds that automatically | |
// concat, minify and revision files. Creates configurations in memory so | |
// additional tasks can operate on them | |
useminPrepare: { | |
html: '<%= yeoman.app %>/index.html', | |
options: { | |
dest: '<%= yeoman.dist %>', | |
flow: { | |
html: { | |
steps: { | |
js: ['concat', 'uglifyjs'], | |
css: ['cssmin'] | |
}, | |
post: {} | |
} | |
} | |
} | |
}, | |
// Performs rewrites based on filerev and the useminPrepare configuration | |
usemin: { | |
html: ['<%= yeoman.dist %>/{,*/}*.html'], | |
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], | |
options: { | |
assetsDirs: [ | |
'<%= yeoman.dist %>', | |
'<%= yeoman.dist %>/images', | |
'<%= yeoman.dist %>/styles' | |
] | |
} | |
}, | |
// The following *-min tasks will produce minified files in the dist folder | |
// By default, your `index.html`'s <!-- Usemin block --> will take care of | |
// minification. These next options are pre-configured if you do not wish | |
// to use the Usemin blocks. | |
// cssmin: { | |
// dist: { | |
// files: { | |
// '<%= yeoman.dist %>/styles/main.css': [ | |
// '.tmp/styles/{,*/}*.css' | |
// ] | |
// } | |
// } | |
// }, | |
// uglify: { | |
// dist: { | |
// files: { | |
// '<%= yeoman.dist %>/scripts/scripts.js': [ | |
// '<%= yeoman.dist %>/scripts/scripts.js' | |
// ] | |
// } | |
// } | |
// }, | |
// concat: { | |
// dist: {} | |
// }, | |
imagemin: { | |
dist: { | |
files: [{ | |
expand: true, | |
cwd: '<%= yeoman.app %>/images', | |
src: '{,*/}*.{png,jpg,jpeg,gif}', | |
dest: '<%= yeoman.dist %>/images' | |
}] | |
} | |
}, | |
svgmin: { | |
dist: { | |
files: [{ | |
expand: true, | |
cwd: '<%= yeoman.app %>/images', | |
src: '{,*/}*.svg', | |
dest: '<%= yeoman.dist %>/images' | |
}] | |
} | |
}, | |
htmlmin: { | |
dist: { | |
options: { | |
collapseWhitespace: true, | |
conservativeCollapse: true, | |
collapseBooleanAttributes: true, | |
removeCommentsFromCDATA: true, | |
removeOptionalTags: true | |
}, | |
files: [{ | |
expand: true, | |
cwd: '<%= yeoman.dist %>', | |
src: ['*.html', 'views/{,*/}*.html'], | |
dest: '<%= yeoman.dist %>' | |
}] | |
} | |
}, | |
// ng-annotate tries to make the code safe for minification automatically | |
// by using the Angular long form for dependency injection. | |
ngAnnotate: { | |
dist: { | |
files: [{ | |
expand: true, | |
cwd: '.tmp/concat/scripts', | |
src: '*.js', | |
dest: '.tmp/concat/scripts' | |
}] | |
} | |
}, | |
// Replace Google CDN references | |
cdnify: { | |
dist: { | |
html: ['<%= yeoman.dist %>/*.html'] | |
} | |
}, | |
// Copies remaining files to places other tasks can use | |
copy: { | |
stage: { | |
files: [{ | |
expand: true, | |
dot: true, | |
cwd: '<%= yeoman.app %>', | |
dest: '<%= yeoman.dist %>', | |
src: [ | |
'*.{ico,png,txt}', | |
'.htaccess', | |
'*.html', | |
'scripts/{,*/}*.js', | |
// 'views/{,*/}*.html', | |
'images/{,*/}*.{webp}', | |
'styles/fonts/{,*/}*.*', | |
'views/**/*', | |
'favicon.ico', | |
'fonts/**/*', | |
// 'images/**/*' | |
]}, | |
{ | |
expand: true, | |
cwd: '.tmp/images', | |
dest: '<%= yeoman.dist %>/images', | |
src: ['generated/*'] | |
}, | |
{ | |
expand: true, | |
cwd: '.tmp/styles', | |
dest: '<%= yeoman.dist %>/styles', | |
src: [ | |
'*' | |
] | |
}, | |
{ | |
expand: true, | |
cwd: '.', | |
dest: '<%= yeoman.dist %>', | |
src: [ | |
'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*', | |
'bower_components/bootstrap-sass-official/assets/javascripts/*', | |
'bower_components/font-awesome/css/*', | |
'bower_components/font-awesome/fonts/*', | |
'bower_components/weather-icons/css/*', | |
'bower_components/weather-icons/fonts/*', | |
'bower_components/weather-icons/font/*', | |
'bower_components/jquery/dist/*', | |
'bower_components/underscore/*', | |
'bower_components/angular-underscore/*', | |
'bower_components/bootstrap/dist/{,*/}*', | |
'bower_components/angular-bootstrap/*', | |
'bower_components/toastr/*', | |
'bower_components/bootstrap-fileinput/{,*/}*', | |
'bower_components/angular-mask/{,*/}*', | |
'bower_components/angular-bootstrap-contextmenu/{,*/}*' | |
]} | |
] | |
}, | |
dist: { | |
files: [{ | |
expand: true, | |
dot: true, | |
cwd: '<%= yeoman.app %>', | |
dest: '<%= yeoman.dist %>', | |
src: [ | |
'*.{ico,png,txt}', | |
'.htaccess', | |
'*.html', | |
// 'views/{,*/}*.html', | |
'images/{,*/}*.{webp}', | |
'styles/fonts/{,*/}*.*', | |
'views/**/*', | |
'favicon.ico', | |
'fonts/**/*', | |
// 'images/**/*' | |
] | |
}, { | |
expand: true, | |
cwd: '.tmp/images', | |
dest: '<%= yeoman.dist %>/images', | |
src: ['generated/*'] | |
}, { | |
expand: true, | |
cwd: '.', | |
src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*', | |
dest: '<%= yeoman.dist %>' | |
}, | |
{ | |
expand: true, | |
cwd: '.', | |
dest: '<%= yeoman.dist %>', | |
src: [ | |
//'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*', | |
// 'bower_components/bootstrap-sass-official/assets/javascripts/*', | |
// 'bower_components/font-awesome/css/*', | |
// 'bower_components/font-awesome/fonts/*', | |
'bower_components/weather-icons/css/*', | |
'bower_components/weather-icons/fonts/*', | |
'bower_components/weather-icons/font/*' | |
// 'bower_components/jquery/dist/*', | |
// 'bower_components/underscore/*', | |
// 'bower_components/angular-underscore/*', | |
// 'bower_components/bootstrap/dist/{,*/}*', | |
// 'bower_components/angular-bootstrap/*', | |
// 'bower_components/toastr/*' | |
]} | |
] | |
}, | |
styles: { | |
expand: true, | |
cwd: '<%= yeoman.app %>/styles', | |
dest: '.tmp/styles/', | |
src: '{,*/}*.css' | |
} | |
}, | |
// Run some tasks in parallel to speed up the build process | |
concurrent: { | |
server: [ | |
'compass:server' | |
], | |
test: [ | |
'compass' | |
], | |
stage: [ | |
'compass:stage', | |
'imagemin', | |
'svgmin' | |
], | |
dist: [ | |
'compass:dist', | |
'imagemin', | |
'svgmin' | |
] | |
}, | |
// Test settings | |
karma: { | |
unit: { | |
configFile: 'test/karma.conf.js', | |
singleRun: true | |
} | |
}, | |
ngconstant: { | |
options: { | |
name: 'ourConfig', | |
dest: './app/scripts/config/config.js' | |
}, | |
server: { | |
constants: { | |
apiConfig: grunt.file.readJSON('./environments/dev.json'), | |
ourVersion:{ | |
version: packageConfig.version | |
}, | |
reportsUrl: grunt.file.readJSON('./environments/reports.dev.json') | |
} | |
}, | |
stage: { | |
constants: { | |
apiConfig: grunt.file.readJSON('./environments/stage.json'), | |
ourVersion:{ | |
version: packageConfig.version | |
}, | |
reportsUrl: grunt.file.readJSON('./environments/reports.stage.json') | |
} | |
}, | |
dist: { | |
constants: { | |
apiConfig: grunt.file.readJSON('./environments/prod.json'), | |
ourVersion:{ | |
version: packageConfig.version | |
}, | |
reportsUrl: grunt.file.readJSON('./environments/reports.prod.json') | |
} | |
} | |
} | |
}); | |
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) { | |
if (target === 'dist') { | |
return grunt.task.run(['build', 'connect:dist:keepalive']); | |
} | |
grunt.task.run([ | |
'clean:server', | |
'wiredep', | |
'ngconstant:server', | |
'concurrent:server', | |
'autoprefixer:server', | |
'connect:livereload', | |
'watch' | |
]); | |
}); | |
grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) { | |
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); | |
grunt.task.run(['serve:' + target]); | |
}); | |
grunt.registerTask('test', [ | |
'clean:server', | |
'wiredep', | |
'ngconstant:server', | |
'concurrent:test', | |
'autoprefixer', | |
'connect:test', | |
'karma' | |
]); | |
grunt.registerTask('stage', [ | |
'clean:dist', | |
'wiredep', | |
'ngconstant:stage', | |
'useminPrepare', | |
'concurrent:stage', | |
'autoprefixer:stage', | |
'ngAnnotate', | |
'copy:stage', | |
'cdnify', | |
'cssmin' | |
]); | |
grunt.registerTask('build', [ | |
'clean:dist', | |
'wiredep', | |
'ngconstant:dist', | |
'useminPrepare', | |
'concurrent:dist', | |
'autoprefixer', | |
'concat', | |
'ngAnnotate', | |
'copy:dist', | |
'cdnify', | |
'cssmin', | |
'uglify', | |
'filerev', | |
'usemin'//, | |
// 'htmlmin' | |
]); | |
grunt.registerTask('default', [ | |
'newer:jshint', | |
'test', | |
'build' | |
]); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "ourApp", | |
"version": "1.0.0", | |
"description": "Portal", | |
"private": true, | |
"author": "me", | |
"license": "private", | |
"dependencies": {}, | |
"repository": {}, | |
"devDependencies": { | |
"connect-livereload": "^0.5.3", | |
"connect-modrewrite": "^0.7.11", | |
"grunt": "^0.4.5", | |
"grunt-autoprefixer": "^2.0.0", | |
"grunt-concurrent": "^1.0.0", | |
"grunt-contrib-clean": "^0.6.0", | |
"grunt-contrib-compass": "^1.0.0", | |
"grunt-contrib-concat": "^0.5.0", | |
"grunt-contrib-connect": "^0.9.0", | |
"grunt-contrib-copy": "^0.7.0", | |
"grunt-contrib-cssmin": "^0.12.0", | |
"grunt-contrib-htmlmin": "^0.4.0", | |
"grunt-contrib-imagemin": "^0.9.2", | |
"grunt-contrib-jshint": "^0.11.0", | |
"grunt-contrib-uglify": "^0.7.0", | |
"grunt-contrib-watch": "^0.6.1", | |
"grunt-filerev": "^2.1.2", | |
"grunt-google-cdn": "^0.4.3", | |
"grunt-karma": "*", | |
"grunt-newer": "^1.1.0", | |
"grunt-ng-annotate": "^0.9.2", | |
"grunt-ng-constant": "^1.1.0", | |
"grunt-svgmin": "^2.0.0", | |
"grunt-usemin": "^3.0.0", | |
"grunt-wiredep": "^2.0.0", | |
"jshint-stylish": "^1.0.0", | |
"karma-jasmine": "*", | |
"karma-phantomjs-launcher": "*", | |
"load-grunt-tasks": "^3.1.0", | |
"time-grunt": "^1.0.0" | |
}, | |
"engines": { | |
"node": ">=0.10.0" | |
}, | |
"scripts": { | |
"test": "grunt test" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment