Skip to content

Firestore exp release script #3444

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
merged 44 commits into from
Jul 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4b7cbe4
Add ReactNative and Browser builds
schmidt-sebastian Jul 13, 2020
386834e
prepare script for firestore exp release
Feiyang1 Jul 18, 2020
97f8b10
add firestore to the exp release script
Feiyang1 Jul 18, 2020
95d712f
add exp release rollup config
Feiyang1 Jul 18, 2020
be496cd
misc changes
Feiyang1 Jul 18, 2020
00bd880
fix typo
Feiyang1 Jul 18, 2020
afe1ca6
add module field
Feiyang1 Jul 18, 2020
b127051
handle peerDeps
Feiyang1 Jul 18, 2020
2850473
fix typo
Feiyang1 Jul 18, 2020
96ba485
replace app-types-exp with app-types
Feiyang1 Jul 20, 2020
0527ad7
fix typo
Feiyang1 Jul 20, 2020
1accb1f
fix typo
Feiyang1 Jul 20, 2020
eef8fcd
remove unused fields
Feiyang1 Jul 20, 2020
5837dab
testing only. remove before making PR
Feiyang1 Jul 20, 2020
367ed55
Merge branch 'master' into fei-firestore-exp-release
Feiyang1 Jul 20, 2020
15a5a64
fix merge
Feiyang1 Jul 20, 2020
a46167d
fix issue
Feiyang1 Jul 20, 2020
6cd903f
Revert "testing only. remove before making PR"
Feiyang1 Jul 21, 2020
bf9a76e
revert dev changes
Feiyang1 Jul 21, 2020
d8685d1
remove unnecessary rollup config
Feiyang1 Jul 21, 2020
b0721d9
update script
Feiyang1 Jul 21, 2020
28c4af4
for test
Feiyang1 Jul 21, 2020
dbe7f3e
add firestore to firebase-exp
Feiyang1 Jul 21, 2020
6331bb2
use existing package as placeholder
Feiyang1 Jul 22, 2020
b3f57f4
add firestore to firebase-exp
Feiyang1 Jul 22, 2020
1984d1c
build firestore first
Feiyang1 Jul 22, 2020
5d31d16
update release config
Feiyang1 Jul 22, 2020
f83224c
use script name
Feiyang1 Jul 22, 2020
c630d5e
get script name correctly
Feiyang1 Jul 22, 2020
a5a430c
use componentName
Feiyang1 Jul 22, 2020
3ede939
show output of build
Feiyang1 Jul 22, 2020
b91f3aa
fix bug
Feiyang1 Jul 22, 2020
c9c031e
make it better
Feiyang1 Jul 22, 2020
a01c72f
add missing script
Feiyang1 Jul 22, 2020
6ee8be7
fix
Feiyang1 Jul 22, 2020
4253ebd
add missing script
Feiyang1 Jul 22, 2020
6ca3885
fix build issue
Feiyang1 Jul 22, 2020
e1b2164
change order
Feiyang1 Jul 22, 2020
13226ca
revert dev change
Feiyang1 Jul 22, 2020
dff2ce4
use umd build for main
Feiyang1 Jul 23, 2020
8a49d6c
update comment
Feiyang1 Jul 24, 2020
a8c50db
add comments
Feiyang1 Jul 24, 2020
4c9c285
address comments
Feiyang1 Jul 24, 2020
19fd38e
Merge branch 'master' into fei-firestore-exp-release
Feiyang1 Jul 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from '@firebase/functions-exp';

export * from '@firebase/firestore';
18 changes: 18 additions & 0 deletions packages-exp/firebase-exp/firestore/lite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 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 * from '@firebase/firestore/lite';
7 changes: 7 additions & 0 deletions packages-exp/firebase-exp/firestore/lite/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "firebase-exp/firestore/lite",
"main": "dist/index.cjs.js",
"browser": "dist/index.esm.js",
"module": "dist/index.esm.js",
"typings": "dist/firestore/lite/index.d.ts"
Comment on lines +3 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these values used at all? Looks like the release script replaces them. Might make sense to use dummy values if that is indeed the case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. They are used when you do import {...} from 'firebase/firestore/lite'

}
7 changes: 7 additions & 0 deletions packages-exp/firebase-exp/firestore/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "firebase-exp/firestore",
"main": "dist/index.cjs.js",
"browser": "dist/index.esm.js",
"module": "dist/index.esm.js",
"typings": "dist/firestore/index.d.ts"
}
7 changes: 4 additions & 3 deletions packages-exp/firebase-exp/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ var sourcemaps = require('gulp-sourcemaps');

const OUTPUT_FILE = 'firebase.js';
const pkgJson = require('./package.json');
const files = [
...pkgJson.components.map(component => `firebase-${component}.js`)
];
const files = pkgJson.components.map(component => {
const componentName = component.replace('/', '-');
return `firebase-${componentName}.js`;
});

