Commit 6b5ee5ba authored by Chris Bargren's avatar Chris Bargren

Adding babel and babel scripts

parent c5806d87
/node_modules/
/build/
/test/coverage/
/test/repos/
/test/test/
/test/home/
/src/
/coverage/
/dist/
/include/
/lib/enums.js
/lib/nodegit.js
/coverage/
/node_modules/
/src/
/test/coverage/
/test/home/
/test/repos/
/test/test/
/generate/output
/generate/**/*.json
......
/build/
/example/
/examples/
/lib/
/test/
/vendor/Release/
......
......@@ -12,6 +12,7 @@ var fromRegistry;
try {
fs.statSync(path.join(__dirname, "..", "include"));
fs.statSync(path.join(__dirname, "..", "src"));
fs.statSync(path.join(__dirname, "..", "dist"));
fromRegistry = true;
}
catch(e) {
......@@ -63,7 +64,45 @@ function prepareAndBuild() {
return prepareForBuild()
.then(function() {
return build();
})
.then(function() {
return transpileJavascript();
});
}
function transpileJavascript() {
var cmd = pathForTool("babel");
var args = [
"--presets",
"es2015",
"-d",
"./dist",
"./lib"
];
var opts = {
cwd: ".",
maxBuffer: Number.MAX_VALUE,
env: process.env,
stdio: "inherit"
};
var home = process.platform == "win32" ?
process.env.USERPROFILE : process.env.HOME;
opts.env.HOME = path.join(home, ".nodegit-gyp");
return new Promise(function(resolve, reject) {
var child = cp.spawn(cmd, args, opts);
child.on("close", function(code) {
console.log(code);
if (code) {
reject(code);
process.exitCode = 13;
}
else {
resolve();
}
});
});
}
function build() {
......
......@@ -21,7 +21,7 @@
"email": "maxkorp@8bytealchemy.com"
}
],
"main": "lib/nodegit.js",
"main": "dist/nodegit.js",
"repository": {
"type": "git",
"url": "git://github.com/nodegit/nodegit.git"
......@@ -42,6 +42,8 @@
"promisify-node": "~0.3.0"
},
"devDependencies": {
"babel-cli": "^6.7.7",
"babel-preset-es2015": "^6.6.0",
"clean-for-publish": "~1.0.2",
"combyne": "~0.8.1",
"coveralls": "~2.11.4",
......@@ -68,6 +70,7 @@
"host": "https://nodegit.s3.amazonaws.com/nodegit/nodegit/"
},
"scripts": {
"babel": "babel --presets es2015 -d ./dist ./lib",
"cov": "npm run cppcov && npm run filtercov && npm run mergecov",
"coveralls": "cat ./test/coverage/merged.lcov | coveralls",
"cppcov": "mkdir -p test/coverage/cpp && ./lcov-1.10/bin/lcov --gcov-tool /usr/bin/gcov-4.9 --capture --directory build/Release/obj.target/nodegit/src --output-file test/coverage/cpp/lcov_full.info",
......@@ -82,9 +85,9 @@
"mocha": "mocha test/runner test/tests --timeout 15000",
"mochaDebug": "mocha --debug-brk test/runner test/tests --timeout 15000",
"postinstall": "node postinstall.js",
"prepublish": "node lifecycleScripts/prepareForBuild.js",
"rebuild": "node generate && node-gyp configure build",
"rebuildDebug": "node generate && node-gyp configure --debug build",
"prepublish": "node lifecycleScripts/prepareForBuild.js && npm run babel",
"rebuild": "node generate && npm run babel && node-gyp configure build",
"rebuildDebug": "node generate && npm run babel && node-gyp configure --debug build",
"recompile": "node-gyp configure build",
"recompileDebug": "node-gyp configure --debug build",
"test": "npm run lint && node --expose-gc test",
......
......@@ -7,7 +7,7 @@ if (process.platform !== "linux") {
return;
}
child_process.exec("node lib/nodegit.js", function(error, stdout, stderr) {
child_process.exec("node dist/nodegit.js", function(error, stdout, stderr) {
if (stderr && ~stderr.indexOf("libstdc++")) {
console.log("[ERROR] Seems like the latest libstdc++ is missing on your system!");
console.log("");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment