Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit e813fb4

Browse files
chalinkwalrath
authored andcommitted
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
1 parent 83faca0 commit e813fb4

File tree

3 files changed

+95
-79
lines changed

3 files changed

+95
-79
lines changed

.firebaserc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"projects": {
33
"live": "angular-io",
4-
"ngdocsdev": "ngdocsdev"
4+
"ngdocsdev": "ngdocsdev",
5+
"kw-dev": "kw-angular-io",
6+
"dev": "angular-io-dev"
57
}
68
}

firebase.json

+75-74
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,76 @@
11
{
2-
"firebase": "angular-io",
3-
"public": "www",
4-
"rewrites": [
5-
{
6-
"source": "/docs/dart/latest/testing",
7-
"destination":"/docs/dart/latest/guide/testing.html"
8-
},
9-
{
10-
"source": "/docs/dart/latest/tutorial",
11-
"destination": "/docs/dart/latest/index.html"
12-
},
13-
{
14-
"source": "/docs/js/latest/testing",
15-
"destination": "/docs/js/latest/guide/testing.html"
16-
},
17-
{
18-
"source": "/docs/js/latest/tutorial",
19-
"destination": "/docs/js/latest/index.html"
20-
},
21-
{
22-
"source": "/docs/ts/latest/guide/setup.html",
23-
"destination": "/docs/ts/latest/index.html"
24-
},
25-
{
26-
"source": "/docs/ts/latest/testing",
27-
"destination": "/docs/ts/latest/guide/testing.html"
28-
},
29-
{
30-
"source": "/cheatsheet",
31-
"destination": "/docs/ts/latest/guide/cheatsheet.html"
32-
},
33-
{
34-
"source": "/cheatsheet.json",
35-
"destination": "/docs/ts/latest/guide/cheatsheet.json"
36-
},
37-
{
38-
"source": "/AngularCheatSheet_Letter.pdf",
39-
"destination": "/docs/ts/latest/guide/AngularCheatSheet_Letter.pdf"
40-
},
41-
{
42-
"source": "/AngularCheatSheet_Poster.pdf",
43-
"destination": "/docs/ts/latest/guide/AngularCheatSheet_Poster.pdf"
44-
},
45-
{
46-
"source": "/cardboard",
47-
"destination": "/cardboard/index.html"
48-
},
49-
{
50-
"source": "/license",
51-
"destination": "/license.txt"
52-
},
53-
{
54-
"source": "/events",
55-
"destination": "/events.html"
56-
},
57-
{
58-
"source": "/survey",
59-
"destination": "/survey.html"
60-
},
61-
{
62-
"source": "/dart",
63-
"destination": "/docs/dart/latest/index.html"
64-
},
65-
{
66-
"source": "/styleguide",
67-
"destination": "/docs/ts/latest/guide/style-guide.html"
68-
}
69-
],
70-
"ignore": [
71-
"firebase.json",
72-
"**/.*",
73-
"**/node_modules/**"
74-
]
75-
}
2+
"hosting": {
3+
"public": "www",
4+
"rewrites": [
5+
{
6+
"source": "/docs/dart/latest/testing",
7+
"destination": "/docs/dart/latest/guide/testing.html"
8+
},
9+
{
10+
"source": "/docs/dart/latest/tutorial",
11+
"destination": "/docs/dart/latest/index.html"
12+
},
13+
{
14+
"source": "/docs/js/latest/testing",
15+
"destination": "/docs/js/latest/guide/testing.html"
16+
},
17+
{
18+
"source": "/docs/js/latest/tutorial",
19+
"destination": "/docs/js/latest/index.html"
20+
},
21+
{
22+
"source": "/docs/ts/latest/guide/setup.html",
23+
"destination": "/docs/ts/latest/index.html"
24+
},
25+
{
26+
"source": "/docs/ts/latest/testing",
27+
"destination": "/docs/ts/latest/guide/testing.html"
28+
},
29+
{
30+
"source": "/cheatsheet",
31+
"destination": "/docs/ts/latest/guide/cheatsheet.html"
32+
},
33+
{
34+
"source": "/cheatsheet.json",
35+
"destination": "/docs/ts/latest/guide/cheatsheet.json"
36+
},
37+
{
38+
"source": "/AngularCheatSheet_Letter.pdf",
39+
"destination": "/docs/ts/latest/guide/AngularCheatSheet_Letter.pdf"
40+
},
41+
{
42+
"source": "/AngularCheatSheet_Poster.pdf",
43+
"destination": "/docs/ts/latest/guide/AngularCheatSheet_Poster.pdf"
44+
},
45+
{
46+
"source": "/cardboard",
47+
"destination": "/cardboard/index.html"
48+
},
49+
{
50+
"source": "/license",
51+
"destination": "/license.txt"
52+
},
53+
{
54+
"source": "/events",
55+
"destination": "/events.html"
56+
},
57+
{
58+
"source": "/survey",
59+
"destination": "/survey.html"
60+
},
61+
{
62+
"source": "/dart",
63+
"destination": "/docs/dart/latest/index.html"
64+
},
65+
{
66+
"source": "/styleguide",
67+
"destination": "/docs/ts/latest/guide/style-guide.html"
68+
}
69+
],
70+
"ignore": [
71+
"firebase.json",
72+
"**/.*",
73+
"**/node_modules/**"
74+
]
75+
}
76+
}

