Skip to content

Commit e03a767

Browse files
authored
fix(angular): added angular version for usage statistics tracking
2 parents ae8e5f9 + 7c40723 commit e03a767

File tree

3 files changed

+66
-13
lines changed

3 files changed

+66
-13
lines changed

packages/angular/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
},
1717
"scripts": {
1818
"prepare": "pnpm run build",
19-
"build": "pnpm run build:logos && ng-packagr -p ng-package.json",
19+
"build": "pnpm run update:version && pnpm run build:logos && ng-packagr -p ng-package.json",
20+
"update:version": "tsx update-version.ts",
2021
"build:logos": "tsx generate-logos.ts",
2122
"test": "jest --silent",
2223
"version:bump": "pnpm version patch",

packages/angular/src/public-api.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import { isDevMode } from "@angular/core";
1817
import { registerFramework } from "@firebase-oss/ui-core";
1918

2019
export { EmailLinkAuthFormComponent } from "./lib/auth/forms/email-link-auth-form";
@@ -34,13 +33,13 @@ export { SmsMultiFactorEnrollmentFormComponent } from "./lib/auth/forms/mfa/sms-
3433
export { TotpMultiFactorAssertionFormComponent } from "./lib/auth/forms/mfa/totp-multi-factor-assertion-form";
3534
export { TotpMultiFactorEnrollmentFormComponent } from "./lib/auth/forms/mfa/totp-multi-factor-enrollment-form";
3635

37-
export { GoogleSignInButtonComponent } from "./lib/auth/oauth/google-sign-in-button";
38-
export { FacebookSignInButtonComponent } from "./lib/auth/oauth/facebook-sign-in-button";
3936
export { AppleSignInButtonComponent } from "./lib/auth/oauth/apple-sign-in-button";
40-
export { MicrosoftSignInButtonComponent } from "./lib/auth/oauth/microsoft-sign-in-button";
41-
export { TwitterSignInButtonComponent } from "./lib/auth/oauth/twitter-sign-in-button";
37+
export { FacebookSignInButtonComponent } from "./lib/auth/oauth/facebook-sign-in-button";
4238
export { GitHubSignInButtonComponent } from "./lib/auth/oauth/github-sign-in-button";
39+
export { GoogleSignInButtonComponent } from "./lib/auth/oauth/google-sign-in-button";
40+
export { MicrosoftSignInButtonComponent } from "./lib/auth/oauth/microsoft-sign-in-button";
4341
export { OAuthButtonComponent } from "./lib/auth/oauth/oauth-button";
42+
export { TwitterSignInButtonComponent } from "./lib/auth/oauth/twitter-sign-in-button";
4443

4544
export { EmailLinkAuthScreenComponent } from "./lib/auth/screens/email-link-auth-screen";
4645
export { ForgotPasswordAuthScreenComponent } from "./lib/auth/screens/forgot-password-auth-screen";
@@ -54,21 +53,20 @@ export { SignUpAuthScreenComponent } from "./lib/auth/screens/sign-up-auth-scree
5453
export { ButtonComponent } from "./lib/components/button";
5554
export {
5655
CardComponent,
56+
CardContentComponent,
5757
CardHeaderComponent,
58-
CardTitleComponent,
5958
CardSubtitleComponent,
60-
CardContentComponent,
59+
CardTitleComponent,
6160
} from "./lib/components/card";
61+
export { ContentComponent } from "./lib/components/content";
6262
export { CountrySelectorComponent } from "./lib/components/country-selector";
6363
export { DividerComponent } from "./lib/components/divider";
6464
export { PoliciesComponent } from "./lib/components/policies";
65-
export { ContentComponent } from "./lib/components/content";
6665
export { RedirectErrorComponent } from "./lib/components/redirect-error";
6766

6867
// Provider
6968
export * from "./lib/provider";
7069

71-
if (!isDevMode()) {
72-
const pkgJson = require("../package.json");
73-
registerFramework("angular", pkgJson.version);
74-
}
70+
// Register framework version
71+
import { VERSION } from "./version";
72+
registerFramework("angular", VERSION);

packages/angular/update-version.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { readFileSync, writeFileSync } from "fs";
18+
import { dirname, join } from "path";
19+
import { fileURLToPath } from "url";
20+
21+
const __filename = fileURLToPath(import.meta.url);
22+
const __dirname = dirname(__filename);
23+
24+
const packageJsonPath = join(__dirname, "package.json");
25+
const versionTsPath = join(__dirname, "src/version.ts");
26+
27+
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
28+
const version = pkg.version;
29+
30+
const versionTsContent = `/**
31+
* Copyright 2025 Google LLC
32+
*
33+
* Licensed under the Apache License, Version 2.0 (the "License");
34+
* you may not use this file except in compliance with the License.
35+
* You may obtain a copy of the License at
36+
*
37+
* http://www.apache.org/licenses/LICENSE-2.0
38+
*
39+
* Unless required by applicable law or agreed to in writing, software
40+
* distributed under the License is distributed on an "AS IS" BASIS,
41+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42+
* See the License for the specific language governing permissions and
43+
* limitations under the License.
44+
*/
45+
46+
/**
47+
* Package version - this file is auto-generated during build
48+
* DO NOT EDIT MANUALLY
49+
*/
50+
export const VERSION = "${version}";
51+
`;
52+
53+
writeFileSync(versionTsPath, versionTsContent, "utf-8");
54+
console.log(`Updated version.ts with version: ${version}`);

0 commit comments

Comments
 (0)