Skip to content

build: new internal builds for google3 #9139

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions packages/app-check-interop-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export interface FirebaseAppCheckInternal {
removeTokenListener(listener: AppCheckTokenListener): void;
}

type AppCheckTokenListener = (token: AppCheckTokenResult) => void;
export type AppCheckTokenListener = (token: AppCheckTokenResult) => void;

// If the error field is defined, the token field will be populated with a dummy token
interface AppCheckTokenResult {
export interface AppCheckTokenResult {
readonly token: string;
readonly error?: Error;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/firebase/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/firebase*.js
/firebase*.map
/firebase*.gz
/firebase*.tgz
/firebase*.tgz
/custom/*.d.ts
/packages
23 changes: 23 additions & 0 deletions packages/firebase/custom/analytics-remote-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @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.
*/

import { registerVersion } from '@firebase/app';
import { version } from '../package.json';

export * as app from '@firebase/app';
export * as analytics from '@firebase/analytics';
export * as remoteConfig from '@firebase/remote-config';
34 changes: 34 additions & 0 deletions packages/firebase/custom/index.all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @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.
*/

import { registerVersion } from '@firebase/app';
import { version } from '../package.json';

registerVersion('fire-js-all', version, 'cdn');
export * as app from '@firebase/app';
export * as ai from '@firebase/ai';
export * as analytics from '@firebase/analytics';
export * as appCheck from '@firebase/app-check';
export * as auth from '@firebase/auth';
export * as dataConnect from '@firebase/data-connect';
export * as database from '@firebase/database';
export * as firestore from '@firebase/firestore';
export * as functions from '@firebase/functions';
export * as installations from '@firebase/installations';
export * as messaging from '@firebase/messaging';
export * as performance from '@firebase/performance';
export * as remoteConfig from '@firebase/remote-config';
3 changes: 2 additions & 1 deletion packages/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@
},
"scripts": {
"build": "rollup -c && gulp cdn-type-module-path && yarn build:compat",
"build:internal": "rollup -c && gulp cdn-type-module-path-internal && yarn build:compat",
"build:internal": "rollup -c rollup-internal.config.js && gulp cdn-type-module-path-internal && yarn build:compat",
"build:compat": "rollup -c compat/rollup.config.js",
"dev": "rollup -c -w",
"test": "echo 'No test suite for firebase wrapper'",
Expand Down Expand Up @@ -446,6 +446,7 @@
"@rollup/plugin-node-resolve": "16.0.0",
"rollup-plugin-sourcemaps": "0.6.3",
"@rollup/plugin-terser": "0.4.4",
"rollup-plugin-dts": "5.3.1",
"rollup-plugin-typescript2": "0.36.0",
"rollup-plugin-uglify": "6.0.4",
"gulp": "4.0.2",
Expand Down
63 changes: 60 additions & 3 deletions packages/firebase/rollup-internal.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,76 @@
*/

// When run in google3, original rollup.config.js will have been renamed to rollup-main.config.js.
import baseBuilds from './rollup-main.config.js';
import { cdnBuilds, plugins } from './rollup.config.js';
import license from 'rollup-plugin-license';
import typescript from 'typescript';
import rollupTypescriptPlugin from 'rollup-plugin-typescript2';
import dts from 'rollup-plugin-dts';
import { parse } from 'path';

const typescriptPluginCustom = rollupTypescriptPlugin({
typescript,
allowJs: true,
include: ['*.ts', '**/*.ts', '*.js', '**/*.js'],
tsconfigOverride: {
compilerOptions: {
declaration: true
}
}
});

const firebaseLicense = license({
banner: `@license
Copyright ${new Date().getFullYear()} Google LLC.
SPDX-License-Identifier: Apache-2.0`
});

const buildsWithLicense = baseBuilds.map(build => {
const buildsWithLicense = cdnBuilds.map(build => {
return Object.assign({}, build, {
plugins: build.plugins.concat(firebaseLicense)
});
});

export default buildsWithLicense;
/**
* Custom builds that include combinations of multiple products.
*/
const customBuilds = [
{ inputFile: 'custom/index.all.ts', outputFile: 'firebase.js' },
{
inputFile: 'custom/analytics-remote-config.ts',
outputFile: 'firebase-analytics-rc.js'
}
]
.map(build => {
const { dir, name } = parse(build.inputFile);
console.log(`${dir}/${name}.d.ts`);
console.log(`dist/${name}.global.d.ts`);
return [
{
input: build.inputFile,
output: {
file: build.outputFile,
sourcemap: true,
format: 'es'
},
plugins: [...plugins, typescriptPluginCustom, firebaseLicense]
},
{
input: `${dir}/${name}.d.ts`,
output: {
file: `dist/${name}.global.d.ts`,
format: 'es'
},
plugins: [
dts({
respectExternal: true
})
]
}
];
})
.flat();

console.log(customBuilds.length);

export default [/*...buildsWithLicense,*/ ...customBuilds];
4 changes: 3 additions & 1 deletion packages/firebase/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const componentBuilds = pkg.components
/**
* CDN script builds
*/
const cdnBuilds = [
export const cdnBuilds = [
{
input: 'app/index.cdn.ts',
output: {
Expand Down Expand Up @@ -175,4 +175,6 @@ const cdnBuilds = [
})
];

export { plugins };

export default [...appBuilds, ...componentBuilds, ...cdnBuilds];
Loading