Skip to content

Commit e47d4a8

Browse files
authored
Set up auth to use a separate d.ts file for docgen (#5354)
* Allow auth to use a separate d.ts file for docgen * Update API reports Co-authored-by: hsubox76 <[email protected]>
1 parent c6076eb commit e47d4a8

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

common/api-review/auth.api.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ export class AuthCredential {
102102
protected constructor(
103103
providerId: string,
104104
signInMethod: string);
105-
// Warning: (ae-forgotten-export) The symbol "AuthInternal" needs to be exported by the entry point index.doc.d.ts
106-
// Warning: (ae-forgotten-export) The symbol "PhoneOrOauthTokenResponse" needs to be exported by the entry point index.doc.d.ts
105+
// Warning: (ae-forgotten-export) The symbol "AuthInternal" needs to be exported by the entry point index.d.ts
106+
// Warning: (ae-forgotten-export) The symbol "PhoneOrOauthTokenResponse" needs to be exported by the entry point index.d.ts
107107
//
108108
// @internal (undocumented)
109109
_getIdTokenResponse(_auth: AuthInternal): Promise<PhoneOrOauthTokenResponse>;
110110
// @internal (undocumented)
111111
_getReauthenticationResolver(_auth: AuthInternal): Promise<IdTokenResponse>;
112-
// Warning: (ae-forgotten-export) The symbol "IdTokenResponse" needs to be exported by the entry point index.doc.d.ts
112+
// Warning: (ae-forgotten-export) The symbol "IdTokenResponse" needs to be exported by the entry point index.d.ts
113113
//
114114
// @internal (undocumented)
115115
_linkToIdToken(_auth: AuthInternal, _idToken: string): Promise<IdTokenResponse>;
@@ -277,9 +277,6 @@ export function connectAuthEmulator(auth: Auth, url: string, options?: {
277277
disableWarnings: boolean;
278278
}): void;
279279

280-
// @public
281-
export const cordovaPopupRedirectResolver: PopupRedirectResolver;
282-
283280
// @public
284281
export function createUserWithEmailAndPassword(auth: Auth, email: string, password: string): Promise<UserCredential>;
285282

@@ -343,7 +340,7 @@ export interface EmulatorConfig {
343340

344341
export { ErrorFn }
345342

346-
// Warning: (ae-forgotten-export) The symbol "BaseOAuthProvider" needs to be exported by the entry point index.doc.d.ts
343+
// Warning: (ae-forgotten-export) The symbol "BaseOAuthProvider" needs to be exported by the entry point index.d.ts
347344
//
348345
// @public
349346
export class FacebookAuthProvider extends BaseOAuthProvider {
@@ -485,7 +482,7 @@ export type NextOrObserver<T> = NextFn<T | null> | Observer<T | null>;
485482
export class OAuthCredential extends AuthCredential {
486483
accessToken?: string;
487484
static fromJSON(json: string | object): OAuthCredential | null;
488-
// Warning: (ae-forgotten-export) The symbol "OAuthCredentialParams" needs to be exported by the entry point index.doc.d.ts
485+
// Warning: (ae-forgotten-export) The symbol "OAuthCredentialParams" needs to be exported by the entry point index.d.ts
489486
//
490487
// @internal (undocumented)
491488
static _fromParams(params: OAuthCredentialParams): OAuthCredential;
@@ -564,7 +561,7 @@ export class PhoneAuthCredential extends AuthCredential {
564561
_getReauthenticationResolver(auth: AuthInternal): Promise<IdTokenResponse>;
565562
// @internal (undocumented)
566563
_linkToIdToken(auth: AuthInternal, idToken: string): Promise<IdTokenResponse>;
567-
// Warning: (ae-forgotten-export) The symbol "SignInWithPhoneNumberRequest" needs to be exported by the entry point index.doc.d.ts
564+
// Warning: (ae-forgotten-export) The symbol "SignInWithPhoneNumberRequest" needs to be exported by the entry point index.d.ts
568565
//
569566
// @internal (undocumented)
570567
_makeVerificationRequest(): SignInWithPhoneNumberRequest;
@@ -637,9 +634,6 @@ export interface ReactNativeAsyncStorage {
637634
setItem(key: string, value: string): Promise<void>;
638635
}
639636

640-
// @public
641-
export const reactNativeLocalPersistence: Persistence;
642-
643637
// @public
644638
export function reauthenticateWithCredential(user: User, credential: AuthCredential): Promise<UserCredential>;
645639

@@ -658,13 +652,13 @@ export interface RecaptchaParameters {
658652
[key: string]: any;
659653
}
660654

661-
// Warning: (ae-forgotten-export) The symbol "ApplicationVerifierInternal" needs to be exported by the entry point index.doc.d.ts
655+
// Warning: (ae-forgotten-export) The symbol "ApplicationVerifierInternal" needs to be exported by the entry point index.d.ts
662656
//
663657
// @public
664658
export class RecaptchaVerifier implements ApplicationVerifierInternal {
665659
constructor(containerOrId: HTMLElement | string, parameters: RecaptchaParameters, authExtern: Auth);
666660
clear(): void;
667-
// Warning: (ae-forgotten-export) The symbol "ReCaptchaLoader" needs to be exported by the entry point index.doc.d.ts
661+
// Warning: (ae-forgotten-export) The symbol "ReCaptchaLoader" needs to be exported by the entry point index.d.ts
668662
//
669663
// @internal (undocumented)
670664
readonly _recaptchaLoader: ReCaptchaLoader;
@@ -678,7 +672,7 @@ export class RecaptchaVerifier implements ApplicationVerifierInternal {
678672
// @public
679673
export function reload(user: User): Promise<void>;
680674

681-
// Warning: (ae-forgotten-export) The symbol "FederatedAuthProvider" needs to be exported by the entry point index.doc.d.ts
675+
// Warning: (ae-forgotten-export) The symbol "FederatedAuthProvider" needs to be exported by the entry point index.d.ts
682676
//
683677
// @public
684678
export class SAMLAuthProvider extends FederatedAuthProvider {

packages/auth/api-extractor.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "../../config/api-extractor.json",
3-
// Point it to your entry point d.ts file.
4-
"mainEntryPointFilePath": "<projectFolder>/dist/esm5/index.doc.d.ts",
3+
// If this path ever changes, make sure to change scripts/exp/docgen.ts
4+
// accordingly.
5+
"mainEntryPointFilePath": "<projectFolder>/dist/esm5/index.d.ts",
56
"dtsRollup": {
67
"enabled": true,
78
"untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",

scripts/exp/docgen.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ async function generateDocs(forDevsite: boolean = false) {
3838
const outputFolder = forDevsite ? 'docs-devsite' : 'docs-exp';
3939
const command = forDevsite ? 'api-documenter-devsite' : 'api-documenter';
4040

41+
// Use a special d.ts file for auth for doc gen only.
42+
const authApiConfigOriginal = fs.readFileSync(
43+
`${projectRoot}/packages/auth/api-extractor.json`,
44+
'utf8'
45+
);
46+
const authApiConfigModified = authApiConfigOriginal.replace(
47+
`"mainEntryPointFilePath": "<projectFolder>/dist/esm5/index.d.ts"`,
48+
`"mainEntryPointFilePath": "<projectFolder>/dist/esm5/index.doc.d.ts"`
49+
);
50+
fs.writeFileSync(
51+
`${projectRoot}/packages/auth/api-extractor.json`,
52+
authApiConfigModified
53+
);
54+
4155
await spawn('yarn', ['build'], {
4256
stdio: 'inherit'
4357
});
@@ -46,6 +60,12 @@ async function generateDocs(forDevsite: boolean = false) {
4660
stdio: 'inherit'
4761
});
4862

63+
// Restore original auth api-extractor.json contents.
64+
fs.writeFileSync(
65+
`${projectRoot}/packages/auth/api-extractor.json`,
66+
authApiConfigOriginal
67+
);
68+
4969
if (!fs.existsSync(tmpDir)) {
5070
fs.mkdirSync(tmpDir);
5171
}

0 commit comments

Comments
 (0)