-
Notifications
You must be signed in to change notification settings - Fork 927
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
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b809c8d
rc exp init
Feiyang1 6e0b16f
Add apis
Feiyang1 fba771f
register rc exp
Feiyang1 3e314a7
implement funcitonal APIs
Feiyang1 77bf463
fix tests
Feiyang1 0e32757
Merge branch 'master' into fei-rc-exp
Feiyang1 e87a19a
build rc exp
Feiyang1 8ac9014
add api-extractor to rc types
Feiyang1 c930b4d
cast directly witout function
Feiyang1 0181236
delete changelog for rc exp
Feiyang1 deaa127
add code owners to rc exp
Feiyang1 864488b
update dep version
Feiyang1 f408d8d
Merge branch 'master' into fei-rc-exp
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,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>; | ||
|
||
// @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) | ||
|
||
``` |
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 @@ | ||
# This file is left intentionally blank |
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,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 |
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,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 | ||
} | ||
} |
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,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; |
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,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" | ||
} | ||
} |
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,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]; |
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,73 @@ | ||
/** | ||
* @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 { 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]; |
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.
The return type before was
object
:https://github.com/firebase/firebase-js-sdk/blob/master/packages/remote-config-types/index.d.ts#L68 -> https://firebase.google.com/docs/reference/js/firebase.remoteconfig.RemoteConfig#getall
Using
{ [key: string]: Value }
still seems idiomatic:https://www.typescriptlang.org/docs/handbook/interfaces.html#indexable-types
What's the value of using
Record
?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.
It's an alias of
{ [key:string]: Value}
. The only reason to use it is it is shorter.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.
👍 Good to know. Thx