@@ -9,7 +9,7 @@ import { experimental } from '@angular-devkit/core';
99import { SchematicsException } from '@angular-devkit/schematics' ;
1010import { satisfies } from 'semver' ;
1111
12- const escapeRegExp = ( str : String ) => str . replace ( / [ \- \[ \] \/ \{ \} \( \) \* \+ \? \ .\\ \^ \$ \ |] / g, '\\$&' ) ;
12+ const escapeRegExp = ( str : string ) => str . replace ( / [ \- \[ \] \/ { } ( ) * + ? . \\ ^ $ | ] / g, '\\$&' ) ;
1313
1414const moveSync = ( src : string , dest : string ) => {
1515 copySync ( src , dest ) ;
@@ -30,7 +30,7 @@ const deployToHosting = (
3030 execSync ( `open http://localhost:${ port } || true` ) ;
3131 } , 1500 ) ;
3232
33- return firebaseTools . serve ( { port, targets : [ 'hosting' ] } ) . then ( ( ) =>
33+ return firebaseTools . serve ( { port, targets : [ 'hosting' ] } ) . then ( ( ) =>
3434 require ( 'inquirer' ) . prompt ( {
3535 type : 'confirm' ,
3636 name : 'deployProject' ,
@@ -78,19 +78,24 @@ const getPackageJson = (context: BuilderContext, workspaceRoot: string) => {
7878 const npmList = execSync ( 'npm ls || true' ) . toString ( ) ;
7979 Object . keys ( dependencies ) . forEach ( ( dependency : string ) => {
8080 const npmLsMatch = npmList . match ( ` ${ escapeRegExp ( dependency ) } @.+\\w` ) ;
81- if ( npmLsMatch ) { dependencies [ dependency ] = npmLsMatch [ 0 ] . split ( `${ dependency } @` ) [ 1 ] ; }
81+ if ( npmLsMatch ) {
82+ dependencies [ dependency ] = npmLsMatch [ 0 ] . split ( `${ dependency } @` ) [ 1 ] ;
83+ }
8284 } ) ;
8385 Object . keys ( devDependencies ) . forEach ( ( devDependency : string ) => {
8486 const npmLsMatch = npmList . match ( ` ${ escapeRegExp ( devDependency ) } @.+\\w` ) ;
85- if ( npmLsMatch ) { devDependencies [ devDependency ] = npmLsMatch [ 0 ] . split ( `${ devDependency } @` ) [ 1 ] ; }
87+ if ( npmLsMatch ) {
88+ devDependencies [ devDependency ] = npmLsMatch [ 0 ] . split ( `${ devDependency } @` ) [ 1 ] ;
89+ }
8690 } ) ;
8791 if ( existsSync ( join ( workspaceRoot , 'angular.json' ) ) ) {
8892 const angularJson = JSON . parse ( readFileSync ( join ( workspaceRoot , 'angular.json' ) ) . toString ( ) ) ;
93+ // tslint:disable-next-line:no-non-null-assertion
8994 const server = angularJson . projects [ context . target ! . project ] . architect . server ;
9095 const serverOptions = server && server . options ;
9196 const externalDependencies = serverOptions && serverOptions . externalDependencies || [ ] ;
9297 const bundleDependencies = serverOptions && serverOptions . bundleDependencies ;
93- if ( bundleDependencies == false ) {
98+ if ( bundleDependencies ! == true ) {
9499 if ( existsSync ( join ( workspaceRoot , 'package.json' ) ) ) {
95100 const packageJson = JSON . parse ( readFileSync ( join ( workspaceRoot , 'package.json' ) ) . toString ( ) ) ;
96101 Object . keys ( packageJson . dependencies ) . forEach ( ( dependency : string ) => {
@@ -100,7 +105,9 @@ const getPackageJson = (context: BuilderContext, workspaceRoot: string) => {
100105 } else {
101106 externalDependencies . forEach ( externalDependency => {
102107 const npmLsMatch = npmList . match ( ` ${ escapeRegExp ( externalDependency ) } @.+\\w` ) ;
103- if ( npmLsMatch ) { dependencies [ externalDependency ] = npmLsMatch [ 0 ] . split ( `${ externalDependency } @` ) [ 1 ] ; }
108+ if ( npmLsMatch ) {
109+ dependencies [ externalDependency ] = npmLsMatch [ 0 ] . split ( `${ externalDependency } @` ) [ 1 ] ;
110+ }
104111 } ) ;
105112 }
106113 } // TODO should we throw?
@@ -177,7 +184,7 @@ export const deployToFunction = async (
177184 execSync ( `open http://localhost:${ port } || true` ) ;
178185 } , 1500 ) ;
179186
180- return firebaseTools . serve ( { port, targets : [ 'hosting' , 'functions' ] } ) . then ( ( ) =>
187+ return firebaseTools . serve ( { port, targets : [ 'hosting' , 'functions' ] } ) . then ( ( ) =>
181188 require ( 'inquirer' ) . prompt ( {
182189 type : 'confirm' ,
183190 name : 'deployProject' ,
@@ -186,6 +193,7 @@ export const deployToFunction = async (
186193 ) . then ( ( { deployProject } : { deployProject : boolean } ) => {
187194 if ( deployProject ) {
188195 return firebaseTools . deploy ( {
196+ // tslint:disable-next-line:no-non-null-assertion
189197 only : `hosting:${ context . target ! . project } ,functions:ssr` ,
190198 cwd : workspaceRoot
191199 } ) ;
@@ -195,6 +203,7 @@ export const deployToFunction = async (
195203 } ) ;
196204 } else {
197205 return firebaseTools . deploy ( {
206+ // tslint:disable-next-line:no-non-null-assertion
198207 only : `hosting:${ context . target ! . project } ,functions:ssr` ,
199208 cwd : workspaceRoot
200209 } ) ;
@@ -233,8 +242,6 @@ export default async function deploy(
233242 }
234243
235244 try {
236- let success : { hosting : string } ;
237-
238245 const winston = require ( 'winston' ) ;
239246 const tripleBeam = require ( 'triple-beam' ) ;
240247
@@ -243,22 +250,22 @@ export default async function deploy(
243250 level : 'info' ,
244251 format : winston . format . printf ( ( info ) =>
245252 [ info . message , ...( info [ tripleBeam . SPLAT ] || [ ] ) ]
246- . filter ( ( chunk ) => typeof chunk == 'string' )
253+ . filter ( ( chunk ) => typeof chunk === 'string' )
247254 . join ( ' ' )
248- ) ,
255+ )
249256 } )
250257 ) ;
251258
252259 if ( ssr ) {
253- success = await deployToFunction (
260+ await deployToFunction (
254261 firebaseTools ,
255262 context ,
256263 context . workspaceRoot ,
257264 projectTargets ,
258265 preview
259266 ) ;
260267 } else {
261- success = await deployToHosting (
268+ await deployToHosting (
262269 firebaseTools ,
263270 context ,
264271 context . workspaceRoot ,
0 commit comments