gulp.task('firebase-js', function () {
return gulp
Expand Down
7 changes: 5 additions & 2 deletions packages-exp/firebase-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
},
"dependencies": {
"@firebase/app-exp": "0.0.800",
"@firebase/functions-exp": "0.0.800"
"@firebase/functions-exp": "0.0.800",
"@firebase/firestore": "1.16.1"
},
"devDependencies": {
"rollup": "2.21.0",
Expand All @@ -54,6 +55,8 @@
},
"components": [
"app",
"functions"
"functions",
"firestore",
"firestore/lite"
]
}
14 changes: 10 additions & 4 deletions packages-exp/firebase-exp/rollup.config.release.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import pkg from './package.json';
import appPkg from './app/package.json';

// remove -exp from dependencies name
const external = Object.keys(pkg.dependencies || {}).map(name =>
const deps = Object.keys(pkg.dependencies || {}).map(name =>
name.replace('-exp', '')
);

Expand Down Expand Up @@ -99,7 +99,7 @@ const appBuilds = [
{ file: resolve('app', appPkg.module), format: 'es', sourcemap: true }
],
plugins: [...plugins, typescriptPlugin],
external
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
},
/**
* App UMD Builds
Expand All @@ -121,6 +121,9 @@ const componentBuilds = pkg.components
.filter(component => component !== 'app')
.map(component => {
const pkg = require(`./${component}/package.json`);
// It is needed for handling sub modules, for example firestore/lite which should produce firebase-firestore-lite.js
// Otherwise, we will create a directory with '/' in the name.
const componentName = component.replace('/', '-');
return [
{
input: `${component}/index.ts`,
Expand All @@ -137,11 +140,14 @@ const componentBuilds = pkg.components
}
],
plugins: [...plugins, typescriptPlugin],
external
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
},
{
input: `${component}/index.ts`,
output: createUmdOutputConfig(`firebase-${component}.js`, component),
output: createUmdOutputConfig(
`firebase-${componentName}.js`,
componentName
),
plugins: [...plugins, typescriptPluginUMD],
external: ['@firebase/app']
}
Expand Down
3 changes: 2 additions & 1 deletion packages-exp/functions-exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"build": "rollup -c && yarn api-report",
"build:deps": "lerna run --scope @firebase/functions-exp --include-dependencies build",
"build:release": "rollup -c rollup.config.release.js && yarn api-report",
"dev": "rollup -c -w",
"test": "yarn type-check && run-p lint test:browser test:node",
"test:ci": "node ../../scripts/run_tests_in_ci.js",
Expand All @@ -22,7 +23,7 @@
"test:browser:debug": "karma start --browsers=Chrome --auto-watch",
"test:node": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'src/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js",
"test:emulator": "env FIREBASE_FUNCTIONS_EMULATOR_ORIGIN=http://localhost:5005 run-p test:node",
"prepare": "rollup -c rollup.config.release.js && yarn api-report",
"prepare": "yarn build:release",
"api-report": "api-extractor run --local --verbose",
"predoc": "node ../../scripts/exp/remove-exp.js temp",
"doc": "api-documenter markdown --input temp --output docs",
Expand Down
2 changes: 2 additions & 0 deletions packages/firestore/exp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
"name": "@firebase/firestore/exp",
"description": "A tree-shakeable version of the Firestore SDK",
"main": "../dist/exp/index.node.umd.js",
"module": "../dist/exp/index.browser.esm2017.js",
"browser": "../dist/exp/index.browser.esm2017.js",
"react-native": "../dist/exp/index.rn.esm2017.js",
"typings": "../exp-types/index.d.ts",
"private": true
}
4 changes: 3 additions & 1 deletion packages/firestore/lite/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"name": "@firebase/firestore/lite",
"description": "A lite version of the Firestore SDK",
"main": "../dist/lite/index.node.umd.js",
"main": "../dist/lite/index.node.esm2017.js",
"module": "../dist/lite/index.browser.esm2017.js",
"browser": "../dist/lite/index.browser.esm2017.js",
"react-native": "../dist/lite/index.rn.esm2017.js",
"typings": "../lite-types/index.d.ts",
"private": true
}
1 change: 1 addition & 0 deletions packages/firestore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"build:console": "node tools/console.build.js",
"build:exp": "rollup -c rollup.config.exp.js",
"build:lite": "rollup -c rollup.config.lite.js",
"build:exp:release": "yarn build:exp && yarn build:lite",
"predev": "yarn prebuild",
"dev": "rollup -c -w",
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/rollup.config.es2017.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const browserBuildPlugins = [
}
},
clean: true,
transformers: util.removeAssertAndPrefixInternalTransformer
transformers: [util.removeAssertAndPrefixInternalTransformer]
}),
json({ preferConst: true }),
terser(util.manglePrivatePropertiesOptions)
Expand Down Expand Up @@ -139,7 +139,7 @@ const nodeBuildPlugins = [
}
},
clean: true,
transformers: util.removeAssertTransformer
transformers: [util.removeAssertTransformer]
}),
json(),
// Needed as we also use the *.proto files
Expand Down
25 changes: 20 additions & 5 deletions packages/firestore/rollup.config.exp.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import typescriptPlugin from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import path from 'path';
import { terser } from 'rollup-plugin-terser';
import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path';

import pkg from './exp/package.json';

Expand All @@ -35,7 +36,8 @@ const nodePlugins = [
}
},
clean: true,
transformers: util.removeAssertTransformer
abortOnError: false,
transformers: [util.removeAssertTransformer, importPathTransformer]
}),
json()
];
Expand All @@ -49,7 +51,11 @@ const browserPlugins = [
}
},
clean: true,
transformers: util.removeAssertAndPrefixInternalTransformer
abortOnError: false,
transformers: [
util.removeAssertAndPrefixInternalTransformer,
importPathTransformer
]
}),
json({ preferConst: true }),
terser(util.manglePrivatePropertiesOptions)
Expand All @@ -65,7 +71,10 @@ const allBuilds = [
name: 'firebase.firestore'
},
plugins: [alias(util.generateAliasConfig('node')), ...nodePlugins],
external: util.resolveNodeExterns
external: util.resolveNodeExterns,
treeshake: {
moduleSideEffects: false
}
},
// Browser build
{
Expand All @@ -75,7 +84,10 @@ const allBuilds = [
format: 'es'
},
plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins],
external: util.resolveBrowserExterns
external: util.resolveBrowserExterns,
treeshake: {
moduleSideEffects: false
}
},
// RN build
{
Expand All @@ -85,7 +97,10 @@ const allBuilds = [
format: 'es'
},
plugins: [alias(util.generateAliasConfig('rn')), ...browserPlugins],
external: util.resolveBrowserExterns
external: util.resolveBrowserExterns,
treeshake: {
moduleSideEffects: false
}
}
];

Expand Down
25 changes: 20 additions & 5 deletions packages/firestore/rollup.config.lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import alias from '@rollup/plugin-alias';
import typescriptPlugin from 'rollup-plugin-typescript2';
import typescript from 'typescript';
import { terser } from 'rollup-plugin-terser';
import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path';

import pkg from './lite/package.json';

Expand All @@ -35,7 +36,8 @@ const nodePlugins = [
}
},
clean: true,
transformers: util.removeAssertTransformer
abortOnError: false,
transformers: [util.removeAssertTransformer, importPathTransformer]
}),
json()
];
Expand All @@ -49,7 +51,11 @@ const browserPlugins = [
}
},
clean: true,
transformers: util.removeAssertAndPrefixInternalTransformer
abortOnError: false,
transformers: [
util.removeAssertAndPrefixInternalTransformer,
importPathTransformer
]
}),
json({ preferConst: true }),
terser(util.manglePrivatePropertiesOptions)
Expand All @@ -65,7 +71,10 @@ const allBuilds = [
name: 'firebase.firestore'
},
plugins: [alias(util.generateAliasConfig('node')), ...nodePlugins],
external: util.resolveNodeExterns
external: util.resolveNodeExterns,
treeshake: {
moduleSideEffects: false
}
},
// Browser build
{
Expand All @@ -75,7 +84,10 @@ const allBuilds = [
format: 'es'
},
plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins],
external: util.resolveBrowserExterns
external: util.resolveBrowserExterns,
treeshake: {
moduleSideEffects: false
}
},
// RN build
{
Expand All @@ -85,7 +97,10 @@ const allBuilds = [
format: 'es'
},
plugins: [alias(util.generateAliasConfig('rn')), ...browserPlugins],
external: util.resolveBrowserExterns
external: util.resolveBrowserExterns,
treeshake: {
moduleSideEffects: false
}
}
];

Expand Down
32 changes: 14 additions & 18 deletions packages/firestore/rollup.shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,25 @@ const publicIdentifiers = extractPublicIdentifiers(externsPaths);
* Transformers that remove calls to `debugAssert` and messages for 'fail` and
* `hardAssert`.
*/
exports.removeAssertTransformer = [
service => ({
before: [removeAsserts(service.getProgram())],
after: []
})
];
exports.removeAssertTransformer = service => ({
before: [removeAsserts(service.getProgram())],
after: []
});

/**
* Transformers that remove calls to `debugAssert`, messages for 'fail` and
* `hardAssert` and appends a __PRIVATE_ prefix to all internal symbols.
*/
exports.removeAssertAndPrefixInternalTransformer = [
service => ({
before: [
removeAsserts(service.getProgram()),
renameInternals(service.getProgram(), {
publicIdentifiers,
prefix: '__PRIVATE_'
})
],
after: []
})
];
exports.removeAssertAndPrefixInternalTransformer = service => ({
before: [
removeAsserts(service.getProgram()),
renameInternals(service.getProgram(), {
publicIdentifiers,
prefix: '__PRIVATE_'
})
],
after: []
});

/**
* Terser options that mangle all properties prefixed with __PRIVATE_.
Expand Down
Loading