Skip to content

Commit

Permalink
First complete transpilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
troyedwardsjr committed Feb 15, 2018
1 parent 6d4d424 commit 4fae01b
Show file tree
Hide file tree
Showing 30 changed files with 1,021,708 additions and 247 deletions.
64 changes: 45 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,50 @@ const readPhaserSrc = (dir) =>
[]);

const transpile = (memberList) => {
var srcFiles = readPhaserSrc("phaser-src/scene/");
let srcFilePath = "phaser-src/";

parser(srcFilePath, () => {
fs.readFile('jsdoc-out/jsdoc.json', 'utf8', function(err, contents) {
if(err) {
return console.log(err);
}
const usefulDocData = JSON.parse(contents);
convert(phaserModuleDOM, usefulDocData, memberList);
const domOutput = dom.emit(phaserPkgModuleDOM) + dom.emit(phaserClassDOM) + dom.emit(phaserModuleDOM);
const outPath = 'out/phaser.d.ts';

console.log(domOutput);

fs.writeFile(outPath, domOutput, (err) => {
if(err) {
return console.log(err);
}
console.log(`File was written to ${outPath}`);
});
});
});
}

const transpiler = (() => {
const memberList = new Map();
phaserPkgModuleDOM.members.push(dom.create.exportName('Phaser'));
// Create namespace for each src namespace.
phaserSrcNs.forEach((cls) => {
const domClass = dom.create.class(cls, 0);
const domNs = dom.create.namespace(cls);

phaserModuleDOM.members.push(domClass);
phaserModuleDOM.members.push(domNs);

memberList.set(cls, {namespace: domNs, class: domClass});
});
transpile(memberList);
})();


/*
const transpile = (memberList) => {
let srcFiles = readPhaserSrc("phaser-src/");
let promiseBuf = [];
let promiseIndex = 0;
Expand Down Expand Up @@ -86,21 +129,4 @@ const transpile = (memberList) => {
});
}

const transpiler = (() => {
const memberList = new Map();
phaserPkgModuleDOM.members.push(dom.create.exportName('Phaser'));
// Create namespace for each src namespace.
phaserSrcNs.forEach((cls) => {
const domClass = dom.create.class(cls, 0);
const domNs = dom.create.namespace(cls);

phaserModuleDOM.members.push(domClass);
phaserModuleDOM.members.push(domNs);

memberList.set(cls, {namespace: domNs, class: domClass});
});
transpile(memberList);
})();

// Change map to pass both namespace and class.
*/
Loading

0 comments on commit 4fae01b

Please sign in to comment.