Permalink
Browse files

este goes to server side #nodejs

  • Loading branch information...
1 parent a06f5d6 commit e4dcd7088588d1ec2f25207ff4f639696c70f66c @steida steida committed Mar 11, 2013
View
@@ -1,43 +1,37 @@
module.exports = (grunt) ->
- appDirs = [
- 'bower_components/closure-library'
- 'bower_components/closure-templates'
- 'bower_components/este-library'
- 'client/app/js'
- ]
-
- appStylusFiles = [
+ stylusStyles = [
'bower_components/este-library/**/*.styl'
'client/app/css/**/*.styl'
]
- appCoffeeFiles = [
+ coffeeScripts = [
'bower_components/este-library/**/*.coffee'
'client/app/js/**/*.coffee'
+ 'server/**/*.coffee'
]
- appJsFiles = [
- 'bower_components/este-library/**/*.js'
- 'client/app/js/**/*.js'
- ]
-
- appTemplates = [
+ soyTemplates = [
'bower_components/este-library/**/*.soy'
'client/app/js/**/*.soy'
]
- appCompiledOutputPath =
- 'client/app/assets/app.js'
+ clientDirs = [
+ 'bower_components/closure-library'
+ 'bower_components/closure-templates'
+ 'bower_components/este-library'
+ 'client/app/js'
+ ]
- depsPath =
- 'client/deps.js'
+ clientJavaScripts = [
+ 'bower_components/este-library/**/*.js'
+ 'client/app/js/**/*.js'
+ ]
- # from closure base.js dir to app root dir
- depsPrefix = '../../../../'
+ clientDepsPath = 'client/deps.js'
+ clientDepsPrefix = '../../../../'
grunt.initConfig
-
clean:
app:
options:
@@ -47,51 +41,59 @@ module.exports = (grunt) ->
'bower_components/este-library/**/*.css'
'client/**/js/**/*.js'
'client/**/css/**/*.css'
+ 'server/**/*.js'
]
# same params as grunt-contrib-stylus
esteStylus:
options:
'include css': true
+ 'compress': false
app:
files: [
expand: true
- src: appStylusFiles
+ src: stylusStyles
ext: '.css'
]
+ cssmin:
+ app:
+ files:
+ 'client/app/build/app.css': 'client/app/css/app.css'
+
# same params as grunt-contrib-coffee
esteCoffee:
options:
bare: true
app:
files: [
expand: true
- src: appCoffeeFiles
+ src: coffeeScripts
ext: '.js'
]
esteTemplates:
options:
soyToJsJarPath: 'bower_components/closure-templates/SoyToJsSrcCompiler.jar'
app:
- src: appTemplates
+ src: soyTemplates
esteDeps:
all:
options:
depsWriterPath: 'bower_components/closure-library/closure/bin/build/depswriter.py'
- outputFile: depsPath
- prefix: depsPrefix
- root: appDirs
+ outputFile: clientDepsPath
+ prefix: clientDepsPrefix
+ root: clientDirs
esteBuilder:
options:
closureBuilderPath: 'bower_components/closure-library/closure/bin/build/closurebuilder.py'
compilerPath: 'bower_components/closure-compiler/compiler.jar'
+ root: clientDirs
# needs Java 1.7+, see http://goo.gl/iS3o6
- fastCompilation: false
- depsPath: depsPath
+ fastCompilation: true
+ depsPath: clientDepsPath
compilerFlags: if grunt.option('stage') == 'debug' then [
'--output_wrapper="(function(){%output%})();"'
'--compilation_level="ADVANCED_OPTIMIZATIONS"'
@@ -110,24 +112,29 @@ module.exports = (grunt) ->
app:
options:
namespace: 'app.start'
- root: appDirs
- outputFilePath: appCompiledOutputPath
+ outputFilePath: 'client/app/build/app.js'
appLocalized:
options:
namespace: 'app.start'
- root: appDirs
- outputFilePath: appCompiledOutputPath
+ outputFilePath: 'client/app/build/app.js'
messagesPath: 'messages/app'
locales: ['cs', 'de']
+ # # Check all source files. Not 100% reliable yet, it can show invalid
+ # # warnings.
+ # all:
+ # options:
+ # namespace: '*'
+ # outputFilePath: 'client/app/build/app.js'
+
esteUnitTests:
options:
basePath: 'bower_components/closure-library/closure/goog/base.js'
app:
options:
- depsPath: depsPath
- prefix: depsPrefix
+ depsPath: clientDepsPath
+ prefix: clientDepsPrefix
src: [
'bower_components/este-library/**/*_test.js'
'client/**/*_test.js'
@@ -143,20 +150,20 @@ module.exports = (grunt) ->
messagesPath: 'messages/app'
languages: ['cs', 'de']
- connect:
- server:
- options:
- port: 8000
- keepalive: true
-
esteWatch:
app:
styl:
- files: appStylusFiles
- tasks: 'esteStylus:app'
+ files: stylusStyles
+ tasks: if grunt.option('stage') then [
+ 'esteStylus:app'
+ 'cssmin:app'
+ ]
+ else [
+ 'esteStylus:app'
+ ]
js:
- files: appJsFiles
+ files: clientJavaScripts
tasks: if grunt.option('stage') then [
'esteDeps:all'
'esteUnitTests:app'
@@ -168,11 +175,11 @@ module.exports = (grunt) ->
]
coffee:
- files: appCoffeeFiles
+ files: coffeeScripts
tasks: 'esteCoffee:app'
soy:
- files: appTemplates
+ files: soyTemplates
tasks: 'esteTemplates:app'
coffeelint:
@@ -184,18 +191,44 @@ module.exports = (grunt) ->
all:
files: [
expand: true
- src: appCoffeeFiles
- ext: '.js'
+ src: coffeeScripts
]
+ release:
+ options:
+ bump: true
+ add: true
+ commit: true
+ tag: true
+ push: true
+ pushTags: true
+ npm: false
+
+ env:
+ development:
+ NODE_ENV: 'development'
+ stage:
+ NODE_ENV: 'stage'
+ production:
+ NODE_ENV: 'production'
+
+ bgShell:
+ _defaults:
+ bg: true
+ app:
+ cmd: 'node server/app'
+
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
- grunt.loadNpmTasks 'grunt-contrib-connect'
+ grunt.loadNpmTasks 'grunt-contrib-cssmin'
grunt.loadNpmTasks 'grunt-contrib-jshint'
grunt.loadNpmTasks 'grunt-contrib-stylus'
grunt.loadNpmTasks 'grunt-contrib-watch'
+ grunt.loadNpmTasks 'grunt-env'
grunt.loadNpmTasks 'grunt-este'
+ grunt.loadNpmTasks 'grunt-release'
+ grunt.loadNpmTasks 'grunt-bg-shell'
grunt.registerTask 'build', 'Build app.', (app) ->
tasks = [
@@ -208,16 +241,18 @@ module.exports = (grunt) ->
"esteUnitTests:#{app}"
]
if grunt.option 'stage'
+ tasks.push "cssmin:#{app}"
tasks.push "esteBuilder:#{app}"
grunt.task.run tasks
grunt.registerTask 'run', 'Build app and run watchers.', (app) ->
tasks = [
"build:#{app}"
+ if grunt.option 'stage' then 'env:stage' else 'env:development'
+ "bgShell:#{app}"
"esteWatch:#{app}"
]
grunt.task.run tasks
grunt.registerTask 'default', 'run:app'
-
grunt.registerTask 'test', 'build:app'
View
@@ -31,8 +31,7 @@ Don't forget to install ```npm install grunt-cli -g```.
- http://docs.python.org/using/windows.html#excursus-setting-environment-variables
## Getting Started
- - run ```grunt```
- - open another cmd window, run ```grunt connect``` for simple web server
+ - run ```grunt```, or ```grunt --stage```
- point your browser to [localhost:8000](http://localhost:8000/)
- build something beautiful
@@ -42,14 +41,10 @@ Start development.
```grunt run:app``` or just ```grunt```
-Build project for continuous integration. No file watchers.
+Build project for continuous integration. No file watchers nor server.
```grunt build:app```
-Start simple static server in another cmd window.
-
-```grunt connect```
-
Start development in stage mode, code is compiled with Closure Compiler.
```grunt run:app --stage```
@@ -97,10 +92,16 @@ My Sublime Text [settings and snippets](https://github.com/Steida/Sublimetext-us
Code snippets [cheat sheet](http://estejs.tumblr.com/post/29363589575/este-js-sublime-text-code-snippets-cheat-sheet).
## Stay Tuned
+
- [twitter.com/estejs](https://twitter.com/estejs)
- [groups.google.com/forum/#!forum/estejs](https://groups.google.com/forum/#!forum/estejs)
- [estejs.tumblr.com](http://estejs.tumblr.com)
+## Tips
+
+ - learn ```npm link``` and ```bower link```
+
+
## License
Copyright (c) 2013 Daniel Steigerwald
View
@@ -1,3 +1,4 @@
.DS_Store
+build/
*.js
*.css
View
@@ -10,7 +10,10 @@
// hide all compiled files from client subdirs
"client/**/js/*.js",
- "client/**/css/*.css"
+ "client/**/css/*.css",
+
+ // hide all compiled files from server subdirs
+ "server/*.js"
]
}
]
View
@@ -2,6 +2,7 @@
"name": "este",
"version": "0.0.3",
"description": "Este is robust, modular and comfortable dev stack for web apps development with several unique features",
+ "author": "Daniel Steigerwald <daniel@steigerwald.cz>",
"keywords": [
"Este",
"CoffeeScript",
@@ -12,27 +13,36 @@
"Mocha",
"Soy"
],
- "author": "Daniel Steigerwald <daniel@steigerwald.cz>",
"repository": {
"type": "git",
"url": "https://github.com/Steida/este.git"
},
"dependencies": {
- "express": "*"
+ "express": "3.x",
+ "jade": "*"
},
"devDependencies": {
"grunt": "*",
+ "grunt-bg-shell": "*",
+ "grunt-coffeelint": "*",
"grunt-contrib-clean": "*",
"grunt-contrib-coffee": "*",
- "grunt-contrib-connect": "*",
+ "grunt-contrib-cssmin": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-stylus": "*",
"grunt-contrib-watch": "*",
+ "grunt-develop": "*",
+ "grunt-env": "*",
"grunt-este": "*",
- "grunt-coffeelint": "*"
+ "grunt-release": "*",
+ "piping": "*"
},
"scripts": {
+ "start": "node server/app",
"test": "grunt test --stage"
},
+ "engines": {
+ "node": "v0.8.x"
+ },
"license": "MIT"
-}
+}
View
@@ -0,0 +1,2 @@
+.DS_Store
+*.js
Oops, something went wrong.

0 comments on commit e4dcd70

Please sign in to comment.