Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions src/appUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,27 @@ describe("appUtils", () => {
{
platform: Platform.WEB,
directory: ".",
frameworks: ["REACT"],
frameworks: ["react"],
},
]);
});

it("should detect angular web framework", async () => {
mockfs({
[testDir]: {
"package.json": JSON.stringify({
dependencies: {
"@angular/core": "1.0.0",
},
}),
},
});
const apps = cleanUndefinedFields(await detectApps(testDir));
expect(apps).to.have.deep.members([
{
platform: Platform.WEB,
directory: ".",
frameworks: ["angular"],
},
]);
});
Expand All @@ -635,7 +655,7 @@ describe("appUtils", () => {
{
platform: Platform.WEB,
directory: ".",
frameworks: ["REACT"],
frameworks: ["react"],
},
]);
});
Expand All @@ -655,7 +675,7 @@ describe("appUtils", () => {
{
platform: Platform.WEB,
directory: ".",
frameworks: ["ANGULAR"],
frameworks: ["angular"],
},
]);
});
Expand Down
8 changes: 4 additions & 4 deletions src/appUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* Supported web frameworks.
*/
export enum Framework {
REACT = "REACT",
ANGULAR = "ANGULAR",
REACT = "react",
ANGULAR = "angular",
}

interface AppIdentifier {
Expand Down Expand Up @@ -176,8 +176,8 @@

const WEB_FRAMEWORKS: Framework[] = Object.values(Framework);
const WEB_FRAMEWORKS_SIGNALS: { [key in Framework]: string[] } = {
REACT: ["react", "next"],
ANGULAR: ["@angular/core"],
react: ["react", "next"],
angular: ["@angular/core"],
};

async function detectAppIdsForPlatform(
Expand Down Expand Up @@ -257,8 +257,8 @@
export function extractAppIdentifierIos(fileContent: string): AppIdentifier[] {
const appIdRegex = /<key>GOOGLE_APP_ID<\/key>\s*<string>([^<]*)<\/string>/;
const bundleIdRegex = /<key>BUNDLE_ID<\/key>\s*<string>([^<]*)<\/string>/;
const appIdMatch = fileContent.match(appIdRegex);

Check warning on line 260 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Use the `RegExp#exec()` method instead
const bundleIdMatch = fileContent.match(bundleIdRegex);

Check warning on line 261 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Use the `RegExp#exec()` method instead
if (appIdMatch?.[1]) {
return [
{
Expand All @@ -278,13 +278,13 @@
export function extractAppIdentifiersAndroid(fileContent: string): AppIdentifier[] {
const identifiers: AppIdentifier[] = [];
try {
const config = JSON.parse(fileContent);

Check warning on line 281 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
if (config.client && Array.isArray(config.client)) {

Check warning on line 282 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .client on an `any` value

Check warning on line 282 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .client on an `any` value
for (const client of config.client) {

Check warning on line 283 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .client on an `any` value
if (client.client_info?.mobilesdk_app_id) {

Check warning on line 284 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .client_info on an `any` value
identifiers.push({
appId: client.client_info.mobilesdk_app_id,

Check warning on line 286 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .client_info on an `any` value

Check warning on line 286 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
bundleId: client.client_info.android_client_info?.package_name,

Check warning on line 287 in src/appUtils.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/apps-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { requireAuth } from "../requireAuth";
import { logger } from "../logger";
import { Options } from "../options";
import { needProjectId } from "../projectUtils";
import { Platform } from "../dataconnect/types";
import { Platform } from "../appUtils";
import { assertEnabled } from "../experiments";

export interface AppsInitOptions extends Options {
Expand Down
179 changes: 0 additions & 179 deletions src/dataconnect/appFinder.spec.ts

This file was deleted.

112 changes: 0 additions & 112 deletions src/dataconnect/appFinder.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/dataconnect/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ export interface SupportedFrameworks {
angular?: boolean;
}

export type Framework = keyof SupportedFrameworks;

export interface JavascriptSDK extends SupportedFrameworks {
outputDir: string;
package: string;
Expand All @@ -174,15 +172,6 @@ export interface DartSDK {
package: string;
}

export enum Platform {
NONE = "NONE",
ANDROID = "ANDROID",
WEB = "WEB",
IOS = "IOS",
FLUTTER = "FLUTTER",
MULTIPLE = "MULTIPLE",
}

// Helper types && converters
export interface ServiceInfo {
serviceName: string;
Expand Down
Loading
Loading