Skip to content

Commit b4dd7dd

Browse files
authored
Merge ecae30f into b87cfd1
2 parents b87cfd1 + ecae30f commit b4dd7dd

File tree

9 files changed

+197
-96
lines changed

9 files changed

+197
-96
lines changed

packages-exp/functions-compat/src/register.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import firebase from '@firebase/app-compat';
1919
import { _FirebaseNamespace } from '@firebase/app-types/private';
2020
import { FunctionsService } from './service';
21-
import '@firebase/functions-exp';
2221
import {
2322
Component,
2423
ComponentType,

packages-exp/remote-config-compat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1414
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
1515
"build": "rollup -c",
16-
"build:release": "yarn build",
16+
"build:release": "rollup -c rollup.config.release.js",
1717
"build:deps": "lerna run --scope @firebase/remote-config-compat --include-dependencies build",
1818
"dev": "rollup -c -w",
1919
"test": "run-p lint test:all",

packages-exp/remote-config-compat/rollup.config.js

+1-34
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,7 @@
1818
import typescriptPlugin from 'rollup-plugin-typescript2';
1919
import typescript from 'typescript';
2020
import json from '@rollup/plugin-json';
21-
import pkg from './package.json';
22-
23-
const deps = Object.keys(
24-
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
25-
);
26-
27-
export const es5BuildsNoPlugin = [
28-
/**
29-
* Browser Builds
30-
*/
31-
{
32-
input: 'src/index.ts',
33-
output: [
34-
{ file: pkg.main, format: 'cjs', sourcemap: true },
35-
{ file: pkg.browser, format: 'es', sourcemap: true }
36-
],
37-
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
38-
}
39-
];
40-
41-
export const es2017BuildsNoPlugin = [
42-
/**
43-
* Browser Builds
44-
*/
45-
{
46-
input: 'src/index.ts',
47-
output: {
48-
file: pkg.esm2017,
49-
format: 'es',
50-
sourcemap: true
51-
},
52-
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
53-
}
54-
];
21+
import { es5BuildsNoPlugin, es2017BuildsNoPlugin } from './rollup.shared.js';
5522

5623
/**
5724
* ES5 Builds
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/**
2+
* @license
3+
* Copyright 2020 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+
import typescriptPlugin from 'rollup-plugin-typescript2';
19+
import typescript from 'typescript';
20+
import json from '@rollup/plugin-json';
21+
import { es5BuildsNoPlugin, es2017BuildsNoPlugin } from './rollup.shared.js';
22+
import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path';
23+
24+
/**
25+
* ES5 Builds
26+
*/
27+
const es5BuildPlugins = [
28+
typescriptPlugin({
29+
typescript,
30+
clean: true,
31+
abortOnError: false,
32+
transformers: [importPathTransformer]
33+
}),
34+
json()
35+
];
36+
37+
const es5Builds = es5BuildsNoPlugin.map(build => ({
38+
...build,
39+
plugins: es5BuildPlugins
40+
}));
41+
42+
/**
43+
* ES2017 Builds
44+
*/
45+
const es2017BuildPlugins = [
46+
typescriptPlugin({
47+
typescript,
48+
tsconfigOverride: {
49+
compilerOptions: {
50+
target: 'es2017'
51+
}
52+
},
53+
clean: true,
54+
abortOnError: false,
55+
transformers: [importPathTransformer]
56+
}),
57+
json({
58+
preferConst: true
59+
})
60+
];
61+
62+
const es2017Builds = es2017BuildsNoPlugin.map(build => ({
63+
...build,
64+
plugins: es2017BuildPlugins
65+
}));
66+
67+
export default [...es5Builds, ...es2017Builds];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* @license
3+
* Copyright 2019 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+
import pkg from './package.json';
19+
20+
const deps = Object.keys(
21+
Object.assign({}, pkg.peerDependencies, pkg.dependencies)
22+
);
23+
24+
export const es5BuildsNoPlugin = [
25+
/**
26+
* Browser Builds
27+
*/
28+
{
29+
input: 'src/index.ts',
30+
output: [
31+
{ file: pkg.main, format: 'cjs', sourcemap: true },
32+
{ file: pkg.browser, format: 'es', sourcemap: true }
33+
],
34+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
35+
}
36+
];
37+
38+
export const es2017BuildsNoPlugin = [
39+
/**
40+
* Browser Builds
41+
*/
42+
{
43+
input: 'src/index.ts',
44+
output: {
45+
file: pkg.esm2017,
46+
format: 'es',
47+
sourcemap: true
48+
},
49+
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
50+
}
51+
];

packages/firestore/api-extractor.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"extends": "../../config/api-extractor.json",
33
// Point it to your entry point d.ts file.
4-
"mainEntryPointFilePath": "<projectFolder>/exp-types/index.d.ts",
4+
"mainEntryPointFilePath": "<projectFolder>/dist/exp/index.d.ts",
55
"additionalEntryPoints": [
66
{
77
"modulePath": "lite",
8-
"filePath": "lite-types/index.d.ts"
8+
"filePath": "<projectFolder>/dist/lite/index.d.ts"
99
}
1010
]
1111
}

