Skip to content
This repository was archived by the owner on Jul 13, 2024. It is now read-only.

Commit e753034

Browse files
committed
Merge develop into master
2 parents d3dae1c + 26533d6 commit e753034

23 files changed

+7178
-545
lines changed

.travis.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
language: node_js
22
node_js:
3-
- "0.11"
4-
- "0.10"
5-
before_script:
6-
- npm install -g grunt-cli
3+
- "6.10"

Gruntfile.js

+56-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
var fs = require("fs");
2+
var tsfmt = require("typescript-formatter");
3+
14
// This file defines grunt tasks used by [Grunt.js](http://gruntjs.com/sample-gruntfile)
25
module.exports = function ( grunt ) {
36

@@ -25,6 +28,8 @@ module.exports = function ( grunt ) {
2528
options: {force: true},
2629
dist: [ "dist/" ],
2730
jsdoc: [ "dist/jsdoc/" ],
31+
jsdocjson: [ "dist/doc.json" ],
32+
tsd: [ "dist/gitgraph.d.ts" ],
2833
release: [ "build/", "docs/" ]
2934
},
3035

@@ -41,6 +46,10 @@ module.exports = function ( grunt ) {
4146
release: {
4247
src: [ "src/gitgraph.js" ],
4348
dest: "build/gitgraph.js"
49+
},
50+
tsd: {
51+
src: [ "dist/gitgraph.d.ts" ],
52+
dest: "dist/gitgraph.d.ts"
4453
}
4554
},
4655

@@ -91,6 +100,14 @@ module.exports = function ( grunt ) {
91100
destination: "dist/docs"
92101
}
93102
},
103+
json: {
104+
src: [ "dist/jsdoc/src/*.js", "README.md" ],
105+
options: {
106+
configure: ".jsdocrc",
107+
destination: "dist/doc.json",
108+
template: "./node_modules/jsdoc-json"
109+
}
110+
},
94111
release: {
95112
src: [ "dist/jsdoc/src/*.js", "README.md" ],
96113
options: {
@@ -190,21 +207,56 @@ module.exports = function ( grunt ) {
190207
// `grunt lint` will check code by running JSHint and unit tests over it.
191208
grunt.registerTask( "test", [ "jshint", "jasmine" ] );
192209

193-
// `grunt docs` will create non-versioned documentation for development use.
210+
// `grunt doc` will create non-versioned documentation for development use.
194211
grunt.registerTask( "doc", [
195212
"string-replace:jsdoc",
196213
"jsdoc:dist",
197214
"clean:jsdoc"
198215
] );
199216

217+
// `grunt doc:json` will create non-versioned documentation for development use.
218+
grunt.registerTask( "doc:json", [
219+
"string-replace:jsdoc",
220+
"jsdoc:json",
221+
"clean:jsdoc"
222+
] );
223+
224+
// `grunt parse:tsd` will parse /dist/doc.json to /dist/gitgraph.d.ts
225+
grunt.registerTask( "parse:tsd", function (dest) {
226+
const done = this.async();
227+
const data = JSON.parse(fs.readFileSync("./dist/doc.json"));
228+
const fileContent = require("./scripts/json2tsd")(data).generate();
229+
fs.writeFile(`./${dest}/gitgraph.d.ts`, fileContent, () => {
230+
tsfmt.processFiles([`./${dest}/gitgraph.d.ts`],{
231+
replace: true
232+
}).then(done);
233+
});
234+
});
235+
236+
// `grunt tsd` will generate /dist/gitgraph.d.ts
237+
grunt.registerTask( "tsd", [
238+
"doc:json",
239+
"parse:tsd:dist",
240+
"concat:tsd",
241+
"clean:jsdocjson"
242+
]);
243+
244+
// `grunt tsd:release` will generate /build/gitgraph.d.ts
245+
grunt.registerTask( "tsd:release", [
246+
"doc:json",
247+
"parse:tsd:build",
248+
"clean:jsdocjson"
249+
]);
250+
200251
// `grunt dist` will create a non-versioned new release for development use.
201252
grunt.registerTask( "dist", [
202253
"test",
203254
"clean:dist",
204255
"copy:dist",
205256
"concat:dist",
206257
"uglify:dist",
207-
"doc"
258+
"doc",
259+
"tsd"
208260
] );
209261

210262
// `grunt release` will create a new release of the source code.
@@ -216,7 +268,8 @@ module.exports = function ( grunt ) {
216268
"uglify:release",
217269
"string-replace:jsdoc",
218270
"jsdoc:release",
219-
"clean:jsdoc"
271+
"clean:jsdoc",
272+
"tsd:release"
220273
] );
221274

222275
// `grunt server` will open a live reload server in your favorite browser.

README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ Grunt commands.
4848

4949
From the command line:
5050

51-
- Install `grunt-cli` globally with `npm install -g grunt-cli`.
5251
- Install [the necessary local dependencies][] with `npm install`.
5352
[the necessary local dependencies]: https://github.com/nicoespeon/gitgraph.js/blob/master/package.json
5453

@@ -57,30 +56,34 @@ the command line.
5756

5857
[> Need more information about how to get started with Grunt?](http://gruntjs.com/getting-started)
5958

60-
### Available Grunt commands
59+
### Available commands
6160

62-
#### test code - `grunt test`
61+
#### test code - `npm test`
6362

6463
Check source code against [JSHint][] then runs unit tests with [Jasmine][].
6564
[JSHint]: http://www.jshint.com/
6665
[Jasmine]: https://jasmine.github.io/
6766

68-
#### generate documentation - `grunt doc`
67+
#### generate documentation - `npm run doc`
6968

7069
Generate source code documentation into `dist/docs/` (not versioned) with
7170
[JSDoc](http://usejsdoc.org/).
7271

73-
#### compile a non-versioned release - `grunt dist`
72+
#### generate TypeScript Definition - `npm run tsd`
73+
74+
Generate TypeScript Definition into `dist/gitgraph.d.ts` (not versioned).
75+
76+
#### compile a non-versioned release - `npm run dist`
7477

7578
Clean `dist/` directory, lint code, output the minified release into
7679
`dist/gitgraph.min.js` and generate the documentation into `dist/docs/`.
7780

78-
#### compile a new release - `grunt release`
81+
#### compile a new release - `npm run release`
7982

8083
Lint code, output the source and minified releases into `build/` and generate
8184
the official documentation into `docs/`.
8285

83-
#### open a live reload server - `grunt server`
86+
#### open a live reload server - `npm start`
8487

8588
For a better code experience, this grunt task opens a live server in your
8689
favorite browser. This server is automatically reloaded when you save a project

bower.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"name": "gitgraph.js",
3-
"version": "1.9.0",
4-
"main": ["./build/gitgraph.js", "./build/gitgraph.css"],
3+
"version": "1.10.0",
4+
"main": [
5+
"./build/gitgraph.js",
6+
"./build/gitgraph.css"
7+
],
58
"ignore": [
69
"**/.*"
710
]

0 commit comments

Comments
 (0)