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

Firestore exp release script #3444

merged 44 commits into from
Jul 25, 2020

Conversation

Feiyang1
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Jul 21, 2020

💥 No Changeset

Latest commit: 19fd38e

Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂

If these changes should be published to npm, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jul 21, 2020

Binary Size Report

Affected SDKs

  • @firebase/firestore/exp

    Type Base (c1cc428) Head (944b991) Diff
    browser 188 kB 187 kB -293 B (-0.2%)
    main 512 kB 511 kB -621 B (-0.1%)
    module ? 187 kB ? (?)
    react-native 188 kB 187 kB -285 B (-0.2%)
  • @firebase/firestore/lite

    Type Base (c1cc428) Head (944b991) Diff
    browser 68.2 kB 67.9 kB -280 B (-0.4%)
    main 498 kB 497 kB -621 B (-0.1%)
    module ? 67.9 kB ? (?)
    react-native 68.3 kB 68.0 kB -283 B (-0.4%)

Test Logs

Comment on lines 82 to 84
treeshake: {
moduleSideEffects: false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This made no difference in my size testing so I removed it.

Copy link
Member Author

Choose a reason for hiding this comment

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

You wouldn't need it normally.
I use it to remove an empty import (import '@firebase/app-types') caused byimportPathTransformer.

@@ -1,8 +1,10 @@
{
"name": "@firebase/firestore/exp",
"description": "A tree-shakeable version of the Firestore SDK",
"main": "../dist/exp/index.node.umd.js",
"main": "../dist/exp/index.node.esm2017.js",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we update these names to match the ones you defined in firestore-exp? Alternatively, can we just drop this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I need to revert this. What do you mean the ones you defined in firestore-exp?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the same names in packages-exp/firestore/package.json and packages/firestore/exp/package.json

But it seems like we could just remove packages/firestore/exp/package.json

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no packages-exp/firestore. Do you mean packages-exp/firebase-exp/firestore/package.json?
I need packages/firestore/exp/package.json for the location of the binary files for exp, so I can use them to update the fields in packages/firestore/package.json.

The exp release process is hacky and might look confusing. Hopefully we just need it for a short period of time.

Comment on lines +3 to +6
"main": "dist/index.cjs.js",
"browser": "dist/index.esm.js",
"module": "dist/index.esm.js",
"typings": "dist/firestore/lite/index.d.ts"
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'

scripts/utils.ts Outdated

export async function readPackageJson(packagePath: string) {
/**
* Nout using require here because require caches the file
Copy link
Contributor

Choose a reason for hiding this comment

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

s/Nout/Not

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

// Prepare @firebase/firestore, so scripts/exp/release.ts can be used to release it
export async function prepare() {
// Update package.json
const packageJson = await readPackageJson(packagePath);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't fully follow this. Maybe that's ok, maybe we need some comments.

This seems to create a new package.json based on expPackageJson, but it seems to use the dependencies and the name from the main Firestore package. If that understanding is correct, then I think we are not using the right name for firestore/lite. We should also consider using different dependencies so that we don't force webchannel-wrapper on users that don't use a bundler for their code.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added some comments. PTAL

Why do you think we are not using the right name for firestore/lite? It will be accessible by @firebase/firestore/lite and firebase/firestore/lite. Is it incorrect?

How do we force webchannel-wrapper on users that don't use a bundler for their code?
Are you talking about people using CDN scripts? We will build firebase-firestore-lite.js in firebase, which should not contain webchannel-wrapper.

I believe firebase/exp has the same dependencies as we currently have, what different dependencies should it have?

Copy link
Contributor

Choose a reason for hiding this comment

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

"@firebase/firestore/lite" and "firebase/firestore/lite" is correct.

Re: wenchannel-wrapper. It would be nice if users can develop against "firebase/firestore/lite" without depending on WebChannelWrapper. If we continue to ask users to just install the "firebase" package then this point is moot though.

Thanks for the comment update.

Copy link
Member Author

@Feiyang1 Feiyang1 Jul 24, 2020

Choose a reason for hiding this comment

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

I see. We won't be able to do that unless we put firestore/lite into its own package. IIUC, it's only an issue for Nodejs apps, right? E.g. the ones running in serverless environments with limited storage. I don't think it matters to Web apps since unused deps will just sit in node_modules, not in the compiled app code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct.

@schmidt-sebastian schmidt-sebastian removed their assignment Jul 24, 2020
@@ -22,7 +22,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`)
...pkgJson.components.map(component => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it was there before and it's not very important but [...array] seems unnecessary when there's only one item, it could just be array

@@ -42,7 +43,8 @@ const nodePlugins = [
}
},
clean: true,
transformers: removeAssertTransformer
abortOnError: false,
transformers: [...removeAssertTransformer, importPathTransformer]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this and removeAssertAndPrefixInternalTransformer be plural ("transformers") so the spread makes sense?

@Feiyang1 Feiyang1 merged commit 9723dcf into master Jul 25, 2020
@Feiyang1 Feiyang1 deleted the fei-firestore-exp-release branch July 25, 2020 00:29
@firebase firebase locked and limited conversation to collaborators Aug 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants