From 984127586ae5284a33a3a13bb1b5a89111e62b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Mon, 14 May 2018 23:50:39 +0200 Subject: [PATCH 01/12] Added ES module build to the auth package. --- packages/auth/gulpfile.js | 94 ++++++++++++++++++++++++++------------ packages/auth/package.json | 3 +- 2 files changed, 67 insertions(+), 30 deletions(-) diff --git a/packages/auth/gulpfile.js b/packages/auth/gulpfile.js index 766d828da5..904e74205c 100644 --- a/packages/auth/gulpfile.js +++ b/packages/auth/gulpfile.js @@ -26,47 +26,78 @@ const path = require('path'); const OPTIMIZATION_LEVEL = 'ADVANCED_OPTIMIZATIONS'; // For minified builds, wrap the output so we avoid leaking global variables. -const OUTPUT_WRAPPER = `(function() { +const OUTPUT_WRAPPER_CJS = `(function() { var firebase = require('@firebase/app').default; %output% }).call(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});`; +const OUTPUT_WRAPPER_ESM = `import firebase from '@firebase/app'; +(function() { + %output% +}).call(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});`; + // The path to Closure Compiler. -const COMPILER_PATH = `${path.dirname(require.resolve('google-closure-compiler/package.json'))}/compiler.jar`; +const COMPILER_PATH = `${path.dirname( + require.resolve('google-closure-compiler/package.json') +)}/compiler.jar`; -const closureLibRoot = path.dirname(require.resolve('google-closure-library/package.json')); -// Builds the core Firebase-auth JS. +const closureLibRoot = path.dirname( + require.resolve('google-closure-library/package.json') +); -function buildFirebaseAuth() { - return gulp +// Builds the core Firebase-auth JS. +const buildFirebaseAuth = (fileName, outputWrapper) => + gulp .src([ `${closureLibRoot}/closure/goog/**/*.js`, `${closureLibRoot}/third_party/closure/goog/**/*.js`, 'src/**/*.js' ]) - .pipe(closureCompiler({ - compilerPath: COMPILER_PATH, - fileName: 'auth.js', - compilerFlags: { - closure_entry_point: 'fireauth.exports', - compilation_level: OPTIMIZATION_LEVEL, - externs: [ - 'externs/externs.js', - 'externs/grecaptcha.js', - 'externs/gapi.iframes.js', - path.resolve(__dirname, '../firebase/externs/firebase-app-externs.js'), - path.resolve(__dirname, '../firebase/externs/firebase-error-externs.js'), - path.resolve(__dirname, '../firebase/externs/firebase-app-internal-externs.js') - ], - language_out: 'ES5', - only_closure_dependencies: true, - output_wrapper: OUTPUT_WRAPPER - } - })) + .pipe( + closureCompiler({ + compilerPath: COMPILER_PATH, + fileName, + compilerFlags: { + closure_entry_point: 'fireauth.exports', + compilation_level: OPTIMIZATION_LEVEL, + externs: [ + 'externs/externs.js', + 'externs/grecaptcha.js', + 'externs/gapi.iframes.js', + path.resolve( + __dirname, + '../firebase/externs/firebase-app-externs.js' + ), + path.resolve( + __dirname, + '../firebase/externs/firebase-error-externs.js' + ), + path.resolve( + __dirname, + '../firebase/externs/firebase-app-internal-externs.js' + ) + ], + language_out: 'ES5', + only_closure_dependencies: true, + output_wrapper: outputWrapper + } + }) + ) .pipe(gulp.dest('dist')); + +function buildFirebaseAuthCJS() { + return buildFirebaseAuth('auth.js', OUTPUT_WRAPPER_CJS); } +buildFirebaseAuthCJS.description = + 'Builds a CommonJS version of the package (dist/auth.js).'; +gulp.task(buildFirebaseAuthCJS); -gulp.task('build-firebase-auth-js', buildFirebaseAuth); +function buildFirebaseAuthESM() { + return buildFirebaseAuth('auth.esm.js', OUTPUT_WRAPPER_ESM); +} +buildFirebaseAuthESM.description = + 'Builds an EcmaScript modules version of the package (dist/auth.esm.js).'; +gulp.task(buildFirebaseAuthESM); // Deletes intermediate files. gulp.task('clean', done => del(['dist/*', 'dist'], done)); @@ -75,11 +106,16 @@ gulp.task('clean', done => del(['dist/*', 'dist'], done)); gulp.task('serve', () => { const app = express(); - app.use('/node_modules', express.static(path.resolve(__dirname, '../../node_modules'))); + app.use( + '/node_modules', + express.static(path.resolve(__dirname, '../../node_modules')) + ); app.use(express.static(__dirname)); app.listen(4000); }); - -gulp.task('default', buildFirebaseAuth); +gulp.task( + 'default', + gulp.parallel(['buildFirebaseAuthCJS', 'buildFirebaseAuthESM']) +); diff --git a/packages/auth/package.json b/packages/auth/package.json index eb5166f851..c880180c20 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,7 +1,8 @@ { "name": "@firebase/auth", - "version": "0.5.2", + "version": "0.6.0", "main": "dist/auth.js", + "module": "dist/auth.esm.js", "description": "Javascript library for Firebase Auth SDK", "author": "Firebase (https://firebase.google.com/)", "files": [ From 790b9231a348376ac1b7ae6853658671a2de9f62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Fri, 18 May 2018 20:28:00 +0200 Subject: [PATCH 02/12] [auth] Improved build efficiency by reusing Clousure Compiler output. --- packages/auth/gulpfile.js | 54 ++++++++++++++++++-------------------- packages/auth/package.json | 4 ++- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/packages/auth/gulpfile.js b/packages/auth/gulpfile.js index 904e74205c..5deac449d2 100644 --- a/packages/auth/gulpfile.js +++ b/packages/auth/gulpfile.js @@ -19,6 +19,8 @@ const closureCompiler = require('gulp-closure-compiler'); const del = require('del'); const express = require('express'); const path = require('path'); +const { through } = require('event-stream'); +const File = require('vinyl'); // The optimization level for the JS compiler. // Valid levels: WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS. @@ -26,15 +28,24 @@ const path = require('path'); const OPTIMIZATION_LEVEL = 'ADVANCED_OPTIMIZATIONS'; // For minified builds, wrap the output so we avoid leaking global variables. -const OUTPUT_WRAPPER_CJS = `(function() { - var firebase = require('@firebase/app').default; - %output% -}).call(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});`; +const CJS_WRAPPER_PREFIX = `(function() {var firebase = require('@firebase/app').default;`; +const EMS_WRAPPER_PREFIX = `import firebase from '@firebase/app';(function() {`; +const WRAPPER_SUFFIX = `}).call(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});`; -const OUTPUT_WRAPPER_ESM = `import firebase from '@firebase/app'; -(function() { - %output% -}).call(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});`; +const wrap = through(function(file) { + const wrappedFile = (prefix, path) => + new File({ + path, + contents: Buffer.concat([ + Buffer.from(prefix), + file.contents, + Buffer.from(WRAPPER_SUFFIX) + ]) + }); + + this.emit('data', wrappedFile(CJS_WRAPPER_PREFIX, 'auth.js')); + this.emit('data', wrappedFile(EMS_WRAPPER_PREFIX, 'auth.esm.js')); +}); // The path to Closure Compiler. const COMPILER_PATH = `${path.dirname( @@ -46,7 +57,7 @@ const closureLibRoot = path.dirname( ); // Builds the core Firebase-auth JS. -const buildFirebaseAuth = (fileName, outputWrapper) => +const buildFirebaseAuth = () => gulp .src([ `${closureLibRoot}/closure/goog/**/*.js`, @@ -56,7 +67,7 @@ const buildFirebaseAuth = (fileName, outputWrapper) => .pipe( closureCompiler({ compilerPath: COMPILER_PATH, - fileName, + fileName: 'unwrapped.js', compilerFlags: { closure_entry_point: 'fireauth.exports', compilation_level: OPTIMIZATION_LEVEL, @@ -78,26 +89,14 @@ const buildFirebaseAuth = (fileName, outputWrapper) => ) ], language_out: 'ES5', - only_closure_dependencies: true, - output_wrapper: outputWrapper + only_closure_dependencies: true } }) ) + .pipe(wrap) .pipe(gulp.dest('dist')); -function buildFirebaseAuthCJS() { - return buildFirebaseAuth('auth.js', OUTPUT_WRAPPER_CJS); -} -buildFirebaseAuthCJS.description = - 'Builds a CommonJS version of the package (dist/auth.js).'; -gulp.task(buildFirebaseAuthCJS); - -function buildFirebaseAuthESM() { - return buildFirebaseAuth('auth.esm.js', OUTPUT_WRAPPER_ESM); -} -buildFirebaseAuthESM.description = - 'Builds an EcmaScript modules version of the package (dist/auth.esm.js).'; -gulp.task(buildFirebaseAuthESM); +gulp.task('build-firebase-auth-js', buildFirebaseAuth); // Deletes intermediate files. gulp.task('clean', done => del(['dist/*', 'dist'], done)); @@ -115,7 +114,4 @@ gulp.task('serve', () => { app.listen(4000); }); -gulp.task( - 'default', - gulp.parallel(['buildFirebaseAuthCJS', 'buildFirebaseAuthESM']) -); +gulp.task('default', buildFirebaseAuth); diff --git a/packages/auth/package.json b/packages/auth/package.json index c880180c20..c3ff04f273 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -24,6 +24,7 @@ "devDependencies": { "closure-builder": "2.2.39", "del": "3.0.0", + "event-stream": "^3.3.4", "express": "4.16.3", "firebase-functions": "1.0.1", "firebase-tools": "3.18.2", @@ -31,7 +32,8 @@ "google-closure-library": "20180405.0.0", "gulp": "4.0.0", "gulp-closure-compiler": "0.4.0", - "protractor": "5.3.1" + "protractor": "5.3.1", + "vinyl": "^2.1.0" }, "repository": { "type": "git", From 311c585278781a97e9fbf2ba63356ad6a44190c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Fri, 18 May 2018 22:46:09 +0200 Subject: [PATCH 03/12] [auth] Improved a test script to accomodate hoisting. --- packages/auth/buildtools/run_tests.sh | 31 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/packages/auth/buildtools/run_tests.sh b/packages/auth/buildtools/run_tests.sh index 86544abba6..a3e6dd4528 100755 --- a/packages/auth/buildtools/run_tests.sh +++ b/packages/auth/buildtools/run_tests.sh @@ -47,13 +47,28 @@ # # Travis will run `npm test -- --saucelabs`. +# Since yarn workspaces might hoist our packages, we have to fallback to +# ../../node_modules when we want to execute a script. +declare -a nodeModulesBasedirs=( + "./node_modules/.bin" + "../../node_modules/.bin" +) +function evalModule { + for basedir in "${nodeModulesBasedirs[@]}" + do + if [ -f "$basedir/$1" ]; then + "$basedir/$1" "${@:2}" + fi + done +} + cd "$(dirname $(dirname "$0"))" function killServer () { if [ "$seleniumStarted" = true ]; then echo "Stopping Selenium..." - ./node_modules/.bin/webdriver-manager shutdown - ./node_modules/.bin/webdriver-manager clean + evalModule webdriver-manager shutdown + evalModule webdriver-manager clean # Selenium is not getting shutdown. Send a kill signal. lsof -t -i :4444 | xargs kill fi @@ -62,7 +77,7 @@ function killServer () { } # Start the local webserver. -./node_modules/.bin/gulp serve & +evalModule gulp serve & serverPid=$! echo "Local HTTP Server started with PID $serverPid." @@ -75,17 +90,17 @@ if [[ $1 = "--saucelabs" ]]; then sleep 2 echo "Using SauceLabs." # $2 contains the tunnelIdentifier argument if specified, otherwise is empty. - ./node_modules/.bin/protractor protractor.conf.js --saucelabs $2 + evalModule protractor protractor.conf.js --saucelabs $2 else echo "Using Chrome and Firefox." - ./node_modules/.bin/webdriver-manager clean + evalModule webdriver-manager clean # Updates Selenium Webdriver. - ./node_modules/.bin/webdriver-manager update + evalModule webdriver-manager update # Start Selenium Webdriver. - ./node_modules/.bin/webdriver-manager start &>/dev/null & + evalModule webdriver-manager start &>/dev/null & seleniumStarted=true echo "Selenium Server started." # Wait for servers to come up. sleep 10 - ./node_modules/.bin/protractor protractor.conf.js + evalModule protractor protractor.conf.js fi From 808f114858c5f8c4bffba0e44fd89a2a4c86dbeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Fri, 18 May 2018 22:46:49 +0200 Subject: [PATCH 04/12] [AUTOMATED]: Prettier Code Styling --- packages/database-types/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/database-types/index.d.ts b/packages/database-types/index.d.ts index a741787695..708cb0668d 100644 --- a/packages/database-types/index.d.ts +++ b/packages/database-types/index.d.ts @@ -53,7 +53,12 @@ export interface OnDisconnect { update(values: Object, onComplete?: (a: Error | null) => any): Promise; } -type EventType = 'value' | 'child_added' | 'child_changed' | 'child_moved' | 'child_removed'; +type EventType = + | 'value' + | 'child_added' + | 'child_changed' + | 'child_moved' + | 'child_removed'; export interface Query { endAt(value: number | string | boolean | null, key?: string): Query; From 538acd6e67f8d10fb09d4cbccaea5be6a732f451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Tue, 5 Jun 2018 18:56:03 +0200 Subject: [PATCH 05/12] Removed build step from a test script in the auth package. --- packages/auth/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/auth/package.json b/packages/auth/package.json index a4677e4868..ce6fc61e78 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -11,11 +11,11 @@ ], "scripts": { "build": "gulp", - "test": "npm run build && npm run generate-test-files && ./buildtools/run_tests.sh", - "serve": "npm run build && npm run generate-test-files && gulp serve", "demo": "./buildtools/run_demo.sh", "generate-test-files": "./buildtools/generate_test_files.sh", - "prepare": "npm run build" + "prepare": "npm run build", + "serve": "npm run build && npm run generate-test-files && gulp serve", + "test": "npm run generate-test-files && ./buildtools/run_tests.sh" }, "license": "Apache-2.0", "dependencies": { From 316b170cfe0b9b5536b4b537edd23b09ae39a74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Tue, 5 Jun 2018 19:57:10 +0200 Subject: [PATCH 06/12] Fixed an issue with getting a PID of a local server in auth tests. Issue was caused by getting a PID of a command creation, rather than the command itself. --- packages/auth/buildtools/run_tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/auth/buildtools/run_tests.sh b/packages/auth/buildtools/run_tests.sh index a3e6dd4528..09b4f90503 100755 --- a/packages/auth/buildtools/run_tests.sh +++ b/packages/auth/buildtools/run_tests.sh @@ -57,7 +57,7 @@ function evalModule { for basedir in "${nodeModulesBasedirs[@]}" do if [ -f "$basedir/$1" ]; then - "$basedir/$1" "${@:2}" + eval "$basedir/$1 ${@:2}" fi done } @@ -77,7 +77,7 @@ function killServer () { } # Start the local webserver. -evalModule gulp serve & +evalModule gulp "serve &" serverPid=$! echo "Local HTTP Server started with PID $serverPid." From 1b43e008cf0ca271569e960ac7699e8ef4ceca8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Tue, 5 Jun 2018 20:01:40 +0200 Subject: [PATCH 07/12] Changed a local method name in a gulp taks of an auth package. The new name should better reflect the purpose of a function. --- packages/auth/gulpfile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/auth/gulpfile.js b/packages/auth/gulpfile.js index 5deac449d2..25c6a8d9ab 100644 --- a/packages/auth/gulpfile.js +++ b/packages/auth/gulpfile.js @@ -33,7 +33,7 @@ const EMS_WRAPPER_PREFIX = `import firebase from '@firebase/app';(function() {`; const WRAPPER_SUFFIX = `}).call(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});`; const wrap = through(function(file) { - const wrappedFile = (prefix, path) => + const makeFile = (prefix, path) => new File({ path, contents: Buffer.concat([ @@ -43,8 +43,8 @@ const wrap = through(function(file) { ]) }); - this.emit('data', wrappedFile(CJS_WRAPPER_PREFIX, 'auth.js')); - this.emit('data', wrappedFile(EMS_WRAPPER_PREFIX, 'auth.esm.js')); + this.emit('data', makeFile(CJS_WRAPPER_PREFIX, 'auth.js')); + this.emit('data', makeFile(EMS_WRAPPER_PREFIX, 'auth.esm.js')); }); // The path to Closure Compiler. From a7492b6d32fa20ac730ef51337c3de284813111f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Sat, 9 Jun 2018 12:23:45 +0200 Subject: [PATCH 08/12] Improved a documentation, spacing and prevented duplicate calls in auth test script. --- packages/auth/buildtools/run_tests.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/auth/buildtools/run_tests.sh b/packages/auth/buildtools/run_tests.sh index 09b4f90503..1172201281 100755 --- a/packages/auth/buildtools/run_tests.sh +++ b/packages/auth/buildtools/run_tests.sh @@ -53,11 +53,16 @@ declare -a nodeModulesBasedirs=( "./node_modules/.bin" "../../node_modules/.bin" ) + +# Tries to resolve the first argument as an npm executable, taking hoisting into +# account. If case of a successful resolution, executes the binary, passing +# the rest of given arguments to an invocation. function evalModule { for basedir in "${nodeModulesBasedirs[@]}" do if [ -f "$basedir/$1" ]; then eval "$basedir/$1 ${@:2}" + break fi done } From 37b70fb62e5974e898c6fc8756b082f223770120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Sat, 9 Jun 2018 12:42:31 +0200 Subject: [PATCH 09/12] Formatted constants in auth package's gulpfile to fit in 80 columns. --- packages/auth/gulpfile.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/auth/gulpfile.js b/packages/auth/gulpfile.js index 25c6a8d9ab..1150b62e36 100644 --- a/packages/auth/gulpfile.js +++ b/packages/auth/gulpfile.js @@ -28,9 +28,13 @@ const File = require('vinyl'); const OPTIMIZATION_LEVEL = 'ADVANCED_OPTIMIZATIONS'; // For minified builds, wrap the output so we avoid leaking global variables. -const CJS_WRAPPER_PREFIX = `(function() {var firebase = require('@firebase/app').default;`; +const CJS_WRAPPER_PREFIX = + `(function() {var firebase = require('@firebase/app').default;`; const EMS_WRAPPER_PREFIX = `import firebase from '@firebase/app';(function() {`; -const WRAPPER_SUFFIX = `}).call(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {});`; +const WRAPPER_SUFFIX = + `}).call(typeof global !== 'undefined' ? ` + + `global : typeof self !== 'undefined' ? ` + + `self : typeof window !== 'undefined' ? window : {});`; const wrap = through(function(file) { const makeFile = (prefix, path) => From b73889398087f3d1d17251e571a1d210ccb42df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Sat, 9 Jun 2018 12:54:29 +0200 Subject: [PATCH 10/12] Added a comment to explain the purpose of a wrap method used in auth package's gulpfile. --- packages/auth/gulpfile.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/auth/gulpfile.js b/packages/auth/gulpfile.js index 1150b62e36..993ff5f8a7 100644 --- a/packages/auth/gulpfile.js +++ b/packages/auth/gulpfile.js @@ -36,6 +36,10 @@ const WRAPPER_SUFFIX = `global : typeof self !== 'undefined' ? ` + `self : typeof window !== 'undefined' ? window : {});`; +/* + * Re-emits file variations surrounding a content of an input file with + * CommonJS and EcmaScript modules wrappers. + */ const wrap = through(function(file) { const makeFile = (prefix, path) => new File({ From 304b1fc9c1267516d1bb50a606d471321830055a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Sat, 9 Jun 2018 12:58:14 +0200 Subject: [PATCH 11/12] Reformatted a gulpfile in the auth package according to reviewer's comments. --- packages/auth/gulpfile.js | 62 +++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/packages/auth/gulpfile.js b/packages/auth/gulpfile.js index 993ff5f8a7..b6f7856c42 100644 --- a/packages/auth/gulpfile.js +++ b/packages/auth/gulpfile.js @@ -57,11 +57,11 @@ const wrap = through(function(file) { // The path to Closure Compiler. const COMPILER_PATH = `${path.dirname( - require.resolve('google-closure-compiler/package.json') + require.resolve('google-closure-compiler/package.json') )}/compiler.jar`; const closureLibRoot = path.dirname( - require.resolve('google-closure-library/package.json') + require.resolve('google-closure-library/package.json') ); // Builds the core Firebase-auth JS. @@ -73,33 +73,33 @@ const buildFirebaseAuth = () => 'src/**/*.js' ]) .pipe( - closureCompiler({ - compilerPath: COMPILER_PATH, - fileName: 'unwrapped.js', - compilerFlags: { - closure_entry_point: 'fireauth.exports', - compilation_level: OPTIMIZATION_LEVEL, - externs: [ - 'externs/externs.js', - 'externs/grecaptcha.js', - 'externs/gapi.iframes.js', - path.resolve( - __dirname, - '../firebase/externs/firebase-app-externs.js' - ), - path.resolve( - __dirname, - '../firebase/externs/firebase-error-externs.js' - ), - path.resolve( - __dirname, - '../firebase/externs/firebase-app-internal-externs.js' - ) - ], - language_out: 'ES5', - only_closure_dependencies: true - } - }) + closureCompiler({ + compilerPath: COMPILER_PATH, + fileName: 'unwrapped.js', + compilerFlags: { + closure_entry_point: 'fireauth.exports', + compilation_level: OPTIMIZATION_LEVEL, + externs: [ + 'externs/externs.js', + 'externs/grecaptcha.js', + 'externs/gapi.iframes.js', + path.resolve( + __dirname, + '../firebase/externs/firebase-app-externs.js' + ), + path.resolve( + __dirname, + '../firebase/externs/firebase-error-externs.js' + ), + path.resolve( + __dirname, + '../firebase/externs/firebase-app-internal-externs.js' + ) + ], + language_out: 'ES5', + only_closure_dependencies: true + } + }) ) .pipe(wrap) .pipe(gulp.dest('dist')); @@ -114,8 +114,8 @@ gulp.task('serve', () => { const app = express(); app.use( - '/node_modules', - express.static(path.resolve(__dirname, '../../node_modules')) + '/node_modules', + express.static(path.resolve(__dirname, '../../node_modules')) ); app.use(express.static(__dirname)); From aaee39a12b19a12f9f7d850c49733e98b444ae80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natan=20S=C4=85gol?= Date: Sat, 9 Jun 2018 20:02:29 +0200 Subject: [PATCH 12/12] Added spaces to multiline assignments to align with a style guide in the auth package's gulpfile. --- packages/auth/gulpfile.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/auth/gulpfile.js b/packages/auth/gulpfile.js index b6f7856c42..c55c0c394f 100644 --- a/packages/auth/gulpfile.js +++ b/packages/auth/gulpfile.js @@ -29,12 +29,12 @@ const OPTIMIZATION_LEVEL = 'ADVANCED_OPTIMIZATIONS'; // For minified builds, wrap the output so we avoid leaking global variables. const CJS_WRAPPER_PREFIX = - `(function() {var firebase = require('@firebase/app').default;`; + `(function() {var firebase = require('@firebase/app').default;`; const EMS_WRAPPER_PREFIX = `import firebase from '@firebase/app';(function() {`; const WRAPPER_SUFFIX = - `}).call(typeof global !== 'undefined' ? ` + - `global : typeof self !== 'undefined' ? ` + - `self : typeof window !== 'undefined' ? window : {});`; + `}).call(typeof global !== 'undefined' ? ` + + `global : typeof self !== 'undefined' ? ` + + `self : typeof window !== 'undefined' ? window : {});`; /* * Re-emits file variations surrounding a content of an input file with