packages/firestore/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"api-report:exp": "(cd exp; api-extractor run --local --verbose) && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/prune-dts.ts --input dist/exp/private.d.ts --output dist/exp/index.d.ts",
1111
"api-report:lite": "(cd lite; api-extractor run --local --verbose) && TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/prune-dts.ts --input dist/lite/private.d.ts --output dist/lite/index.d.ts",
1212
"bundle": "rollup -c",
13-
"prebuild": "tsc --emitDeclarationOnly --declaration -p tsconfig.json && run-p api-report:exp api-report:lite",
13+
"prebuild": "tsc --emitDeclarationOnly --declaration -p tsconfig.json; run-p api-report:exp api-report:lite",
1414
"build": "run-p 'bundle rollup.config.browser.js' 'bundle rollup.config.browser.memory.js' 'bundle rollup.config.node.js' 'bundle rollup.config.node.memory.js' 'bundle rollup.config.rn.js' 'bundle rollup.config.rn.memory.js' build:lite build:exp",
1515
"build:scripts": "tsc -moduleResolution node --module commonjs scripts/*.ts && ls scripts/*.js | xargs -I % sh -c 'terser % -o %'",
1616
"prebuild:release": "yarn prebuild",
@@ -20,6 +20,7 @@
2020
"build:exp": "rollup -c rollup.config.exp.js",
2121
"build:lite": "rollup -c rollup.config.lite.js",
2222
"build:exp:release": "yarn build:exp && yarn build:lite",
23+
"postbuild:exp:release": "node ../../scripts/exp/remove-exp.js dist/exp/index.d.ts && node ../../scripts/exp/remove-exp.js dist/lite/index.d.ts",
2324
"predev": "yarn prebuild",
2425
"dev": "rollup -c -w",
2526
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
@@ -44,7 +45,6 @@
4445
"test:node:persistence:prod": "node ./scripts/run-tests.js --main=index.node.ts --persistence 'test/{,!(browser)/**/}*.test.ts'",
4546
"test:travis": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/firestore-test-runner.ts",
4647
"test:minified": "(cd ../../integration/firestore ; yarn test)",
47-
"prepare": "yarn build:release",
4848
"api-report": "api-extractor run --local --verbose",
4949
"predoc": "node ../../scripts/exp/remove-exp.js temp",
5050
"doc": "api-documenter markdown --input temp --output docs"

packages/firestore/rollup.config.lite.js

