Skip to content

Remote Config Modularization #3975

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 13 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from 8 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
48 changes: 48 additions & 0 deletions common/api-review/remote-config-exp.api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## API Report File for "@firebase/remote-config-exp"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import { FirebaseApp } from '@firebase/app-types-exp';
import { LogLevel } from '@firebase/remote-config-types-exp';
import { RemoteConfig } from '@firebase/remote-config-types-exp';
import { Value } from '@firebase/remote-config-types-exp';

// @public (undocumented)
export function activate(remoteConfig: RemoteConfig): Promise<boolean>;

// @public (undocumented)
export function ensureInitialized(remoteConfig: RemoteConfig): Promise<void>;

// @public (undocumented)
export function fetchAndActivate(remoteConfig: RemoteConfig): Promise<boolean>;

// @public (undocumented)
export function fetchConfig(remoteConfig: RemoteConfig): Promise<void>;

// @public (undocumented)
export function getAll(remoteConfig: RemoteConfig): Record<string, Value>;
Copy link

@erikeldridge erikeldridge Oct 26, 2020

Choose a reason for hiding this comment

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

Copy link
Member Author

@Feiyang1 Feiyang1 Oct 28, 2020

Choose a reason for hiding this comment

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

It's an alias of { [key:string]: Value}. The only reason to use it is it is shorter.

Choose a reason for hiding this comment

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

👍 Good to know. Thx


// @public (undocumented)
export function getBoolean(remoteConfig: RemoteConfig, key: string): boolean;

// @public (undocumented)
export function getNumber(remoteConfig: RemoteConfig, key: string): number;

// @public (undocumented)
export function getRemoteConfig(app: FirebaseApp): RemoteConfig;

// @public (undocumented)
export function getString(remoteConfig: RemoteConfig, key: string): string;

// @public (undocumented)
export function getValue(remoteConfig: RemoteConfig, key: string): Value;

// @public (undocumented)
export function setLogLevel(remoteConfig: RemoteConfig, logLevel: LogLevel): void;


// (No @packageDocumentation comment for this package)

```
6 changes: 3 additions & 3 deletions config/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ module.exports = {
}
}
},
/**
* Transform firebase packages to cjs, so they can be stubbed in tests
*/
{
test: /\.js$/,
include: function (modulePath) {
const match = /node_modules\/@firebase.*/.test(modulePath);
if (match) {
console.log('modulePath', modulePath, match);
}
return match;
},
use: {
Expand Down
26 changes: 26 additions & 0 deletions packages-exp/remote-config-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
}
};
1 change: 1 addition & 0 deletions packages-exp/remote-config-exp/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This file is left intentionally blank
39 changes: 39 additions & 0 deletions packages-exp/remote-config-exp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# @firebase/remote-config

## 0.1.28

### Patch Changes

- [`fb3b095e4`](https://github.com/firebase/firebase-js-sdk/commit/fb3b095e4b7c8f57fdb3172bc039c84576abf290) [#2800](https://github.com/firebase/firebase-js-sdk/pull/2800) - Moved `calculateBackoffMillis()` exponential backoff function to util and have remote-config
import it from util.
- Updated dependencies [[`da1c7df79`](https://github.com/firebase/firebase-js-sdk/commit/da1c7df7982b08bbef82fcc8d93255f3e2d23cca), [`fb3b095e4`](https://github.com/firebase/firebase-js-sdk/commit/fb3b095e4b7c8f57fdb3172bc039c84576abf290)]:
- @firebase/[email protected]
- @firebase/[email protected]
- @firebase/[email protected]

## 0.1.27

### Patch Changes

- Updated dependencies [[`d4ca3da0`](https://github.com/firebase/firebase-js-sdk/commit/d4ca3da0a59fcea1261ba69d7eb663bba38d3089)]:
- @firebase/[email protected]
- @firebase/[email protected]
- @firebase/[email protected]

## 0.1.26

### Patch Changes

- Updated dependencies [[`a87676b8`](https://github.com/firebase/firebase-js-sdk/commit/a87676b84b78ccc2f057a22eb947a5d13402949c)]:
- @firebase/[email protected]
- @firebase/[email protected]
- @firebase/[email protected]

## 0.1.25

### Patch Changes

- Updated dependencies [[`a754645e`](https://github.com/firebase/firebase-js-sdk/commit/a754645ec2be1b8c205f25f510196eee298b0d6e)]:
- @firebase/[email protected]
- @firebase/[email protected]
- @firebase/[email protected]
27 changes: 27 additions & 0 deletions packages-exp/remote-config-exp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# @firebase/remote-config

This is the [Remote Config](https://firebase.google.com/docs/remote-config/) component of the
[Firebase JS SDK](https://www.npmjs.com/package/firebase).

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

## Contributing

Setup:

1. Run `yarn` in repo root

Format:

1. Run `yarn prettier` in RC package

Unit test:

1. Run `yarn test` in RC package

End-to-end test:

1. Run `yarn build` in RC package
1. Run `yarn build` in Firebase package
1. Open test_app/index.html in a browser
8 changes: 8 additions & 0 deletions packages-exp/remote-config-exp/api-extractor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../config/api-extractor.json",
// Point it to your entry point d.ts file.
"mainEntryPointFilePath": "<projectFolder>/dist/src/index.d.ts",
"dtsRollup": {
"enabled": true
}
}
36 changes: 36 additions & 0 deletions packages-exp/remote-config-exp/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @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 karma = require('karma');
const path = require('path');
const karmaBase = require('../../config/karma.base');

const files = [`test/**/*`];

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

config.set(karmaConfig);
};

module.exports.files = files;
64 changes: 64 additions & 0 deletions packages-exp/remote-config-exp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@firebase/remote-config-exp",
"version": "0.0.800",
"description": "The Remote Config package of the Firebase JS SDK",
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
"private": true,
"main": "dist/index.cjs.js",
"browser": "dist/index.esm.js",
"module": "dist/index.esm.js",
"esm2017": "dist/index.esm2017.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 && yarn api-report",
"build:deps": "lerna run --scope @firebase/remote-config-exp --include-dependencies build",
"build:release": "rollup -c rollup.config.release.js && yarn api-report",
"dev": "rollup -c -w",
"test": "run-p lint test:browser",
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser",
"test:browser": "karma start --single-run",
"test:debug": "karma start --browsers=Chrome --auto-watch",
"prettier": "prettier --write '{src,test}/**/*.{js,ts}'",
"prepare": "yarn build",
"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"
},
"peerDependencies": {
"@firebase/app-exp": "0.x",
"@firebase/app-types-exp": "0.x"
},
"dependencies": {
"@firebase/installations-exp": "0.0.800",
"@firebase/logger": "0.2.6",
"@firebase/remote-config-types-exp": "0.0.800",
"@firebase/util": "0.3.2",
"@firebase/component": "0.1.19",
"tslib": "^1.11.1"
},
"license": "Apache-2.0",
"devDependencies": {
"@firebase/app-exp": "0.0.800",
"rollup": "2.29.0",
"rollup-plugin-typescript2": "0.27.3",
"typescript": "4.0.2"
},
"repository": {
"directory": "packages/remote-config",
"type": "git",
"url": "https://github.com/firebase/firebase-js-sdk.git"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"typings": "dist/remote-config-exp.d.ts",
"nyc": {
"extension": [
".ts"
],
"reportDir": "./coverage/node"
}
}
58 changes: 58 additions & 0 deletions packages-exp/remote-config-exp/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* @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'; // Enables package.json import in TypeScript.
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];
Loading