Skip to content

Commit

Permalink
Initial Import
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Aniszczyk <[email protected]>
  • Loading branch information
Tim Trueman authored and caniszczyk committed Feb 19, 2013
0 parents commit dbd5bc3
Show file tree
Hide file tree
Showing 57 changed files with 17,542 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.swp
.DS_Store

dist
.grunt
_SpecRunner.html

node_modules
npm-debug.log
17 changes: 17 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"curly": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"quotmark": true,
"regexp": true,
"trailing": true,

"boss": true,
"eqnull": true,
"expr": true,

"browser": true,
"jquery": true
}
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- 0.8
before_script:
- npm install -g grunt-cli
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Changelog

---

### 0.1 Febuary 14, 2013
Initial public release (third major version release include internal ones)
* Prefetch and search data locally insanely fast
* Search hard-coded, prefetched, and/or remote data
* Hinting
* RTL/IME/international support
* Search multiple datasets
* Share datasets (and caching) between multiple inputs
* And much, much more…
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Contributing Guildlines
=======================

Setup
-----

1. [Fork the project][how-to-fork] and clone the fork to your machine.
2. Create a feature branch to work in. `$ git checkout -b name-of-feature`

Writing Code
------------

* Use the project's coding style, not your own. If the code you write looks drastically different than the preexisting code, you're doing it wrong.
* Include tests that fail without your code, and pass with it.
* If you add a new feature or break backwards compatibility, update the project's documentation accordingly.
* Commits should have meaningful messages. If you end up with a bunch of commits with garbage messages, squash your commits before submitting a pull request.

Pull Requests
-------------

1. Push your feature branch to your remote repo on GitHub. `$ git push origin name-of-feature`
2. [Create a pull request][create-pull-request] against the integration-\* branch if present, otherwise master.
3. Write a meaningful title and description.
4. Submit the pull request!

[how-to-fork]: https://help.github.com/articles/fork-a-repo
[create-pull-request]: https://help.github.com/articles/creating-a-pull-request

License
-------

By contributing your code,

You agree to license your contribution under the terms of the MIT License
https://github.com/twitter/typeahead.js/blob/master/LICENSE
211 changes: 211 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
// release tasks
// 1. grunt build
// 2. grunt bump
// 3. grunt component
// 4. grunt publish_assets

var jsFiles = [
'src/js/version.js',
'src/js/utils.js',
'src/js/event_target.js',
'src/js/persistent_storage.js',
'src/js/request_cache.js',
'src/js/transport.js',
'src/js/dataset.js',
'src/js/input_view.js',
'src/js/dropdown_view.js',
'src/js/typeahead_view.js',
'src/js/typeahead.js'
];

module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

buildDir: 'dist',

banner: [
'/*!',
' * Twitter Typeahead <%= pkg.version %>',
' * https://github.com/twitter/typeahead',
' * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT',
' */\n\n'
].join('\n'),

less: {
css: {
src: 'src/css/typeahead.css',
dest: '<%= buildDir %>/typeahead.css'
},
cssmin: {
options: { yuicompress: true },
src: 'src/css/typeahead.css',
dest: '<%= buildDir %>/typeahead.min.css'
}
},

concat: {
css: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
src: '<%= less.css.dest %>',
dest: '<%= less.css.dest %>'
},
cssmin: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
src: '<%= less.cssmin.dest %>',
dest: '<%= less.cssmin.dest %>'
},
js: {
src: ['src/js/intro.js', jsFiles, 'src/js/outro.js'],
dest: '<%= buildDir %>/typeahead.js'
},
jsmin: {
src: ['src/js/intro.js', jsFiles, 'src/js/outro.js'],
dest: '<%= buildDir %>/typeahead.min.js'
}
},

sed: {
version: {
pattern: '%VERSION%',
replacement: '<%= pkg.version %>',
path: ['<%= concat.js.dest %>', '<%= concat.jsmin.dest %>']
}
},

uglify: {
options: {
banner: '<%= banner %>'
},
js: {
options: {
mangle: false,
beautify: true,
compress: false
},
src: '<%= concat.js.dest %>',
dest: '<%= concat.js.dest %>'
},
jsmin: {
options: {
mangle: true,
compress: true
},
src: '<%= concat.jsmin.dest %>',
dest: '<%= concat.jsmin.dest %>'
}
},

jshint: {
options: {
jshintrc: '.jshintrc'
},
src: jsFiles,
tests: ['test/*.js'],
gruntfile: ['Gruntfile.js']
},

watch: {
js: {
files: jsFiles,
tasks: 'build:js'
},
css: {
files: '<%= less.css.src %>',
tasks: 'build:css'
}
},

jasmine: {
js: {
src: jsFiles,
options: {
specs: 'test/*_spec.js',
helpers: 'test/helpers/*',
vendor: 'test/vendor/*'
}
}
},

exec: {
open_spec_runner: {
cmd: 'open _SpecRunner.html'
},
bump: {
cmd: function(v) {
return [
'npm version ' + v,
'git push',
'git push --tags'
].join(' && ');
}
},
publish_assets: {
cmd: [
'zip -r <%= buildDir %>/typeahead.zip <%= buildDir %>',
'git checkout gh-pages',
'rm -rf releases/latest',
'cp -r <%= buildDir %> releases/<%= pkg.version %>',
'cp -rf <%= buildDir %> releases/latest',
'git add releases/<%= pkg.version %> releases/latest',
'git commit -m "Add assets for <%= pkg.version %>."',
'git push',
'git checkout -'
].join(' && ')
}
},

clean: {
dist: 'dist'
},

connect: {
server: {
options: {
port: 8888, keepalive: true
}
}
}
});

grunt.registerTask('component', 'Updates component.json', function() {
var _ = grunt.util._,
component = grunt.file.readJSON('component.json'),
pkg = grunt.file.readJSON('package.json');

_(component).extend(_(pkg).pick('name', 'version'));
grunt.file.write('component.json', JSON.stringify(component, null, 2));
});

// aliases
// -------

grunt.registerTask('default', 'build');
grunt.registerTask('build', ['build:js', 'build:css']);
grunt.registerTask('build:js', ['concat:js', 'concat:jsmin', 'sed:version', 'uglify']);
grunt.registerTask('build:css', ['less', 'concat:css', 'concat:cssmin']);
grunt.registerTask('server', 'connect:server');
grunt.registerTask('lint', 'jshint');
grunt.registerTask('test', 'jasmine:js');
grunt.registerTask('test:browser', ['jasmine:js:build', 'exec:open_spec_runner']);

// load tasks
// ----------

grunt.loadNpmTasks('grunt-sed');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jasmine');
};
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2013 Twitter, Inc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit dbd5bc3

Please sign in to comment.