gulpfile.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var fsExtra = require('fs-extra');
1414
var fs = fsExtra;
1515
var exec = require('child_process').exec;
1616
var execPromise = Q.denodeify(exec);
17+
var execSync = require('child_process').execSync;
1718
// cross platform version of spawn that also works on windows.
1819
var xSpawn = require('cross-spawn');
1920
var prompt = require('prompt');
@@ -744,7 +745,7 @@ gulp.task('build-compile', ['build-docs'], function() {
744745
return harpCompile();
745746
});
746747

747-
gulp.task('check-deploy', ['build-docs'], function() {
748+
gulp.task('check-deploy', ['firebase-use-proj-check', 'build-docs'], () => {
748749
return harpCompile().then(function() {
749750
gutil.log('compile ok');
750751
gutil.log('running live server ...');
@@ -753,7 +754,7 @@ gulp.task('check-deploy', ['build-docs'], function() {
753754
}).then(function(shouldDeploy) {
754755
if (shouldDeploy) {
755756
gutil.log('deploying...');
756-
return execPromise('firebase deploy');
757+
return execPromise(`firebase deploy -p ${WWW}`);
757758
} else {
758759
return ['Not deploying'];
759760
}
@@ -764,6 +765,17 @@ gulp.task('check-deploy', ['build-docs'], function() {
764765
});
765766
});
766767

768+
gulp.task('firebase-use-proj-check', cb => {
769+
try {
770+
execSync('firebase use');
771+
} catch (e) {
772+
// Rerun command so user gets project + alias info
773+
execSync('firebase use', {stdio:[0,1,2]});
774+
throw `\nAborting: no firebase project selected. Run:\n\n firebase use <project-or-alias-name>\n\n`;
775+
}
776+
return cb();
777+
});
778+
767779
gulp.task('test-api-builder', function (cb) {
768780
execCommands(['npm run test-api-builder'], {}, cb);
769781
});
@@ -1071,7 +1083,6 @@ function backupApiHtmlFilesExist(folderName) {
10711083
}
10721084

10731085
function harpJsonSetJade2NgTo(v) {
1074-
const execSync = require('child_process').execSync;
10751086
const harpJsonPath = path.join(ANGULAR_IO_PROJECT_PATH, 'harp.json');
10761087
execSync(`perl -pi -e 's/("jade2ng": *)\\w+/$1${v}/' ${harpJsonPath}`);
10771088
const harpJson = require(harpJsonPath);
@@ -1204,10 +1215,12 @@ function watchAndSync(options, cb) {
12041215

12051216
// returns a promise;
12061217
function askDeploy() {
1218+
// Show user what the currently active firebase project is:
1219+
execSync('firebase use', {stdio:[0,1,2]});
12071220
prompt.start();
12081221
var schema = {
12091222
name: 'shouldDeploy',
1210-
description: 'Deploy to Firebase? (y/n)',
1223+
description: `Deploy ${WWW} to firebase? (y/n)`,
12111224
type: 'string',
12121225
pattern: /Y|N|y|n/,
12131226
message: "Respond with either a 'y' or 'n'",

0 commit comments

Comments
 (0)