Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"directory" : "src/bower_components"
}
"directory" : "ignored_bower_components"
}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ logs
results

node_modules
bower_components
ignored_bower_components
*.sublime-workspace
# build folder
.grunt
.tmp
.tmp
8 changes: 6 additions & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
// Details: https://github.com/victorporof/Sublime-JSHint#using-your-own-jshintrc-options
// Example: https://github.com/jshint/jshint/blob/master/examples/.jshintrc
// Documentation: http://www.jshint.com/docs/
"browser": false,
"browser": true,
"devel": true,
"esnext": true,
"globals": {
"app": true,
"angular": false
},
"globalstrict": true,
"quotmark": true,
"smarttabs": true,
"trailing": true,
"undef": true,
"unused": "vars",
"node": true
"node": false
}
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
Version numbers correspond to `bower.json` version

# Latest (maybe 0.1.0)

## Backward compatible changes:

## Internal Changes

- Moved all demo-only related files to a demo folder and added a symbolic link to src and bower_components so when it's deployed the src and bower_components go with it. This will also allow us to make a symlink in the test directory when it's created.
- Separated out the src folder into three sub folders: `common`, `bootstrap`, and `vanilla`. The build takes `bootstrap` and `vanilla` and builds them separately. They each build with `common`. There is also a separate file for setting up the default template mapping with their types and this is excluded for the `no-templates` build. The final output is: `formly.js`, `formly.bootstrap.js`, and `formly.vanilla.js`. Adding other styles will be very easy. It also should make it possible for us to have directive templates (funcationality for a field).
- Removed bower_components from git ignore because it's sort of insanity to have to install it every time... Especially when it's needed for the demo. Could name the symlink different... But not worth it I think...

## Breaking changes:

- Added no-template build that builds to `formly.js` and changed vanilla build to `formly.vanilla.js`.


# 0.0.16

- The password field no longer uses whitespace trimming.
Expand Down Expand Up @@ -67,4 +83,4 @@ Added `template` property on fields. Allows devs to have one-liner templates. Ma

## Bug Fixes

