-
Notifications
You must be signed in to change notification settings - Fork 934
Add the umbrella firebase package for modular packages #2927
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fec82b6
add firebase-exp
Feiyang1 345eef6
add rollup config for generating CDN scripts
Feiyang1 1bde8a6
[AUTOMATED]: Prettier Code Styling
Feiyang1 d363476
[AUTOMATED]: License Headers
Feiyang1 9df377b
[AUTOMATED]: API Reports
Feiyang1 ae813b7
remove old files
Feiyang1 adcd637
make release rollup config for firebase package
Feiyang1 f353e02
[AUTOMATED]: Prettier Code Styling
Feiyang1 b2603e9
[AUTOMATED]: API Reports
Feiyang1 a2be6e9
add a CDN entry point, so we can collect its usage
Feiyang1 656e216
[AUTOMATED]: License Headers
Feiyang1 27df71d
fix the transformer
Feiyang1 33f4341
[AUTOMATED]: Prettier Code Styling
Feiyang1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module.exports = { | ||
extends: '../../config/.eslintrc.js', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
// to make vscode-eslint work with monorepo | ||
// https://github.com/typescript-eslint/typescript-eslint/issues/251#issuecomment-463943250 | ||
tsconfigRootDir: __dirname | ||
} | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/firebase*.js | ||
/firebase*.map | ||
/firebase*.gz | ||
/firebase*.tgz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Firebase - App success made simple | ||
|
||
## Overview | ||
|
||
TODO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { registerVersion } from '@firebase/app-exp'; | ||
import { name, version } from '../package.json'; | ||
|
||
registerVersion(name, version, 'cdn'); | ||
export * from '@firebase/app-exp'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { registerVersion } from '@firebase/app-exp'; | ||
import { name, version } from '../package.json'; | ||
|
||
registerVersion(name, version, 'app'); | ||
export * from '@firebase/app-exp'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "firebase-exp/app", | ||
"main": "dist/index.cjs.js", | ||
"browser": "dist/index.esm.js", | ||
"module": "dist/index.esm.js", | ||
"typings": "dist/app/index.d.ts" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
var gulp = require('gulp'); | ||
var concat = require('gulp-concat'); | ||
var sourcemaps = require('gulp-sourcemaps'); | ||
|
||
const OUTPUT_FILE = 'firebase.js'; | ||
const pkgJson = require('./package.json'); | ||
const files = [ | ||
...pkgJson.components.map(component => `firebase-${component}.js`) | ||
]; | ||
|
||
gulp.task('firebase-js', function() { | ||
return gulp | ||
.src(files) | ||
.pipe(sourcemaps.init({ loadMaps: true })) | ||
.pipe(concat(OUTPUT_FILE)) | ||
.pipe(sourcemaps.write('.')) | ||
.pipe(gulp.dest('.')); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "firebase-exp", | ||
"version": "0.800.0", | ||
"description": "Firebase JavaScript library for web and Node.js", | ||
"author": "Firebase <[email protected]> (https://firebase.google.com/)", | ||
"license": "Apache-2.0", | ||
"homepage": "https://firebase.google.com/", | ||
"keywords": [ | ||
"authentication", | ||
"database", | ||
"Firebase", | ||
"firebase", | ||
"realtime", | ||
"storage", | ||
"performance", | ||
"remote-config" | ||
], | ||
"files": [ | ||
"**/dist/", | ||
"**/package.json", | ||
"/firebase*.js", | ||
"/firebase*.map" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/firebase/firebase-js-sdk.git" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c && gulp firebase-js", | ||
"build:release": "rollup -c rollup.config.release.js && gulp firebase-js", | ||
"dev": "rollup -c -w", | ||
"prepare": "yarn build" | ||
}, | ||
"dependencies": { | ||
"@firebase/app-exp": "0.800.0" | ||
}, | ||
"devDependencies": { | ||
"rollup": "1.28.0", | ||
"rollup-plugin-commonjs": "10.1.0", | ||
"rollup-plugin-license": "0.13.0", | ||
"rollup-plugin-node-resolve": "5.2.0", | ||
"rollup-plugin-sourcemaps": "0.5.0", | ||
"rollup-plugin-terser": "5.1.3", | ||
"rollup-plugin-typescript2": "0.25.3", | ||
"rollup-plugin-uglify": "6.0.4", | ||
"gulp": "4.0.2", | ||
"gulp-sourcemaps": "2.6.5", | ||
"gulp-concat": "2.6.1", | ||
"typescript": "3.7.5" | ||
}, | ||
"components": [ | ||
"app" | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { resolve } from 'path'; | ||
import resolveModule from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import sourcemaps from 'rollup-plugin-sourcemaps'; | ||
import rollupTypescriptPlugin from 'rollup-plugin-typescript2'; | ||
import typescript from 'typescript'; | ||
import { uglify } from 'rollup-plugin-uglify'; | ||
import json from 'rollup-plugin-json'; | ||
import pkg from './package.json'; | ||
import appPkg from './app/package.json'; | ||
|
||
const external = Object.keys(pkg.dependencies || {}); | ||
|
||
/** | ||
* Global UMD Build | ||
*/ | ||
const GLOBAL_NAME = 'firebase'; | ||
|
||
function createUmdOutputConfig(output, componentName) { | ||
return { | ||
file: output, | ||
format: 'umd', | ||
sourcemap: true, | ||
extend: true, | ||
name: `${GLOBAL_NAME}.${componentName}`, | ||
globals: { | ||
'@firebase/app-exp': `${GLOBAL_NAME}.app` | ||
}, | ||
|
||
/** | ||
* use iife to avoid below error in the old Safari browser | ||
* SyntaxError: Functions cannot be declared in a nested block in strict mode | ||
* https://github.com/firebase/firebase-js-sdk/issues/1228 | ||
* | ||
*/ | ||
intro: ` | ||
try { | ||
(function() {`, | ||
outro: ` | ||
}).apply(this, arguments); | ||
} catch(err) { | ||
console.error(err); | ||
throw new Error( | ||
'Cannot instantiate ${output} - ' + | ||
'be sure to load firebase-app.js first.' | ||
); | ||
}` | ||
}; | ||
} | ||
|
||
const plugins = [sourcemaps(), resolveModule(), json(), commonjs()]; | ||
|
||
const typescriptPlugin = rollupTypescriptPlugin({ | ||
typescript, | ||
// Workaround for typescript plugins that use async functions. | ||
// In this case, `rollup-plugin-sourcemaps`. | ||
// See https://github.com/ezolenko/rollup-plugin-typescript2/blob/master/README.md | ||
objectHashIgnoreUnknownHack: true, | ||
// For safety, given hack above (see link). | ||
clean: true | ||
}); | ||
|
||
const typescriptPluginUMD = rollupTypescriptPlugin({ | ||
typescript, | ||
// Workaround for typescript plugins that use async functions. | ||
// In this case, `rollup-plugin-sourcemaps`. | ||
// See https://github.com/ezolenko/rollup-plugin-typescript2/blob/master/README.md | ||
objectHashIgnoreUnknownHack: true, | ||
// For safety, given hack above (see link). | ||
clean: true, | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
declaration: false | ||
} | ||
} | ||
}); | ||
|
||
/** | ||
* Individual Component Builds | ||
*/ | ||
const appBuilds = [ | ||
/** | ||
* App Browser Builds | ||
*/ | ||
{ | ||
input: 'app/index.ts', | ||
output: [ | ||
{ file: resolve('app', appPkg.main), format: 'cjs', sourcemap: true }, | ||
{ file: resolve('app', appPkg.module), format: 'es', sourcemap: true } | ||
], | ||
plugins: [...plugins, typescriptPlugin], | ||
external | ||
}, | ||
/** | ||
* App UMD Builds | ||
*/ | ||
{ | ||
input: 'app/index.cdn.ts', | ||
output: { | ||
file: 'firebase-app.js', | ||
sourcemap: true, | ||
format: 'umd', | ||
name: `${GLOBAL_NAME}.app` | ||
}, | ||
plugins: [...plugins, typescriptPluginUMD, uglify()] | ||
} | ||
]; | ||
|
||
const componentBuilds = pkg.components | ||
// The "app" component is treated differently because it doesn't depend on itself. | ||
.filter(component => component !== 'app') | ||
.map(component => { | ||
const pkg = require(`./${component}/package.json`); | ||
return [ | ||
{ | ||
input: `${component}/index.ts`, | ||
output: [ | ||
{ | ||
file: resolve(component, pkg.main), | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
{ | ||
file: resolve(component, pkg.module), | ||
format: 'es', | ||
sourcemap: true | ||
} | ||
], | ||
plugins: [...plugins, typescriptPlugin], | ||
external | ||
}, | ||
{ | ||
input: `${component}/index.ts`, | ||
output: createUmdOutputConfig(`firebase-${component}.js`, component), | ||
plugins: [...plugins, typescriptPluginUMD, uglify()], | ||
external: ['@firebase/app-exp'] | ||
} | ||
]; | ||
}) | ||
.reduce((a, b) => a.concat(b), []); | ||
|
||
export default [...appBuilds, ...componentBuilds]; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this the CDN build? Is it not going to include polyfills anymore? Should we still
registerVersion
as 'cdn' to track when this build is used?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.
Yes, it's the
firebase.js
file. I don't think we need to include polyfills for several reasons:Yup, good idea that we should keep tracking its usage. Will update.
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.
Added
packages-exp/firebase-exp/app/index.cdn.ts
. PTAL.