Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main branch update from Dev branch #719

Merged
merged 29 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2d9c672
Refactor: Move web source to sub-package
SnowSuno Jan 1, 2024
00da015
Fix: Move `cypress` dependencies into `@taxi/web` package
SnowSuno Jan 9, 2024
5d50825
Fix: Move `prettier` configs into `@taxi/web` package
SnowSuno Jan 9, 2024
0a759af
Fix: Update `.gitignore` rules for monorepo build files
SnowSuno Jan 10, 2024
8245070
Build: Update `Dockerfile` to build monorepo packages
SnowSuno Jan 10, 2024
0043e47
Add: `.dockerignore`
SnowSuno Jan 10, 2024
b9d456c
Merge pull request #700 from sparcs-kaist/#699-migrate-to-monorepo
SnowSuno Jan 17, 2024
63f01b7
Fix: Update dotenv load path
SnowSuno Jan 17, 2024
5484b36
Fix: Change unmet module resolutions
SnowSuno Jan 17, 2024
1c16f01
Build: Add `build:web` script
SnowSuno Jan 17, 2024
7358a74
Docs: Update development docs
SnowSuno Jan 17, 2024
0043835
Build: Unify and update `tsconfig.json`
SnowSuno Jan 17, 2024
12fac24
Merge pull request #703 from sparcs-kaist/#699.1-migrate-to-monorepo
SnowSuno Jan 18, 2024
ab623cd
Add: Init `@taxi/app` package
SnowSuno Jan 18, 2024
a230234
Add: Implement `WebView` wrapper
SnowSuno Jan 18, 2024
0c45634
Add: Connect local web server with app
SnowSuno Jan 23, 2024
44b0157
Add: Config `@taxi/app` path aliases
SnowSuno Jan 24, 2024
d2eb95f
Add: Navigation packages
SnowSuno Jan 24, 2024
17b39bb
Add: Impl webview screen routing
SnowSuno Jan 24, 2024
d548130
Remove: unused webview listener
SnowSuno Jan 24, 2024
b315981
Fix: remove redundant types
SnowSuno Jan 24, 2024
adedbd9
Fix: Configure socket.io dev proxy
SnowSuno Jan 30, 2024
3d2129d
Add: `start:app:prod` script
SnowSuno Jan 30, 2024
2ff481a
Fix: Temp disable native tab navigation
SnowSuno Jan 30, 2024
036ac16
Add: Inject platform OS in userAgent
SnowSuno Jan 30, 2024
fcf0786
Merge pull request #704 from sparcs-kaist/#702-app-core-package-init
SnowSuno Jan 30, 2024
cc0e067
Fix: Vite .env At config
happycastle114 Jan 30, 2024
314aa17
Fix: Vite config for env
happycastle114 Feb 3, 2024
4a60374
Merge pull request #717 from sparcs-kaist/707-bug-vite-env-파일-작동-안함
14KGun Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
29 changes: 2 additions & 27 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,2 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
*.swp

# testing
/coverage

# production
/build

# misc
.DS_Store
.vscode
.idea
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
**/node_modules
**/build
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
**/node_modules
/.pnp
.pnp.js
package-lock.json
Expand All @@ -11,7 +11,7 @@ package-lock.json
/coverage

# production
/build
**/build

# misc
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node-linker=hoisted
20 changes: 13 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,23 @@ RUN apt-get -qq update; \
nvm use --delete-prefix default
ENV PATH /root/.nvm/versions/node/$NODE_VERSION/bin:$PATH

# Install base dependencies
RUN npm install --global pnpm@8.6.6 serve@14.1.2 react-inject-env@2.1.0

# Copy lockfile and prefetch depdendencies
COPY pnpm-lock.yaml .
RUN pnpm fetch

# Copy repository
COPY . .

# Install requirements
RUN npm install --global pnpm@8.6.6 serve@14.1.2; \
pnpm install; \
pnpm install react-inject-env@2.1.0 --save

# Build
RUN pnpm run build; \
chmod 711 /root
RUN pnpm --filter @taxi/web... install --offline; \
pnpm --filter @taxi/web... build

# Move built files to root
RUN mv /root/packages/web/build .
RUN chmod 711 /root

