Skip to content
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

Merged
merged 17 commits into from
Jun 11, 2018

Conversation

merlinnot
Copy link
Contributor

@merlinnot merlinnot commented May 14, 2018

Resolves #818

There is no changelog entry 'cause I couldn't find it ;)

@merlinnot
Copy link
Contributor Author

Travis probably needs a retry.

@merlinnot
Copy link
Contributor Author

May I kindly ask for a review?

@bojeil-google
Copy link
Contributor

Hey @merlinnot, thanks for your contribution. I reran the tests several times and they are all failing. Please fix and I can help review.

@merlinnot
Copy link
Contributor Author

I will take a look in the evening.

@merlinnot
Copy link
Contributor Author

Travis build: #818 (comment)

@merlinnot
Copy link
Contributor Author

@bojeil-google test are passing, I'd appreciate a review :)

Copy link
Contributor

@bojeil-google bojeil-google left a 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 {
Copy link
Contributor

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"
)
Copy link
Contributor

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

}).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 : {});`;
Copy link
Contributor

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.

@@ -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',
Copy link
Contributor

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.

app.use('/node_modules', express.static(path.resolve(__dirname, '../../node_modules')));
app.use(
'/node_modules',
express.static(path.resolve(__dirname, '../../node_modules'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent 2 additional spaces.

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')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent 2 additional spaces.

}
}))
.pipe(
closureCompiler({
Copy link
Contributor

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.

'externs/grecaptcha.js',
'externs/gapi.iframes.js',
path.resolve(
__dirname,
Copy link
Contributor

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(.

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) {
Copy link
Contributor

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.

@merlinnot
Copy link
Contributor Author

Thanks for the review, gonna take care of it tomorrow.

@merlinnot
Copy link
Contributor Author

@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.

Copy link
Contributor

@bojeil-google bojeil-google left a 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.

@@ -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;`;
Copy link
Contributor

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';

const WRAPPER_SUFFIX =
`}).call(typeof global !== 'undefined' ? ` +
`global : typeof self !== 'undefined' ? ` +
`self : typeof window !== 'undefined' ? window : {});`;
Copy link
Contributor

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';

@merlinnot
Copy link
Contributor Author

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!

@bojeil-google bojeil-google merged commit f2a4472 into firebase:master Jun 11, 2018
@merlinnot merlinnot deleted the fix-issue-818 branch June 11, 2018 10:08
@firebase firebase locked and limited conversation to collaborators Oct 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auth: ES modules build
3 participants