-
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
Added ES module bundle to the auth package #819
Conversation
Travis probably needs a retry. |
May I kindly ask for a review? |
Hey @merlinnot, thanks for your contribution. I reran the tests several times and they are all failing. Please fix and I can help review. |
I will take a look in the evening. |
Travis build: #818 (comment) |
Issue was caused by getting a PID of a command creation, rather than the command itself.
The new name should better reflect the purpose of a function.
@bojeil-google test are passing, I'd appreciate a review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. I just have a bunch of requests for additional explanations and some style nits.
"./node_modules/.bin" | ||
"../../node_modules/.bin" | ||
) | ||
function evalModule { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare javadoc or some guidance on this function's usage/signature.
declare -a nodeModulesBasedirs=( | ||
"./node_modules/.bin" | ||
"../../node_modules/.bin" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add new line after this
packages/auth/gulpfile.js
Outdated
}).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 : {});`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. Split into multiple lines.
packages/auth/gulpfile.js
Outdated
@@ -75,11 +105,13 @@ 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', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent 2 additional spaces. Style guide recommendations is to indent 4 spaces for function arguments that spill over to next line.
packages/auth/gulpfile.js
Outdated
app.use('/node_modules', express.static(path.resolve(__dirname, '../../node_modules'))); | ||
app.use( | ||
'/node_modules', | ||
express.static(path.resolve(__dirname, '../../node_modules')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent 2 additional spaces.
packages/auth/gulpfile.js
Outdated
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent 2 additional spaces.
packages/auth/gulpfile.js
Outdated
} | ||
})) | ||
.pipe( | ||
closureCompiler({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent entire block 2 additional spaces.
packages/auth/gulpfile.js
Outdated
'externs/grecaptcha.js', | ||
'externs/gapi.iframes.js', | ||
path.resolve( | ||
__dirname, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both arguments need 2 additional spaces, here and below for each path.resolve(
.
packages/auth/gulpfile.js
Outdated
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment or javadoc to explain what this function does.
Thanks for the review, gonna take care of it tomorrow. |
package's gulpfile.
@bojeil-google sorry for not aligning with a style guide, it's hard to match all of the criteria when you use other standards on a daily basis. I've fixed the issues you've mentioned and one additional call to align with the rule you've pointed out. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes! 2 more nits. You are right we should document our style guide. We'll look into it.
packages/auth/gulpfile.js
Outdated
@@ -28,10 +28,18 @@ 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;`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add 2 more spaces here. (if right hand side of = is on second line)
const CJS_WRAPPER_PREFIX =
'value';
packages/auth/gulpfile.js
Outdated
const WRAPPER_SUFFIX = | ||
`}).call(typeof global !== 'undefined' ? ` + | ||
`global : typeof self !== 'undefined' ? ` + | ||
`self : typeof window !== 'undefined' ? window : {});`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here for above block:
Add 2 more spaces here. (if right hand side of = is on second line)
const WRAPPER_SUFFIX =
'value1' +
'value2';
auth package's gulpfile.
It is actually documented here, the thing that is missing is an auto-formatting tool that would check for all of these rules. It's enough to have a documentation for people who work on the project on a daily basis, but it's hard to expect from external contributors to learn all of theses rules to make a few small PRs, it's just a waste of time. A tool like Prettier (aren't you already using it in other packages?) or clang would do. Thank you for the approval! |
Resolves #818
There is no changelog entry 'cause I couldn't find it ;)