+53-53
Original file line numberDiff line numberDiff line change
@@ -78,45 +78,45 @@ const browserPlugins = [
7878

7979
const allBuilds = [
8080
// Node ESM build
81-
{
82-
input: './lite/index.ts',
83-
output: {
84-
file: path.resolve('./lite', pkg['main-esm']),
85-
format: 'es',
86-
sourcemap: true
87-
},
88-
plugins: [alias(util.generateAliasConfig('node_lite')), ...nodePlugins],
89-
external: util.resolveNodeExterns,
90-
treeshake: {
91-
moduleSideEffects: false
92-
}
93-
},
94-
// Node UMD build
95-
{
96-
input: path.resolve('./lite', pkg['main-esm']),
97-
output: {
98-
file: path.resolve('./lite', pkg.main),
99-
format: 'umd',
100-
name: 'firebase.firestore',
101-
sourcemap: true
102-
},
103-
plugins: [
104-
typescriptPlugin({
105-
typescript,
106-
compilerOptions: {
107-
allowJs: true,
108-
target: 'es5'
109-
},
110-
include: ['dist/lite/*.js']
111-
}),
112-
json(),
113-
sourcemaps()
114-
],
115-
external: util.resolveNodeExterns,
116-
treeshake: {
117-
moduleSideEffects: false
118-
}
119-
},
81+
// {
82+
// input: './lite/index.ts',
83+
// output: {
84+
// file: path.resolve('./lite', pkg['main-esm']),
85+
// format: 'es',
86+
// sourcemap: true
87+
// },
88+
// plugins: [alias(util.generateAliasConfig('node_lite')), ...nodePlugins],
89+
// external: util.resolveNodeExterns,
90+
// treeshake: {
91+
// moduleSideEffects: false
92+
// }
93+
// },
94+
// // Node UMD build
95+
// {
96+
// input: path.resolve('./lite', pkg['main-esm']),
97+
// output: {
98+
// file: path.resolve('./lite', pkg.main),
99+
// format: 'umd',
100+
// name: 'firebase.firestore',
101+
// sourcemap: true
102+
// },
103+
// plugins: [
104+
// typescriptPlugin({
105+
// typescript,
106+
// compilerOptions: {
107+
// allowJs: true,
108+
// target: 'es5'
109+
// },
110+
// include: ['dist/lite/*.js']
111+
// }),
112+
// json(),
113+
// sourcemaps()
114+
// ],
115+
// external: util.resolveNodeExterns,
116+
// treeshake: {
117+
// moduleSideEffects: false
118+
// }
119+
// },
120120
// Browser build
121121
{
122122
input: './lite/index.ts',
@@ -133,21 +133,21 @@ const allBuilds = [
133133
treeshake: {
134134
moduleSideEffects: false
135135
}
136-
},
137-
// RN build
138-
{
139-
input: './lite/index.ts',
140-
output: {
141-
file: path.resolve('./lite', pkg['react-native']),
142-
format: 'es',
143-
sourcemap: true
144-
},
145-
plugins: [alias(util.generateAliasConfig('rn_lite')), ...browserPlugins],
146-
external: util.resolveBrowserExterns,
147-
treeshake: {
148-
moduleSideEffects: false
149-
}
150136
}
137+
// RN build
138+
// {
139+
// input: './lite/index.ts',
140+
// output: {
141+
// file: path.resolve('./lite', pkg['react-native']),
142+
// format: 'es',
143+
// sourcemap: true
144+
// },
145+
// plugins: [alias(util.generateAliasConfig('rn_lite')), ...browserPlugins],
146+
// external: util.resolveBrowserExterns,
147+
// treeshake: {
148+
// moduleSideEffects: false
149+
// }
150+
// }
151151
];
152152

153153
export default allBuilds;

scripts/exp/release.ts

+20-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ async function publishExpPackages({ dryRun }: { dryRun: boolean }) {
4747
/**
4848
* Welcome to the firebase release CLI!
4949
*/
50-
console.log('Welcome to the Firebase Exp Packages release CLI!');
50+
console.log(
51+
`Welcome to the Firebase Exp Packages release CLI! dryRun: ${dryRun}`
52+
);
5153

5254
/**
5355
* Update fields in package.json and stuff
@@ -76,7 +78,7 @@ async function publishExpPackages({ dryRun }: { dryRun: boolean }) {
7678
* since the last release. This simplifies the script and works fine for exp packages.
7779
*
7880
* 2. Removes -exp in package names because we will publish them using
79-
* the existing package names under a special release tag (e.g. firebase@exp).
81+
* the existing package names under a special release tag (firebase@exp).
8082
*/
8183
const versions = await updatePackageNamesAndVersions(packagePaths);
8284

@@ -138,9 +140,15 @@ async function buildPackages() {
138140
'run',
139141
'--scope',
140142
// We replace `@firebase/app-exp` with `@firebase/app` during compilation, so we need to
141-
// compile @firebase/app to make rollup happy though it's not an actual dependency.
143+
// compile @firebase/app first to make rollup happy though it's not an actual dependency.
142144
'@firebase/app',
143145
'--scope',
146+
// the same reason above
147+
'@firebase/functions',
148+
'--scope',
149+
// the same reason above
150+
'@firebase/remote-config',
151+
'--scope',
144152
'@firebase/util',
145153
'--scope',
146154
'@firebase/component',
@@ -176,6 +184,15 @@ async function buildPackages() {
176184

177185
// Build exp packages developed in place
178186
// Firestore
187+
await spawn(
188+
'yarn',
189+
['lerna', 'run', '--scope', '@firebase/firestore', 'prebuild'],
190+
{
191+
cwd: projectRoot,
192+
stdio: 'inherit'
193+
}
194+
);
195+
179196
await spawn(
180197
'yarn',
181198
['lerna', 'run', '--scope', '@firebase/firestore', 'build:exp:release'],

0 commit comments

Comments
 (0)