Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jpetitcolas committed May 18, 2015
1 parent ef51268 commit 1ea55f8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 143 deletions.
132 changes: 2 additions & 130 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,6 @@ module.exports = function (grunt) {

// Define the configuration for all the tasks
grunt.initConfig({
"babel": {
"options": {
"sourceMap": true,
"modules": "amd"
},
dist: {
files: [{
"cwd": "src/javascripts/ng-admin/es6/lib/",
"expand": true,
"src": "**/*.js",
"dest": "build/es6/",
"ext": ".js"
}]
}
},

requirejs: grunt.file.readJSON('grunt/grunt-requirejs.json'),
compass: grunt.file.readJSON('grunt/grunt-compass.json'),

ngAnnotate: {
ngadmin: {
files: {
'build/ng-admin.min.js': ['build/ng-admin.min.js']
}
}
},

cssmin: {
combine: {
files: {
'build/ng-admin.min.css': [
'build/ng-admin.css',
'src/javascripts/bower_components/nprogress/nprogress.css',
'src/javascripts/bower_components/humane/themes/flatty.css',
'src/javascripts/bower_components/textAngular/dist/textAngular.min.css',
'src/javascripts/bower_components/codemirror/lib/codemirror.css',
'src/javascripts/bower_components/codemirror/addon/lint/lint.css'
]
}
}
},

concat: {
css: {
src: [
'build/ng-admin.css',
'src/javascripts/bower_components/nprogress/nprogress.css',
'src/javascripts/bower_components/humane/themes/flatty.css',
'src/javascripts/bower_components/textAngular/dist/textAngular.min.css',
'src/javascripts/bower_components/codemirror/lib/codemirror.css',
'src/javascripts/bower_components/codemirror/addon/lint/lint.css'
],
dest: 'build/ng-admin.min.css'
}
},

uglify: {
ngadmin: {
options: {
sourceMap: true,
sourceMapName: 'build/ng-admin.min.map'
},
files: {
'build/ng-admin.min.js': ['build/ng-admin.min.js']
}
},
config: {
options: {
sourceMap: true,
sourceMapName: 'build/ng-admin-configuration.min.map'
},
files: {
'build/ng-admin-configuration.min.js': ['build/ng-admin-configuration.js']
}
}
},

clean : {
build : ["build/*", "!build/ng-admin.min.js", "!build/ng-admin.min.css", "!build/ng-admin.min.map"]
},

copy: {
css_dev: {
src: 'build/ng-admin.min.css',
Expand Down Expand Up @@ -124,32 +43,8 @@ module.exports = function (grunt) {
angular: {
src: 'src/javascripts/bower_components/angular/angular.js',
dest: 'examples/blog/build/angular.js'
},
config: {
src: 'examples/blog/config.js',
dest: 'examples/blog/config.js',
options: {
process: function (content) {
return process.env.CI ? content.replace(/http:\/\/localhost:3000\//g, 'http://ng-admin.marmelab.com:8080/') : content;
}
}
},
es6: {
src: 'build/ng-admin-configuration.min.js',
dest: 'examples/blog/build/ng-admin-configuration.min.js'
},
es6_dev: {
src: 'build/ng-admin-configuration.js',
dest: 'examples/blog/build/ng-admin-configuration.min.js'
},
es6_devmap: {
cwd: 'build/es6/',
src: ['**/*.map'],
dest: 'examples/blog/build/',
expand: true
}
},

connect: {
server: {
options: {
Expand All @@ -160,7 +55,6 @@ module.exports = function (grunt) {
}
}
},

json_server: {
stub: {
options: {
Expand All @@ -170,8 +64,6 @@ module.exports = function (grunt) {
}
}
},

// Watches files for changes and runs tasks based on the changed files
watch: {
configFiles: {
files: ['Gruntfile.js', 'grunt/grunt-*.json'],
Expand All @@ -198,23 +90,19 @@ module.exports = function (grunt) {
}
}
},

// Test settings
karma: {
unit: {
configFile: 'src/javascripts/test/karma.conf.js',
singleRun: true
}
},

protractor: {
e2e: {
configFile: 'src/javascripts/test/protractor.conf.js',
keepAlive: true,
debug: true
}
},

mochaTest: {
test: {
options: {
Expand All @@ -225,34 +113,18 @@ module.exports = function (grunt) {
}
});

// load npm tasks
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-json-server');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-mocha-test');

// register tasks
grunt.registerTask('ngconfig', ['babel', 'requirejs:ngconfig']);
grunt.registerTask('test', ['mochaTest', 'karma', 'build', 'copy_build', 'connect', 'protractor']);
grunt.registerTask('build', ['ngconfig', 'requirejs:prod', 'ngAnnotate', 'uglify', 'compass:prod', 'cssmin:combine', 'clean:build']);
grunt.registerTask('copy_build', ['copy:config', 'copy:es6', 'copy:angular', 'copy:js_dev', 'copy:css', 'copy:fonts_dev']);
grunt.registerTask('copy_build', ['copy:config', 'copy:angular', 'copy:js_dev', 'copy:css', 'copy:fonts_dev']);

grunt.registerTask('test:local', ['mochaTest', 'karma', 'build:dev', 'copy_build:dev', 'test:local:e2e']);
grunt.registerTask('test:local:e2e', ['json_server', 'connect', 'protractor']);
grunt.registerTask('build:dev', ['ngconfig', 'requirejs:dev', 'ngAnnotate', 'compass:dev', 'concat:css']);
grunt.registerTask('copy_build:dev', ['copy:es6_dev', 'copy:es6_devmap', 'copy:js_dev', 'copy:angular', 'copy:css_dev', 'copy:fonts_dev', 'clean']);

// register default task
grunt.registerTask('default', ['copy:angular', 'json_server', 'connect', 'watch']);
grunt.registerTask('default', ['copy:angular', 'json_server', 'connect']);
};
12 changes: 2 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
.PHONY: build

watch:
@./node_modules/webpack-dev-server/bin/webpack-dev-server.js --progress --colors --host=0.0.0.0

install:
bower install
npm install
./node_modules/protractor/bin/webdriver-manager update

run:
@./node_modules/webpack-dev-server/bin/webpack-dev-server.js --progress --colors --host=0.0.0.0 &
@grunt

build-dev:
@./node_modules/webpack/bin/webpack.js --progress
@echo "Files build/ng-admin.min.css and build/ng-admin.min.js updated (no minification)"

build:
@NODE_ENV=production ./node_modules/webpack/bin/webpack.js -p --progress
@echo "Files build/ng-admin.min.css and build/ng-admin.min.js updated (with minification)"
@cp build/ng-admin* examples/blog/build
@echo "Demo updated!"

test:
test: build
@grunt test:local
4 changes: 2 additions & 2 deletions examples/blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="utf-8">
<title>Angular admin</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="build/ng-admin-standalone.min.css">
<link rel="stylesheet" href="http://localhost:8080/build/ng-admin-standalone.min.css">
</head>
<body ng-app="myApp" ng-strict-di>
<div ui-view></div>
<script src="build/ng-admin-standalone.min.js" type="text/javascript"></script>
<script src="http://localhost:8080/build/ng-admin-standalone.min.js" type="text/javascript"></script>
<script src="config.js" type="text/javascript"></script>
</body>
</html>
1 change: 0 additions & 1 deletion src/javascripts/vendors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
global.angular = require('angular');
global.rangy = require('../../node_modules/rangy/lib/rangy-core');
global.rangy = require('../../node_modules/rangy/lib/rangy-selectionsaverestore');
global.numeral = require('numeral');
Expand Down

0 comments on commit 1ea55f8

Please sign in to comment.