-
Notifications
You must be signed in to change notification settings - Fork 971
Add new Telemetry package #9214
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
+337
−0
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 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 @@ | ||
# @firebase/telemetry |
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,3 @@ | ||
# @firebase/telemetry | ||
|
||
This package provides instrumentation functionality for javascript applications. |
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,28 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 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. | ||
*/ | ||
|
||
/** | ||
* This is the file that people using Node.js will actually import. You should | ||
* only include this file if you have something specific about your | ||
* implementation that mandates having a separate entrypoint. Otherwise you can | ||
* just use index.ts | ||
*/ | ||
|
||
import { testFxn } from './src'; | ||
|
||
console.log('Hi Node.js Users!'); | ||
testFxn(); |
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,20 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 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 { testFxn } from './src'; | ||
|
||
testFxn(); |
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 2025 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; |
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,70 @@ | ||
{ | ||
"name": "@firebase/telemetry", | ||
"version": "0.0.1", | ||
"private": true, | ||
"description": "The Firebase Web Telemetry package of the Firebase JS SDK", | ||
"author": "Firebase <[email protected]> (https://firebase.google.com/)", | ||
"main": "dist/index.node.cjs.js", | ||
"browser": "dist/index.esm.js", | ||
"module": "dist/index.esm.js", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"node": { | ||
"import": "./dist/node-esm/index.node.esm.js", | ||
"require": "./dist/index.node.cjs.js" | ||
}, | ||
"browser": { | ||
"require": "./dist/index.cjs.js", | ||
"import": "./dist/index.esm.js" | ||
}, | ||
"default": "./dist/index.esm.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"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/telemetry --include-dependencies build", | ||
"dev": "rollup -c -w", | ||
"test": "run-p --npm-path npm lint test:all", | ||
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", | ||
"test:all": "run-p --npm-path npm test:browser test:node", | ||
"test:browser": "karma start", | ||
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha src/**/*.test.* --config ../../config/mocharc.node.js", | ||
"trusted-type-check": "tsec -p tsconfig.json --noEmit" | ||
}, | ||
"peerDependencies": { | ||
"@firebase/app": "0.x", | ||
"@firebase/app-types": "0.x" | ||
}, | ||
"dependencies": { | ||
"tslib": "^2.1.0" | ||
}, | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"@firebase/app": "0.14.1", | ||
"rollup": "2.79.2", | ||
"rollup-plugin-typescript2": "0.36.0", | ||
"typescript": "5.5.4" | ||
}, | ||
"repository": { | ||
"directory": "packages/telemetry", | ||
"type": "git", | ||
"url": "git+https://github.com/firebase/firebase-js-sdk.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/firebase/firebase-js-sdk/issues" | ||
}, | ||
"typings": "dist/index.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,75 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 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 pkg from './package.json'; | ||
import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file'; | ||
|
||
const deps = Object.keys( | ||
Object.assign({}, pkg.peerDependencies, pkg.dependencies) | ||
); | ||
|
||
const buildPlugins = [typescriptPlugin({ typescript })]; | ||
|
||
const browserBuilds = [ | ||
{ | ||
input: 'index.ts', | ||
output: { | ||
file: pkg.module, | ||
format: 'es', | ||
sourcemap: true | ||
}, | ||
plugins: buildPlugins, | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
}, | ||
{ | ||
input: 'index.ts', | ||
output: { | ||
file: './dist/index.cjs.js', | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
plugins: buildPlugins, | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
} | ||
]; | ||
|
||
const nodeBuilds = [ | ||
{ | ||
input: 'index.node.ts', | ||
output: { | ||
file: pkg.main, | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
plugins: buildPlugins, | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
}, | ||
{ | ||
input: 'index.node.ts', | ||
output: { | ||
file: pkg.exports['.'].node.import, | ||
format: 'es', | ||
sourcemap: true | ||
}, | ||
plugins: [...buildPlugins, emitModulePackageFile()], | ||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) | ||
} | ||
]; | ||
|
||
export default [...browserBuilds, ...nodeBuilds]; |
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,31 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 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 { expect } from 'chai'; | ||
import { testFxn } from './index'; | ||
|
||
describe('Simple test', () => { | ||
it('Should skip this test'); | ||
it('Should test this function', () => { | ||
expect(testFxn()).to.equal(42); | ||
}); | ||
it('Should test this async thing', async () => { | ||
// Do some async assertions, you can use `await` syntax if it helps | ||
const val = await Promise.resolve(42); | ||
expect(val).to.equal(42); | ||
}); | ||
}); |
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,24 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 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 { TestType } from './types/index'; | ||
|
||
export function testFxn(): number { | ||
const _thing: TestType = {}; | ||
console.log('hi'); | ||
return 42; | ||
} |
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,20 @@ | ||
/** | ||
* @license | ||
* Copyright 2025 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. | ||
*/ | ||
|
||
export interface TestType { | ||
prop?: string; | ||
} |
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 @@ | ||
{ | ||
"extends": "../../config/tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "dist" | ||
}, | ||
"exclude": ["dist/**/*"] | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.