Skip to content

Commit 74844d4

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 fa6de71 commit 74844d4

File tree

7 files changed

+18
-37
lines changed

7 files changed

+18
-37
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/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
@@ -12027,6 +12027,13 @@ [email protected]:
1202712027
dependencies:
1202812028
fs-extra "^5.0.0"
1202912029

12030+
12031+
version "4.0.0"
12032+
resolved "https://registry.npmjs.org/rollup-plugin-json/-/rollup-plugin-json-4.0.0.tgz#a18da0a4b30bf5ca1ee76ddb1422afbb84ae2b9e"
12033+
integrity sha512-hgb8N7Cgfw5SZAkb3jf0QXii6QX/FOkiIq2M7BAQIEydjHvTyxXHQiIzZaTFgx1GK0cRCHOCBHIyEkkLdWKxow==
12034+
dependencies:
12035+
rollup-pluginutils "^2.5.0"
12036+
1203012037
1203112038
version "0.8.1"
1203212039
resolved "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-0.8.1.tgz#cdcfee2a32f27790e5019a2a7abd9234476ac589"
@@ -12102,7 +12109,7 @@ [email protected], rollup-pluginutils@^2.0.1:
1210212109
estree-walker "^0.6.0"
1210312110
micromatch "^3.1.10"
1210412111

12105-
rollup-pluginutils@^2.6.0:
12112+
rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0:
1210612113
version "2.6.0"
1210712114
resolved "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.6.0.tgz#203706edd43dfafeaebc355d7351119402fc83ad"
1210812115
integrity sha512-aGQwspEF8oPKvg37u3p7h0cYNwmJR1sCBMZGZ5b9qy8HGtETknqjzcxrDRrcAnJNXN18lBH4Q9vZYth/p4n8jQ==

0 commit comments

Comments
 (0)