Skip to content

Commit 7611406

Browse files
committed
Remove unneeded types from public util typings.
1 parent 14ccbad commit 7611406

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.changeset/fluffy-seahorses-thank.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/util': patch
3+
---
4+
5+
Remove unneeded types from public typings file.

packages/util/generate-public-dts.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* @license
3+
* Copyright 2022 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/* eslint-disable @typescript-eslint/no-require-imports */
19+
20+
/**
21+
* @fileoverview
22+
* Strip indexeddb types from typings before publishing, to
23+
* prevent errors for Node users.
24+
*/
25+
const { readFileSync, writeFileSync } = require('fs');
26+
27+
const typingsText = readFileSync('./dist/index.d.ts', 'utf-8');
28+
const newText = typingsText.replace(`export * from './src/indexeddb';`, '');
29+
writeFileSync('./dist/index-public.d.ts', newText, { encoding: 'utf-8' });

packages/util/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
3333
"test:all": "run-p test:browser test:node",
3434
"test:browser": "karma start --single-run",
35-
"test:node": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --config ../../config/mocharc.node.js"
35+
"test:node": "TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha test/**/*.test.* --config ../../config/mocharc.node.js",
36+
"typings:public": "ts-node generate-public-dts.ts && node ../../scripts/build/use_typings.js ./dist/index-public.d.ts"
3637
},
3738
"license": "Apache-2.0",
3839
"dependencies": {

0 commit comments

Comments
 (0)