From a98daec74a6a463e32472ec2535d93e8c5b74057 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 26 Aug 2021 17:10:58 -0700 Subject: [PATCH 1/7] clean up docgen --- package.json | 8 +- .../content-sources/js/HOME.md | 0 .../content-sources/js/toc.yaml | 0 .../content-sources/node/HOME.md | 0 .../content-sources/node/toc.yaml | 0 .../generate-docs.js | 2 +- .../theme/assets/css/firebase.css | 0 .../theme/assets/css/main.css | 0 .../theme/assets/images/lockup.png | Bin .../theme/layouts/default.hbs | 0 .../theme/partials/breadcrumb.hbs | 0 .../theme/partials/comment.hbs | 0 .../theme/partials/header.hbs | 0 .../theme/partials/member.signatures.hbs | 0 .../theme/partials/member.sources.hbs | 0 .../theme/partials/navigation.hbs | 0 .../theme/templates/reflection.hbs | 0 .../{docgen => docgen-compat}/tsconfig.json | 0 scripts/{docgen => docgen-compat}/typedoc.js | 0 scripts/{exp => docgen}/docgen.ts | 0 .../exp/prepare-database-for-exp-release.ts | 83 --- .../exp/prepare-firestore-for-exp-release.ts | 95 ---- .../exp/prepare-storage-for-exp-release.ts | 84 --- scripts/exp/release.ts | 517 ------------------ scripts/exp/remove-exp.js | 63 --- 25 files changed, 5 insertions(+), 847 deletions(-) rename scripts/{docgen => docgen-compat}/content-sources/js/HOME.md (100%) rename scripts/{docgen => docgen-compat}/content-sources/js/toc.yaml (100%) rename scripts/{docgen => docgen-compat}/content-sources/node/HOME.md (100%) rename scripts/{docgen => docgen-compat}/content-sources/node/toc.yaml (100%) rename scripts/{docgen => docgen-compat}/generate-docs.js (99%) rename scripts/{docgen => docgen-compat}/theme/assets/css/firebase.css (100%) rename scripts/{docgen => docgen-compat}/theme/assets/css/main.css (100%) rename scripts/{docgen => docgen-compat}/theme/assets/images/lockup.png (100%) rename scripts/{docgen => docgen-compat}/theme/layouts/default.hbs (100%) rename scripts/{docgen => docgen-compat}/theme/partials/breadcrumb.hbs (100%) rename scripts/{docgen => docgen-compat}/theme/partials/comment.hbs (100%) rename scripts/{docgen => docgen-compat}/theme/partials/header.hbs (100%) rename scripts/{docgen => docgen-compat}/theme/partials/member.signatures.hbs (100%) rename scripts/{docgen => docgen-compat}/theme/partials/member.sources.hbs (100%) rename scripts/{docgen => docgen-compat}/theme/partials/navigation.hbs (100%) rename scripts/{docgen => docgen-compat}/theme/templates/reflection.hbs (100%) rename scripts/{docgen => docgen-compat}/tsconfig.json (100%) rename scripts/{docgen => docgen-compat}/typedoc.js (100%) rename scripts/{exp => docgen}/docgen.ts (100%) delete mode 100644 scripts/exp/prepare-database-for-exp-release.ts delete mode 100644 scripts/exp/prepare-firestore-for-exp-release.ts delete mode 100644 scripts/exp/prepare-storage-for-exp-release.ts delete mode 100644 scripts/exp/release.ts delete mode 100644 scripts/exp/remove-exp.js diff --git a/package.json b/package.json index deeafa8ce7f..c6005111deb 100644 --- a/package.json +++ b/package.json @@ -38,16 +38,16 @@ "test:changed": "ts-node-script scripts/ci-test/test_changed.ts", "test:setup": "node tools/config.js", "test:saucelabs": "node scripts/run_saucelabs.js", - "docgen:js": "node scripts/docgen/generate-docs.js --api js", - "docgen:node": "node scripts/docgen/generate-docs.js --api node", - "docgen": "yarn docgen:js; yarn docgen:node", + "docgen": "ts-node-script scripts/docgen/docgen.ts", + "docgen:compat": "yarn docgen:compat:js; yarn docgen:compat:node", + "docgen:compat:js": "node scripts/docgen-compat/generate-docs.js --api js", + "docgen:compat:node": "node scripts/docgen-compat/generate-docs.js --api node", "prettier": "prettier --config .prettierrc --write '**/*.{ts,js}'", "lint": "lerna run --scope @firebase/* lint", "lint:fix": "lerna run --scope @firebase/* lint:fix", "size-report": "ts-node-script scripts/size_report/report_binary_size.ts", "modular-export-size-report": "ts-node-script scripts/size_report/report_modular_export_binary_size.ts", "api-report": "lerna run --scope @firebase/* api-report", - "docgen:exp": "ts-node-script scripts/exp/docgen.ts", "postinstall": "yarn --cwd repo-scripts/changelog-generator build", "sa": "ts-node-script repo-scripts/size-analysis/cli.ts", "api-documenter-devsite": "ts-node-script repo-scripts/api-documenter/src/start.ts" diff --git a/scripts/docgen/content-sources/js/HOME.md b/scripts/docgen-compat/content-sources/js/HOME.md similarity index 100% rename from scripts/docgen/content-sources/js/HOME.md rename to scripts/docgen-compat/content-sources/js/HOME.md diff --git a/scripts/docgen/content-sources/js/toc.yaml b/scripts/docgen-compat/content-sources/js/toc.yaml similarity index 100% rename from scripts/docgen/content-sources/js/toc.yaml rename to scripts/docgen-compat/content-sources/js/toc.yaml diff --git a/scripts/docgen/content-sources/node/HOME.md b/scripts/docgen-compat/content-sources/node/HOME.md similarity index 100% rename from scripts/docgen/content-sources/node/HOME.md rename to scripts/docgen-compat/content-sources/node/HOME.md diff --git a/scripts/docgen/content-sources/node/toc.yaml b/scripts/docgen-compat/content-sources/node/toc.yaml similarity index 100% rename from scripts/docgen/content-sources/node/toc.yaml rename to scripts/docgen-compat/content-sources/node/toc.yaml diff --git a/scripts/docgen/generate-docs.js b/scripts/docgen-compat/generate-docs.js similarity index 99% rename from scripts/docgen/generate-docs.js rename to scripts/docgen-compat/generate-docs.js index db7fbc07a15..309d896ef5e 100644 --- a/scripts/docgen/generate-docs.js +++ b/scripts/docgen-compat/generate-docs.js @@ -32,7 +32,7 @@ const { api: apiType, source: sourceFile } = yargs type: 'string' }) .option('source', { - default: `${repoPath}/packages/firebase/index.d.ts`, + default: `${repoPath}/packages/firebase/compat/index.d.ts`, describe: 'Typescript source file(s)', type: 'string' }) diff --git a/scripts/docgen/theme/assets/css/firebase.css b/scripts/docgen-compat/theme/assets/css/firebase.css similarity index 100% rename from scripts/docgen/theme/assets/css/firebase.css rename to scripts/docgen-compat/theme/assets/css/firebase.css diff --git a/scripts/docgen/theme/assets/css/main.css b/scripts/docgen-compat/theme/assets/css/main.css similarity index 100% rename from scripts/docgen/theme/assets/css/main.css rename to scripts/docgen-compat/theme/assets/css/main.css diff --git a/scripts/docgen/theme/assets/images/lockup.png b/scripts/docgen-compat/theme/assets/images/lockup.png similarity index 100% rename from scripts/docgen/theme/assets/images/lockup.png rename to scripts/docgen-compat/theme/assets/images/lockup.png diff --git a/scripts/docgen/theme/layouts/default.hbs b/scripts/docgen-compat/theme/layouts/default.hbs similarity index 100% rename from scripts/docgen/theme/layouts/default.hbs rename to scripts/docgen-compat/theme/layouts/default.hbs diff --git a/scripts/docgen/theme/partials/breadcrumb.hbs b/scripts/docgen-compat/theme/partials/breadcrumb.hbs similarity index 100% rename from scripts/docgen/theme/partials/breadcrumb.hbs rename to scripts/docgen-compat/theme/partials/breadcrumb.hbs diff --git a/scripts/docgen/theme/partials/comment.hbs b/scripts/docgen-compat/theme/partials/comment.hbs similarity index 100% rename from scripts/docgen/theme/partials/comment.hbs rename to scripts/docgen-compat/theme/partials/comment.hbs diff --git a/scripts/docgen/theme/partials/header.hbs b/scripts/docgen-compat/theme/partials/header.hbs similarity index 100% rename from scripts/docgen/theme/partials/header.hbs rename to scripts/docgen-compat/theme/partials/header.hbs diff --git a/scripts/docgen/theme/partials/member.signatures.hbs b/scripts/docgen-compat/theme/partials/member.signatures.hbs similarity index 100% rename from scripts/docgen/theme/partials/member.signatures.hbs rename to scripts/docgen-compat/theme/partials/member.signatures.hbs diff --git a/scripts/docgen/theme/partials/member.sources.hbs b/scripts/docgen-compat/theme/partials/member.sources.hbs similarity index 100% rename from scripts/docgen/theme/partials/member.sources.hbs rename to scripts/docgen-compat/theme/partials/member.sources.hbs diff --git a/scripts/docgen/theme/partials/navigation.hbs b/scripts/docgen-compat/theme/partials/navigation.hbs similarity index 100% rename from scripts/docgen/theme/partials/navigation.hbs rename to scripts/docgen-compat/theme/partials/navigation.hbs diff --git a/scripts/docgen/theme/templates/reflection.hbs b/scripts/docgen-compat/theme/templates/reflection.hbs similarity index 100% rename from scripts/docgen/theme/templates/reflection.hbs rename to scripts/docgen-compat/theme/templates/reflection.hbs diff --git a/scripts/docgen/tsconfig.json b/scripts/docgen-compat/tsconfig.json similarity index 100% rename from scripts/docgen/tsconfig.json rename to scripts/docgen-compat/tsconfig.json diff --git a/scripts/docgen/typedoc.js b/scripts/docgen-compat/typedoc.js similarity index 100% rename from scripts/docgen/typedoc.js rename to scripts/docgen-compat/typedoc.js diff --git a/scripts/exp/docgen.ts b/scripts/docgen/docgen.ts similarity index 100% rename from scripts/exp/docgen.ts rename to scripts/docgen/docgen.ts diff --git a/scripts/exp/prepare-database-for-exp-release.ts b/scripts/exp/prepare-database-for-exp-release.ts deleted file mode 100644 index 44db5430742..00000000000 --- a/scripts/exp/prepare-database-for-exp-release.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @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 { projectRoot, readPackageJson } from '../utils'; -import { writeFile as _writeFile, readFile as _readFile } from 'fs'; -import { promisify } from 'util'; -import { resolve } from 'path'; -import { createCompatProject } from './prepare-util'; - -const writeFile = promisify(_writeFile); -const packagePath = `${projectRoot}/packages/database`; - -/** - * Transform package.json in @firebase/database so that we can use scripts/exp/release.ts to release Database exp. - * It does following things: - * 1. Update package.json to point to exp binaries - * 2. Update version to '0.0.900', the version number we choose for releasing exp packages - * (9 stands for v9, 900 to avoid conflict with official versions). - * The release script will append commit hash to it and release the package with that version. - * e.g. 0.0.900-exp.fe85035e1 - * 3. Replace peerDependencies with the exp version, so the release script can match and update them to the correct version. - */ -export async function prepare() { - // Update package.json - const packageJson = await readPackageJson(packagePath); - const expPackageJson = await readPackageJson(`${packagePath}/exp`); - packageJson.version = '0.0.900'; - - packageJson.peerDependencies = { - '@firebase/app-exp': '0.x' - }; - - packageJson.main = expPackageJson.main.replace('../', ''); - packageJson.module = expPackageJson.module.replace('../', ''); - packageJson.browser = expPackageJson.browser.replace('../', ''); - packageJson.esm5 = expPackageJson.esm5.replace('../', ''); - delete packageJson['esm2017']; - - packageJson.typings = expPackageJson.typings.replace('../', ''); - - // include files to be published - packageJson.files = [...packageJson.files, packageJson.typings]; - - // update package.json files - await writeFile( - `${packagePath}/package.json`, - `${JSON.stringify(packageJson, null, 2)}\n`, - { encoding: 'utf-8' } - ); -} - -export async function createDatabaseCompatProject() { - const DATABASE_SRC = resolve(projectRoot, 'packages/database'); - const DATABASE_COMPAT_SRC = resolve(projectRoot, 'packages/database/compat'); - const DATABASE_COMPAT_DEST = resolve( - projectRoot, - 'packages-exp/database-compat' - ); - const DATABASE_COMPAT_BINARY_SRC = resolve(DATABASE_SRC, 'dist/compat'); - const DATABASE_COMPAT_BINARY_DEST = resolve(DATABASE_COMPAT_DEST, 'dist'); - - createCompatProject({ - srcDir: DATABASE_SRC, - compatSrcDir: DATABASE_COMPAT_SRC, - compatDestDir: DATABASE_COMPAT_DEST, - compatBinarySrcDir: DATABASE_COMPAT_BINARY_SRC, - compatBinaryDestDir: DATABASE_COMPAT_BINARY_DEST - }); -} diff --git a/scripts/exp/prepare-firestore-for-exp-release.ts b/scripts/exp/prepare-firestore-for-exp-release.ts deleted file mode 100644 index 1df5571afcf..00000000000 --- a/scripts/exp/prepare-firestore-for-exp-release.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @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 { resolve } from 'path'; -import { projectRoot, readPackageJson } from '../utils'; -import { writeFileSync } from 'fs'; -import { createCompatProject } from './prepare-util'; - -const packagePath = `${projectRoot}/packages/firestore`; - -/** - * Transform package.json in @firebase/firestore so that we can use scripts/exp/release.ts to release Firestore exp. - * It does following things: - * 1. Update package.json to point to exp binaries - * 2. Update version to '0.0.900', the version number we choose for releasing exp packages - * (9 stands for v9, 900 to avoid conflict with official versions). - * The release script will append commit hash to it and release the package with that version. - * e.g. 0.0.900-exp.fe85035e1 - * 3. Replace peerDependencies with the exp version, so the release script can match and update them to the correct version. - * 4. Replace imports with imports from exp packages in typing files. - */ -export async function prepare() { - // Update package.json - const packageJson = await readPackageJson(packagePath); - const expPackageJson = await readPackageJson(`${packagePath}/exp`); - const litePackageJson = await readPackageJson(`${packagePath}/lite`); - packageJson.version = '0.0.900'; - - packageJson.peerDependencies = { - '@firebase/app-exp': '0.x' - }; - - packageJson.main = expPackageJson.main.replace('../', ''); - packageJson.module = expPackageJson.module.replace('../', ''); - packageJson.browser = expPackageJson.browser.replace('../', ''); - packageJson['react-native'] = expPackageJson['react-native'].replace( - '../', - '' - ); - delete packageJson['main-esm2017']; - delete packageJson['esm2017']; - - packageJson.typings = expPackageJson.typings.replace('../', ''); - - // include files to be published - packageJson.files = [ - ...packageJson.files, - packageJson.typings, - 'lite/package.json', - litePackageJson.typings.replace('../', '') - ]; - - // update package.json files - writeFileSync( - `${packagePath}/package.json`, - `${JSON.stringify(packageJson, null, 2)}\n`, - { encoding: 'utf-8' } - ); -} - -export async function createFirestoreCompatProject() { - const FIRESTORE_SRC = resolve(projectRoot, 'packages/firestore'); - const FIRESTORE_COMPAT_SRC = resolve( - projectRoot, - 'packages/firestore/compat' - ); - const FIRESTORE_COMPAT_DEST = resolve( - projectRoot, - 'packages-exp/firestore-compat' - ); - const FIRESTORE_COMPAT_BINARY_SRC = resolve(FIRESTORE_SRC, 'dist/compat'); - const FIRESTORE_COMPAT_BINARY_DEST = resolve(FIRESTORE_COMPAT_DEST, 'dist'); - - createCompatProject({ - srcDir: FIRESTORE_SRC, - compatSrcDir: FIRESTORE_COMPAT_SRC, - compatDestDir: FIRESTORE_COMPAT_DEST, - compatBinarySrcDir: FIRESTORE_COMPAT_BINARY_SRC, - compatBinaryDestDir: FIRESTORE_COMPAT_BINARY_DEST - }); -} diff --git a/scripts/exp/prepare-storage-for-exp-release.ts b/scripts/exp/prepare-storage-for-exp-release.ts deleted file mode 100644 index efe5e9e1e3d..00000000000 --- a/scripts/exp/prepare-storage-for-exp-release.ts +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @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 { projectRoot, readPackageJson } from '../utils'; -import { writeFile as _writeFile, readFile as _readFile } from 'fs'; -import { resolve } from 'path'; -import { promisify } from 'util'; -import { createCompatProject } from './prepare-util'; - -const writeFile = promisify(_writeFile); -const packagePath = `${projectRoot}/packages/storage`; - -/** - * Transform package.json in @firebase/storage so that we can use scripts/exp/release.ts to release storage exp. - * It does following things: - * 1. Update package.json to point to exp binaries - * 2. Update version to '0.0.900', the version number we choose for releasing exp packages - * (9 stands for v9, 900 to avoid conflict with official versions). - * The release script will append commit hash to it and release the package with that version. - * e.g. 0.0.900-exp.fe85035e1 - * 3. Replace peerDependencies with the exp version, so the release script can match and update them to the correct version. - * 4. Replace imports with imports from exp packages in typing files. - */ -export async function prepare() { - // Update package.json - const packageJson = await readPackageJson(packagePath); - const expPackageJson = await readPackageJson(`${packagePath}/exp`); - packageJson.version = '0.0.900'; - - packageJson.peerDependencies = { - '@firebase/app-exp': '0.x' - }; - - packageJson.main = expPackageJson.main.replace('./', 'exp/'); - packageJson.module = expPackageJson.module.replace('./', 'exp/'); - packageJson.browser = expPackageJson.browser.replace('./', 'exp/'); - packageJson.esm5 = expPackageJson.esm5.replace('./', 'exp/'); - delete packageJson['esm2017']; - - packageJson.typings = expPackageJson.typings.replace('./', 'exp/'); - - // include files to be published - packageJson.files = ['exp/dist']; - - // update package.json files - await writeFile( - `${packagePath}/package.json`, - `${JSON.stringify(packageJson, null, 2)}\n`, - { encoding: 'utf-8' } - ); -} - -export async function createStorageCompatProject() { - const STORAGE_SRC = resolve(projectRoot, 'packages/storage'); - const STORAGE_COMPAT_SRC = resolve(projectRoot, 'packages/storage/compat'); - const STORAGE_COMPAT_DEST = resolve( - projectRoot, - 'packages-exp/storage-compat' - ); - const STORAGE_COMPAT_BINARY_SRC = resolve(STORAGE_SRC, 'dist/compat'); - const STORAGE_COMPAT_BINARY_DEST = resolve(STORAGE_COMPAT_DEST, 'dist'); - - createCompatProject({ - srcDir: STORAGE_SRC, - compatSrcDir: STORAGE_COMPAT_SRC, - compatDestDir: STORAGE_COMPAT_DEST, - compatBinarySrcDir: STORAGE_COMPAT_BINARY_SRC, - compatBinaryDestDir: STORAGE_COMPAT_BINARY_DEST - }); -} diff --git a/scripts/exp/release.ts b/scripts/exp/release.ts deleted file mode 100644 index d4778ceedc0..00000000000 --- a/scripts/exp/release.ts +++ /dev/null @@ -1,517 +0,0 @@ -/** - * @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 { spawn, exec } from 'child-process-promise'; -import ora from 'ora'; -import { createPromptModule } from 'inquirer'; -import { projectRoot, readPackageJson } from '../utils'; -import simpleGit from 'simple-git/promise'; - -import { mapWorkspaceToPackages } from '../release/utils/workspace'; -import { inc } from 'semver'; -import { writeFile as _writeFile, rmdirSync, existsSync } from 'fs'; -import { resolve } from 'path'; -import { promisify } from 'util'; -import chalk from 'chalk'; -import Listr from 'listr'; -import { - prepare as prepareFirestoreForRelease, - createFirestoreCompatProject -} from './prepare-firestore-for-exp-release'; -import { - createStorageCompatProject, - prepare as prepareStorageForRelease -} from './prepare-storage-for-exp-release'; -import { - createDatabaseCompatProject, - prepare as prepareDatabaseForRelease -} from './prepare-database-for-exp-release'; -import * as yargs from 'yargs'; -import { addCompatToFirebasePkgJson } from './prepare-util'; - -const prompt = createPromptModule(); -const argv = yargs - .options({ - dryRun: { - type: 'boolean', - default: false - } - }) - .help().argv; - -const writeFile = promisify(_writeFile); -const git = simpleGit(projectRoot); -const FIREBASE_UMBRELLA_PACKAGE_NAME = 'firebase-exp'; - -async function publishExpPackages({ dryRun }: { dryRun: boolean }) { - try { - /** - * Welcome to the firebase release CLI! - */ - console.log( - `Welcome to the Firebase Exp Packages release CLI! dryRun: ${dryRun}` - ); - - /** - * Update fields in package.json and create compat packages (e.g. packages-exp/firestore-compat) - */ - await prepareFirestoreForRelease(); - await prepareStorageForRelease(); - await prepareDatabaseForRelease(); - - // path to exp packages - let packagePaths = await mapWorkspaceToPackages([ - `${projectRoot}/packages-exp/*` - ]); - - packagePaths.push(`${projectRoot}/packages/firestore`); - packagePaths.push(`${projectRoot}/packages/storage`); - packagePaths.push(`${projectRoot}/packages/database`); - - packagePaths.push(`${projectRoot}/packages/firestore/compat`); - packagePaths.push(`${projectRoot}/packages/storage/compat`); - packagePaths.push(`${projectRoot}/packages/database/compat`); - - /** - * Bumps the patch version of firebase-exp package regardless if there is any update - * since the last release. This simplifies the script and works fine for exp packages. - * - * We do this before the build so the registerVersion will grab the correct - * versions from package.json for platform logging. - */ - const versions = await getNewVersions(packagePaths); - - await updatePackageJsons(packagePaths, versions, { - // Changing the package names here will break the build process. - // It will be done after the build. - removeExpInName: false, - updateVersions: true, - makePublic: true - }); - - /** - * build packages except for the umbrella package (firebase) which will be built after firestore/storage/database compat packages are created - */ - await buildPackages(); - - /** - * Create compat packages for Firestore, Database and Storage - */ - await createFirestoreCompatProject(); - await createStorageCompatProject(); - await createDatabaseCompatProject(); - - /** - * Add firestore-compat, database-compat and storage-compat to the dependencies array of firebase-exp - */ - await addCompatToFirebasePkgJson([ - '@firebase/firestore-compat', - '@firebase/storage-compat', - '@firebase/database-compat' - ]); - - /** - * build firebase - */ - await buildFirebasePackage(); - - /** - * Removes -exp in package names because we will publish them using - * the existing package names under a special release tag (firebase@exp). - */ - await updatePackageJsons(packagePaths, versions, { - removeExpInName: true, - updateVersions: false, - makePublic: false - }); - - let versionCheckMessage = - '\r\nAre you sure these are the versions you want to publish?\r\n'; - for (const [pkgName, version] of versions) { - versionCheckMessage += `${pkgName} : ${version}\n`; - } - const { versionCheck } = await prompt([ - { - type: 'confirm', - name: 'versionCheck', - message: versionCheckMessage, - default: false - } - ]); - - if (!versionCheck) { - throw new Error('Version check failed'); - } - - // publish all packages under packages-exp plus firestore, storage and database - const packagesToPublish = await mapWorkspaceToPackages([ - `${projectRoot}/packages-exp/*` - ]); - - packagesToPublish.push(`${projectRoot}/packages/firestore`); - packagesToPublish.push(`${projectRoot}/packages/storage`); - packagesToPublish.push(`${projectRoot}/packages/database`); - - /** - * Release packages to NPM - */ - await publishToNpm(packagesToPublish, dryRun); - - /** - * reset the working tree to recover package names with -exp in the package.json files, - * then bump patch version of firebase-exp (the umbrella package) only - */ - const firebaseExpVersion = new Map(); - firebaseExpVersion.set( - FIREBASE_UMBRELLA_PACKAGE_NAME, - versions.get(FIREBASE_UMBRELLA_PACKAGE_NAME) - ); - const firebaseExpPath = packagePaths.filter(p => - p.includes(FIREBASE_UMBRELLA_PACKAGE_NAME) - ); - - const { resetWorkingTree } = await prompt([ - { - type: 'confirm', - name: 'resetWorkingTree', - message: 'Do you want to reset the working tree?', - default: true - } - ]); - - if (resetWorkingTree) { - await resetWorkingTreeAndBumpVersions( - firebaseExpPath, - firebaseExpVersion - ); - } else { - process.exit(0); - } - - /** - * Do not push to remote if it's a dryrun - */ - if (!dryRun) { - const { shouldCommitAndPush } = await prompt([ - { - type: 'confirm', - name: 'shouldCommitAndPush', - message: - 'Do you want to commit and push the exp version update to remote?', - default: true - } - ]); - /** - * push to github - */ - if (shouldCommitAndPush) { - await commitAndPush(versions); - } - } - } catch (err) { - /** - * Log any errors that happened during the process - */ - console.error(err); - - /** - * Exit with an error code - */ - process.exit(1); - } -} - -/** - * The order of build is important - */ -async function buildPackages() { - const spinner = ora(' Building Packages').start(); - - // Build dependencies - await spawn( - 'yarn', - [ - 'lerna', - 'run', - '--scope', - '@firebase/util', - '--scope', - '@firebase/component', - '--scope', - '@firebase/logger', - '--scope', - '@firebase/webchannel-wrapper', - 'build' - ], - { - cwd: projectRoot, - stdio: 'inherit' - } - ); - - // Build exp and compat packages except for firebase-exp - await spawn( - 'yarn', - [ - 'lerna', - 'run', - '--scope', - '@firebase/*-exp', - '--scope', - '@firebase/*-compat', - 'build:release' - ], - { - cwd: projectRoot, - stdio: 'inherit' - } - ); - - // Build exp packages developed in place - // Firestore and firestore-compat - await spawn( - 'yarn', - ['lerna', 'run', '--scope', '@firebase/firestore', 'prebuild'], - { - cwd: projectRoot, - stdio: 'inherit' - } - ); - - await spawn( - 'yarn', - ['lerna', 'run', '--scope', '@firebase/firestore', 'build:exp:release'], - { - cwd: projectRoot, - stdio: 'inherit' - } - ); - - // Storage - await spawn( - 'yarn', - ['lerna', 'run', '--scope', '@firebase/storage', 'build:exp:release'], - { - cwd: projectRoot, - stdio: 'inherit' - } - ); - - // Database - await spawn( - 'yarn', - ['lerna', 'run', '--scope', '@firebase/database', 'build:exp:release'], - { - cwd: projectRoot, - stdio: 'inherit' - } - ); - - // remove packages/installations/dist, otherwise packages that depend on packages-exp/installations-exp (e.g. Perf, FCM) - // will incorrectly reference packages/installations. - const installationsDistDirPath = resolve( - projectRoot, - 'packages/installations/dist' - ); - if (existsSync(installationsDistDirPath)) { - rmdirSync(installationsDistDirPath, { recursive: true }); - } - - spinner.stopAndPersist({ - symbol: '✅' - }); -} - -async function buildFirebasePackage() { - const spinner = ora(' Building firebase').start(); - // Build firebase-exp - await spawn( - 'yarn', - ['lerna', 'run', '--scope', 'firebase-exp', 'build:release'], - { - cwd: projectRoot, - stdio: 'inherit' - } - ); - spinner.stopAndPersist({ - symbol: '✅' - }); -} - -async function getNewVersions(packagePaths: string[]) { - // get package name -> next version mapping - const versions = new Map(); - for (const path of packagePaths) { - const { version, name } = await readPackageJson(path); - - // increment firebase-exp as a v9 prerelease, e.g. 9.0.0-beta.0 -> 9.0.0-beta.1 - if (name === FIREBASE_UMBRELLA_PACKAGE_NAME) { - const nextVersion = inc(version, 'prerelease'); - versions.set(name, nextVersion); - } else { - // create individual packages version - // we can't use minor version for them because most of them - // are still in the pre-major version officially. - const nextVersion = `${version}-exp.${await getCurrentSha()}`; - versions.set(name, nextVersion); - } - } - return versions; -} - -async function publishToNpm(packagePaths: string[], dryRun = false) { - const taskArray = await Promise.all( - packagePaths.map(async pp => { - const { version, name } = await readPackageJson(pp); - return { - title: `📦 ${name}@${version}`, - task: () => publishPackage(pp, dryRun) - }; - }) - ); - - const tasks = new Listr(taskArray, { - concurrent: false, - exitOnError: false - }); - - console.log('\r\nPublishing Packages to NPM:'); - return tasks.run(); -} - -async function publishPackage(packagePath: string, dryRun: boolean) { - const args = ['publish', '--access', 'public', '--tag', 'beta']; - if (dryRun) { - args.push('--dry-run'); - } - await spawn('npm', args, { cwd: packagePath }); -} - -async function resetWorkingTreeAndBumpVersions( - packagePaths: string[], - versions: Map -) { - console.log('Resetting working tree'); - await git.checkout('.'); - - await updatePackageJsons(packagePaths, versions, { - removeExpInName: false, - updateVersions: true, - makePublic: false - }); -} - -async function updatePackageJsons( - packagePaths: string[], - versions: Map, - { - removeExpInName, - updateVersions, - makePublic - }: { - removeExpInName: boolean; - updateVersions: boolean; - makePublic: boolean; - } -) { - for (const path of packagePaths) { - const packageJsonPath = `${path}/package.json`; - const packageJson = await readPackageJson(path); - - // update version - if (updateVersions) { - const nextVersion = versions.get(packageJson.name); - console.log( - chalk`Updating {blue ${packageJson.name}} from {green ${packageJson.version}} to {green ${nextVersion}}` - ); - packageJson.version = nextVersion; - } - - // remove -exp in the package name - if (removeExpInName) { - const cleanName = removeExpInPackageName(packageJson.name); - console.log( - chalk`Renaming {blue ${packageJson.name}} to {blue ${cleanName}}` - ); - packageJson.name = cleanName; - - // update dep version and remove -exp in dep names - // don't care about devDependencies because they are irrelavant when using the package - const depTypes = ['dependencies', 'peerDependencies']; - - for (const depType of depTypes) { - const dependencies = packageJson[depType] || {}; - const newDependenciesObj: { [key: string]: string } = {}; - for (const d of Object.keys(dependencies)) { - const dNextVersion = versions.get(d); - const nameWithoutExp = removeExpInPackageName(d); - if (!dNextVersion) { - newDependenciesObj[nameWithoutExp] = dependencies[d]; - } else { - newDependenciesObj[nameWithoutExp] = dNextVersion; - } - } - packageJson[depType] = newDependenciesObj; - } - } - - // set private to false - if (makePublic) { - packageJson.private = false; - } - - // update package.json files - await writeFile( - packageJsonPath, - `${JSON.stringify(packageJson, null, 2)}\n`, - { encoding: 'utf-8' } - ); - } -} - -async function commitAndPush(versions: Map) { - await exec('git add packages-exp/firebase-exp/package.json yarn.lock'); - - const firebaseExpVersion = versions.get(FIREBASE_UMBRELLA_PACKAGE_NAME); - await exec(`git commit -m "Publish firebase ${firebaseExpVersion || ''}"`); - - let { stdout: currentBranch, stderr } = await exec( - `git rev-parse --abbrev-ref HEAD` - ); - currentBranch = currentBranch.trim(); - - await exec(`git push origin ${currentBranch} --no-verify -u`, { - cwd: projectRoot - }); -} - -function removeExpInPackageName(name: string) { - const regex = /^(.*firebase.*)-exp(.*)$/g; - - const captures = regex.exec(name); - if (!captures) { - return name; - } - - return `${captures[1]}${captures[2]}`; -} - -async function getCurrentSha() { - return (await git.revparse(['--short', 'HEAD'])).trim(); -} - -publishExpPackages(argv); diff --git a/scripts/exp/remove-exp.js b/scripts/exp/remove-exp.js deleted file mode 100644 index 7bbdbf58766..00000000000 --- a/scripts/exp/remove-exp.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @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. - */ - -/** - * Replace "-exp" with "" in all files within the directory. - * Used to generate reference docs without "-exp" in package names. - */ -const { argv } = require('yargs'); -const path = require('path'); -const { - readdirSync, - statSync, - readFileSync, - writeFileSync, - accessSync -} = require('fs'); - -// can be used in command line -if (argv._[0]) { - const dirOrFile = path.resolve(argv._[0]); - try { - accessSync(dirOrFile); - if (statSync(dirOrFile).isFile()) { - removeExpSuffixFromFile(dirOrFile); - } else { - removeExpSuffix(dirOrFile); - } - } catch (_err) {} -} - -function removeExpSuffix(dir) { - for (const file of readdirSync(dir)) { - const filePath = `${dir}/${file}`; - if (statSync(filePath).isFile()) { - removeExpSuffixFromFile(filePath); - } - } -} - -function removeExpSuffixFromFile(filePath) { - const content = readFileSync(filePath, 'utf-8'); - - // replace -exp with empty string - const modified = content.replace(/-exp/g, ''); - - writeFileSync(filePath, modified, 'utf-8'); -} - -exports.removeExpSuffix = removeExpSuffix; From 747b63dbe1768a9fe5770da28606a63674aa3b2c Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 26 Aug 2021 17:12:11 -0700 Subject: [PATCH 2/7] remove unneeded transformer --- packages/firestore/rollup.config.lite.js | 3 +- scripts/exp/ts-transform-import-path.js | 97 ------------------------ 2 files changed, 1 insertion(+), 99 deletions(-) delete mode 100644 scripts/exp/ts-transform-import-path.js diff --git a/packages/firestore/rollup.config.lite.js b/packages/firestore/rollup.config.lite.js index 8fb916fca3f..ff049f31916 100644 --- a/packages/firestore/rollup.config.lite.js +++ b/packages/firestore/rollup.config.lite.js @@ -25,7 +25,6 @@ import sourcemaps from 'rollup-plugin-sourcemaps'; import copy from 'rollup-plugin-copy'; import replace from 'rollup-plugin-replace'; import { terser } from 'rollup-plugin-terser'; -import { importPathTransformer } from '../../scripts/exp/ts-transform-import-path'; import pkg from './lite/package.json'; @@ -42,7 +41,7 @@ const nodePlugins = function () { }, cacheDir: tmp.dirSync(), abortOnError: false, - transformers: [util.removeAssertTransformer, importPathTransformer] + transformers: [util.removeAssertTransformer] }), json({ preferConst: true }), copy({ diff --git a/scripts/exp/ts-transform-import-path.js b/scripts/exp/ts-transform-import-path.js deleted file mode 100644 index 46fb7b9217d..00000000000 --- a/scripts/exp/ts-transform-import-path.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @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 * as ts from 'typescript'; - -export function getImportPathTransformer({ pattern, template }) { - return () => ({ - before: [transformImportPath({ pattern, template })], - after: [], - afterDeclarations: [transformImportPath({ pattern, template })] - }); -} -/** - * remove '-exp' in import paths. - * For example, `import {...} from '@firebase/app-exp'` becomes `import {...} from '@firebase/app'`. - * - * Used to generate the release build for exp packages. We do this because we publish them - * using the existing package names under a special release tag (e.g. firebase@exp); - */ -export const importPathTransformer = () => ({ - before: [ - transformImportPath({ - pattern: /^(@firebase.*)-exp(.*)$/, - template: [1, 2] - }) - ], - after: [], - afterDeclarations: [ - transformImportPath({ - pattern: /^(@firebase.*)-exp(.*)$/, - template: [1, 2] - }) - ] -}); - -function transformImportPath({ pattern, template }) { - return context => file => { - return visitNodeAndChildren(file, context, { pattern, template }); - }; -} - -function visitNodeAndChildren(node, context, { pattern, template }) { - return ts.visitEachChild( - visitNode(node, { pattern, template }), - childNode => - visitNodeAndChildren(childNode, context, { pattern, template }), - context - ); -} - -function visitNode(node, { pattern, template }) { - let importPath; - if ( - (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) && - node.moduleSpecifier - ) { - const importPathWithQuotes = node.moduleSpecifier.getText(); - importPath = importPathWithQuotes.substr( - 1, - importPathWithQuotes.length - 2 - ); - - const captures = pattern.exec(importPath); - if (captures) { - const newNameFragments = []; - for (const fragment of template) { - if (typeof fragment === 'number') { - newNameFragments.push(captures[fragment]); - } else if (typeof fragment === 'string') { - newNameFragments.push(fragment); - } else { - throw Error(`unrecognized fragment: ${fragment}`); - } - } - const newName = newNameFragments.join(''); - const newNode = ts.getMutableClone(node); - newNode.moduleSpecifier = ts.createLiteral(newName); - return newNode; - } - } - - return node; -} From 7a0e9a421c9ed47226fa5aea94f73f4ef48ff03e Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 26 Aug 2021 17:26:19 -0700 Subject: [PATCH 3/7] clean up scripts --- .github/workflows/check-changeset.yml | 2 +- .github/workflows/label-doc-changes.yml | 2 +- .github/workflows/release.yml | 2 +- packages/analytics-compat/package.json | 2 +- packages/analytics/package.json | 2 +- packages/app-check-compat/package.json | 2 +- packages/app-check/package.json | 2 +- packages/app/package.json | 4 +- packages/auth-compat/package.json | 2 +- packages/auth/package.json | 2 +- packages/database-compat/package.json | 2 +- packages/database/package.json | 2 +- packages/firestore-compat/package.json | 2 +- packages/firestore/package.json | 2 +- packages/functions-compat/package.json | 2 +- packages/functions/package.json | 2 +- packages/installations/package.json | 4 +- packages/messaging-compat/package.json | 2 +- packages/messaging/package.json | 2 +- packages/performance-compat/package.json | 2 +- packages/remote-config-compat/package.json | 2 +- packages/remote-config/package.json | 4 +- packages/storage-compat/package.json | 2 +- packages/storage/package.json | 2 +- scripts/{exp => build}/create-overloads.ts | 0 scripts/{exp => build}/use_typings.js | 0 scripts/{ => ci}/add_changeset.ts | 2 +- scripts/{ => ci}/check_changeset.ts | 0 scripts/{exp => ci}/detect-doc-changes.ts | 0 scripts/exp/prepare-util.ts | 130 ------------------ .../extract-deps.helpers.ts | 0 scripts/{exp => extract-deps}/extract-deps.sh | 0 scripts/{exp => extract-deps}/extract-deps.ts | 0 .../{exp => }/update-internal-dep-versions.ts | 4 +- 34 files changed, 30 insertions(+), 160 deletions(-) rename scripts/{exp => build}/create-overloads.ts (100%) rename scripts/{exp => build}/use_typings.js (100%) rename scripts/{ => ci}/add_changeset.ts (98%) rename scripts/{ => ci}/check_changeset.ts (100%) rename scripts/{exp => ci}/detect-doc-changes.ts (100%) delete mode 100644 scripts/exp/prepare-util.ts rename scripts/{exp => extract-deps}/extract-deps.helpers.ts (100%) rename scripts/{exp => extract-deps}/extract-deps.sh (100%) rename scripts/{exp => extract-deps}/extract-deps.ts (100%) rename scripts/{exp => }/update-internal-dep-versions.ts (94%) diff --git a/.github/workflows/check-changeset.yml b/.github/workflows/check-changeset.yml index 3d35135df6f..9ffaeade681 100644 --- a/.github/workflows/check-changeset.yml +++ b/.github/workflows/check-changeset.yml @@ -24,7 +24,7 @@ jobs: - name: Yarn install run: yarn - name: Run changeset script - run: yarn ts-node-script scripts/check_changeset.ts + run: yarn ts-node-script scripts/ci/check_changeset.ts id: check-changeset - name: Print changeset checker output run: echo "${{steps.check-changeset.outputs.CHANGESET_ERROR_MESSAGE}}" diff --git a/.github/workflows/label-doc-changes.yml b/.github/workflows/label-doc-changes.yml index ddfbadea64d..195859443b2 100644 --- a/.github/workflows/label-doc-changes.yml +++ b/.github/workflows/label-doc-changes.yml @@ -24,7 +24,7 @@ jobs: - name: Yarn install run: yarn - name: Run detect doc changes script - run: yarn ts-node-script scripts/exp/detect-doc-changes.ts + run: yarn ts-node-script scripts/ci/detect-doc-changes.ts id: check-doc-changes - name: Print if doc changed output run: echo "${{steps.check-doc-changes.outputs.DOC_CHANGED}}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 256ee58db70..d005506a193 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: run: yarn - name: Add a changeset for @firebase/app - run: yarn ts-node-script scripts/add_changeset.ts + run: yarn ts-node-script scripts/ci/add_changeset.ts - name: Create Release Pull Request uses: changesets/action@master diff --git a/packages/analytics-compat/package.json b/packages/analytics-compat/package.json index b7e3c38d1b5..df3981badcc 100644 --- a/packages/analytics-compat/package.json +++ b/packages/analytics-compat/package.json @@ -39,7 +39,7 @@ "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser", "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers=Chrome --auto-watch", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../analytics/dist/analytics-public.d.ts -o dist/src/index.d.ts -a -r Analytics:FirebaseAnalytics -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/analytics" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../analytics/dist/analytics-public.d.ts -o dist/src/index.d.ts -a -r Analytics:FirebaseAnalytics -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/analytics" }, "typings": "dist/src/index.d.ts", "dependencies": { diff --git a/packages/analytics/package.json b/packages/analytics/package.json index f8f9f40a1ba..1ca61f52fcf 100644 --- a/packages/analytics/package.json +++ b/packages/analytics/package.json @@ -24,7 +24,7 @@ "api-report": "api-extractor run --local --verbose", "doc": "api-documenter markdown --input temp --output docs", "build:doc": "yarn build && yarn doc", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/analytics-public.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/analytics-public.d.ts" }, "peerDependencies": { "@firebase/app": "0.x" diff --git a/packages/app-check-compat/package.json b/packages/app-check-compat/package.json index b1322f6703c..7b4539821e9 100644 --- a/packages/app-check-compat/package.json +++ b/packages/app-check-compat/package.json @@ -19,7 +19,7 @@ "test": "run-p lint test:browser", "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:browser", "test:browser": "karma start --single-run --nocache", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../app-check/dist/app-check-public.d.ts -o dist/src/index.d.ts -a -r AppCheck:FirebaseAppCheck -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/app-check" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../app-check/dist/app-check-public.d.ts -o dist/src/index.d.ts -a -r AppCheck:FirebaseAppCheck -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/app-check" }, "peerDependencies": { "@firebase/app-compat": "0.x" diff --git a/packages/app-check/package.json b/packages/app-check/package.json index 9fc215892fc..2c4c8c3d5a2 100644 --- a/packages/app-check/package.json +++ b/packages/app-check/package.json @@ -22,7 +22,7 @@ "api-report": "api-extractor run --local --verbose", "doc": "api-documenter markdown --input temp --output docs", "build:doc": "yarn build && yarn doc", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/app-check-public.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/app-check-public.d.ts" }, "peerDependencies": { "@firebase/app": "0.x" diff --git a/packages/app/package.json b/packages/app/package.json index 4f56ea495a2..1c0f4ba8276 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -24,8 +24,8 @@ "api-report": "api-extractor run --local --verbose", "doc": "api-documenter markdown --input temp --output docs", "build:doc": "yarn build && yarn doc", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/app-public.d.ts", - "typings:internal": "node ../../scripts/exp/use_typings.js ./dist/app.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/app-public.d.ts", + "typings:internal": "node ../../scripts/build/use_typings.js ./dist/app.d.ts" }, "dependencies": { "@firebase/util": "1.3.0", diff --git a/packages/auth-compat/package.json b/packages/auth-compat/package.json index 01fd36f73cc..7b5d66a9376 100644 --- a/packages/auth-compat/package.json +++ b/packages/auth-compat/package.json @@ -25,7 +25,7 @@ "test:node:integration": "ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --integration", "test:webdriver": "rollup -c test/integration/webdriver/static/rollup.config.js && ts-node -O '{\"module\": \"commonjs\", \"target\": \"es6\"}' scripts/run_node_tests.ts --webdriver", "test:integration": "firebase emulators:exec --project demo-emulatedproject --only auth \"run-s test:browser:integration test:node:integration test:webdriver\"", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../auth/dist/auth-public.d.ts -o dist/auth-compat/index.d.ts -a -r Auth:types.FirebaseAuth -r User:types.User -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/auth" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../auth/dist/auth-public.d.ts -o dist/auth-compat/index.d.ts -a -r Auth:types.FirebaseAuth -r User:types.User -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/auth" }, "peerDependencies": { "@firebase/app-compat": "0.x" diff --git a/packages/auth/package.json b/packages/auth/package.json index a0edbffcb15..c1c3997a4b9 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -44,7 +44,7 @@ "api-report": "api-extractor run --local --verbose && ts-node-script ../../repo-scripts/prune-dts/prune-dts.ts --input dist/auth-public.d.ts --output dist/auth-public.d.ts", "doc": "api-documenter markdown --input temp --output docs", "build:doc": "yarn build && yarn doc", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/auth-public.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/auth-public.d.ts" }, "peerDependencies": { "@firebase/app": "0.x" diff --git a/packages/database-compat/package.json b/packages/database-compat/package.json index 6d443c5457f..8ef0700c798 100644 --- a/packages/database-compat/package.json +++ b/packages/database-compat/package.json @@ -21,7 +21,7 @@ "test:ci": "node ../../scripts/run_tests_in_ci.js -s test", "test:browser": "karma start --single-run", "test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file src/index.node.ts --config ../../config/mocharc.node.js", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../database/dist/public.d.ts -o dist/database-compat/src/index.d.ts -a -r Database:types.FirebaseDatabase -r Query:types.Query -r DatabaseReference:types.Reference -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/database" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../database/dist/public.d.ts -o dist/database-compat/src/index.d.ts -a -r Database:types.FirebaseDatabase -r Query:types.Query -r DatabaseReference:types.Reference -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/database" }, "peerDependencies": { "@firebase/app-compat": "0.x" diff --git a/packages/database/package.json b/packages/database/package.json index 9f3d49b30d4..2247fa31aad 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -26,7 +26,7 @@ "api-report": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package database --packageRoot . --typescriptDts ./dist/src/index.d.ts --rollupDts ./dist/private.d.ts --untrimmedRollupDts ./dist/internal.d.ts --publicDts ./dist/public.d.ts && yarn api-report:api-json", "api-report:api-json": "rm -rf temp && api-extractor run --local --verbose", "doc": "api-documenter markdown --input temp --output docs", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/public.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/public.d.ts" }, "license": "Apache-2.0", "peerDependencies": {}, diff --git a/packages/firestore-compat/package.json b/packages/firestore-compat/package.json index d1da506e410..15b56cb3c43 100644 --- a/packages/firestore-compat/package.json +++ b/packages/firestore-compat/package.json @@ -17,7 +17,7 @@ "build:deps": "lerna run --scope @firebase/firestore-compat --include-dependencies build", "build:release": "yarn build && yarn add-compat-overloads", "test": "echo 'tested as part of firestore'", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../firestore/dist/index.d.ts -o dist/src/index.d.ts -a -r Firestore:types.FirebaseFirestore -r CollectionReference:types.CollectionReference -r DocumentReference:types.DocumentReference -r Query:types.Query -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/firestore" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../firestore/dist/index.d.ts -o dist/src/index.d.ts -a -r Firestore:types.FirebaseFirestore -r CollectionReference:types.CollectionReference -r DocumentReference:types.DocumentReference -r Query:types.Query -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/firestore" }, "peerDependencies": { "@firebase/app-compat": "0.x" diff --git a/packages/firestore/package.json b/packages/firestore/package.json index eaf55e65f55..244a3862a13 100644 --- a/packages/firestore/package.json +++ b/packages/firestore/package.json @@ -43,7 +43,7 @@ "api-report": "run-s api-report:main api-report:lite && yarn api-report:api-json", "doc": "api-documenter markdown --input temp --output docs", "test:prepare": "node ./scripts/prepare-test.js", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/index.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/index.d.ts" }, "main": "dist/index.node.cjs.js", "main-esm": "dist/index.node.cjs.esm2017.js", diff --git a/packages/functions-compat/package.json b/packages/functions-compat/package.json index f1d93731ca7..05c59004010 100644 --- a/packages/functions-compat/package.json +++ b/packages/functions-compat/package.json @@ -42,7 +42,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_HOST=http://localhost FIREBASE_FUNCTIONS_PORT=5005 run-p test:node", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../functions/dist/functions-public.d.ts -o dist/src/index.d.ts -a -r Functions:types.FirebaseFunctions -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/functions" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../functions/dist/functions-public.d.ts -o dist/src/index.d.ts -a -r Functions:types.FirebaseFunctions -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/functions" }, "typings": "dist/src/index.d.ts", "dependencies": { diff --git a/packages/functions/package.json b/packages/functions/package.json index eda241d2bc0..311b4ab1fcd 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -26,7 +26,7 @@ "api-report": "api-extractor run --local --verbose", "doc": "api-documenter markdown --input temp --output docs", "build:doc": "yarn build && yarn doc", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/functions-public.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/functions-public.d.ts" }, "license": "Apache-2.0", "peerDependencies": { diff --git a/packages/installations/package.json b/packages/installations/package.json index 2da6e759331..347e4f648af 100644 --- a/packages/installations/package.json +++ b/packages/installations/package.json @@ -28,8 +28,8 @@ "api-report": "api-extractor run --local --verbose", "doc": "api-documenter markdown --input temp --output docs", "build:doc": "yarn build && yarn doc", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/installations-public.d.ts", - "typings:internal": "node ../../scripts/exp/use_typings.js ./dist/src/index.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/installations-public.d.ts", + "typings:internal": "node ../../scripts/build/use_typings.js ./dist/src/index.d.ts" }, "repository": { "directory": "packages/installations", diff --git a/packages/messaging-compat/package.json b/packages/messaging-compat/package.json index 938045f6d94..38d7ab7bae0 100644 --- a/packages/messaging-compat/package.json +++ b/packages/messaging-compat/package.json @@ -24,7 +24,7 @@ "test:karma": "karma start --single-run", "test:debug": "karma start --browsers=Chrome --auto-watch", "type-check": "tsc --noEmit", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../messaging/dist/index-public.d.ts -o dist/src/index.d.ts -a -r Messaging:MessagingCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/messaging" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../messaging/dist/index-public.d.ts -o dist/src/index.d.ts -a -r Messaging:MessagingCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/messaging" }, "peerDependencies": { "@firebase/app-compat": "0.x" diff --git a/packages/messaging/package.json b/packages/messaging/package.json index 91e78ffd45c..0101ad21cdd 100644 --- a/packages/messaging/package.json +++ b/packages/messaging/package.json @@ -29,7 +29,7 @@ "api-report:sw": "ts-node-script ../../repo-scripts/prune-dts/extract-public-api.ts --package messaging-sw --packageRoot . --typescriptDts ./dist/index.sw.d.ts --rollupDts ./dist/sw/private.d.ts --untrimmedRollupDts ./dist/sw/internal.d.ts --publicDts ./dist/sw/index-public.d.ts", "api-report:api-json": "api-extractor run --local --verbose", "type-check": "tsc --noEmit", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/index-public.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/index-public.d.ts" }, "license": "Apache-2.0", "peerDependencies": { diff --git a/packages/performance-compat/package.json b/packages/performance-compat/package.json index e2ea02fac81..f8bfdbde51b 100644 --- a/packages/performance-compat/package.json +++ b/packages/performance-compat/package.json @@ -22,7 +22,7 @@ "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers Chrome --auto-watch", "prettier": "prettier --write '{src,test}/**/*.{js,ts}'", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../performance/dist/src/index.d.ts -o dist/src/index.d.ts -a -r FirebasePerformance:FirebasePerformanceCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/performance" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../performance/dist/src/index.d.ts -o dist/src/index.d.ts -a -r FirebasePerformance:FirebasePerformanceCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/performance" }, "license": "Apache-2.0", "peerDependencies": { diff --git a/packages/remote-config-compat/package.json b/packages/remote-config-compat/package.json index ab7d15c23d0..8a9f676a6dd 100644 --- a/packages/remote-config-compat/package.json +++ b/packages/remote-config-compat/package.json @@ -21,7 +21,7 @@ "test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all", "test:browser": "karma start --single-run", "test:browser:debug": "karma start --browsers Chrome --auto-watch", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../remote-config/dist/remote-config-public.d.ts -o dist/src/index.d.ts -a -r RemoteConfig:RemoteConfigCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/remote-config" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../remote-config/dist/remote-config-public.d.ts -o dist/src/index.d.ts -a -r RemoteConfig:RemoteConfigCompat -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/remote-config" }, "license": "Apache-2.0", "peerDependencies": { diff --git a/packages/remote-config/package.json b/packages/remote-config/package.json index d443294b644..bafc6807c5f 100644 --- a/packages/remote-config/package.json +++ b/packages/remote-config/package.json @@ -24,8 +24,8 @@ "api-report": "api-extractor run --local --verbose", "doc": "api-documenter markdown --input temp --output docs", "build:doc": "yarn build && yarn doc", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/remote-config-public.d.ts", - "typings:internal": "node ../../scripts/exp/use_typings.js ./dist/src/index.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/remote-config-public.d.ts", + "typings:internal": "node ../../scripts/build/use_typings.js ./dist/src/index.d.ts" }, "peerDependencies": { "@firebase/app": "0.x" diff --git a/packages/storage-compat/package.json b/packages/storage-compat/package.json index 9d246e5e60c..d5652133a11 100644 --- a/packages/storage-compat/package.json +++ b/packages/storage-compat/package.json @@ -23,7 +23,7 @@ "test:node": "TS_NODE_FILES=true TS_NODE_CACHE=NO TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --file src/index.ts --config ../../config/mocharc.node.js", "test:debug": "karma start --browser=Chrome", "prettier": "prettier --write 'src/**/*.ts' 'test/**/*.ts'", - "add-compat-overloads": "ts-node-script ../../scripts/exp/create-overloads.ts -i ../storage/dist/storage-public.d.ts -o dist/src/index.d.ts -a -r FirebaseStorage:types.FirebaseStorage -r StorageReference:types.Reference -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/storage" + "add-compat-overloads": "ts-node-script ../../scripts/build/create-overloads.ts -i ../storage/dist/storage-public.d.ts -o dist/src/index.d.ts -a -r FirebaseStorage:types.FirebaseStorage -r StorageReference:types.Reference -r FirebaseApp:FirebaseAppCompat --moduleToEnhance @firebase/storage" }, "peerDependencies": { "@firebase/app-compat": "0.x" diff --git a/packages/storage/package.json b/packages/storage/package.json index 55663a61790..8971c08974f 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -26,7 +26,7 @@ "test:debug": "karma start --browser=Chrome", "prettier": "prettier --write 'src/**/*.ts' 'test/**/*.ts'", "api-report": "api-extractor run --local --verbose && ts-node-script ../../repo-scripts/prune-dts/prune-dts.ts --input dist/storage-public.d.ts --output dist/storage-public.d.ts", - "typings:public": "node ../../scripts/exp/use_typings.js ./dist/storage-public.d.ts" + "typings:public": "node ../../scripts/build/use_typings.js ./dist/storage-public.d.ts" }, "license": "Apache-2.0", "dependencies": { diff --git a/scripts/exp/create-overloads.ts b/scripts/build/create-overloads.ts similarity index 100% rename from scripts/exp/create-overloads.ts rename to scripts/build/create-overloads.ts diff --git a/scripts/exp/use_typings.js b/scripts/build/use_typings.js similarity index 100% rename from scripts/exp/use_typings.js rename to scripts/build/use_typings.js diff --git a/scripts/add_changeset.ts b/scripts/ci/add_changeset.ts similarity index 98% rename from scripts/add_changeset.ts rename to scripts/ci/add_changeset.ts index 8167c9d6baf..6ab8ac92f54 100644 --- a/scripts/add_changeset.ts +++ b/scripts/ci/add_changeset.ts @@ -23,7 +23,7 @@ */ import { writeFileSync } from 'fs'; -import { projectRoot } from './utils'; +import { projectRoot } from '../utils'; import { exec } from 'child-process-promise'; const CONTENT = ` diff --git a/scripts/check_changeset.ts b/scripts/ci/check_changeset.ts similarity index 100% rename from scripts/check_changeset.ts rename to scripts/ci/check_changeset.ts diff --git a/scripts/exp/detect-doc-changes.ts b/scripts/ci/detect-doc-changes.ts similarity index 100% rename from scripts/exp/detect-doc-changes.ts rename to scripts/ci/detect-doc-changes.ts diff --git a/scripts/exp/prepare-util.ts b/scripts/exp/prepare-util.ts deleted file mode 100644 index 5e402de56e8..00000000000 --- a/scripts/exp/prepare-util.ts +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @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 { resolve } from 'path'; -import { - writeFileSync, - statSync, - readFileSync, - existsSync, - readdirSync, - mkdirSync, - copyFileSync, - rmdirSync -} from 'fs'; -import { projectRoot, readPackageJson } from '../utils'; - -export interface CompatConfig { - srcDir: string; - compatSrcDir: string; - compatDestDir: string; - compatBinarySrcDir: string; - compatBinaryDestDir: string; -} - -export async function createCompatProject(config: CompatConfig) { - const { - srcDir, - compatSrcDir, - compatDestDir, - compatBinarySrcDir, - compatBinaryDestDir - } = config; - // remove the dir if it exists - if (existsSync(compatDestDir)) { - rmdirSync(compatDestDir, { recursive: true }); - } - - copyRecursiveSync(compatSrcDir, compatDestDir); - copyRecursiveSync( - compatBinarySrcDir, - compatBinaryDestDir, - /* include d.ts files*/ true - ); - - // update root package.json - await transformFile(resolve(compatDestDir, 'package.json'), async content => { - const updatedContent = content.replace(/\.\.\/dist\/compat/g, './dist'); - const compatPkgJson = JSON.parse(updatedContent); - - const srcPkgJson = await readPackageJson(srcDir); - - compatPkgJson.dependencies = { - ...srcPkgJson.dependencies, - [srcPkgJson.name]: srcPkgJson.version - }; - - compatPkgJson.files = ['dist']; - - return `${JSON.stringify(compatPkgJson, null, 2)}\n`; - }); -} - -const FIREBASE_EXP_DIR = `${projectRoot}/packages-exp/firebase-exp`; -export async function addCompatToFirebasePkgJson(compatPkgNames: string[]) { - const compatDeps: Record = {}; - for (const pkgName of compatPkgNames) { - compatDeps[pkgName] = '0.0.900'; - } - - const firebasePkgJson = await readPackageJson(FIREBASE_EXP_DIR); - firebasePkgJson.dependencies = { - ...firebasePkgJson.dependencies, - ...compatDeps - }; - - writeFileSync( - `${FIREBASE_EXP_DIR}/package.json`, - `${JSON.stringify(firebasePkgJson, null, 2)}\n`, - { encoding: 'utf-8' } - ); -} - -export function copyRecursiveSync( - src: string, - dest: string, - includeTs: boolean = false -) { - if (!existsSync(src)) { - return; - } - - const srcStat = statSync(src); - const isDirectory = srcStat.isDirectory(); - if (isDirectory) { - mkdirSync(dest); - for (const item of readdirSync(src)) { - copyRecursiveSync(resolve(src, item), resolve(dest, item), includeTs); - } - } else { - // do not copy source file - if (src.includes('.ts') && !includeTs) { - return; - } - - copyFileSync(src, dest); - } -} - -export async function transformFile( - path: string, - transformer: (content: string) => Promise -) { - let content = readFileSync(path, 'utf8'); - - writeFileSync(path, await transformer(content), { encoding: 'utf8' }); -} diff --git a/scripts/exp/extract-deps.helpers.ts b/scripts/extract-deps/extract-deps.helpers.ts similarity index 100% rename from scripts/exp/extract-deps.helpers.ts rename to scripts/extract-deps/extract-deps.helpers.ts diff --git a/scripts/exp/extract-deps.sh b/scripts/extract-deps/extract-deps.sh similarity index 100% rename from scripts/exp/extract-deps.sh rename to scripts/extract-deps/extract-deps.sh diff --git a/scripts/exp/extract-deps.ts b/scripts/extract-deps/extract-deps.ts similarity index 100% rename from scripts/exp/extract-deps.ts rename to scripts/extract-deps/extract-deps.ts diff --git a/scripts/exp/update-internal-dep-versions.ts b/scripts/update-internal-dep-versions.ts similarity index 94% rename from scripts/exp/update-internal-dep-versions.ts rename to scripts/update-internal-dep-versions.ts index 86f903576f3..462d19cae38 100644 --- a/scripts/exp/update-internal-dep-versions.ts +++ b/scripts/update-internal-dep-versions.ts @@ -25,8 +25,8 @@ * Example: node scripts/exp/update-internal-dep-versions.js --file packages-exp/functions-exp/package.json */ -import { projectRoot } from '../utils'; -import { mapPkgNameToPkgJson } from '../release/utils/workspace'; +import { projectRoot } from './utils'; +import { mapPkgNameToPkgJson } from './release/utils/workspace'; import { argv } from 'yargs'; import fs from 'mz/fs'; From 1f61653a39d95b89811ceb475ce59237dcaa8612 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 26 Aug 2021 17:35:43 -0700 Subject: [PATCH 4/7] more clean up --- packages/auth/api-extractor.json | 2 -- packages/database/package.json | 2 +- packages/database/src/core/view/EventRegistration.ts | 2 +- packages/firestore-compat/src/config.ts | 2 +- packages/firestore/karma.conf.js | 3 --- packages/firestore/rollup.shared.js | 10 ---------- repo-scripts/prune-dts/tests/firestore.input.d.ts | 4 ++-- repo-scripts/prune-dts/tests/firestore.output.d.ts | 4 ++-- scripts/ci/detect-doc-changes.ts | 4 ++-- scripts/docgen/docgen.ts | 2 +- .../size_report/report_modular_export_binary_size.ts | 2 +- scripts/update-internal-dep-versions.ts | 4 ++-- 12 files changed, 13 insertions(+), 28 deletions(-) diff --git a/packages/auth/api-extractor.json b/packages/auth/api-extractor.json index 135909ee3f5..bd0dda5cca2 100644 --- a/packages/auth/api-extractor.json +++ b/packages/auth/api-extractor.json @@ -1,7 +1,5 @@ { "extends": "../../config/api-extractor.json", - // If this path ever changes, make sure to change scripts/exp/docgen.ts - // accordingly. "mainEntryPointFilePath": "/dist/esm5/index.d.ts", "dtsRollup": { "enabled": true, diff --git a/packages/database/package.json b/packages/database/package.json index 2247fa31aad..e08ecea5686 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -13,7 +13,7 @@ "scripts": { "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", "lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", - "prettier": "prettier --write '*.js' '*.ts' '@(exp|src|test)/**/*.ts'", + "prettier": "prettier --write '*.js' '*.ts' '@(src|test)/**/*.ts'", "build": "rollup -c rollup.config.js && yarn api-report", "build:deps": "lerna run --scope @firebase/'{app,database}' --include-dependencies build", "dev": "rollup -c -w", diff --git a/packages/database/src/core/view/EventRegistration.ts b/packages/database/src/core/view/EventRegistration.ts index bbe18e49d1c..205eee9adba 100644 --- a/packages/database/src/core/view/EventRegistration.ts +++ b/packages/database/src/core/view/EventRegistration.ts @@ -27,7 +27,7 @@ import { QueryParams } from './QueryParams'; /** * A user callback. Callbacks issues from the Legacy SDK maintain references - * to the original user-issued callbacks, which allows equality + * to the original user-issued callbacks, which allows equality * comparison by reference even though this callbacks are wrapped before * they can be passed to the firebase@exp SDK. * diff --git a/packages/firestore-compat/src/config.ts b/packages/firestore-compat/src/config.ts index 29dea55d0a8..a00fd0dda0f 100644 --- a/packages/firestore-compat/src/config.ts +++ b/packages/firestore-compat/src/config.ts @@ -25,7 +25,7 @@ import { CACHE_SIZE_UNLIMITED, GeoPoint, Timestamp -} from '@firebase/firestore'; // import from the exp public API +} from '@firebase/firestore'; import { Blob } from './api/blob'; import { diff --git a/packages/firestore/karma.conf.js b/packages/firestore/karma.conf.js index 15b6cdce68a..21d9fe6277e 100644 --- a/packages/firestore/karma.conf.js +++ b/packages/firestore/karma.conf.js @@ -55,9 +55,6 @@ function getTestFiles(argv) { process.env.TEST_PLATFORM = 'browser_lite'; return [liteIntegrationTests]; } else { - // Note that we cannot include both the firestore-exp and the legacy SDK - // as the test runners modify the global namespace cannot be both included - // in the same bundle. return [unitTests, legcayIntegrationTests]; } } diff --git a/packages/firestore/rollup.shared.js b/packages/firestore/rollup.shared.js index 36cdff5206a..464cc633980 100644 --- a/packages/firestore/rollup.shared.js +++ b/packages/firestore/rollup.shared.js @@ -119,16 +119,6 @@ const removeAssertTransformer = service => ({ }); exports.removeAssertTransformer = removeAssertTransformer; -/** - * Transformer that coverts import paths that match `exp/index` to `@firebase/firestore` - * and `lite/index` to `@firebase/firestore/lite` - */ -const importTransformer = service => ({ - before: [removeAsserts(service.getProgram())], - after: [] -}); -exports.importTransformer = importTransformer; - /** * Transformers that remove calls to `debugAssert`, messages for 'fail` and * `hardAssert` and appends a __PRIVATE_ prefix to all internal symbols. diff --git a/repo-scripts/prune-dts/tests/firestore.input.d.ts b/repo-scripts/prune-dts/tests/firestore.input.d.ts index ffd2b242f29..bb007b62608 100644 --- a/repo-scripts/prune-dts/tests/firestore.input.d.ts +++ b/repo-scripts/prune-dts/tests/firestore.input.d.ts @@ -15,9 +15,9 @@ * limitations under the License. */ import { DocumentData as DocumentData_2 } from '@firebase/firestore-types'; -import { FirebaseApp } from '@firebase/app-exp'; +import { FirebaseApp } from '@firebase/app'; import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; -import { _FirebaseService } from '@firebase/app-exp'; +import { _FirebaseService } from '@firebase/app'; import { LogLevelString as LogLevel } from '@firebase/logger'; import { Provider } from '@firebase/component'; import { SetOptions as SetOptions_2 } from '@firebase/firestore-types'; diff --git a/repo-scripts/prune-dts/tests/firestore.output.d.ts b/repo-scripts/prune-dts/tests/firestore.output.d.ts index 9eb0f6a56ab..f6078262dd0 100644 --- a/repo-scripts/prune-dts/tests/firestore.output.d.ts +++ b/repo-scripts/prune-dts/tests/firestore.output.d.ts @@ -15,9 +15,9 @@ * limitations under the License. */ import { DocumentData as DocumentData_2 } from '@firebase/firestore-types'; -import { FirebaseApp } from '@firebase/app-exp'; +import { FirebaseApp } from '@firebase/app'; import { FirebaseAuthInternalName } from '@firebase/auth-interop-types'; -import { _FirebaseService } from '@firebase/app-exp'; +import { _FirebaseService } from '@firebase/app'; import { LogLevelString as LogLevel } from '@firebase/logger'; import { Provider } from '@firebase/component'; import { SetOptions as SetOptions_2 } from '@firebase/firestore-types'; diff --git a/scripts/ci/detect-doc-changes.ts b/scripts/ci/detect-doc-changes.ts index 14691adf5cd..070ef226604 100644 --- a/scripts/ci/detect-doc-changes.ts +++ b/scripts/ci/detect-doc-changes.ts @@ -37,7 +37,7 @@ async function docChanged(baseSha: string, headSha: string): Promise { // generate reference docs using the baseSha await git.checkout(baseSha); await spawn('yarn', [], { cwd: tmpDir, stdio: 'inherit' }); - await spawn('yarn', ['docgen:exp', 'devsite'], { + await spawn('yarn', ['docgen', 'devsite'], { cwd: tmpDir, stdio: 'inherit' }); @@ -54,7 +54,7 @@ async function docChanged(baseSha: string, headSha: string): Promise { // stage the docs generated by baseSha, so we can use git diff to tell if any docs are different in the headSha await git.stash(['pop']); await git.add('*'); - await spawn('yarn', ['docgen:exp', 'devsite'], { + await spawn('yarn', ['docgen', 'devsite'], { cwd: tmpDir, stdio: 'inherit' }); diff --git a/scripts/docgen/docgen.ts b/scripts/docgen/docgen.ts index 58c2da0224c..c655c594ae9 100644 --- a/scripts/docgen/docgen.ts +++ b/scripts/docgen/docgen.ts @@ -35,7 +35,7 @@ yargs const tmpDir = `${projectRoot}/temp`; // create *.api.json files async function generateDocs(forDevsite: boolean = false) { - const outputFolder = forDevsite ? 'docs-devsite' : 'docs-exp'; + const outputFolder = forDevsite ? 'docs-devsite' : 'docs'; const command = forDevsite ? 'api-documenter-devsite' : 'api-documenter'; // Use a special d.ts file for auth for doc gen only. diff --git a/scripts/size_report/report_modular_export_binary_size.ts b/scripts/size_report/report_modular_export_binary_size.ts index 8b0e393621a..6fa245089c9 100644 --- a/scripts/size_report/report_modular_export_binary_size.ts +++ b/scripts/size_report/report_modular_export_binary_size.ts @@ -33,7 +33,7 @@ interface ModularExportBinarySizeRequestBody extends RequestBody { async function generateReport(): Promise { let allModulesLocation: string[] = await mapWorkspaceToPackages([ - `${projectRoot}/packages-exp/*` + `${projectRoot}/packages/*` ]); allModulesLocation = allModulesLocation.filter(path => { diff --git a/scripts/update-internal-dep-versions.ts b/scripts/update-internal-dep-versions.ts index 462d19cae38..256ea755335 100644 --- a/scripts/update-internal-dep-versions.ts +++ b/scripts/update-internal-dep-versions.ts @@ -20,9 +20,9 @@ * These can get out of sync when working on a new unreleased component in a branch while the * already-released component versions in its deps keep being updated with each release. * - * Usage: node scripts/exp/update-internal-dep-versions.js --file [package.json file path] + * Usage: node scripts/update-internal-dep-versions.js --file [package.json file path] * - * Example: node scripts/exp/update-internal-dep-versions.js --file packages-exp/functions-exp/package.json + * Example: node scripts/update-internal-dep-versions.js --file packages/functions/package.json */ import { projectRoot } from './utils'; From eaf6b0d8eff4e0f4e995d76aa496697d6c3cb4a1 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Wed, 1 Sep 2021 14:52:31 -0700 Subject: [PATCH 5/7] remove stray reference --- packages/firestore/rollup.config.lite.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/firestore/rollup.config.lite.js b/packages/firestore/rollup.config.lite.js index ff049f31916..53e435706b7 100644 --- a/packages/firestore/rollup.config.lite.js +++ b/packages/firestore/rollup.config.lite.js @@ -69,10 +69,7 @@ const browserPlugins = function () { }, cacheDir: tmp.dirSync(), abortOnError: false, - transformers: [ - util.removeAssertAndPrefixInternalTransformer, - importPathTransformer - ] + transformers: [util.removeAssertAndPrefixInternalTransformer] }), json({ preferConst: true }), terser(util.manglePrivatePropertiesOptions) From d08a2aafde895c87d29e89d09c466f3f9abb2708 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Wed, 1 Sep 2021 15:06:20 -0700 Subject: [PATCH 6/7] remove unused plugins --- packages/auth-compat/demo/package.json | 1 - packages/firebase/package.json | 1 - yarn.lock | 71 ++------------------------ 3 files changed, 3 insertions(+), 70 deletions(-) diff --git a/packages/auth-compat/demo/package.json b/packages/auth-compat/demo/package.json index b89727d1d07..e8346894c8a 100644 --- a/packages/auth-compat/demo/package.json +++ b/packages/auth-compat/demo/package.json @@ -30,7 +30,6 @@ "@rollup/plugin-json": "4.1.0", "rollup-plugin-replace": "2.2.0", "@rollup/plugin-commonjs": "17.1.0", - "rollup-plugin-license": "0.14.0", "@rollup/plugin-node-resolve": "11.2.0", "rollup-plugin-sourcemaps": "0.6.3", "rollup-plugin-typescript2": "0.30.0", diff --git a/packages/firebase/package.json b/packages/firebase/package.json index 366575d2cd0..0a31d172bf9 100644 --- a/packages/firebase/package.json +++ b/packages/firebase/package.json @@ -248,7 +248,6 @@ "devDependencies": { "rollup": "2.52.2", "@rollup/plugin-commonjs": "17.1.0", - "rollup-plugin-license": "2.5.0", "@rollup/plugin-node-resolve": "11.2.0", "rollup-plugin-sourcemaps": "0.6.3", "rollup-plugin-terser": "7.0.2", diff --git a/yarn.lock b/yarn.lock index ac49f79ee84..ac036fb4ec8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3939,11 +3939,6 @@ array-each@^1.0.0, array-each@^1.0.1: resolved "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz#a794af0c05ab1752846ee753a1f211a05ba0c44f" integrity sha1-p5SvDAWrF1KEbudTofIRoFugxE8= -array-find-index@^1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" - integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= - array-flatten@1.1.1, array-flatten@^1.0.0: version "1.1.1" resolved "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -5507,11 +5502,6 @@ commander@^4.0.1: resolved "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== -commenting@1.1.0: - version "1.1.0" - resolved "https://registry.npmjs.org/commenting/-/commenting-1.1.0.tgz#fae14345c6437b8554f30bc6aa6c1e1633033590" - integrity sha512-YeNK4tavZwtH7jEgK1ZINXzLKm6DZdEMfsaaieOsCAN0S8vsY7UeuO3Q7d/M018EFgE+IeUAuBOKkFccBZsUZA== - commondir@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -8252,7 +8242,7 @@ glob@7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@7.1.7, glob@^7.0.0, glob@^7.0.3, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7: version "7.1.7" resolved "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== @@ -11005,7 +10995,7 @@ lodash@4.17.20: resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== -lodash@4.17.21, lodash@^4.16.6, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.7.0, lodash@~4.17.15: +lodash@^4.16.6, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.7.0, lodash@~4.17.15: version "4.17.21" resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -11143,7 +11133,7 @@ lunr@^2.3.8: resolved "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== -magic-string@0.25.7, magic-string@^0.25.2, magic-string@^0.25.7: +magic-string@^0.25.2, magic-string@^0.25.7: version "0.25.7" resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== @@ -11737,11 +11727,6 @@ modify-values@^1.0.0: resolved "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== -moment@2.29.1: - version "2.29.1" - resolved "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" - integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== - morgan@^1.10.0, morgan@^1.8.2: version "1.10.0" resolved "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz#091778abc1fc47cd3509824653dae1faab6b17d7" @@ -12779,11 +12764,6 @@ package-json@^6.3.0: registry-url "^5.0.0" semver "^6.2.0" -package-name-regex@2.0.1: - version "2.0.1" - resolved "https://registry.npmjs.org/package-name-regex/-/package-name-regex-2.0.1.tgz#69e5e5412a7d5367d3cb965da6c4e480e5e9ffa4" - integrity sha512-U+K6/cuwHwr/8pUQrpNpKOIFSdS/EluTRSmtn92mug1UiPcff4t9AHs36e2xXJtpEtRfbg+JOj3Y/GLX+mzT6w== - pacote@^11.2.6: version "11.3.5" resolved "https://registry.npmjs.org/pacote/-/pacote-11.3.5.tgz#73cf1fc3772b533f575e39efa96c50be8c3dc9d2" @@ -14138,21 +14118,6 @@ rollup-plugin-copy@3.4.0: globby "10.0.1" is-plain-object "^3.0.0" -rollup-plugin-license@2.5.0: - version "2.5.0" - resolved "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-2.5.0.tgz#9c0ba9b3562564c555b48142c420af80a9909f32" - integrity sha512-HUjGV+i1tRxi/zL4WpeNCLJZfEJBbCcDmwGJCjKBvcLDIK6VNW1JmYKjSJJOqJjNqRIvKt6/BLSQB9RwNDLtQw== - dependencies: - commenting "1.1.0" - glob "7.1.7" - lodash "4.17.21" - magic-string "0.25.7" - mkdirp "1.0.4" - moment "2.29.1" - package-name-regex "2.0.1" - spdx-expression-validate "2.0.0" - spdx-satisfies "5.0.1" - rollup-plugin-replace@2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/rollup-plugin-replace/-/rollup-plugin-replace-2.2.0.tgz#f41ae5372e11e7a217cde349c8b5d5fd115e70e3" @@ -14879,15 +14844,6 @@ spawndamnit@^2.0.0: cross-spawn "^5.1.0" signal-exit "^3.0.2" -spdx-compare@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz#2c55f117362078d7409e6d7b08ce70a857cd3ed7" - integrity sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A== - dependencies: - array-find-index "^1.0.2" - spdx-expression-parse "^3.0.0" - spdx-ranges "^2.0.0" - spdx-correct@^3.0.0: version "3.1.1" resolved "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" @@ -14909,32 +14865,11 @@ spdx-expression-parse@^3.0.0: spdx-exceptions "^2.1.0" spdx-license-ids "^3.0.0" -spdx-expression-validate@2.0.0: - version "2.0.0" - resolved "https://registry.npmjs.org/spdx-expression-validate/-/spdx-expression-validate-2.0.0.tgz#25c9408e1c63fad94fff5517bb7101ffcd23350b" - integrity sha512-b3wydZLM+Tc6CFvaRDBOF9d76oGIHNCLYFeHbftFXUWjnfZWganmDmvtM5sm1cRwJc/VDBMLyGGrsLFd1vOxbg== - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids@^3.0.0: version "3.0.8" resolved "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.8.tgz#eb1e97ad99b11bf3f82a3b71a0472dd9a00f2ecf" integrity sha512-NDgA96EnaLSvtbM7trJj+t1LUR3pirkDCcz9nOUlPb5DMBGsH7oES6C3hs3j7R9oHEa1EMvReS/BUAIT5Tcr0g== -spdx-ranges@^2.0.0: - version "2.1.1" - resolved "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.1.tgz#87573927ba51e92b3f4550ab60bfc83dd07bac20" - integrity sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA== - -spdx-satisfies@5.0.1: - version "5.0.1" - resolved "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-5.0.1.tgz#9feeb2524686c08e5f7933c16248d4fdf07ed6a6" - integrity sha512-Nwor6W6gzFp8XX4neaKQ7ChV4wmpSh2sSDemMFSzHxpTw460jxFYeOn+jq4ybnSSw/5sc3pjka9MQPouksQNpw== - dependencies: - spdx-compare "^1.0.0" - spdx-expression-parse "^3.0.0" - spdx-ranges "^2.0.0" - split-on-first@^1.0.0: version "1.1.0" resolved "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" From dcada542d865855ff4bba83b5046421aa039e3a1 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Wed, 1 Sep 2021 16:04:46 -0700 Subject: [PATCH 7/7] remove unused lib --- package.json | 1 - yarn.lock | 7 ------- 2 files changed, 8 deletions(-) diff --git a/package.json b/package.json index c6005111deb..0391f709de4 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,6 @@ "ora": "5.4.1", "prettier": "2.3.1", "protractor": "5.4.2", - "rxjs": "6.6.3", "semver": "7.3.4", "simple-git": "2.40.0", "sinon": "9.2.2", diff --git a/yarn.lock b/yarn.lock index ac036fb4ec8..d027f94a99a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14216,13 +14216,6 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs@6.6.3: - version "6.6.3" - resolved "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552" - integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ== - dependencies: - tslib "^1.9.0" - rxjs@^6.3.3, rxjs@^6.4.0, rxjs@^6.5.1, rxjs@^6.6.0, rxjs@^6.6.6: version "6.6.7" resolved "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9"