🌐 AI搜索 & 代理 主页
Skip to content
This repository was archived by the owner on Oct 21, 2023. It is now read-only.

Commit 1805c31

Browse files
Merge branch 'release/0.0.1'
2 parents 77e0bb7 + 15f15ad commit 1805c31

Some content is hidden

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

42 files changed

+73944
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
*~
3+
*/*~

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Gordon Woodhull <gordon@woodhull.com>

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## dc.dataTables.js 0.0.1
2+
3+
Initial proof-of-concept of a library integrating jquery.dataTables.js with dc.js

Gruntfile.js

Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
module.exports = function (grunt) {
2+
'use strict';
3+
4+
require('load-grunt-tasks')(grunt, {
5+
pattern: ['grunt-*', '!grunt-lib-phantomjs']
6+
});
7+
require('time-grunt')(grunt);
8+
9+
var config = {
10+
src: 'src',
11+
spec: 'spec',
12+
web: 'web',
13+
pkg: require('./package.json'),
14+
banner: grunt.file.read('./LICENSE_BANNER'),
15+
jsFiles: module.exports.jsFiles
16+
};
17+
18+
grunt.initConfig({
19+
conf: config,
20+
21+
concat: {
22+
options : {
23+
process: true,
24+
sourceMap: true,
25+
banner : '<%= conf.banner %>'
26+
},
27+
js: {
28+
src: '<%= conf.jsFiles %>',
29+
dest: '<%= conf.pkg.name %>.js'
30+
}
31+
},
32+
uglify: {
33+
jsmin: {
34+
options: {
35+
mangle: true,
36+
compress: true,
37+
sourceMap: true,
38+
banner : '<%= conf.banner %>'
39+
},
40+
src: '<%= conf.pkg.name %>.js',
41+
dest: '<%= conf.pkg.name %>.min.js'
42+
}
43+
},
44+
jscs: {
45+
old: {
46+
src: ['<%= conf.spec %>/**/*.js'],
47+
options: {
48+
validateIndentation: 4
49+
}
50+
},
51+
source: {
52+
src: ['<%= conf.src %>/**/*.js', '!<%= conf.src %>/{banner,footer}.js', 'Gruntfile.js',
53+
'grunt/*.js', '<%= conf.web %>/stock.js'],
54+
options: {
55+
config: '.jscsrc'
56+
}
57+
}
58+
},
59+
jshint: {
60+
source: {
61+
src: ['<%= conf.src %>/**/*.js', 'Gruntfile.js', 'grunt/*.js', '<%= conf.web %>/stock.js'],
62+
options: {
63+
jshintrc: '.jshintrc',
64+
ignores: ['<%= conf.src %>/banner.js', '<%= conf.src %>/footer.js']
65+
}
66+
}
67+
},
68+
watch: {
69+
scripts: {
70+
files: ['<%= conf.src %>/**/*.js'],
71+
tasks: ['docs']
72+
},
73+
tests: {
74+
files: ['<%= conf.src %>/**/*.js', '<%= conf.spec %>/**/*.js'],
75+
tasks: ['test']
76+
},
77+
reload: {
78+
files: ['<%= conf.pkg.name %>.js',
79+
'<%= conf.pkg.name %>css',
80+
'<%= conf.web %>/js/<%= conf.pkg.name %>.js',
81+
'<%= conf.web %>/css/<%= conf.pkg.name %>.css',
82+
'<%= conf.pkg.name %>.min.js'],
83+
options: {
84+
livereload: true
85+
}
86+
}
87+
},
88+
connect: {
89+
server: {
90+
options: {
91+
port: 8888,
92+
base: '.'
93+
}
94+
}
95+
},
96+
emu: {
97+
api: {
98+
src: '<%= conf.pkg.name %>.js',
99+
dest: '<%= conf.web %>/docs/api-latest.md'
100+
}
101+
},
102+
toc: {
103+
api: {
104+
src: '<%= emu.api.dest %>',
105+
dest: '<%= emu.api.dest %>'
106+
}
107+
},
108+
markdown: {
109+
html: {
110+
src: '<%= emu.api.dest %>',
111+
dest: '<%= conf.web %>/docs/index.html'
112+
},
113+
options: {markdownOptions: {highlight: 'manual'}}
114+
},
115+
copy: {
116+
'dc-to-gh': {
117+
files: [
118+
{
119+
expand: true,
120+
flatten: true,
121+
nonull: true,
122+
src: [
123+
'<%= conf.pkg.name %>.css',
124+
'node_modules/dc/dc.css',
125+
'node_modules/datatables/media/css/jquery.dataTables.css',
126+
],
127+
dest: '<%= conf.web %>/css/'
128+
},
129+
{
130+
expand: true,
131+
flatten: true,
132+
nonull: true,
133+
src: [
134+
'<%= conf.pkg.name %>.js',
135+
'<%= conf.pkg.name %>.js.map',
136+
'<%= conf.pkg.name %>.min.js',
137+
'<%= conf.pkg.name %>.min.js.map',
138+
'node_modules/jquery/dist/jquery.js',
139+
'node_modules/d3/dist/d3.js',
140+
'node_modules/dc/dc.js',
141+
'node_modules/datatables/media/js/jquery.dataTables.js',
142+
'node_modules/crossfilter2/crossfilter.js'
143+
],
144+
dest: '<%= conf.web %>/js/'
145+
},
146+
{
147+
expand: true,
148+
flatten: true,
149+
src: [
150+
'node_modules/datatables/media/images/*'
151+
],
152+
dest: '<%= conf.web %>/images'
153+
},
154+
]
155+
}
156+
},
157+
'gh-pages': {
158+
options: {
159+
base: '<%= conf.web %>',
160+
message: 'Synced from from master branch.'
161+
},
162+
src: ['**']
163+
},
164+
shell: {
165+
merge: {
166+
command: function (pr) {
167+
return [
168+
'git fetch origin',
169+
'git checkout master',
170+
'git reset --hard origin/master',
171+
'git fetch origin',
172+
'git merge --no-ff origin/pr/' + pr + ' -m \'Merge pull request #' + pr + '\''
173+
].join('&&');
174+
},
175+
options: {
176+
stdout: true,
177+
failOnError: true
178+
}
179+
},
180+
amend: {
181+
command: 'git commit -a --amend --no-edit',
182+
options: {
183+
stdout: true,
184+
failOnError: true
185+
}
186+
},
187+
hooks: {
188+
command: 'cp -n scripts/pre-commit.sh .git/hooks/pre-commit' +
189+
' || echo \'Cowardly refusing to overwrite your existing git pre-commit hook.\''
190+
}
191+
},
192+
browserify: {
193+
dev: {
194+
src: '<%= conf.pkg.name %>.js',
195+
dest: 'bundle.js',
196+
options: {
197+
browserifyOptions: {
198+
standalone: 'dc'
199+
}
200+
}
201+
}
202+
}
203+
});
204+
205+
// custom tasks
206+
grunt.registerMultiTask('emu', 'Documentation extraction by emu.', function () {
207+
var emu = require('emu'),
208+
srcFile = this.files[0].src[0],
209+
destFile = this.files[0].dest,
210+
source = grunt.file.read(srcFile);
211+
grunt.file.write(destFile, emu.getComments(source));
212+
grunt.log.writeln('File \'' + destFile + '\' created.');
213+
});
214+
grunt.registerTask('merge', 'Merge a github pull request.', function (pr) {
215+
grunt.log.writeln('Merge Github Pull Request #' + pr);
216+
grunt.task.run(['shell:merge:' + pr, 'test' , 'shell:amend']);
217+
});
218+
grunt.registerMultiTask('toc', 'Generate a markdown table of contents.', function () {
219+
var marked = require('marked'),
220+
slugify = function (s) { return s.trim().replace(/[-_\s]+/g, '-').toLowerCase(); },
221+
srcFile = this.files[0].src[0],
222+
destFile = this.files[0].dest,
223+
source = grunt.file.read(srcFile),
224+
tokens = marked.lexer(source),
225+
toc = tokens.filter(function (item) {
226+
return item.type === 'heading' && item.depth === 2;
227+
}).reduce(function (toc, item) {
228+
return toc + ' * [' + item.text + '](#' + slugify(item.text) + ')\n';
229+
}, '');
230+
231+
grunt.file.write(destFile, '# dc.datatables.js API\n' + toc + '\n' + source);
232+
grunt.log.writeln('Added TOC to \'' + destFile + '\'.');
233+
});
234+
grunt.registerTask('test-stock-example', 'Test a new rendering of the stock example web page against a ' +
235+
'baseline rendering', function (option) {
236+
require('./regression/stock-regression-test.js').testStockExample(this.async(), option === 'diff');
237+
});
238+
grunt.registerTask('update-stock-example', 'Update the baseline stock example web page.', function () {
239+
require('./regression/stock-regression-test.js').updateStockExample(this.async());
240+
});
241+
242+
// task aliases
243+
grunt.registerTask('build', ['concat', 'uglify']);
244+
grunt.registerTask('docs', ['build', 'copy', 'emu', 'toc', 'markdown']);
245+
grunt.registerTask('web', ['docs', 'gh-pages']);
246+
grunt.registerTask('server', ['docs', 'connect:server', 'watch:scripts']);
247+
grunt.registerTask('test', ['build', 'jasmine:specs', 'shell:hooks']);
248+
grunt.registerTask('test-browserify', ['build', 'browserify', 'jasmine:browserify']);
249+
grunt.registerTask('coverage', ['build', 'jasmine:coverage']);
250+
grunt.registerTask('ci', ['test', 'jasmine:specs:build', 'connect:server', 'saucelabs-jasmine']);
251+
grunt.registerTask('ci-pull', ['test', 'jasmine:specs:build', 'connect:server']);
252+
grunt.registerTask('lint', ['build', 'jshint', 'jscs']);
253+
grunt.registerTask('default', ['build']);
254+
};
255+
256+
module.exports.jsFiles = [
257+
'src/banner.js', // NOTE: keep this first
258+
'src/core.js', // then this!
259+
'src/datatable.js',
260+
'src/footer.js' // NOTE: keep this last
261+
];

LICENSE_BANNER

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*!
2+
* dc.datatables <%= conf.pkg.version %>
3+
* http://dc-js.github.io/dc.datatables.js/
4+
* Copyright 2018 Gordon Woodhull & the dc.datatables Developers
5+
* https://github.com/dc-js/dc.datatables.js/blob/master/AUTHORS
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/

dc.datatables.css

Whitespace-only changes.

0 commit comments

Comments
 (0)