Skip to content

Commit 96ba485

Browse files
committed
replace app-types-exp with app-types
1 parent 2850473 commit 96ba485

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

scripts/exp/prepare-firestore-for-exp-release.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717

1818
import { spawn } from 'child-process-promise';
1919
import { projectRoot, readPackageJson } from '../utils';
20-
import { writeFile as _writeFile } from 'fs';
20+
import { writeFile as _writeFile, readFile as _readFile } from 'fs';
2121
import { promisify } from 'util';
22-
import { removeExpSuffix } from './remove-exp';
22+
import path from 'path';
23+
2324
const writeFile = promisify(_writeFile);
25+
const readFile = promisify(_readFile);
2426
const packagePath = `${projectRoot}/packages/firestore`;
2527

2628
// Prepare @firebase/firestore, so scripts/exp/release.ts can be used to release it
@@ -34,6 +36,7 @@ export async function prepare() {
3436
// Update package.json
3537
const packageJson = await readPackageJson(packagePath);
3638
const expPackageJson = await readPackageJson(`${packagePath}/exp`);
39+
const litePackageJson = await readPackageJson(`${packagePath}/lite`);
3740
packageJson.version = '0.0.800';
3841

3942
packageJson.peerDependencies = {
@@ -60,7 +63,23 @@ export async function prepare() {
6063
{ encoding: 'utf-8' }
6164
);
6265

66+
const expTypingPath = `${packagePath}/${packageJson.typing}`;
67+
const liteTypingPath = path.resolve(
68+
`${packagePath}/lite`,
69+
litePackageJson.typing
70+
);
71+
6372
// remove -exp in typings files
64-
removeExpSuffix(`${packagePath}/exp-types`);
65-
removeExpSuffix(`${packagePath}/lite-types`);
73+
await replaceAppTypesExpInFile(expTypingPath);
74+
await replaceAppTypesExpInFile(liteTypingPath);
75+
}
76+
77+
async function replaceAppTypesExpInFile(filePath: string): Promise<void> {
78+
const fileContent = await readFile(filePath, { encoding: 'utf-8' });
79+
const newFileContent = fileContent.replace(
80+
'@firebase/app-types-exp',
81+
'@firebase/app-types'
82+
);
83+
84+
await writeFile(filePath, newFileContent, { encoding: 'utf-8' });
6685
}

0 commit comments

Comments
 (0)