-
Notifications
You must be signed in to change notification settings - Fork 903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
importing firebase-tools in gulp makes tasks hang #86
Comments
@rolandjitsu this is unfortunately a current limitation of the Firebase real-time client (which is used by |
@mbleigh I am unsure what you mean with Also with |
var tools = require('firebase-tools');
tools.deploy({
firebase: 'YOUR_FIREBASE_PROJECT',
token: 'YOUR_FIREBASE_TOKEN'
}).then(function() {
process.exit(0);
}).catch(function(err) {
console.log(err);
process.exit(1);
}); via spawn: var spawn = require('child_process').spawn;
var proc = spawn("./node_modules/.bin/firebase", ["deploy", "-f", "YOUR_FIREBASE_PROJECT", "--token", "YOUR_TOKEN"]);
proc.on('close', function(code) {
if (code === 0) {
// succeeded
} else {
// failed
}
}); Note: I wrote these without testing them, but they should be close to correct. |
@mbleigh thanks. I already had this done, the second version, but I thought you may have another way of doing it. |
Are there tools that will show any open resources? Took me a while to find out that it was firebase causing this. Would love a better answer than "kill the beast" |
@jensenbox to find out if there any processes running you could import gulp from 'gulp';
import {exec} from 'child_process';
import {env, log, colors} from 'gulp-util';
// https://github.com/firebase/firebase-tools#commands
function runFirebaseCommand(cmd, args = []) {
let binary = process.platform === 'win32' ? 'node_modules\\.bin\\firebase' : 'node_modules/.bin/firebase'; // Windows or Linux path
const TOKEN = process.env.FIREBASE_TOKEN || env.token;
if (!TOKEN) {
log(colors.red('No FIREBASE_TOKEN found in env or --token option passed.'));
return Promise.reject();
}
let defaultArgs = [
'--non-interactive',
'--token',
`"${TOKEN}"`
];
if (Array.isArray(args)) args.unshift.apply(args, defaultArgs);
else args = defaultArgs;
binary += ` ${cmd}`;
args.unshift(binary);
let proc = exec(args.join(' '));
// streamProcLog(proc); // a fn to stream data to from the child process
return proc;
}
gulp.task(function deploy() {
return runFirebaseCommand('deploy');
}); And you can use it as such If you want to pass extra args, use the second arg of the fn |
It looks like if I
import { deploy } from 'firebase-tools'
orrequire('firebase-tools')
in my gulp file, any tasks I start it seems to be hanging after it's done and it never exists.You can check it on Travis by looking at one of my failed builds. If you look at what changed from the previous versions you can see that I've added firebase tools to manage the deployments to Firebase.
The text was updated successfully, but these errors were encountered: