Skip to content

@firebase/app modularization #2836

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 23 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"npmClient": "yarn",
"packages": [
"packages/*",
"packages-exp/*",
"integration/*"
],
"useWorkspaces": true
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
"scripts": {
"dev": "lerna run --parallel --scope @firebase/* --scope firebase --scope rxfire dev",
"build": "lerna run --scope @firebase/* --scope firebase --scope rxfire prepare",
"build:exp": "lerna run --scope @firebase/*-exp prepare",
"link:packages": "lerna exec --scope @firebase/* --scope firebase --scope rxfire -- yarn link",
"stage:packages": "./scripts/prepublish.sh",
"repl": "node tools/repl.js",
"release": "node scripts/release/cli.js",
"pretest": "node tools/pretest.js",
"test": "lerna run --concurrency 4 --stream test",
"test:exp": "lerna run --concurrency 4 --stream --scope @firebase/*-exp test",
"pretest:coverage": "mkdirp coverage",
"ci:coverage": "lcov-result-merger 'packages/**/lcov.info' 'lcov-all.info'",
"test:coverage": "lcov-result-merger 'packages/**/lcov.info' | coveralls",
Expand All @@ -45,6 +47,7 @@
},
"workspaces": [
"packages/*",
"packages-exp/*",
"integration/*"
],
"devDependencies": {
Expand Down Expand Up @@ -96,6 +99,7 @@
"lcov-result-merger": "3.1.0",
"lerna": "3.20.2",
"listr": "0.14.3",
"lodash": "4.17.15",
"long": "3.2.0",
"merge2": "1.3.0",
"mkdirp": "0.5.3",
Expand All @@ -113,16 +117,15 @@
"sinon": "9.0.1",
"sinon-chai": "3.5.0",
"source-map-loader": "0.2.4",
"terser": "4.6.7",
"ts-loader": "6.2.1",
"ts-node": "8.6.2",
"tslint": "6.1.0",
"typedoc": "0.16.11",
"typescript": "3.8.3",
"watch": "1.0.2",
"webpack": "4.42.0",
"yargs": "15.3.1",
"lodash": "4.17.15",
"terser": "4.6.7"
"yargs": "15.3.1"
},
"husky": {
"hooks": {
Expand Down
26 changes: 26 additions & 0 deletions packages-exp/app-exp/.eslintrc.js
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
}
};
5 changes: 5 additions & 0 deletions packages-exp/app-exp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @firebase/app-exp

This package coordinates the communication between the different Firebase components

**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**
8 changes: 8 additions & 0 deletions packages-exp/app-exp/internal/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@firebase/app-exp/internal",
"main": "../dist/cjs/internal.js",
"browser": "../dist/esm5/internal.js",
"module": "../dist/esm5/internal.js",
"esm2017": "../dist/esm2017/internal.js",
"typings": "../dist/esm5/packages-exp/app-exp/src/internal.d.ts"
}
35 changes: 35 additions & 0 deletions packages-exp/app-exp/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @license
* Copyright 2019 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.
*/

const karmaBase = require('../../config/karma.base');

const files = ['src/**/*.test.ts'];

module.exports = function(config) {
const karmaConfig = Object.assign({}, karmaBase, {
// files to load into karma
files: files,
preprocessors: { '**/*.ts': ['webpack', 'sourcemap'] },
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha']
});

config.set(karmaConfig);
};

module.exports.files = files;
55 changes: 55 additions & 0 deletions packages-exp/app-exp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@firebase/app-exp",
"version": "0.800.0",
"private": true,
"description": "FirebaseApp",
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
"main": "dist/cjs/index.js",
"browser": "dist/esm5/index.js",
"module": "dist/esm5/index.js",
"esm2017": "dist/esm2017/index.js",
"files": [
"dist"
],
"scripts": {
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"build": "rollup -c",
"dev": "rollup -c -w",
"test": "yarn type-check && run-p lint test:browser test:node",
"test:browser": "karma start --single-run",
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.ts --opts ../../config/mocha.node.opts",
"type-check": "tsc -p . --noEmit",
"prepare": "yarn build"
},
"dependencies": {
"@firebase/app-types-exp": "0.800.0",
"@firebase/util": "0.2.43",
"@firebase/logger": "0.2.0",
"@firebase/component": "0.1.8",
"tslib": "1.11.1"
},
"license": "Apache-2.0",
"devDependencies": {
"rollup": "1.32.1",
"rollup-plugin-json": "4.0.0",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-typescript2": "0.26.0",
"typescript": "3.8.3"
},
"repository": {
"directory": "packages-exp/app-exp",
"type": "git",
"url": "https://github.com/firebase/firebase-js-sdk.git"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"typings": "dist/esm5/packages-exp/app-exp/src/index.d.ts",
"nyc": {
"extension": [
".ts"
],
"reportDir": "./coverage/node"
}
}
100 changes: 100 additions & 0 deletions packages-exp/app-exp/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* @license
* Copyright 2019 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 typescriptPlugin from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import json from 'rollup-plugin-json';
import pkg from './package.json';

const deps = Object.keys(
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
);

/**
* ES5 Builds
*/
const es5BuildPlugins = [
typescriptPlugin({
typescript
}),
json()
];

const es5Builds = [
/**
* Browser Builds
*/
{
input: {
index: 'src/index.ts',
internal: 'src/internal.ts'
},
output: [{ dir: 'dist/esm5', format: 'es', sourcemap: true }],
plugins: es5BuildPlugins,
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
},
/**
* Node.js Build
*/
{
input: {
index: 'src/index.ts',
internal: 'src/internal.ts'
},
output: [{ dir: 'dist/cjs', format: 'cjs', sourcemap: true }],
plugins: es5BuildPlugins,
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
}
];

/**
* ES2017 Builds
*/
const es2017BuildPlugins = [
typescriptPlugin({
typescript,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
}
}
}),
json({
preferConst: true
})
];

const es2017Builds = [
/**
* Browser Builds
*/
{
input: {
index: 'src/index.ts',
internal: 'src/internal.ts'
},
output: {
dir: 'dist/esm2017',
format: 'es',
sourcemap: true
},
plugins: es2017BuildPlugins,
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
}
];

export default [...es5Builds, ...es2017Builds];
Loading