-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(code): add plugin-google-signin impl
- Loading branch information
Showing
5 changed files
with
235 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,122 @@ | ||
/** | ||
* @jest-environment-options {"requireTemplate": true} | ||
*/ | ||
|
||
import { BuildConfig, fs, path } from "@brandingbrand/code-cli-kit"; | ||
import plugin, { type CodePluginGoogleSignin } from "../src"; | ||
|
||
describe("plugin-google-signin", () => { | ||
it("ios", async () => {}); | ||
it("ios", async () => { | ||
const config: BuildConfig & CodePluginGoogleSignin = { | ||
ios: { | ||
displayName: "App", | ||
bundleId: "com.app", | ||
}, | ||
android: { | ||
displayName: "App", | ||
packageName: "com.app", | ||
}, | ||
codePluginGoogleSignin: { | ||
plugin: { | ||
ios: { | ||
reversedClientId: "blah", | ||
}, | ||
android: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
await plugin.ios?.(config, {} as any); | ||
|
||
expect(await fs.readFile(path.ios.infoPlist, "utf-8")).toContain(`<array> | ||
<dict> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>blah</string> | ||
</array> | ||
</dict> | ||
</array>`); | ||
|
||
expect( | ||
await fs.readFile( | ||
path.project.resolve("ios", "app", "AppDelegate.mm"), | ||
"utf-8" | ||
) | ||
) | ||
.toContain(`if ([RNGoogleSignin application:application openURL:url options:options]) { | ||
return YES; | ||
}`); | ||
|
||
expect( | ||
await fs.readFile( | ||
path.project.resolve("ios", "app", "AppDelegate.mm"), | ||
"utf-8" | ||
) | ||
).toContain("#import <RNGoogleSignin/RNGoogleSignin.h>"); | ||
}); | ||
|
||
it("android", async () => { | ||
const config: BuildConfig & CodePluginGoogleSignin = { | ||
ios: { | ||
displayName: "App", | ||
bundleId: "com.app", | ||
}, | ||
android: { | ||
displayName: "App", | ||
packageName: "com.app", | ||
}, | ||
codePluginGoogleSignin: { | ||
plugin: { | ||
ios: { | ||
reversedClientId: "blah", | ||
}, | ||
android: {}, | ||
}, | ||
}, | ||
}; | ||
|
||
await plugin.android?.(config, {} as any); | ||
|
||
expect(await fs.readFile(path.android.buildGradle, "utf-8")).toContain( | ||
'googlePlayServicesAuthVersion = "19.2.0"' | ||
); | ||
|
||
expect(await fs.readFile(path.android.appBuildGradle, "utf-8")).toContain( | ||
"implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" | ||
); | ||
}); | ||
|
||
it("android versions", async () => { | ||
const config: BuildConfig & CodePluginGoogleSignin = { | ||
ios: { | ||
displayName: "App", | ||
bundleId: "com.app", | ||
}, | ||
android: { | ||
displayName: "App", | ||
packageName: "com.app", | ||
}, | ||
codePluginGoogleSignin: { | ||
plugin: { | ||
ios: { | ||
reversedClientId: "blah", | ||
}, | ||
android: { | ||
googlePlayServicesAuthVersion: "20.0.0", | ||
swiperefreshlayoutVersion: "2.0.0", | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
await plugin.android?.(config, {} as any); | ||
|
||
expect(await fs.readFile(path.android.buildGradle, "utf-8")).toContain( | ||
'googlePlayServicesAuthVersion = "20.0.0"' | ||
); | ||
|
||
it("android", async () => {}); | ||
expect(await fs.readFile(path.android.appBuildGradle, "utf-8")).toContain( | ||
"implementation 'androidx.swiperefreshlayout:swiperefreshlayout:2.0.0" | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
import type { Plugin } from "@brandingbrand/code-cli-kit"; | ||
|
||
export type CodePluginGoogleSignin = {}; | ||
export type CodePluginGoogleSignin = { | ||
codePluginGoogleSignin: Plugin<{ | ||
ios: { | ||
reversedClientId: string; | ||
}; | ||
android: { | ||
googlePlayServicesAuthVersion?: string; | ||
swiperefreshlayoutVersion?: string; | ||
}; | ||
}>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8520,7 +8520,7 @@ meow@^6.0.0: | |
type-fest "^0.13.1" | ||
yargs-parser "^18.1.3" | ||
|
||
[email protected]: | ||
[email protected], merge-anything@^5.1.7: | ||
version "5.1.7" | ||
resolved "https://registry.yarnpkg.com/merge-anything/-/merge-anything-5.1.7.tgz#94f364d2b0cf21ac76067b5120e429353b3525d7" | ||
integrity sha512-eRtbOb1N5iyH0tkQDAoQ4Ipsp/5qSR79Dzrz8hEPxRX10RWWR/iQXdoKmBSRCThY1Fh5EhISDtpSc93fpxUniQ== | ||
|