Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit 3cd4ac0

Browse files
committed
Merge pull request #72 from nimbly/0.1.0
Restructured application using simlinks in preparation for added tests.
2 parents 7d102f7 + 58001ab commit 3cd4ac0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+959
-700
lines changed

.bowerrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"directory" : "src/bower_components"
3-
}
2+
"directory" : "ignored_bower_components"
3+
}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ logs
1414
results
1515

1616
node_modules
17-
bower_components
17+
ignored_bower_components
1818
*.sublime-workspace
1919
# build folder
2020
.grunt
21-
.tmp
21+
.tmp

.jshintrc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
// Details: https://github.com/victorporof/Sublime-JSHint#using-your-own-jshintrc-options
33
// Example: https://github.com/jshint/jshint/blob/master/examples/.jshintrc
44
// Documentation: http://www.jshint.com/docs/
5-
"browser": false,
5+
"browser": true,
66
"devel": true,
77
"esnext": true,
8+
"globals": {
9+
"app": true,
10+
"angular": false
11+
},
812
"globalstrict": true,
913
"quotmark": true,
1014
"smarttabs": true,
1115
"trailing": true,
1216
"undef": true,
1317
"unused": "vars",
14-
"node": true
18+
"node": false
1519
}

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
Version numbers correspond to `bower.json` version
2+
3+
# Latest (maybe 0.1.0)
4+
5+
## Backward compatible changes:
6+
7+
## Internal Changes
8+
9+
- 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.
10+
- 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).
11+
- 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...
12+
13+
## Breaking changes:
14+
15+
- Added no-template build that builds to `formly.js` and changed vanilla build to `formly.vanilla.js`.
16+
17+
218
# 0.0.16
319

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

6884
## Bug Fixes
6985

70-
## Breaking Changes
86+
## Breaking Changes

Gruntfile.js