# Set default environment variables
ENV REACT_APP_BACK_URL=https://taxi.sparcs.org/api \
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@ $ pnpm install
See [notion page](https://www.notion.so/sparcs/Environment-Variables-1b404bd385fa495bac6d5517b57d72bf).
Refer to [.env.example](.env.example) and write your own `.env`.


## Development

Run scoped scripts

```bash
pnpm <scope> <script>
```

Valid scopes are:
- `web`: Corresponds to `@taxi/web`
- ~~`app`: (intended) Corresponds to `@taxi/app`~~
- ~~`core`: (intended) Corresponds to `@taxi/core`~~

### Examples

Run `web` development server
```bash
pnpm web start
```

Install new dependency to `app`
```bash
pnpm app install <package_name>
```

## Testing

This project contains E2E tests with Cypress. To run the test, start React development server with `npm start` and run test script by `npm run test` on another shell.
Expand Down
88 changes: 10 additions & 78 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,83 +2,22 @@
"name": "taxi-front",
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/css": "^11.10.6",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@mui/icons-material": "^5.14.1",
"@mui/material": "^5.4.1",
"antd": "^5.4.6",
"axios": "^0.21.1",
"browser-image-compression": "^2.0.0",
"dayjs": "^1.11.7",
"firebase": "^9.15.0",
"heic2any": "^0.0.4",
"i18next": "^22.0.2",
"i18next-browser-languagedetector": "^7.0.1",
"moment": "^2.29.3",
"prop-types": "^15.8.1",
"qs": "^6.11.0",
"react": "^18.2.0",
"react-cookie": "^4.1.1",
"react-dom": "^18.2.0",
"react-ga4": "^1.4.1",
"react-i18next": "^12.0.0",
"react-qr-code": "^2.0.11",
"react-router-dom": "^5.3.3",
"react-toastify": "8.2.0",
"recoil": "^0.7.5",
"socket.io-client": "^4.3.2",
"use-state-with-callback": "^3.0.2"
},
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"preinstall": "npx only-allow pnpm",
"test": "cypress open",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
"app": "pnpm --filter @taxi/app",
"web": "pnpm --filter @taxi/web",
"start:app": "pnpm -r --stream start",
"start:app:prod": "NODE_ENV=production pnpm --filter @taxi/app start",
"start:web": "pnpm --filter @taxi/web... start",
"build:all": "pnpm -r build",
"build:web": "pnpm --filter @taxi/web... build",
"test": "pnpm -r test",
"typecheck": "pnpm -r typecheck"
},
"devDependencies": {
"@storybook/addon-essentials": "^7.5.2",
"@storybook/addon-interactions": "^7.5.2",
"@storybook/addon-links": "^7.5.2",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/blocks": "^7.5.2",
"@storybook/react": "^7.5.2",
"@storybook/react-vite": "^7.5.2",
"@storybook/testing-library": "^0.2.2",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/eslint": "^8.44.0",
"@types/eslint-config-prettier": "^6.11.0",
"@types/prop-types": "^15.7.5",
"@types/qs": "^6.9.7",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@types/react-router-dom": "^5.3.3",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"@vitejs/plugin-react-swc": "^3.4.1",
"cypress": "^10.3.1",
"cypress-react-selector": "^3.0.0",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -88,13 +27,6 @@
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-storybook": "^0.6.15",
"storybook": "^7.5.2",
"typescript": "^5.1.6",
"vite": "^4.5.0",
"vite-plugin-svgr": "^3.2.0"
},
"resolutions": {
"@types/react": "^17.0.2",
"react-error-overlay": "6.0.9"
"typescript": "^5.1.6"
}
}
35 changes: 35 additions & 0 deletions packages/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo
40 changes: 40 additions & 0 deletions packages/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { ConfigContext, ExpoConfig } from "@expo/config";
import ip from "internal-ip";

const isDev = process.env.NODE_ENV === "development";

export default ({ config }: ConfigContext): Partial<ExpoConfig> => ({
...config,
name: "Taxi for KAIST",
slug: "Taxi-for-KAIST",
version: "1.0.0",
orientation: "portrait",
icon: "./assets/icon.png",
userInterfaceStyle: "light",
splash: {
image: "./assets/splash.png",
resizeMode: "contain",
backgroundColor: "#ffffff",
},
assetBundlePatterns: ["**/*"],
ios: {
supportsTablet: true,
},
android: {
adaptiveIcon: {
foregroundImage: "./assets/adaptive-icon.png",
backgroundColor: "#ffffff",
},
},
web: {
favicon: "./assets/favicon.png",
},
experiments: {
tsconfigPaths: true,
},
extra: {
SERVER_URL: isDev
? `http://${ip.v4.sync()}:3000`
: "https://taxi.sparcs.org",
},
});
Binary file added packages/app/assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/app/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/app/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/app/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/app/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
26 changes: 26 additions & 0 deletions packages/app/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Learn more https://docs.expo.dev/guides/monorepos
const { getDefaultConfig } = require('expo/metro-config');
const { FileStore } = require('metro-cache');
const path = require('path');

const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '../..');

const config = getDefaultConfig(projectRoot);

// #1 - Watch all files in the monorepo
config.watchFolders = [workspaceRoot];
// #3 - Force resolving nested modules to the folders below
config.resolver.disableHierarchicalLookup = true;
// #2 - Try resolving with project modules first, then workspace modules
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
];

// Use turborepo to restore the cache when possible
config.cacheStores = [
new FileStore({ root: path.join(projectRoot, 'node_modules', '.cache', 'metro') }),
];

module.exports = config;
1 change: 1 addition & 0 deletions packages/app/node.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@types/node" />
32 changes: 32 additions & 0 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@taxi/app",
"version": "1.0.0",
"main": "src/main.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@react-navigation/bottom-tabs": "^6.5.11",
"@react-navigation/native": "^6.1.9",
"@react-navigation/stack": "^6.3.20",
"expo": "~49.0.15",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-native": "0.72.6",
"react-native-webview": "^13.6.4",
"shallow-equal": "^3.1.0",
"url-pattern": "^1.0.3",
"uuid": "3.4.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@types/node": "^20.11.5",
"@types/react": "~18.2.14",
"internal-ip": "^6.2.0",
"typescript": "^5.1.3"
},
"private": true
}
15 changes: 15 additions & 0 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { RootStack } from "@/screens";
import { NavigationContainer } from "@react-navigation/native";
import { StatusBar } from "expo-status-bar";
import { View } from "react-native";

export function App() {
return (
<View style={{ flex: 1 }}>
<NavigationContainer>
<RootStack />
</NavigationContainer>
<StatusBar style="auto" />
</View>
);
}
Loading
Loading