## Breaking Changes
## Breaking Changes
274 changes: 128 additions & 146 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
'use strict';
module.exports = function(grunt) {
var _ = require('lodash-node');

// Project configuration.
grunt.initConfig({
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
var config = {
pkg: grunt.file.readJSON('package.json'),
formlyConfig: {
hostname: 'localhost', // change to 0.0.0.0 to listen on all connections
base: 'src',
demo: 'demo',
port: 4000,
livereloadport: 35701
},
Expand All @@ -15,126 +18,22 @@ module.exports = function(grunt) {
options: {
hostname: '<%= formlyConfig.hostname %>',
port: '<%= formlyConfig.port %>',
base: '<%= formlyConfig.base %>',
base: '<%= formlyConfig.demo %>',
livereload: '<%= formlyConfig.livereloadport %>'
}
}
},
'gh-pages': {
options: {
base: '<%= formlyConfig.base %>'
base: '<%= formlyConfig.demo %>'
},
src: ['**']
},
clean: {
build: ['.tmp/**/*'],
dist: ['dist/**/*']
},
copy: {
vanilla: {
files: [
{
expand: true,
cwd: '<%= formlyConfig.base %>/',
src: ['directives/formly*.*', 'modules/formly*.*', 'providers/formly*.*', '!.jshintrc'],
dest: '.tmp/'
}
]
},
bootstrap: {
files: [
{
expand: true,
cwd: '<%= formlyConfig.base %>/',
src: ['directives/formly*.js', 'directives/bootstrap/formly*.html', 'modules/formly*.*', 'providers/formly*.*', '!.jshintrc'],
dest: '.tmp/'
}
]
},
deploy: {
files: [{
expand: true,
cwd: '.tmp/dist',
src: ['formly*.*'],
dest: 'dist/'
}]
}
},
concat: {
build: {
// specifing files so that they are added in this order
src: ['.tmp/modules/formly*.js', '.tmp/directives/formly*.js', '.tmp/providers/formly*.js', '.tmp/formly*.js'],
dest: '.tmp/formly.js'
}
},
uglify: {
vanilla: {
src: '.tmp/dist/formly.js',
dest: '.tmp/dist/formly.min.js'
},
bootstrap: {
src: '.tmp/dist/formly.bootstrap.js',
dest: '.tmp/dist/formly.bootstrap.min.js'
},
options: {
mangle: true,
sourceMap: true
}
},
ngtemplates: {
vanilla: {
cwd: '.tmp/',
src: [
'directives/formly*.html'
],
dest: '.tmp/formly-templates.js',
options: {
module: 'formly.render',
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true, // Only if you don't use comment directives!
removeEmptyAttributes: true,
removeRedundantAttributes: false, //removing this as it can removes properties that can be used when styling
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
}
},
bootstrap: {
cwd: '.tmp/',
src: [
'directives/bootstrap/formly*.html'
],
dest: '.tmp/formly-templates.js',
options: {
module: 'formly.render',
url: function(url) {
return url.replace('bootstrap/', '');
},
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true, // Only if you don't use comment directives!
removeEmptyAttributes: true,
removeRedundantAttributes: false, //removing this as it can removes properties that can be used when styling
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
}
}
build: ['.tmp/**/*', 'dist/**/*']
},
ngmin: {
vanilla: {
src: '.tmp/formly.js',
dest: '.tmp/dist/formly.js'
},
bootstrap: {
src: '.tmp/formly.js',
dest: '.tmp/dist/formly.bootstrap.js'
}
jshint: {
src: ['src/**/*.js']
},
watch: {
livereload: {
Expand All @@ -143,20 +42,108 @@ module.exports = function(grunt) {
livereload: '<%= formlyConfig.livereloadport %>'
}
}
},

copy: {
deploy: {
expand: true,
cwd: '.tmp/',
src: '**/*-built/**/*.*',
dest: 'dist/',
flatten: true,
filter: 'isFile',
}
},
ngtemplates: {},
concat: {},
ngAnnotate: {},
uglify: {}
};

// targets build config (because they're pretty much identical)
var targets = ['vanilla', 'bootstrap', 'no-template'];

_.each(targets, function(target) {
var tmp = '.tmp/' + target;
var noTemplates = target === 'no-template';

var preBuiltDest = tmp + '-build-prep';
var builtDest = tmp + '-built';

var templatesFile = preBuiltDest + '/formly-templates.js';
var targetFilename = 'formly.' + target;
if (noTemplates) {
targetFilename = 'formly';
}
var concatFile = builtDest + '/' + targetFilename + '.js';
var uglifyFile = builtDest + '/' + targetFilename + '.min.js';

var commonCopyPatterns = ['**/*.*']
if (noTemplates) {
commonCopyPatterns.push('!**/formly-template-config.js');
}

config.copy[target] = {
files: [
{
expand: true,
cwd: '<%= formlyConfig.base %>/',
src: [target + '/**/*.*'],
dest: preBuiltDest
},
{
expand: true,
cwd: '<%= formlyConfig.base %>/common',
src: commonCopyPatterns,
dest: preBuiltDest
}
]
};

config.ngtemplates[target] = {
cwd: preBuiltDest + '/' + target + '/',
src: [
'fields/**/*.html'
],
dest: templatesFile,
options: {
module: 'formly.render',
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: false,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
}
};

config.concat[target] = {
src: [preBuiltDest + '/modules/**/*.js', preBuiltDest + '/**/*.js'],
dest: concatFile
};

config.ngAnnotate[target] = {
src: concatFile,
dest: concatFile
};

config.uglify[target] = {
src: concatFile,
dest: uglifyFile,
options: {
mangle: true,
sourceMap: true
}
};
});

// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('grunt-angular-templates');
grunt.loadNpmTasks('grunt-ngmin');
grunt.loadNpmTasks('grunt-contrib-watch');

// Pass config to grunt
grunt.initConfig(config);

grunt.registerTask('publish', [
'gh-pages'
Expand All @@ -167,29 +154,24 @@ module.exports = function(grunt) {
'watch'
]);

grunt.registerTask('build', [
'clean:dist',
'build:vanilla',
'build:bootstrap'
]);
_.each(targets, function(target) {
grunt.registerTask('build:' + target, [
'copy:' + target,
'ngtemplates:' + target,
'concat:' + target,
'ngAnnotate:' + target,
'uglify:' + target
]);
});

grunt.registerTask('build:vanilla', [
'clean:build',
'copy:vanilla',
'ngtemplates:vanilla',
'concat:build',
'ngmin:vanilla',
'uglify:vanilla',
'copy:deploy'
]);

grunt.registerTask('build:bootstrap', [
'clean:build',
'copy:bootstrap',
'ngtemplates:bootstrap',
'concat:build',
'ngmin:bootstrap',
'uglify:bootstrap',
'copy:deploy'
]);
};
var buildTasks = _.map(targets, function(target) {
return 'build:' + target;
});
buildTasks.unshift('clean:build');
buildTasks.push('copy:deploy');

grunt.registerTask('build', buildTasks);

grunt.registerTask('default', ['build']);
};
Loading