chore: fix firebase.json; check-deploy to active firebase project
Remove project name from firebase.json, since that is deprecated. The `check-deploy` gulp task now checks that an active project is defined at the start of `check-deploy`. To set the active project use: `firebase use <project-or-alias-name>`. Fixes #2576
This commit is contained in:
parent
83faca0f94
commit
e813fb4716
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"projects": {
|
"projects": {
|
||||||
"live": "angular-io",
|
"live": "angular-io",
|
||||||
"ngdocsdev": "ngdocsdev"
|
"ngdocsdev": "ngdocsdev",
|
||||||
|
"kw-dev": "kw-angular-io",
|
||||||
|
"dev": "angular-io-dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"firebase": "angular-io",
|
"hosting": {
|
||||||
"public": "www",
|
"public": "www",
|
||||||
"rewrites": [
|
"rewrites": [
|
||||||
{
|
{
|
||||||
@ -73,3 +73,4 @@
|
|||||||
"**/node_modules/**"
|
"**/node_modules/**"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
}
|
21
gulpfile.js
21
gulpfile.js
@ -14,6 +14,7 @@ var fsExtra = require('fs-extra');
|
|||||||
var fs = fsExtra;
|
var fs = fsExtra;
|
||||||
var exec = require('child_process').exec;
|
var exec = require('child_process').exec;
|
||||||
var execPromise = Q.denodeify(exec);
|
var execPromise = Q.denodeify(exec);
|
||||||
|
var execSync = require('child_process').execSync;
|
||||||
// cross platform version of spawn that also works on windows.
|
// cross platform version of spawn that also works on windows.
|
||||||
var xSpawn = require('cross-spawn');
|
var xSpawn = require('cross-spawn');
|
||||||
var prompt = require('prompt');
|
var prompt = require('prompt');
|
||||||
@ -744,7 +745,7 @@ gulp.task('build-compile', ['build-docs'], function() {
|
|||||||
return harpCompile();
|
return harpCompile();
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('check-deploy', ['build-docs'], function() {
|
gulp.task('check-deploy', ['firebase-use-proj-check', 'build-docs'], () => {
|
||||||
return harpCompile().then(function() {
|
return harpCompile().then(function() {
|
||||||
gutil.log('compile ok');
|
gutil.log('compile ok');
|
||||||
gutil.log('running live server ...');
|
gutil.log('running live server ...');
|
||||||
@ -753,7 +754,7 @@ gulp.task('check-deploy', ['build-docs'], function() {
|
|||||||
}).then(function(shouldDeploy) {
|
}).then(function(shouldDeploy) {
|
||||||
if (shouldDeploy) {
|
if (shouldDeploy) {
|
||||||
gutil.log('deploying...');
|
gutil.log('deploying...');
|
||||||
return execPromise('firebase deploy');
|
return execPromise(`firebase deploy -p ${WWW}`);
|
||||||
} else {
|
} else {
|
||||||
return ['Not deploying'];
|
return ['Not deploying'];
|
||||||
}
|
}
|
||||||
@ -764,6 +765,17 @@ gulp.task('check-deploy', ['build-docs'], function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('firebase-use-proj-check', cb => {
|
||||||
|
try {
|
||||||
|
execSync('firebase use');
|
||||||
|
} catch (e) {
|
||||||
|
// Rerun command so user gets project + alias info
|
||||||
|
execSync('firebase use', {stdio:[0,1,2]});
|
||||||
|
throw `\nAborting: no firebase project selected. Run:\n\n firebase use <project-or-alias-name>\n\n`;
|
||||||
|
}
|
||||||
|
return cb();
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('test-api-builder', function (cb) {
|
gulp.task('test-api-builder', function (cb) {
|
||||||
execCommands(['npm run test-api-builder'], {}, cb);
|
execCommands(['npm run test-api-builder'], {}, cb);
|
||||||
});
|
});
|
||||||
@ -1071,7 +1083,6 @@ function backupApiHtmlFilesExist(folderName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function harpJsonSetJade2NgTo(v) {
|
function harpJsonSetJade2NgTo(v) {
|
||||||
const execSync = require('child_process').execSync;
|
|
||||||
const harpJsonPath = path.join(ANGULAR_IO_PROJECT_PATH, 'harp.json');
|
const harpJsonPath = path.join(ANGULAR_IO_PROJECT_PATH, 'harp.json');
|
||||||
execSync(`perl -pi -e 's/("jade2ng": *)\\w+/$1${v}/' ${harpJsonPath}`);
|
execSync(`perl -pi -e 's/("jade2ng": *)\\w+/$1${v}/' ${harpJsonPath}`);
|
||||||
const harpJson = require(harpJsonPath);
|
const harpJson = require(harpJsonPath);
|
||||||
@ -1204,10 +1215,12 @@ function watchAndSync(options, cb) {
|
|||||||
|
|
||||||
// returns a promise;
|
// returns a promise;
|
||||||
function askDeploy() {
|
function askDeploy() {
|
||||||
|
// Show user what the currently active firebase project is:
|
||||||
|
execSync('firebase use', {stdio:[0,1,2]});
|
||||||
prompt.start();
|
prompt.start();
|
||||||
var schema = {
|
var schema = {
|
||||||
name: 'shouldDeploy',
|
name: 'shouldDeploy',
|
||||||
description: 'Deploy to Firebase? (y/n)',
|
description: `Deploy ${WWW} to firebase? (y/n)`,
|
||||||
type: 'string',
|
type: 'string',
|
||||||
pattern: /Y|N|y|n/,
|
pattern: /Y|N|y|n/,
|
||||||
message: "Respond with either a 'y' or 'n'",
|
message: "Respond with either a 'y' or 'n'",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user