Skip to content

Commit ebce634

Browse files
committed
Lets get this comments show on the road
1 parent 6321a9d commit ebce634

5 files changed

Lines changed: 383 additions & 46 deletions

File tree

v3/comments.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// https://github.com/jonschlinkert/extract-comments
2+
// https://github.com/eslint/doctrine
3+
// https://nodejs.org/api/fs.html
4+
// https://github.com/jprichardson/node-fs-extra
5+
6+
var fs = require('fs-extra');
7+
var extract = require('extract-comments');
8+
var beautify = require('json-beautify');
9+
var doctrine = require('doctrine');
10+
11+
var source = './src/gameobjects/GameObject.js';
12+
var dest = './docs/comments.json';
13+
14+
var doctrineOptions = {
15+
unwrap: true,
16+
recoverable: true,
17+
sloppy: true,
18+
lineNumbers: true
19+
};
20+
21+
fs.readFile(source, 'utf8', (err, data) => {
22+
23+
if (err)
24+
{
25+
throw err;
26+
}
27+
28+
var comments = [];
29+
var blocks = extract.block(data);
30+
31+
for (var i = 0; i < blocks.length; i++)
32+
{
33+
var block = blocks[i];
34+
35+
comments.push(doctrine.parse(block.value, doctrineOptions));
36+
}
37+
38+
// comments = JSON.stringify(comments);
39+
comments = beautify(comments, null, 2, 100); // just for debugging really
40+
41+
fs.writeFile(dest, comments, { encoding: 'utf8', flag: 'w' }, function (error) {
42+
43+
if (error)
44+
{
45+
throw error;
46+
}
47+
else
48+
{
49+
console.log('Comments written');
50+
}
51+
52+
});
53+
54+
});

