Skip to content

Commit 3c7d84a

Browse files
Feiyang1mmermerkaya
authored andcommitted
import package.json for version directly (#1775)
* import package.json for version * [AUTOMATED]: Prettier Code Styling * use var in es5 build
1 parent b48126c commit 3c7d84a

File tree

9 files changed

+18
-62
lines changed

9 files changed

+18
-62
lines changed

packages/app/declarations.d.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"rollup": "1.11.0",
5353
"rollup-plugin-replace": "2.2.0",
5454
"rollup-plugin-typescript2": "0.21.0",
55+
"rollup-plugin-json": "4.0.0",
5556
"sinon": "7.3.2",
5657
"source-map-loader": "0.2.4",
5758
"ts-loader": "5.4.5",

packages/app/rollup.config.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
*/
1717

1818
import typescriptPlugin from 'rollup-plugin-typescript2';
19-
import replace from 'rollup-plugin-replace';
19+
import json from 'rollup-plugin-json';
2020
import typescript from 'typescript';
2121
import pkg from './package.json';
2222

23-
import firebasePkg from '../firebase/package.json';
24-
2523
const deps = Object.keys(
2624
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
2725
);
@@ -33,12 +31,7 @@ const es5BuildPlugins = [
3331
typescriptPlugin({
3432
typescript
3533
}),
36-
replace({
37-
delimiters: ['__', '__'],
38-
values: {
39-
JSCORE_VERSION: JSON.stringify(firebasePkg.version)
40-
}
41-
})
34+
json()
4235
];
4336

4437
const es5Builds = [
@@ -98,11 +91,8 @@ const es2017BuildPlugins = [
9891
}
9992
}
10093
}),
101-
replace({
102-
delimiters: ['__', '__'],
103-
values: {
104-
JSCORE_VERSION: JSON.stringify(firebasePkg.version)
105-
}
94+
json({
95+
preferConst: true
10696
})
10797
];
10898

packages/app/src/firebaseNamespaceCore.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { FirebaseAppImpl } from './firebaseApp';
3434
import { error, AppError } from './errors';
3535
import { FirebaseAppLiteImpl } from './lite/firebaseAppLite';
3636
import { DEFAULT_ENTRY_NAME } from './constants';
37+
import { version } from '../../firebase/package.json';
3738

3839
function contains(obj: object, key: string) {
3940
return Object.prototype.hasOwnProperty.call(obj, key);
@@ -62,7 +63,7 @@ export function createFirebaseNamespaceCore(
6263
initializeApp: initializeApp,
6364
app: app as any,
6465
apps: null as any,
65-
SDK_VERSION: __JSCORE_VERSION__,
66+
SDK_VERSION: version,
6667
INTERNAL: {
6768
registerService,
6869
removeApp,

packages/app/src/lite/firebaseNamespaceLite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { createFirebaseNamespaceCore } from '../firebaseNamespaceCore';
2828
export function createFirebaseNamespaceLite(): FirebaseNamespace {
2929
const namespace = createFirebaseNamespaceCore(FirebaseAppLiteImpl);
3030

31-
namespace.SDK_VERSION = `${__JSCORE_VERSION__}_LITE`;
31+
namespace.SDK_VERSION = `${namespace.SDK_VERSION}_LITE`;
3232

3333
const registerService = (namespace as _FirebaseNamespace).INTERNAL
3434
.registerService;

packages/app/test/firebaseApp.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
import './setup';
19-
2018
import { FirebaseApp, FirebaseNamespace } from '@firebase/app-types';
2119
import {
2220
_FirebaseApp,

packages/app/test/setup.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/app/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "../../config/tsconfig.base.json",
33
"compilerOptions": {
4-
"outDir": "dist"
4+
"outDir": "dist",
5+
"resolveJsonModule": true
56
},
67
"exclude": [
78
"dist/**/*"

yarn.lock

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11964,6 +11964,13 @@ [email protected]:
1196411964
dependencies:
1196511965
fs-extra "^5.0.0"
1196611966

11967+
11968+
version "4.0.0"
11969+
resolved "https://registry.npmjs.org/rollup-plugin-json/-/rollup-plugin-json-4.0.0.tgz#a18da0a4b30bf5ca1ee76ddb1422afbb84ae2b9e"
11970+
integrity sha512-hgb8N7Cgfw5SZAkb3jf0QXii6QX/FOkiIq2M7BAQIEydjHvTyxXHQiIzZaTFgx1GK0cRCHOCBHIyEkkLdWKxow==
11971+
dependencies:
11972+
rollup-pluginutils "^2.5.0"
11973+
1196711974
1196811975
version "0.8.1"
1196911976
resolved "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-0.8.1.tgz#cdcfee2a32f27790e5019a2a7abd9234476ac589"
@@ -12039,7 +12046,7 @@ [email protected], rollup-pluginutils@^2.0.1:
1203912046
estree-walker "^0.6.0"
1204012047
micromatch "^3.1.10"
1204112048

12042-
rollup-pluginutils@^2.6.0:
12049+
rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0:
1204312050
version "2.6.0"
1204412051
resolved "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.6.0.tgz#203706edd43dfafeaebc355d7351119402fc83ad"
1204512052
integrity sha512-aGQwspEF8oPKvg37u3p7h0cYNwmJR1sCBMZGZ5b9qy8HGtETknqjzcxrDRrcAnJNXN18lBH4Q9vZYth/p4n8jQ==

0 commit comments

Comments
 (0)