Skip to content

Fis compat #4215

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 7 commits into from
Dec 29, 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
6 changes: 5 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["../repo-scripts/changelog-generator", { "repo": "firebase/firebase-js-sdk"}],
"changelog": [
"../repo-scripts/changelog-generator",
{ "repo": "firebase/firebase-js-sdk" }
],
"commit": false,
"linked": [],
"access": "public",
Expand All @@ -20,6 +23,7 @@
"@firebase/functions-types-exp",
"@firebase/installations-exp",
"@firebase/installations-types-exp",
"@firebase/installations-compat",
"@firebase/messaging-exp",
"@firebase/messaging-types-exp",
"@firebase/performance-exp",
Expand Down
26 changes: 26 additions & 0 deletions packages-exp/installations-compat/.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
}
};
35 changes: 35 additions & 0 deletions packages-exp/installations-compat/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 = {
...karmaBase,
// files to load into karma
files,
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha']
};

config.set(karmaConfig);
};

module.exports.files = files;
63 changes: 63 additions & 0 deletions packages-exp/installations-compat/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "@firebase/installations-compat",
"version": "0.0.900",
"private": true,
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"browser": "dist/index.esm.js",
"esm2017": "dist/index.esm2017.js",
"typings": "dist/installations-compat.d.ts",
"license": "Apache-2.0",
"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",
"build:deps": "lerna run --scope @firebase/installations-compat --include-dependencies build",
"build:release": "rollup -c rollup.config.release.js",
"dev": "rollup -c -w",
"test": "yarn type-check && yarn test:karma && yarn lint",
"test:ci": "node ../../scripts/run_tests_in_ci.js",
"test:karma": "karma start --single-run",
"test:debug": "karma start --browsers=Chrome --auto-watch",
"type-check": "tsc -p . --noEmit",
"serve": "yarn serve:build && yarn serve:host",
"serve:build": "rollup -c test-app/rollup.config.js",
"serve:host": "http-server -c-1 test-app",
"prepare": "yarn build:release",
"api-report": "api-extractor run --local --verbose",
"predoc": "node ../../scripts/exp/remove-exp.js temp",
"doc": "api-documenter markdown --input temp --output docs",
"build:doc": "yarn build && yarn doc"
},
"repository": {
"directory": "packages-exp/installations-compat",
"type": "git",
"url": "https://github.com/firebase/firebase-js-sdk.git"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"devDependencies": {
"@firebase/app-compat": "0.0.900",
"rollup": "2.33.2",
"@rollup/plugin-commonjs": "15.1.0",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "9.0.0",
"rollup-plugin-typescript2": "0.29.0",
"rollup-plugin-uglify": "6.0.4",
"typescript": "4.0.5"
},
"peerDependencies": {
"@firebase/app-compat": "0.x"
},
"dependencies": {
"@firebase/installations-exp": "0.0.900",
"@firebase/installations-types-exp": "0.0.900",
"@firebase/util": "0.3.4",
"@firebase/component": "0.1.21",
"idb": "3.0.2",
"tslib": "^1.11.1"
}
}
53 changes: 53 additions & 0 deletions packages-exp/installations-compat/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* @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 json from '@rollup/plugin-json';
import typescriptPlugin from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import { es2017BuildsNoPlugin, es5BuildsNoPlugin } from './rollup.shared';

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

const es5Builds = es5BuildsNoPlugin.map(build => ({
...build,
plugins: es5BuildPlugins
}));

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

const es2017Builds = es2017BuildsNoPlugin.map(build => ({
...build,
plugins: es2017BuildPlugins
}));

export default [...es5Builds, ...es2017Builds];
71 changes: 71 additions & 0 deletions packages-exp/installations-compat/rollup.config.release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* @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 json from '@rollup/plugin-json';
import typescriptPlugin from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path';
import { es2017BuildsNoPlugin, es5BuildsNoPlugin } from './rollup.shared';

/**
* ES5 Builds
*/
const es5BuildPlugins = [
typescriptPlugin({
typescript,
clean: true,
abortOnError: false,
transformers: [importPathTransformer]
}),
json()
];

const es5Builds = es5BuildsNoPlugin.map(build => ({
...build,
plugins: es5BuildPlugins,
treeshake: {
moduleSideEffects: false
}
}));

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

const es2017Builds = es2017BuildsNoPlugin.map(build => ({
...build,
plugins: es2017BuildPlugins,
treeshake: {
moduleSideEffects: false
}
}));

export default [...es5Builds, ...es2017Builds];
48 changes: 48 additions & 0 deletions packages-exp/installations-compat/rollup.shared.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @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 pkg from './package.json';

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

/**
* ES5 Builds
*/
export const es5BuildsNoPlugin = [
{
input: 'src/index.ts',
output: [
{ file: pkg.main, format: 'cjs', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true }
],
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
}
];

/**
* ES2017 Builds
*/
export const es2017BuildsNoPlugin = [
{
input: 'src/index.ts',
output: {
file: pkg.esm2017,
format: 'es',
sourcemap: true
},
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
}
];
51 changes: 51 additions & 0 deletions packages-exp/installations-compat/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @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 { firebase } from '@firebase/app-compat';
import { name, version } from '../package.json';
import { _FirebaseNamespace } from '@firebase/app-types/private';
import { Component, ComponentType } from '@firebase/component';
import { FirebaseInstallations as FirebaseInstallationsCompat } from '@firebase/installations-types';
import { FirebaseApp } from '@firebase/app-types';
import { InstallationsCompat } from './installationsCompat';

declare module '@firebase/component' {
interface NameServiceMapping {
'app-compat': FirebaseApp;
'installations-compat': FirebaseInstallationsCompat;
}
}

function registerInstallations(instance: _FirebaseNamespace): void {
instance.INTERNAL.registerComponent(
new Component(
'installations-compat',
container => {
const app = container.getProvider('app-compat').getImmediate()!;
const installations = container
.getProvider('installations-exp')
.getImmediate()!;
return new InstallationsCompat(app, installations);
},
ComponentType.PUBLIC
)
);

instance.registerVersion(name, version);
}

registerInstallations(firebase as _FirebaseNamespace);
Loading