v3/docs/comments.json

Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
[
2+
{
3+
"description": "The base GameObject class that all Game Objects extend.",
4+
"tags": [
5+
{
6+
"title": "class",
7+
"description": null,
8+
"lineNumber": 3,
9+
"type": null,
10+
"name": "GameObject"
11+
},
12+
{
13+
"title": "param",
14+
"description": "The Scene to which this Game Object belongs.",
15+
"lineNumber": 5,
16+
"type": { "type": "NameExpression", "name": "Scene" },
17+
"name": "scene"
18+
},
19+
{
20+
"title": "param",
21+
"description": "A textual representation of the Game Object.",
22+
"lineNumber": 6,
23+
"type": { "type": "NameExpression", "name": "String" },
24+
"name": "type"
25+
}
26+
]
27+
},
28+
{
29+
"description": "The Scene to which this Game Object belongs.",
30+
"tags": [
31+
{
32+
"title": "property",
33+
"description": null,
34+
"lineNumber": 3,
35+
"type": { "type": "NameExpression", "name": "Scene" },
36+
"name": "scene"
37+
}
38+
]
39+
},
40+
{
41+
"description": "A textual representation of this Game Object.",
42+
"tags": [
43+
{
44+
"title": "property",
45+
"description": null,
46+
"lineNumber": 3,
47+
"type": { "type": "NameExpression", "name": "String" },
48+
"name": "type"
49+
}
50+
]
51+
},
52+
{
53+
"description": "The name of this Game Object. Blank by default and not populated by Phaser. Left for developers use.",
54+
"tags": [
55+
{
56+
"title": "property",
57+
"description": null,
58+
"lineNumber": 3,
59+
"type": { "type": "OptionalType", "expression": { "type": "NameExpression", "name": "String" } },
60+
"name": "name",
61+
"default": "''"
62+
}
63+
]
64+
},
65+
{
66+
"description": "The active state of this Game Object. A Game Object with an active state of `true` is processed by the UpdateList.",
67+
"tags": [
68+
{
69+
"title": "property",
70+
"description": null,
71+
"lineNumber": 3,
72+
"type": { "type": "OptionalType", "expression": { "type": "NameExpression", "name": "Boolean" } },
73+
"name": "active",
74+
"default": "true"
75+
}
76+
]
77+
},
78+
{
79+
"description": "The Tab Index of this Game Object.",
80+
"tags": [
81+
{
82+
"title": "property",
83+
"description": null,
84+
"lineNumber": 3,
85+
"type": { "type": "OptionalType", "expression": { "type": "NameExpression", "name": "Integer" } },
86+
"name": "tabIndex",
87+
"default": "-1"
88+
}
89+
]
90+
},
91+
{
92+
"description": "A proxy to the Data class. It allows you to store and query key/value paired information specific to this Game Object.",
93+
"tags": [
94+
{
95+
"title": "property",
96+
"description": null,
97+
"lineNumber": 3,
98+
"type": { "type": "NameExpression", "name": "DataProxy" },
99+
"name": "data"
100+
}
101+
]
102+
},
103+
{
104+
"description": "The bitmask that determines if the Game Object will render or not.\r\nStructure: 0001 | 0010 | 0100 | 1000\r\nThe components: Visible, Alpha, Transform and Texture set bits in this mask respectively",
105+
"tags": [
106+
{
107+
"title": "property",
108+
"description": null,
109+
"lineNumber": 5,
110+
"type": { "type": "OptionalType", "expression": { "type": "NameExpression", "name": "Integer" } },
111+
"name": "renderMask",
112+
"default": "15"
113+
},
114+
{ "title": "private", "description": null, "lineNumber": 6 }
115+
]
116+
},
117+
{
118+
"description": "The flags that the renderMask uses to determine if the Game Object will render or not.",
119+
"tags": [
120+
{
121+
"title": "property",
122+
"description": null,
123+
"lineNumber": 3,
124+
"type": { "type": "OptionalType", "expression": { "type": "NameExpression", "name": "Integer" } },
125+
"name": "renderFlags",
126+
"default": "15"
127+
},
128+
{ "title": "private", "description": null, "lineNumber": 4 }
129+
]
130+
},
131+
{
132+
"description": "A bitmask that controls if this Game Object is drawn by a Camera or not.",
133+
"tags": [
134+
{
135+
"title": "property",
136+
"description": null,
137+
"lineNumber": 3,
138+
"type": { "type": "OptionalType", "expression": { "type": "NameExpression", "name": "Number" } },
139+
"name": "cameraFilter",
140+
"default": "0"
141+
},
142+
{ "title": "private", "description": null, "lineNumber": 4 }
143+
]
144+
},
145+
{
146+
"description": "If this Game Object is enabled for input then this property will contain a Phaser.Input.InteractiveObject reference.",
147+
"tags": [
148+
{
149+
"title": "property",
150+
"description": null,
151+
"lineNumber": 3,
152+
"type": {
153+
"type": "OptionalType",
154+
"expression": {
155+
"type": "UnionType",
156+
"elements": [
157+
{ "type": "NameExpression", "name": "Phaser.Input.InteractiveObject" },
158+
{ "type": "NullLiteral" }
159+
]
160+
}
161+
},
162+
"name": "input",
163+
"default": "null"
164+
}
165+
]
166+
},
167+
{
168+
"description": "If this Game Object is enabled for physics then this property will contain a reference to a Physics Body.",
169+
"tags": [
170+
{
171+
"title": "property",
172+
"description": null,
173+
"lineNumber": 3,
174+
"type": {
175+
"type": "OptionalType",
176+
"expression": {
177+
"type": "UnionType",
178+
"elements": [
179+
{ "type": "NameExpression", "name": "Phaser.Physics.Body" },
180+
{ "type": "NullLiteral" }
181+
]
182+
}
183+
},
184+
"name": "body",
185+
"default": "null"
186+
}
187+
]
188+
},
189+
{
190+
"description": "Sets the `active` property of this Game Object and returns this Game Object for further chaining.",
191+
"tags": [
192+
{ "title": "method", "description": null, "lineNumber": 3, "name": "GameObject#setActive" },
193+
{
194+
"title": "param",
195+
"description": "True if this Game Object should be set as active, false if not.",
196+
"lineNumber": 5,
197+
"type": { "type": "NameExpression", "name": "Boolean" },
198+
"name": "value"
199+
},
200+
{
201+
"title": "return",
202+
"description": "This GameObject.",
203+
"lineNumber": 6,
204+
"type": { "type": "NameExpression", "name": "GameObject" }
205+
}
206+
]
207+
},
208+
{
209+
"description": "Sets the `name` property of this Game Object and returns this Game Object for further chaining.",
210+
"tags": [
211+
{ "title": "method", "description": null, "lineNumber": 3, "name": "GameObject#setName" },
212+
{
213+
"title": "param",
214+
"description": "The name to be given to this Game Object.",
215+
"lineNumber": 5,
216+
"type": { "type": "NameExpression", "name": "String" },
217+
"name": "value"
218+
},
219+
{
220+
"title": "return",
221+
"description": "This GameObject.",
222+
"lineNumber": 6,
223+
"type": { "type": "NameExpression", "name": "GameObject" }
224+
}
225+
]
226+
},
227+
{
228+
"description": "Pass this Game Object to the Input Manager to enable it for Input.",
229+
"tags": [
230+
{
231+
"title": "method",
232+
"description": null,
233+
"lineNumber": 3,
234+
"name": "GameObject#setInteractive"
235+
},
236+
{
237+
"title": "param",
238+
"description": "A geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used.",
239+
"lineNumber": 5,
240+
"type": {
241+
"type": "OptionalType",
242+
"expression": { "type": "ArrayType", "elements": [ { "type": "NameExpression", "name": "type" } ] }
243+
},
244+
"name": "shape"
245+
},
246+
{
247+
"title": "param",
248+
"description": "A callback to be invoked when the Game Object is interacted with.",
249+
"lineNumber": 6,
250+
"type": { "type": "OptionalType", "expression": { "type": "NameExpression", "name": "Function" } },
251+
"name": "callback"
252+
},
253+
{
254+
"title": "return",
255+
"description": "This GameObject.",
256+
"lineNumber": 7,
257+
"type": { "type": "NameExpression", "name": "GameObject" }
258+
}
259+
]
260+
},
261+
{
262+
"description": "Returns a JSON representation of the Game Object.",
263+
"tags": [
264+
{ "title": "method", "description": null, "lineNumber": 3, "name": "GameObject#toJSON" },
265+
{
266+
"title": "return",
267+
"description": "A JSON representation of the Game Object.",
268+
"lineNumber": 5,
269+
"type": { "type": "NameExpression", "name": "Object" }
270+
}
271+
]
272+
},
273+
{
274+
"description": "Compares the renderMask with the renderFlags to see if this Game Object will render or not.",
275+
"tags": [
276+
{ "title": "method", "description": null, "lineNumber": 3, "name": "GameObject#willRender" },
277+
{
278+
"title": "return",
279+
"description": "True if the Game Object should be rendered, otherwise false.",
280+
"lineNumber": 5,
281+
"type": { "type": "NameExpression", "name": "Boolean" }
282+
}
283+
]
284+
},
285+
{
286+
"description": "Destroys this Game Object, removing it from the Display List and Update List.\r\nAlso removes it from the Input and Physics Managers if enabled.\r\nSets the active state to `false`. Use this to remove a Game Object from your game if\r\nyou don't plan to use it again later. If you do wish to use it later then look at using\r\nthe Game Object Pool class instead.",
287+
"tags": [ { "title": "method", "description": null, "lineNumber": 7, "name": "GameObject#destroy" } ]
288+
}
289+
]

v3/documentjs.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"versionDest": "<%= version %>",
3+
"defaultVersion": "3.0.0",
4+
"defaultDest": "./docs",
5+
"versions": {
6+
"3.0.0": {
7+
"source": "./src",
8+
"sites": {
9+
"docs": {
10+
"glob" : "src/**/*.{js,md}"
11+
}
12+
}
13+
}
14+
}
15+
}

v3/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"//": "git tag 3.0.0-beta.1",
3-
"//": "git push",
42
"//": "npm publish ---tag beta",
53
"name": "phaser",
64
"version": "3.0.0-beta.1",
@@ -36,11 +34,15 @@
3634
"web audio"
3735
],
3836
"devDependencies": {
37+
"doctrine": "^2.0.0",
3938
"eslint": "^4.3.0",
4039
"fs-extra": "^4.0.0",
4140
"uglifyjs-webpack-plugin": "^0.4.6",
4241
"uuid": "^3.1.0",
4342
"webpack": "^3.4.1",
4443
"webpack-shell-plugin": "^0.5.0"
44+
},
45+
"dependencies": {
46+
"extract-comments": "^0.10.1"
4547
}
4648
}

0 commit comments

Comments
 (0)