Lines changed: 128 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
'use strict';
2-
module.exports = function(grunt) {
2+
var _ = require('lodash-node');
33

4-
// Project configuration.
5-
grunt.initConfig({
4+
module.exports = function(grunt) {
5+
require('load-grunt-tasks')(grunt);
6+
require('time-grunt')(grunt);
7+
var config = {
68
pkg: grunt.file.readJSON('package.json'),
79
formlyConfig: {
810
hostname: 'localhost', // change to 0.0.0.0 to listen on all connections
911
base: 'src',
12+
demo: 'demo',
1013
port: 4000,
1114
livereloadport: 35701
1215
},
@@ -15,126 +18,22 @@ module.exports = function(grunt) {
1518
options: {
1619
hostname: '<%= formlyConfig.hostname %>',
1720
port: '<%= formlyConfig.port %>',
18-
base: '<%= formlyConfig.base %>',
21+
base: '<%= formlyConfig.demo %>',
1922
livereload: '<%= formlyConfig.livereloadport %>'
2023
}
2124
}
2225
},
2326
'gh-pages': {
2427
options: {
25-
base: '<%= formlyConfig.base %>'
28+
base: '<%= formlyConfig.demo %>'
2629
},
2730
src: ['**']
2831
},
2932
clean: {
30-
build: ['.tmp/**/*'],
31-
dist: ['dist/**/*']
32-
},
33-
copy: {
34-
vanilla: {
35-
files: [
36-
{
37-
expand: true,
38-
cwd: '<%= formlyConfig.base %>/',
39-
src: ['directives/formly*.*', 'modules/formly*.*', 'providers/formly*.*', '!.jshintrc'],
40-
dest: '.tmp/'
41-
}
42-
]
43-
},
44-
bootstrap: {
45-
files: [
46-
{
47-
expand: true,
48-
cwd: '<%= formlyConfig.base %>/',
49-
src: ['directives/formly*.js', 'directives/bootstrap/formly*.html', 'modules/formly*.*', 'providers/formly*.*', '!.jshintrc'],
50-
dest: '.tmp/'
51-
}
52-
]
53-
},
54-
deploy: {
55-
files: [{
56-
expand: true,
57-
cwd: '.tmp/dist',
58-
src: ['formly*.*'],
59-
dest: 'dist/'
60-
}]
61-
}
62-
},
63-
concat: {
64-
build: {
65-
// specifing files so that they are added in this order
66-
src: ['.tmp/modules/formly*.js', '.tmp/directives/formly*.js', '.tmp/providers/formly*.js', '.tmp/formly*.js'],
67-
dest: '.tmp/formly.js'
68-
}
69-
},
70-
uglify: {
71-
vanilla: {
72-
src: '.tmp/dist/formly.js',
73-
dest: '.tmp/dist/formly.min.js'
74-
},
75-
bootstrap: {
76-
src: '.tmp/dist/formly.bootstrap.js',
77-
dest: '.tmp/dist/formly.bootstrap.min.js'
78-
},
79-
options: {
80-
mangle: true,
81-
sourceMap: true
82-
}
83-
},
84-
ngtemplates: {
85-
vanilla: {
86-
cwd: '.tmp/',
87-
src: [
88-
'directives/formly*.html'
89-
],
90-
dest: '.tmp/formly-templates.js',
91-
options: {
92-
module: 'formly.render',
93-
htmlmin: {
94-
collapseBooleanAttributes: true,
95-
collapseWhitespace: true,
96-
removeAttributeQuotes: true,
97-
removeComments: true, // Only if you don't use comment directives!
98-
removeEmptyAttributes: true,
99-
removeRedundantAttributes: false, //removing this as it can removes properties that can be used when styling
100-
removeScriptTypeAttributes: true,
101-
removeStyleLinkTypeAttributes: true
102-
}
103-
}
104-
},
105-
bootstrap: {
106-
cwd: '.tmp/',
107-
src: [
108-
'directives/bootstrap/formly*.html'
109-
],
110-
dest: '.tmp/formly-templates.js',
111-
options: {
112-
module: 'formly.render',
113-
url: function(url) {
114-
return url.replace('bootstrap/', '');
115-
},
116-
htmlmin: {
117-
collapseBooleanAttributes: true,
118-
collapseWhitespace: true,
119-
removeAttributeQuotes: true,
120-
removeComments: true, // Only if you don't use comment directives!
121-
removeEmptyAttributes: true,
122-
removeRedundantAttributes: false, //removing this as it can removes properties that can be used when styling
123-
removeScriptTypeAttributes: true,
124-
removeStyleLinkTypeAttributes: true
125-
}
126-
}
127-
}
33+
build: ['.tmp/**/*', 'dist/**/*']
12834
},
129-
ngmin: {
130-
vanilla: {
131-
src: '.tmp/formly.js',
132-
dest: '.tmp/dist/formly.js'
133-
},
134-
bootstrap: {
135-
src: '.tmp/formly.js',
136-
dest: '.tmp/dist/formly.bootstrap.js'
137-
}
35+
jshint: {
36+
src: ['src/**/*.js']
13837
},
13938
watch: {
14039
livereload: {
@@ -143,20 +42,108 @@ module.exports = function(grunt) {
14342
livereload: '<%= formlyConfig.livereloadport %>'
14443
}
14544
}
45+
},
46+
47+
copy: {
48+
deploy: {
49+
expand: true,
50+
cwd: '.tmp/',
51+
src: '**/*-built/**/*.*',
52+
dest: 'dist/',
53+
flatten: true,
54+
filter: 'isFile',
55+
}
56+
},
57+
ngtemplates: {},
58+
concat: {},
59+
ngAnnotate: {},
60+
uglify: {}
61+
};
62+
63+
// targets build config (because they're pretty much identical)
64+
var targets = ['vanilla', 'bootstrap', 'no-template'];
65+
66+
_.each(targets, function(target) {
67+
var tmp = '.tmp/' + target;
68+
var noTemplates = target === 'no-template';
69+
70+
var preBuiltDest = tmp + '-build-prep';
71+
var builtDest = tmp + '-built';
72+
73+
var templatesFile = preBuiltDest + '/formly-templates.js';
74+
var targetFilename = 'formly.' + target;
75+
if (noTemplates) {
76+
targetFilename = 'formly';
14677
}
78+
var concatFile = builtDest + '/' + targetFilename + '.js';
79+
var uglifyFile = builtDest + '/' + targetFilename + '.min.js';
80+
81+
var commonCopyPatterns = ['**/*.*']
82+
if (noTemplates) {
83+
commonCopyPatterns.push('!**/formly-template-config.js');
84+
}
85+
86+
config.copy[target] = {
87+
files: [
88+
{
89+
expand: true,
90+
cwd: '<%= formlyConfig.base %>/',
91+
src: [target + '/**/*.*'],
92+
dest: preBuiltDest
93+
},
94+
{
95+
expand: true,
96+
cwd: '<%= formlyConfig.base %>/common',
97+
src: commonCopyPatterns,
98+
dest: preBuiltDest
99+
}
100+
]
101+
};
102+
103+
config.ngtemplates[target] = {
104+
cwd: preBuiltDest + '/' + target + '/',
105+
src: [
106+
'fields/**/*.html'
107+
],
108+
dest: templatesFile,
109+
options: {
110+
module: 'formly.render',
111+
htmlmin: {
112+
collapseBooleanAttributes: true,
113+
collapseWhitespace: true,
114+
removeAttributeQuotes: true,
115+
removeComments: true,
116+
removeEmptyAttributes: true,
117+
removeRedundantAttributes: false,
118+
removeScriptTypeAttributes: true,
119+
removeStyleLinkTypeAttributes: true
120+
}
121+
}
122+
};
123+
124+
config.concat[target] = {
125+
src: [preBuiltDest + '/modules/**/*.js', preBuiltDest + '/**/*.js'],
126+
dest: concatFile
127+
};
128+
129+
config.ngAnnotate[target] = {
130+
src: concatFile,
131+
dest: concatFile
132+
};
147133

134+
config.uglify[target] = {
135+
src: concatFile,
136+
dest: uglifyFile,
137+
options: {
138+
mangle: true,
139+
sourceMap: true
140+
}
141+
};
148142
});
149143

150-
// Load the plugin that provides the "uglify" task.
151-
grunt.loadNpmTasks('grunt-contrib-concat');
152-
grunt.loadNpmTasks('grunt-contrib-connect');
153-
grunt.loadNpmTasks('grunt-contrib-copy');
154-
grunt.loadNpmTasks('grunt-contrib-clean');
155-
grunt.loadNpmTasks('grunt-contrib-uglify');
156-
grunt.loadNpmTasks('grunt-gh-pages');
157-
grunt.loadNpmTasks('grunt-angular-templates');
158-
grunt.loadNpmTasks('grunt-ngmin');
159-
grunt.loadNpmTasks('grunt-contrib-watch');
144+
145+
// Pass config to grunt
146+
grunt.initConfig(config);
160147

161148
grunt.registerTask('publish', [
162149
'gh-pages'
@@ -167,29 +154,24 @@ module.exports = function(grunt) {
167154
'watch'
168155
]);
169156

170-
grunt.registerTask('build', [
171-
'clean:dist',
172-
'build:vanilla',
173-
'build:bootstrap'
174-
]);
157+
_.each(targets, function(target) {
158+
grunt.registerTask('build:' + target, [
159+
'copy:' + target,
160+
'ngtemplates:' + target,
161+
'concat:' + target,
162+
'ngAnnotate:' + target,
163+
'uglify:' + target
164+
]);
165+
});
175166

176-
grunt.registerTask('build:vanilla', [
177-
'clean:build',
178-
'copy:vanilla',
179-
'ngtemplates:vanilla',
180-
'concat:build',
181-
'ngmin:vanilla',
182-
'uglify:vanilla',
183-
'copy:deploy'
184-
]);
185167

186-
grunt.registerTask('build:bootstrap', [
187-
'clean:build',
188-
'copy:bootstrap',
189-
'ngtemplates:bootstrap',
190-
'concat:build',
191-
'ngmin:bootstrap',
192-
'uglify:bootstrap',
193-
'copy:deploy'
194-
]);
195-
};
168+
var buildTasks = _.map(targets, function(target) {
169+
return 'build:' + target;
170+
});
171+
buildTasks.unshift('clean:build');
172+
buildTasks.push('copy:deploy');
173+
174+
grunt.registerTask('build', buildTasks);
175+
176+
grunt.registerTask('default', ['build']);
177+
};

0 commit comments

Comments
 (0)