Skip to content

Commit

Permalink
카카오로그인 웹 함수 추가 (#319)
Browse files Browse the repository at this point in the history
* refactor: orgnize sourcecode in `src` directory

   Since there is more than a file now by including the web platform code,
   it is quite a mess to include them in config files like tsconfig, gitignore or npmignore.

   I have managed to place the typescript code that should be compiled in a `src` directory so that we can have less 
   configuration.

* build: fix build path for flowgen

* refactor: cleanup codebase

* 5.0.0

Co-authored-by: hyochan <dooboolab@gmail.com>
  • Loading branch information
nain93 and hyochan committed Aug 10, 2022
1 parent 735db39 commit e56852f
Show file tree
Hide file tree
Showing 57 changed files with 4,168 additions and 8,397 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
@@ -0,0 +1,2 @@
src/**/*.js
src/**/*.d.ts
6 changes: 5 additions & 1 deletion .eslintrc.js
@@ -1,4 +1,8 @@
module.exports = {
root: true,
extends: "@dooboo/eslint-config",
extends: "@dooboo/eslint-config-react-native",
settings: {
react: {version: 'detect'},
jest: {version: 26},
},
};
8 changes: 5 additions & 3 deletions .gitignore
Expand Up @@ -45,10 +45,12 @@ buck-out/
\.buckd/
*.keystore

index.js
index.d.ts
index.js.flow
# Built files
src/**/*.js
src/**/*.d.ts
src/**/*.js.flow

# iOS
ios/Pods

.watchman*
3 changes: 2 additions & 1 deletion .npmignore
Expand Up @@ -5,4 +5,5 @@ node_modules/
KakaoLoginExample/
image/

index.ts
src/**/*.ts
!src/**/*.d.ts
1 change: 0 additions & 1 deletion .prettierrc.js
Expand Up @@ -4,6 +4,5 @@ module.exports = {
arrowParens: "always",
singleQuote: true,
jsxSingleQuote: false,
jsxBracketSameLine: true,
bracketSpacing: false,
};
7 changes: 6 additions & 1 deletion KakaoLoginExample/.eslintrc.js
@@ -1,8 +1,13 @@
module.exports = {
root: true,
extends: '@dooboo/eslint-config',
extends: '@dooboo/eslint-config-react-native',
rules: {
'eslint-comments/no-unlimited-disable': 0,
'eslint-comments/no-unused-disable': 0,
},
settings: {
react: {
version: 'detect',
},
},
};
5 changes: 0 additions & 5 deletions KakaoLoginExample/.gitignore
Expand Up @@ -66,8 +66,3 @@ package-lock.json

ios/Pods/

# fbt
src/utils/i18n/fbt/.enum_manifest.json
src/utils/i18n/fbt/.source_strings.json
src/utils/i18n/fbt/.src_manifest.json

1 change: 0 additions & 1 deletion KakaoLoginExample/.prettierrc.js
Expand Up @@ -4,6 +4,5 @@ module.exports = {
arrowParens: "always",
singleQuote: true,
jsxSingleQuote: false,
jsxBracketSameLine: true,
bracketSpacing: false,
};
92 changes: 0 additions & 92 deletions KakaoLoginExample/@types/fbt/globals.d.ts

This file was deleted.

10 changes: 0 additions & 10 deletions KakaoLoginExample/README.md
Expand Up @@ -12,7 +12,6 @@ DO NOT MODIFY OR CHANGE THE CODE BEFORE CONFIRMED BY `DOOBOOLAB`. THIS REPOSITOR
- [react-native](https://github.com/facebook/react-native)
- [react-navigation](https://github.com/react-navigation/react-navigation)
- [typescript](https://github.com/Microsoft/TypeScript)
- [fbt](https://medium.com/dooboolab/localizing-react-app-with-fbt-instead-of-i18n-90822e0cb373)
- [styled-components](https://github.com/styled-components/styled-components)
- [ts-jest](https://github.com/kulshekhar/ts-jest)
- [react-hook](https://reactjs.org/docs/hooks-intro.html)
Expand Down Expand Up @@ -196,12 +195,3 @@ const component = (props): React.ReactElement => {

> using consistent theme(ThemeType.LIGHT as default) explicitly is encouraged in testing for avoiding unexpected snapshot test errors
### Localization

Previously, we used `i18n-j` to localize our app and we decided to switch to [fbt](https://github.com/facebook/fbt). If you want to understand why, you may see our blog for [Localizing react app with FBT instead of src/utils/i18n](https://medium.com/dooboolab/localizing-react-app-with-fbt-instead-of-i18n-90822e0cb373).

We've defined localized strings in `assets/translations/en.json` for English and `assets/translations/ko.json` for Korean. Since the `en` is default locale setup in current project, you do not need to localize this file. However, you still should not delete this if you don't want to see missing localization warning messages when you are running jest.

We are using [fbt](https://github.com/facebook/fbt) to localize our app which is maintained by Facebook team. Simply running `yarn fbt:all` will generate `i18n/fbt/translatedFbts.json` which has all the localized strings.

If you find trouble using it, you may follow [Integrate FBT into your React Native Application](https://medium.com/translate-your-react-native-application-with/integrate-fbt-into-your-react-native-application-2bac420e8e0c).
16 changes: 1 addition & 15 deletions KakaoLoginExample/babel.config.js
@@ -1,24 +1,10 @@
// eslint-disable-next-line
const path = require('path');

const fbtEnumPath = path.join(
__dirname,
'src/utils/i18n/fbt/.enum_manifest.json',
);

module.exports = {
presets: [
'module:metro-react-native-babel-preset',
'@babel/preset-typescript',
],
plugins: [
'babel-plugin-fbt-runtime',
[
'babel-plugin-fbt',
{
fbtEnumPath,
extraOptions: {__self: true},
},
],
],
plugins: [],
};
15 changes: 0 additions & 15 deletions KakaoLoginExample/craco.config.js

This file was deleted.

25 changes: 5 additions & 20 deletions KakaoLoginExample/package.json
Expand Up @@ -7,7 +7,6 @@
"postinstall": "npx jetify",
"scripts": {
"preinstall": "cd .. && yarn install && yarn build",
"postinstall": "yarn fbt:all",
"dev": "react-native start",
"tsc": "tsc",
"watch": "tsc -w",
Expand All @@ -18,8 +17,7 @@
"test": "jest --runInBand",
"start:packager": "node_modules/react-native/packager/packager.sh",
"start:reset": "react-native start --reset-cache",
"web": "craco start",
"build": "craco build",
"web": "SKIP_PREFLIGHT_CHECK=true react-scripts start",
"reset": "watchman watch-del-all; rm -rf /tmp/metro-bundler-cache-*; rm -rf ./android/build; rm -rf ./android/.gradle; rm -rf ./android/app/build; rm -rf ~/Library/Developer/Xcode/DerivedData; rm -rf /tmp/haste-map-react-native-packager-*; rm -rf ./ios/build; jest --clearCache; cd ios; pod install --repo-update; cd ..; npx jetify; cd android; ./gradlew clean; cd ..; react-native start --reset-cache",
"android": "react-native run-android",
"android:shake": "adb shell input keyevent 82",
Expand All @@ -36,13 +34,7 @@
"ios:reset": "rm -rf ios/build/ModuleCache",
"lint": "eslint src --ext .ts,.tsx,.js,.jsx",
"build:ios": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ./ios",
"build:android": "react-native bundle --entry-file index.js --platform android --dev false --bundle-output android/main.jsbundle --assets-dest ./android",
"manifest": "fbt-manifest --src src/ --enum-manifest src/utils/i18n/fbt/.enum_manifest.json --src-manifest src/utils/i18n/fbt/.src_manifest.json",
"collect-fbts": "fbt-collect --hash-module 'fb-tiger-hash/src/hashPhrases' --react-native-mode --manifest --options __self < src/utils/i18n/fbt/.src_manifest.json > src/utils/i18n/fbt/.source_strings.json",
"translate-fbts": "fbt-translate --jenkins --source-strings src/utils/i18n/fbt/.source_strings.json --translations src/assets/translations/*.json > src/utils/i18n/fbt/translatedFbts.json",
"clean-fbts": "rm src/utils/i18n/fbt/.enum_manifest.json src/utils/i18n/fbt/.src_manifest.json src/utils/i18n/fbt/.source_strings.json src/assets/translatedFbts.json 2&> /dev/null || exit 0",
"fbt:android": "babel-node src/utils/i18n/scripts/generate-android-localizables-executor.js",
"fbt:all": "yarn manifest && yarn collect-fbts && yarn translate-fbts && yarn fbt:android"
"build:android": "react-native bundle --entry-file index.js --platform android --dev false --bundle-output android/main.jsbundle --assets-dest ./android"
},
"dependencies": {
"@react-native-community/async-storage": "^1.12.1",
Expand All @@ -51,8 +43,6 @@
"@react-navigation/core": "^5.15.3",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.4",
"dooboo-ui": "0.0.51",
"fbt": "^0.16.5",
"react": "17.0.2",
"react-native": "0.64.1",
"react-native-gesture-handler": "^1.10.3",
Expand All @@ -72,31 +62,26 @@
"@babel/plugin-syntax-jsx": "^7.12.13",
"@babel/preset-typescript": "^7.13.0",
"@babel/runtime": "^7.14.0",
"@craco/craco": "^6.1.2",
"@dooboo/eslint-config": "^0.7.0",
"@dooboo/eslint-config-react-native": "^1.0.0",
"@testing-library/jest-native": "^4.0.1",
"@testing-library/react-native": "^7.2.0",
"@types/jest": "^26.0.23",
"@types/react": "^17.0.4",
"@types/react-native": "^0.64.4",
"@types/react-native": "^0.64",
"@types/react-responsive": "^8.0.2",
"@types/styled-components": "^5.1.9",
"@types/styled-components-react-native": "^5.1.1",
"@types/styled-components-react-native": "^5.1.3",
"babel-jest": "^26.6.3",
"babel-plugin-fbt": "^0.20.0",
"babel-plugin-fbt-runtime": "^0.9.17",
"babel-preset-react-native": "^4.0.1",
"codecov": "^3.8.1",
"eslint": "^7.25.0",
"fb-tiger-hash": "^0.1.6",
"fbt-generate-translations": "^0.0.4",
"jest-fetch-mock": "^3.0.3",
"jest-styled-components": "^7.0.4",
"jetifier": "^1.6.6",
"metro-react-native-babel-preset": "^0.64.0",
"prettier": "^2.2.1",
"react-dom": "^17.0.2",
"react-native-fbt": "^0.0.2",
"react-test-renderer": "^17.0.2",
"ts-jest": "^26.5.5",
"typescript": "4.2.4"
Expand Down
10 changes: 1 addition & 9 deletions KakaoLoginExample/src/App.tsx
@@ -1,20 +1,12 @@
import React from 'react';
import RootNavigator from './components/navigations/RootStackNavigator';
import RootProvider from './providers';
import {initFbt} from './utils/fbt';

initFbt();

function App(): React.ReactElement {
return <RootNavigator />;
}

function ProviderWrapper(): React.ReactElement {
return (
<RootProvider>
<App />
</RootProvider>
);
return <App />;
}

export default ProviderWrapper;
Expand Up @@ -7,7 +7,6 @@ import Intro from '../pages/Intro';
import {NavigationContainer} from '@react-navigation/native';
import React from 'react';
import Temp from '../pages/Temp';
import {useTheme} from 'dooboo-ui';

export type RootStackParamList = {
default: undefined;
Expand All @@ -16,36 +15,25 @@ export type RootStackParamList = {
};

export type RootStackNavigationProps<
T extends keyof RootStackParamList = 'default'
T extends keyof RootStackParamList = 'default',
> = StackNavigationProp<RootStackParamList, T>;

const Stack = createStackNavigator<RootStackParamList>();

function RootNavigator(): React.ReactElement {
const {theme} = useTheme();

return (
<NavigationContainer
theme={{
colors: {
background: theme.background,
border: theme.border,
card: theme.paper,
primary: theme.primary,
notification: theme.primary,
text: theme.text,
},
dark: true,
}}>
<NavigationContainer>
{/* @ts-ignore */}
<Stack.Navigator
initialRouteName="Intro"
screenOptions={{
headerStyle: {
backgroundColor: theme.background,
backgroundColor: 'white',
},
headerTitleStyle: {color: theme.text},
headerTintColor: theme.primary,
}}>
headerTitleStyle: {color: 'black'},
headerTintColor: 'yellow',
}}
>
<Stack.Screen name="Intro" component={Intro} />
<Stack.Screen name="Temp" component={Temp} />
</Stack.Navigator>
Expand Down

0 comments on commit e56852f

Please sign in to comment.