Merge pull request #7 from movie-web/turbo

refactor to turbo
This commit is contained in:
Jorrin
2024-02-03 21:48:03 +01:00
committed by GitHub
111 changed files with 3678 additions and 8508 deletions

View File

@@ -1,13 +0,0 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@@ -1,4 +0,0 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache

View File

@@ -1,81 +0,0 @@
module.exports = {
extends: [
'airbnb',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
ignorePatterns: [
'dist/*',
'plugins/*',
'tests/*',
'/*.cjs',
'/*.js',
'/**/*.test.ts',
'test/*',
],
parser: '@typescript-eslint/parser',
settings: {
'import/resolver': {
typescript: {
project: ['./tsconfig.base.json', './apps/*/tsconfig.json'],
},
},
},
plugins: ['@typescript-eslint', 'import', 'prettier'],
rules: {
'no-underscore-dangle': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'no-console': 'off',
'@typescript-eslint/no-this-alias': 'off',
'import/prefer-default-export': 'off',
'@typescript-eslint/no-empty-function': 'off',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
'no-restricted-syntax': 'off',
'import/no-unresolved': ['error', { ignore: ['^virtual:'] }],
'consistent-return': 'off',
'no-continue': 'off',
'no-eval': 'off',
'no-await-in-loop': 'off',
'no-nested-ternary': 'off',
'no-param-reassign': ['error', { props: false }],
'prefer-destructuring': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'import/extensions': [
'error',
'ignorePackages',
{
ts: 'never',
tsx: 'never',
},
],
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
['sibling', 'parent'],
'index',
'unknown',
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'sort-imports': [
'error',
{
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
allowSeparatedGroups: true,
},
],
},
};

13
.github/renovate.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"],
"packageRules": [
{
"matchPackagePatterns": ["^@movie-web/"],
"enabled": false
}
],
"updateInternalDeps": true,
"rangeStrategy": "bump",
"automerge": true
}

View File

@@ -1,151 +0,0 @@
name: build mobile app
on:
push:
branches:
- master
workflow_dispatch:
permissions:
contents: write
jobs:
bump-version:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Automated Version Bump
uses: phips28/gh-action-bump-version@v10.1.1
with:
skip-tag: 'true'
commit-message: 'chore: bump mobile version to {{version}} [skip ci]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGEJSON_DIR: 'apps/mobile'
build-android:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 21
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install dependencies
run: pnpm install
- name: Build native Android modules
run: pnpm exec nx run mobile:prebuild --platform=android
- name: Build Android app
run: cd apps/mobile/android && ./gradlew assembleRelease
- name: Rename apk
run: mv apps/mobile/android/app/build/outputs/apk/release/app-release.apk apps/mobile/android/app/build/outputs/apk/release/movie-web.apk
- name: Upload movie-web.apk as artifact
uses: actions/upload-artifact@v4
with:
name: apk
path: ./apps/mobile/android/app/build/outputs/apk/release/movie-web.apk
build-ios:
runs-on: macos-13
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Xcode Select Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.1.0'
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 21
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Install dependencies
run: pnpm install
- name: Build native iOS modules
run: pnpm exec nx run mobile:prebuild --platform=ios
- name: Build iOS app
run: cd apps/mobile/ios && xcodebuild archive -workspace movieweb.xcworkspace -scheme "movieweb" -sdk iphoneos -configuration "Release" -archivePath "build/app.xcarchive" -destination generic/platform=iOS CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
- name: Export .ipa from .xcarchive
run: |
mv apps/mobile/ios/build/app.xcarchive/Products/Applications apps/mobile/ios/build/app.xcarchive/Products/Payload
cd apps/mobile/ios/build/app.xcarchive/Products
zip -r ../../movie-web.ipa Payload
- name: Upload movie-web.ipa as artifact
uses: actions/upload-artifact@v4
with:
name: ipa
path: ./apps/mobile/ios/build/movie-web.ipa
release-app:
runs-on: ubuntu-latest
needs: [build-android, build-ios]
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Get package version
id: package-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
with:
path: apps/mobile
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.package-version.outputs.current-version }}
files: |
movie-web.apk
movie-web.ipa
fail_on_unmatched_files: true
token: ${{ env.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

53
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: CI
on:
pull_request:
branches: ["*"]
push:
branches: ["main"]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
# You can leverage Vercel Remote Caching with Turbo to speed up your builds
# @link https://turborepo.org/docs/core-concepts/remote-caching#remote-caching-on-vercel-builds
env:
FORCE_COLOR: 3
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./tooling/github/setup
- name: Lint
run: pnpm lint && pnpm lint:ws
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./tooling/github/setup
- name: Format
run: pnpm format
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./tooling/github/setup
- name: Typecheck
run: pnpm typecheck

80
.gitignore vendored
View File

@@ -1,59 +1,45 @@
# See http://help.github.com/ignore-files/ for more about ignoring files. # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# compiled output
dist
tmp
/out-tsc
# dependencies # dependencies
node_modules node_modules
.pnp
.pnp.js
# IDEs and editors # testing
/.idea coverage
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode # nitro
.vscode/* .nitro/
!.vscode/settings.json .output/
!.vscode/tasks.json
!.vscode/launch.json # expo
!.vscode/extensions.json .expo/
dist/
expo-env.d.ts
apps/expo/.gitignore
# production
build
# misc # misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store .DS_Store
Thumbs.db *.pem
.nx/cache # debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# Expo # local env files
node_modules/ .env
.expo/ .env*.local
.yarn/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
cache/
# vercel
.vercel
apps/mobile-e2e/artifacts # typescript
*.tsbuildinfo
# turbo
.turbo

2
.npmrc
View File

@@ -1,3 +1 @@
strict-peer-dependencies=false
auto-install-peers=true
node-linker=hoisted node-linker=hoisted

2
.nvmrc
View File

@@ -1 +1 @@
20.10 20.11

View File

@@ -1,4 +0,0 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache

View File

@@ -1,5 +0,0 @@
{
"singleQuote": true,
"endOfLine": "auto",
"plugins": ["prettier-plugin-tailwindcss"]
}

View File

@@ -1,8 +1,9 @@
{ {
"recommendations": [ "recommendations": [
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"editorconfig.editorconfig", "expo.vscode-expo-tools",
"esbenp.prettier-vscode", "esbenp.prettier-vscode",
"firsttris.vscode-jest-runner" "yoavbls.pretty-ts-errors",
"bradlc.vscode-tailwindcss"
] ]
} }

View File

@@ -1,4 +1,10 @@
{ {
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"typescript.tsdk": "node_modules\\typescript\\lib",
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint", "editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.format.enable": true, "eslint.format.enable": true,
@@ -8,7 +14,6 @@
"[typescriptreact]": { "[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode" "editor.defaultFormatter": "esbenp.prettier-vscode"
}, },
"typescript.tsdk": "node_modules\\typescript\\lib",
"tailwindCSS.experimental.classRegex": [ "tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"] ["cn\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]

159
README.md
View File

@@ -1,70 +1,139 @@
# movie-web native-app # movie-web native-app
Native-app for movie-web. ## About
## Getting started It uses [Turborepo](https://turborepo.org) and contains:
```bash ```text
pnpm install .github
└─ workflows
// Having nx installed globally is recommended └─ CI with pnpm cache setup
pnpm install -g nx .vscode
└─ Recommended extensions and settings for VSCode users
// If you don't want nx installed globally, you can use the following command apps
(pnpm exec or npx) nx <command> └─ expo
├─ Expo SDK 50
├─ React Native using React 18
├─ Navigation using Expo Router
├─ Tailwind using Nativewind
└─ Typesafe API calls using tRPC
packages
├─ tmdb
└─ Typesafe API calls to The Movie Database
tooling
├─ eslint
| └─ shared, fine-grained, eslint presets
├─ prettier
| └─ shared prettier configuration
├─ tailwind
| └─ shared tailwind configuration
└─ typescript
└─ shared tsconfig you can extend from
``` ```
## Running tasks ### Configure Expo `dev`-script
To execute tasks with Nx use the following syntax: #### Use iOS Simulator
```bash 1. Make sure you have XCode and XCommand Line Tools installed [as shown on expo docs](https://docs.expo.dev/workflow/ios-simulator).
nx <target> <project> <...options>
```
For example, to run the mobile app: > **NOTE:** If you just installed XCode, or if you have updated it, you need to open the simulator manually once. Run `npx expo start` in the root dir, and then enter `I` to launch Expo Go. After the manual launch, you can run `pnpm dev` in the root directory.
### Android ```diff
+ "dev": "expo start --ios",
```
```bash 2. Run `pnpm dev` at the project root folder.
nx run mobile:android
```
### iOS #### Use Android Emulator
```bash 1. Install Android Studio tools [as shown on expo docs](https://docs.expo.dev/workflow/android-studio-emulator).
nx run mobile:ios
```
## Building archives 2. Change the `dev` script at `apps/expo/package.json` to open the Android emulator.
### Android .apk ```diff
+ "dev": "expo start --android",
```
```bash 3. Run `pnpm dev` at the project root folder.
nx run mobile:prebuild --platform=android
cd apps/mobile/android && ./gradlew assembleRelease
```
### iOS .app > **TIP:** It might be easier to run each app in separate terminal windows so you get the logs from each app separately. This is also required if you want your terminals to be interactive, e.g. to access the Expo QR code. You can run `pnpm --filter expo dev` and `pnpm --filter nextjs dev` to run each app in a separate terminal window.
#### Real device ### 3. When it's time to add a new package
```bash To add a new package, simply run `pnpm turbo gen init` in the monorepo root. This will prompt you for a package name as well as if you want to install any dependencies to the new package (of course you can also do this yourself later).
nx run mobile:prebuild --platform=ios
cd apps/mobile/ios && xcodebuild archive -workspace movieweb.xcworkspace -scheme "movieweb" -sdk iphoneos -configuration "Release" -archivePath "build/app.xcarchive" -destination generic/platform=iOS CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
```
#### Simulator The generator sets up the `package.json`, `tsconfig.json` and a `index.ts`, as well as configures all the necessary configurations for tooling around your package such as formatting, linting and typechecking. When the package is created, you're ready to go build out the package.
```bash ## Deployment
nx run mobile:prebuild --platform=ios
cd apps/mobile/ios && xcodebuild archive -workspace movieweb.xcworkspace -scheme "movieweb" -sdk iphonesimulator -configuration "Release" -archivePath "build/app.xcarchive" -destination "generic/platform=iOS Simulator" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
```
## Repository information ### Expo
This project uses Nx to manage the monorepo. For more information about Nx, visit [nx.dev](https://nx.dev). Deploying your Expo application works slightly differently compared to Next.js on the web. Instead of "deploying" your app online, you need to submit production builds of your app to app stores, like [Apple App Store](https://www.apple.com/app-store) and [Google Play](https://play.google.com/store/apps). You can read the full [guide to distributing your app](https://docs.expo.dev/distribution/introduction), including best practices, in the Expo docs.
1. Make sure to modify the `getBaseUrl` function to point to your backend's production URL:
<https://github.com/t3-oss/create-t3-turbo/blob/656965aff7db271e5e080242c4a3ce4dad5d25f8/apps/expo/src/utils/api.tsx#L20-L37>
2. Let's start by setting up [EAS Build](https://docs.expo.dev/build/introduction), which is short for Expo Application Services. The build service helps you create builds of your app, without requiring a full native development setup. The commands below are a summary of [Creating your first build](https://docs.expo.dev/build/setup).
```bash
# Install the EAS CLI
pnpm add -g eas-cli
# Log in with your Expo account
eas login
# Configure your Expo app
cd apps/expo
eas build:configure
```
3. After the initial setup, you can create your first build. You can build for Android and iOS platforms and use different [`eas.json` build profiles](https://docs.expo.dev/build-reference/eas-json) to create production builds or development, or test builds. Let's make a production build for iOS.
```bash
eas build --platform ios --profile production
```
> If you don't specify the `--profile` flag, EAS uses the `production` profile by default.
4. Now that you have your first production build, you can submit this to the stores. [EAS Submit](https://docs.expo.dev/submit/introduction) can help you send the build to the stores.
```bash
eas submit --platform ios --latest
```
> You can also combine build and submit in a single command, using `eas build ... --auto-submit`.
5. Before you can get your app in the hands of your users, you'll have to provide additional information to the app stores. This includes screenshots, app information, privacy policies, etc. _While still in preview_, [EAS Metadata](https://docs.expo.dev/eas/metadata) can help you with most of this information.
6. Once everything is approved, your users can finally enjoy your app. Let's say you spotted a small typo; you'll have to create a new build, submit it to the stores, and wait for approval before you can resolve this issue. In these cases, you can use EAS Update to quickly send a small bugfix to your users without going through this long process. Let's start by setting up EAS Update.
The steps below summarize the [Getting started with EAS Update](https://docs.expo.dev/eas-update/getting-started/#configure-your-project) guide.
```bash
# Add the `expo-updates` library to your Expo app
cd apps/expo
pnpm expo install expo-updates
# Configure EAS Update
eas update:configure
```
7. Before we can send out updates to your app, you have to create a new build and submit it to the app stores. For every change that includes native APIs, you have to rebuild the app and submit the update to the app stores. See steps 2 and 3.
8. Now that everything is ready for updates, let's create a new update for `production` builds. With the `--auto` flag, EAS Update uses your current git branch name and commit message for this update. See [How EAS Update works](https://docs.expo.dev/eas-update/how-eas-update-works/#publishing-an-update) for more information.
```bash
cd apps/expo
eas update --auto
```
> Your OTA (Over The Air) updates must always follow the app store's rules. You can't change your app's primary functionality without getting app store approval. But this is a fast way to update your app for minor changes and bug fixes.
9. Done! Now that you have created your production build, submitted it to the stores, and installed EAS Update, you are ready for anything!
### References
This app is based on [create-t3-turbo](https://github.com/t3-oss/create-t3-turbo) and [Turborepo](https://turborepo.org).
### Mobile app
The mobile app is built with React Native and Expo. For more information about Expo, visit [expo.io](https://expo.io).

View File

@@ -0,0 +1,4 @@
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}

47
apps/expo/app.config.ts Normal file
View File

@@ -0,0 +1,47 @@
import type { ExpoConfig } from "expo/config";
const defineConfig = (): ExpoConfig => ({
name: "movie-web",
slug: "mw-mobile",
scheme: "dev.movieweb.app",
version: "1.0.0",
orientation: "portrait",
icon: "./assets/images/icon.png",
userInterfaceStyle: "automatic",
splash: {
image: "./assets/images/splash.png",
resizeMode: "contain",
backgroundColor: "#ffffff",
},
updates: {
fallbackToCacheTimeout: 0,
},
assetBundlePatterns: ["**/*"],
ios: {
bundleIdentifier: "dev.movieweb.app",
supportsTablet: true,
},
android: {
package: "dev.movieweb.app",
adaptiveIcon: {
foregroundImage: "./assets/images/adaptive-icon.png",
backgroundColor: "#FFFFFF",
},
},
web: {
favicon: "./assets/images/favicon.png",
bundler: "metro",
},
// extra: {
// eas: {
// projectId: "your-eas-project-id",
// },
// },
experiments: {
tsconfigPaths: true,
typedRoutes: true,
},
plugins: ["expo-router"],
});
export default defineConfig;

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

11
apps/expo/babel.config.js Normal file
View File

@@ -0,0 +1,11 @@
/** @type {import("@babel/core").ConfigFunction} */
module.exports = function (api) {
api.cache(true);
return {
presets: [
["babel-preset-expo", { jsxImportSource: "nativewind" }],
"nativewind/babel",
],
plugins: ["react-native-reanimated/plugin"],
};
};

View File

@@ -1,28 +1,31 @@
{ {
"cli": {
"version": ">= 4.1.2"
},
"build": { "build": {
"production": { "base": {
"android": { "node": "18.16.1",
"buildType": "app-bundle" "ios": {
"resourceClass": "m-medium"
} }
}, },
"development": { "development": {
"extends": "base",
"developmentClient": true, "developmentClient": true,
"distribution": "internal" "distribution": "internal"
}, },
"preview": { "preview": {
"extends": "base",
"distribution": "internal", "distribution": "internal",
"ios": { "ios": {
"simulator": true "simulator": true
},
"android": {
"buildType": "apk"
} }
},
"production": {
"extends": "base"
} }
}, },
"submit": { "submit": {
"production": {} "production": {}
},
"cli": {
"version": ">= 5.2.0"
} }
} }

60
apps/expo/metro.config.js Normal file
View File

@@ -0,0 +1,60 @@
// Learn more: https://docs.expo.dev/guides/monorepos/
const { getDefaultConfig } = require("expo/metro-config");
const { FileStore } = require("metro-cache");
const { withNativeWind } = require("nativewind/metro");
const path = require("path");
module.exports = withTurborepoManagedCache(
withMonorepoPaths(
withNativeWind(
getDefaultConfig(__dirname, {
isCSSEnabled: true,
}),
{
input: "./src/app/styles/global.css",
configPath: "./tailwind.config.ts",
},
),
),
);
/**
* Add the monorepo paths to the Metro config.
* This allows Metro to resolve modules from the monorepo.
*
* @see https://docs.expo.dev/guides/monorepos/#modify-the-metro-config
* @param {import('expo/metro-config').MetroConfig} config
* @returns {import('expo/metro-config').MetroConfig}
*/
function withMonorepoPaths(config) {
const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, "../..");
// #1 - Watch all files in the monorepo
config.watchFolders = [workspaceRoot];
// #2 - Resolve modules within the project's `node_modules` first, then all monorepo modules
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, "node_modules"),
path.resolve(workspaceRoot, "node_modules"),
];
return config;
}
/**
* Move the Metro cache to the `node_modules/.cache/metro` folder.
* This repository configured Turborepo to use this cache location as well.
* If you have any environment variables, you can configure Turborepo to invalidate it when needed.
*
* @see https://turbo.build/repo/docs/reference/configuration#env
* @param {import('expo/metro-config').MetroConfig} config
* @returns {import('expo/metro-config').MetroConfig}
*/
function withTurborepoManagedCache(config) {
config.cacheStores = [
new FileStore({ root: path.join(__dirname, "node_modules/.cache/metro") }),
];
return config;
}

66
apps/expo/package.json Normal file
View File

@@ -0,0 +1,66 @@
{
"name": "@movie-web/mobile",
"version": "0.1.0",
"private": true,
"main": "expo-router/entry",
"scripts": {
"clean": "git clean -xdf .expo .turbo node_modules",
"dev": "expo start",
"dev:android": "expo start --android",
"dev:ios": "expo start --ios",
"android": "expo run:android",
"ios": "expo run:ios",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint .",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@expo/metro-config": "^0.17.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"expo": "~50.0.5",
"expo-constants": "~15.4.5",
"expo-linking": "~6.2.2",
"expo-router": "~3.4.6",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-web-browser": "^12.8.2",
"nativewind": "~4.0.23",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.73.2",
"react-native-css-interop": "~0.0.22",
"react-native-gesture-handler": "~2.14.1",
"react-native-reanimated": "~3.6.2",
"react-native-safe-area-context": "~4.8.2",
"react-native-screens": "~3.29.0",
"react-native-web": "^0.19.10",
"tailwind-merge": "^2.2.1"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@babel/runtime": "^7.23.9",
"@movie-web/eslint-config": "workspace:^0.2.0",
"@movie-web/prettier-config": "workspace:^0.1.0",
"@movie-web/tailwind-config": "workspace:^0.1.0",
"@movie-web/tsconfig": "workspace:^0.1.0",
"@types/babel__core": "^7.20.5",
"@types/react": "^18.2.48",
"eslint": "^8.56.0",
"prettier": "^3.1.1",
"tailwindcss": "^3.4.0",
"typescript": "^5.3.3"
},
"eslintConfig": {
"root": true,
"extends": [
"@movie-web/eslint-config/base",
"@movie-web/eslint-config/react"
],
"ignorePatterns": [
"expo-plugins/**"
]
},
"prettier": "@movie-web/prettier-config"
}

View File

@@ -1,7 +1,8 @@
import { Tabs } from 'expo-router'; import { Tabs } from "expo-router";
import TabBarIcon from '@/components/TabBarIcon'; import Colors from "@movie-web/tailwind-config/colors";
import Colors from '@/constants/Colors';
import TabBarIcon from "~/components/TabBarIcon";
export default function TabLayout() { export default function TabLayout() {
return ( return (
@@ -14,7 +15,7 @@ export default function TabLayout() {
tabBarActiveTintColor: Colors.primary[100], tabBarActiveTintColor: Colors.primary[100],
tabBarStyle: { tabBarStyle: {
backgroundColor: Colors.secondary[700], backgroundColor: Colors.secondary[700],
borderTopColor: 'transparent', borderTopColor: "transparent",
borderTopRightRadius: 20, borderTopRightRadius: 20,
borderTopLeftRadius: 20, borderTopLeftRadius: 20,
height: 80, height: 80,
@@ -33,7 +34,7 @@ export default function TabLayout() {
<Tabs.Screen <Tabs.Screen
name="index" name="index"
options={{ options={{
title: 'Home', title: "Home",
tabBarIcon: ({ focused }) => ( tabBarIcon: ({ focused }) => (
<TabBarIcon name="home" focused={focused} /> <TabBarIcon name="home" focused={focused} />
), ),
@@ -42,7 +43,7 @@ export default function TabLayout() {
<Tabs.Screen <Tabs.Screen
name="about" name="about"
options={{ options={{
title: 'About', title: "About",
tabBarIcon: ({ focused }) => ( tabBarIcon: ({ focused }) => (
<TabBarIcon name="info-circle" focused={focused} /> <TabBarIcon name="info-circle" focused={focused} />
), ),
@@ -51,11 +52,11 @@ export default function TabLayout() {
<Tabs.Screen <Tabs.Screen
name="search" name="search"
options={{ options={{
title: 'Search', title: "Search",
tabBarLabel: '', tabBarLabel: "",
tabBarIcon: () => ( tabBarIcon: () => (
<TabBarIcon <TabBarIcon
className=" bg-primary-400 flex aspect-[1/1] h-14 items-center justify-center rounded-full text-center text-2xl text-white" className="flex aspect-[1/1] h-14 items-center justify-center rounded-full bg-primary-400 text-center align-middle text-2xl text-white"
name="search" name="search"
color="#FFF" color="#FFF"
/> />
@@ -65,7 +66,7 @@ export default function TabLayout() {
<Tabs.Screen <Tabs.Screen
name="settings" name="settings"
options={{ options={{
title: 'Settings', title: "Settings",
tabBarIcon: ({ focused }) => ( tabBarIcon: ({ focused }) => (
<TabBarIcon name="cog" focused={focused} /> <TabBarIcon name="cog" focused={focused} />
), ),
@@ -74,7 +75,7 @@ export default function TabLayout() {
<Tabs.Screen <Tabs.Screen
name="account" name="account"
options={{ options={{
title: 'Account', title: "Account",
tabBarIcon: ({ focused }) => ( tabBarIcon: ({ focused }) => (
<TabBarIcon name="user" focused={focused} /> <TabBarIcon name="user" focused={focused} />
), ),

View File

@@ -1,5 +1,5 @@
import ScreenLayout from '@/components/layout/ScreenLayout'; import ScreenLayout from "~/components/layout/ScreenLayout";
import { Text } from '@/components/ui/Text'; import { Text } from "~/components/ui/Text";
export default function AboutScreen() { export default function AboutScreen() {
return ( return (

View File

@@ -1,5 +1,5 @@
import ScreenLayout from '@/components/layout/ScreenLayout'; import ScreenLayout from "~/components/layout/ScreenLayout";
import { Text } from '@/components/ui/Text'; import { Text } from "~/components/ui/Text";
export default function AccountScreen() { export default function AccountScreen() {
return ( return (

View File

@@ -1,5 +1,5 @@
import ScreenLayout from '@/components/layout/ScreenLayout'; import ScreenLayout from "~/components/layout/ScreenLayout";
import { Text } from '@/components/ui/Text'; import { Text } from "~/components/ui/Text";
export default function HomeScreen() { export default function HomeScreen() {
return ( return (

View File

@@ -1,13 +1,12 @@
import { FontAwesome5 } from '@expo/vector-icons'; import { useCallback, useRef, useState } from "react";
import { useFocusEffect } from 'expo-router'; import { TextInput, View } from "react-native";
import { useCallback, useRef, useState } from 'react'; import { useFocusEffect } from "expo-router";
import { View } from 'react-native'; import { FontAwesome5 } from "@expo/vector-icons";
import { TextInput } from 'react-native-gesture-handler';
import Colors from '@/constants/Colors'; import Colors from "@movie-web/tailwind-config/colors";
export default function Searchbar() { export default function Searchbar() {
const [keyword, setKeyword] = useState(''); const [keyword, setKeyword] = useState("");
const inputRef = useRef<TextInput>(null); const inputRef = useRef<TextInput>(null);
useFocusEffect( useFocusEffect(
@@ -24,13 +23,12 @@ export default function Searchbar() {
); );
return ( return (
<View className="border-primary-400 focus-within:border-primary-300 mb-6 mt-4 flex-row items-center rounded-full border"> <View className="mb-6 mt-4 flex-row items-center rounded-full border border-primary-400 focus-within:border-primary-300">
<View className="ml-1 w-12 items-center justify-center"> <View className="ml-1 w-12 items-center justify-center">
<FontAwesome5 name="search" size={18} color={Colors.secondary[200]} /> <FontAwesome5 name="search" size={18} color={Colors.secondary[200]} />
</View> </View>
<TextInput <TextInput
value={keyword} value={keyword}
autoFocus
onChangeText={(text) => setKeyword(text)} onChangeText={(text) => setKeyword(text)}
ref={inputRef} ref={inputRef}
placeholder="What are you looking for?" placeholder="What are you looking for?"

View File

@@ -1,10 +1,9 @@
import { ScrollView, View } from 'react-native'; import { ScrollView, View } from "react-native";
import Item from '@/components/item/item'; import Item from "~/components/item/item";
import ScreenLayout from '@/components/layout/ScreenLayout'; import ScreenLayout from "~/components/layout/ScreenLayout";
import { Text } from '@/components/ui/Text'; import { Text } from "~/components/ui/Text";
import Searchbar from "./Searchbar";
import Searchbar from './Searchbar';
export default function SearchScreen() { export default function SearchScreen() {
return ( return (

View File

@@ -1,5 +1,5 @@
import ScreenLayout from '@/components/layout/ScreenLayout'; import ScreenLayout from "~/components/layout/ScreenLayout";
import { Text } from '@/components/ui/Text'; import { Text } from "~/components/ui/Text";
export default function SettingsScreen() { export default function SettingsScreen() {
return ( return (

View File

@@ -1,4 +1,4 @@
import { ScrollViewStyleReset } from 'expo-router/html'; import { ScrollViewStyleReset } from "expo-router/html";
// This file is web-only and used to configure the root HTML for every // This file is web-only and used to configure the root HTML for every
// web page during static rendering. // web page during static rendering.

View File

@@ -1,12 +1,12 @@
import { Link, Stack } from 'expo-router'; import { View } from "react-native";
import { View } from 'react-native'; import { Link, Stack } from "expo-router";
import { Text } from '@/components/ui/Text'; import { Text } from "~/components/ui/Text";
export default function NotFoundScreen() { export default function NotFoundScreen() {
return ( return (
<> <>
<Stack.Screen options={{ title: 'Oops!' }} /> <Stack.Screen options={{ title: "Oops!" }} />
<View className="flex-1 items-center justify-center p-5"> <View className="flex-1 items-center justify-center p-5">
<Text className="text-lg font-bold"> <Text className="text-lg font-bold">
This screen doesn&apos;t exist. This screen doesn&apos;t exist.

View File

@@ -0,0 +1,81 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { useEffect } from "react";
import { useColorScheme } from "react-native";
import { useFonts } from "expo-font";
import { SplashScreen, Stack } from "expo-router";
import FontAwesome from "@expo/vector-icons/FontAwesome";
import {
DarkTheme,
DefaultTheme,
ThemeProvider,
} from "@react-navigation/native";
import Colors from "@movie-web/tailwind-config/colors";
import "./styles/global.css";
export {
// Catch any errors thrown by the Layout component.
ErrorBoundary,
} from "expo-router";
export const unstable_settings = {
// Ensure that reloading on `/modal` keeps a back button present.
initialRouteName: "(tabs)/index",
};
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync().catch(() => {
/* reloading the app might trigger this, so it's safe to ignore */
});
export default function RootLayout() {
const [loaded, error] = useFonts({
OpenSansRegular: require("../../assets/fonts/OpenSans-Regular.ttf"),
OpenSansLight: require("../../assets/fonts/OpenSans-Light.ttf"),
OpenSansMedium: require("../../assets/fonts/OpenSans-Medium.ttf"),
OpenSansBold: require("../../assets/fonts/OpenSans-Bold.ttf"),
OpenSansSemiBold: require("../../assets/fonts/OpenSans-SemiBold.ttf"),
OpenSansExtra: require("../../assets/fonts/OpenSans-ExtraBold.ttf"),
...FontAwesome.font,
});
// Expo Router uses Error Boundaries to catch errors in the navigation tree.
useEffect(() => {
if (error) throw error;
}, [error]);
useEffect(() => {
if (loaded) {
SplashScreen.hideAsync().catch(() => {
/* reloading the app might trigger this, so it's safe to ignore */
});
}
}, [loaded]);
if (!loaded) {
return null;
}
return <RootLayoutNav />;
}
function RootLayoutNav() {
const colorScheme = useColorScheme();
return (
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
<Stack
screenOptions={{
gestureEnabled: true,
headerShown: false,
contentStyle: {
backgroundColor: Colors.background,
},
}}
>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
</Stack>
</ThemeProvider>
);
}

View File

@@ -1,6 +1,6 @@
import { FontAwesome } from '@expo/vector-icons'; import { FontAwesome } from "@expo/vector-icons";
import Colors from '@/constants/Colors'; import Colors from "@movie-web/tailwind-config/colors";
type Props = { type Props = {
focused?: boolean; focused?: boolean;

View File

@@ -1,7 +1,7 @@
import { Image, View } from 'react-native'; import { Image, View } from "react-native";
import { Text } from '@/components/ui/Text'; import { TMDB_POSTER_PATH } from "~/app/constants/General";
import { TMDB_POSTER_PATH } from '@/constants/General'; import { Text } from "~/components/ui/Text";
export default function Item() { export default function Item() {
return ( return (

View File

@@ -1,20 +1,20 @@
import { View } from 'react-native'; import { View } from "react-native";
import { Text } from '@/components/ui/Text'; import { Text } from "~/components/ui/Text";
type Props = { interface Props {
title?: React.ReactNode | string; title?: React.ReactNode | string;
subtitle?: string; subtitle?: string;
children?: React.ReactNode; children?: React.ReactNode;
}; }
export default function ScreenLayout({ title, subtitle, children }: Props) { export default function ScreenLayout({ title, subtitle, children }: Props) {
return ( return (
<View className="bg-shade-900 flex-1 p-12"> <View className="bg-shade-900 flex-1 p-12">
{typeof title === 'string' && ( {typeof title === "string" && (
<Text className="text-2xl font-bold">{title}</Text> <Text className="text-2xl font-bold">{title}</Text>
)} )}
{typeof title !== 'string' && title} {typeof title !== "string" && title}
<Text className="mt-1 text-sm font-bold">{subtitle}</Text> <Text className="mt-1 text-sm font-bold">{subtitle}</Text>
<View className="py-3">{children}</View> <View className="py-3">{children}</View>
</View> </View>

View File

@@ -0,0 +1,18 @@
import type { TextProps } from "react-native";
import { Text as RNText } from "react-native";
import { cva } from "class-variance-authority";
import { cn } from "~/app/lib/utils";
const textVariants = cva("text-white");
export function Text({ className, ...props }: TextProps) {
return (
<RNText
className={cn(className, textVariants(), {
"font-sans": !className?.includes("font-"),
})}
{...props}
/>
);
}

View File

@@ -0,0 +1,7 @@
import type { ClassValue } from "clsx";
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

View File

@@ -0,0 +1,28 @@
import type { Config } from "tailwindcss";
// @ts-expect-error - no types
import nativewind from "nativewind/preset";
import baseConfig from "@movie-web/tailwind-config/native";
export default {
content: ["./src/**/*.{ts,tsx}"],
presets: [
baseConfig,
nativewind,
{
theme: {
extend: {
fontFamily: {
sans: ["OpenSansRegular"],
thin: ["OpenSansLight"],
normal: ["OpenSansRegular"],
medium: ["OpenSansMedium"],
semibold: ["OpenSansSemiBold"],
bold: ["OpenSansBold"],
extrabold: ["OpenSansExtra"],
},
},
},
},
],
} satisfies Config;

16
apps/expo/tsconfig.json Normal file
View File

@@ -0,0 +1,16 @@
{
"extends": ["@movie-web/tsconfig/base.json"],
"compilerOptions": {
"incremental": true,
"baseUrl": ".",
"paths": {
"~/*": ["./src/*"],
"~/components/*": ["./src/app/components/*"],
},
"jsx": "react-native",
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
"types": ["nativewind/types"],
},
"include": ["src", "*.ts", "*.js", ".expo/types/**/*.ts", "expo-env.d.ts"],
"exclude": ["node_modules"],
}

View File

@@ -1,11 +0,0 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
},
],
],
"plugins": [],
}

View File

@@ -1,89 +0,0 @@
{
"testRunner": {
"args": {
"$0": "jest",
"config": "./jest.config.json"
},
"jest": {
"setupTimeout": 120000
}
},
"apps": {
"ios.debug": {
"type": "ios.app",
"build": "cd ../../apps/mobile/ios && xcodebuild -workspace movieweb.xcworkspace -scheme movieweb -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
"binaryPath": "../../apps/mobile/ios/build/Build/Products/Debug-iphonesimulator/movieweb.app"
},
"ios.release": {
"type": "ios.app",
"build": "cd ../../apps/mobile/ios && xcodebuild -workspace movieweb.xcworkspace -scheme movieweb -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
"binaryPath": "../../apps/mobile/ios/build/Build/Products/Release-iphonesimulator/movieweb.app"
},
"ios.local": {
"type": "ios.app",
"build": "pnpm exec nx run mobile:build --platform ios --profile preview --wait --local --no-interactive --output=../../apps/mobile/dist/movieweb.tar.gz",
"binaryPath": "../../apps/mobile/dist/movieweb.app"
},
"android.debug": {
"type": "android.apk",
"build": "cd ../../apps/mobile/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug",
"binaryPath": "../../apps/mobile/android/app/build/outputs/apk/debug/app-debug.apk"
},
"android.release": {
"type": "android.apk",
"build": "cd ../../apps/mobile/android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release",
"binaryPath": "../../apps/mobile/android/app/build/outputs/apk/release/app-release.apk"
},
"android.local": {
"type": "android.apk",
"build": "pnpm exec nx run mobile:build --platform android --profile preview --wait --local --no-interactive --output=../../apps/mobile/dist/movieweb.apk",
"binaryPath": "../../apps/mobile/dist/movieweb.apk"
}
},
"devices": {
"simulator": {
"type": "ios.simulator",
"device": {
"type": "iPhone 14"
}
},
"emulator": {
"type": "android.emulator",
"device": {
"avdName": "Pixel_4a_API_30"
}
}
},
"configurations": {
"ios.sim.release": {
"device": "simulator",
"app": "ios.release"
},
"ios.sim.debug": {
"device": "simulator",
"app": "ios.debug"
},
"ios.sim.local": {
"device": "simulator",
"app": "ios.local"
},
"android.emu.release": {
"device": "emulator",
"app": "android.release"
},
"android.emu.debug": {
"device": "emulator",
"app": "android.debug"
},
"android.emu.local": {
"device": "emulator",
"app": "android.local"
}
}
}

View File

@@ -1,18 +0,0 @@
{
"extends": ["../../.eslintrc.js"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

View File

@@ -1,22 +0,0 @@
{
"preset": "../../jest.preset",
"rootDir": ".",
"testMatch": [
"<rootDir>/src/**/*.test.ts?(x)",
"<rootDir>/src/**/*.spec.ts?(x)"
],
"testTimeout": 120000,
"maxWorkers": 1,
"globalSetup": "detox/runners/jest/globalSetup",
"globalTeardown": "detox/runners/jest/globalTeardown",
"reporters": ["detox/runners/jest/reporter"],
"testEnvironment": "detox/runners/jest/testEnvironment",
"verbose": true,
"setupFilesAfterEnv": ["<rootDir>/test-setup.ts"],
"transform": {
"^.+\\.(ts|js|html)$": [
"ts-jest",
{ "tsconfig": "<rootDir>/tsconfig.e2e.json" }
]
}
}

View File

@@ -1,76 +0,0 @@
{
"name": "mobile-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/mobile-e2e/src",
"projectType": "application",
"targets": {
"build-ios": {
"executor": "@nx/detox:build",
"options": {
"detoxConfiguration": "ios.sim.local"
},
"configurations": {
"bare": {
"detoxConfiguration": "ios.sim.debug"
},
"production": {
"detoxConfiguration": "ios.sim.release"
}
}
},
"test-ios": {
"executor": "@nx/detox:test",
"options": {
"detoxConfiguration": "ios.sim.local",
"buildTarget": "mobile-e2e:build-ios"
},
"configurations": {
"bare": {
"detoxConfiguration": "ios.sim.debug",
"buildTarget": "mobile-e2e:build-ios:bare"
},
"production": {
"detoxConfiguration": "ios.sim.release",
"buildTarget": "mobile-e2e:build-ios:production"
}
}
},
"build-android": {
"executor": "@nx/detox:build",
"options": {
"detoxConfiguration": "android.emu.local"
},
"configurations": {
"bare": {
"detoxConfiguration": "android.emu.debug"
},
"production": {
"detoxConfiguration": "android.emu.release"
}
}
},
"test-android": {
"executor": "@nx/detox:test",
"options": {
"detoxConfiguration": "android.emu.local",
"buildTarget": "mobile-e2e:build-android"
},
"configurations": {
"bare": {
"detoxConfiguration": "android.emu.debug",
"buildTarget": "mobile-e2e:build-android:bare"
},
"production": {
"detoxConfiguration": "android.emu.release",
"buildTarget": "mobile-e2e:build-android:production"
}
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
},
"tags": [],
"implicitDependencies": ["mobile"]
}

View File

@@ -1,11 +0,0 @@
import { device, element, by, expect } from 'detox';
describe('movieweb', () => {
beforeEach(async () => {
await device.reloadReactNative();
});
it('should display welcome message', async () => {
await expect(element(by.id('heading'))).toHaveText('Welcome movie-web 👋');
});
});

View File

@@ -1,5 +0,0 @@
import { device } from 'detox';
beforeAll(async () => {
await device.launchApp();
});

View File

@@ -1,10 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["node", "jest", "detox"]
},
"include": ["src/**/*.ts", "src/**/*.js"]
}

View File

@@ -1,10 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.e2e.json"
}
]
}

View File

@@ -1,37 +0,0 @@
module.exports = {
extends: ['../../.eslintrc.js'],
ignorePatterns: ['/*.js', '/*.d.ts'],
overrides: [
{
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {},
},
{
files: ['*.ts', '*.tsx'],
rules: {},
},
{
files: ['*.js', '*.jsx'],
rules: {},
},
],
rules: {
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react/require-default-props': 'off',
'react/destructuring-assignment': 'off',
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
'react/jsx-filename-extension': [
'error',
{ extensions: ['.js', '.tsx', '.jsx'] },
],
'react/jsx-props-no-spreading': 'off',
'react/no-unstable-nested-components': 'off',
'no-use-before-define': 'off',
},
};

View File

@@ -1,18 +0,0 @@
{
"extends": ["../../.eslintrc.js"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

View File

@@ -1,44 +0,0 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
# dependencies
node_modules/
# Expo
.expo/
dist/
web-build/
android/
ios/
# 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
# @generated expo-cli sync-2b81b286409207a5da26e14c78851eb30d8ccbdb
# The following patterns were generated by expo-cli
expo-env.d.ts
# @end expo-cli

View File

@@ -1,49 +0,0 @@
{
"expo": {
"name": "movie-web",
"slug": "mw-mobile",
"version": "1.0.0",
"orientation": "portrait",
"scheme": "dev.movieweb.app",
"userInterfaceStyle": "automatic",
"icon": "./assets/images/icon.png",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"jsEngine": "jsc",
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "dev.movieweb.app"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "dev.movieweb.app"
},
"web": {
"favicon": "./assets/images/favicon.png",
"bundler": "metro"
},
"plugins": [
"expo-router",
[
"@config-plugins/detox",
{
"skipProguard": false,
"subdomains": ["10.0.2.2", "localhost"]
}
]
],
"experiments": {
"typedRoutes": true
}
}
}

View File

@@ -1,78 +0,0 @@
/* eslint-disable global-require */
import FontAwesome from '@expo/vector-icons/FontAwesome';
import {
DarkTheme,
DefaultTheme,
ThemeProvider,
} from '@react-navigation/native';
import { useFonts } from 'expo-font';
import { SplashScreen, Stack } from 'expo-router';
import { useEffect } from 'react';
import { useColorScheme } from 'react-native';
import Colors from '@/constants/Colors';
import './styles/global.css';
export {
// Catch any errors thrown by the Layout component.
ErrorBoundary,
} from 'expo-router';
// eslint-disable-next-line camelcase
export const unstable_settings = {
// Ensure that reloading on `/modal` keeps a back button present.
initialRouteName: '(tabs)/index',
};
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
export default function RootLayout() {
const [loaded, error] = useFonts({
OpenSansRegular: require('../assets/fonts/OpenSans-Regular.ttf'),
OpenSansLight: require('../assets/fonts/OpenSans-Light.ttf'),
OpenSansMedium: require('../assets/fonts/OpenSans-Medium.ttf'),
OpenSansBold: require('../assets/fonts/OpenSans-Bold.ttf'),
OpenSansSemiBold: require('../assets/fonts/OpenSans-SemiBold.ttf'),
OpenSansExtra: require('../assets/fonts/OpenSans-ExtraBold.ttf'),
...FontAwesome.font,
});
// Expo Router uses Error Boundaries to catch errors in the navigation tree.
useEffect(() => {
if (error) throw error;
}, [error]);
useEffect(() => {
if (loaded) {
SplashScreen.hideAsync();
}
}, [loaded]);
if (!loaded) {
return null;
}
return <RootLayoutNav />;
}
function RootLayoutNav() {
const colorScheme = useColorScheme();
return (
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
<Stack
screenOptions={{
gestureEnabled: true,
headerShown: false,
contentStyle: {
backgroundColor: Colors.background,
},
}}
>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
</Stack>
</ThemeProvider>
);
}

View File

@@ -1,27 +0,0 @@
import { Link } from 'expo-router';
import * as WebBrowser from 'expo-web-browser';
import React from 'react';
import { Platform } from 'react-native';
export function ExternalLink(
props: Omit<React.ComponentProps<typeof Link>, 'href'> & { href: string },
) {
return (
<Link
hrefAttrs={{
// On web, launch the link in a new tab.
target: '_blank',
}}
{...props}
href={props.href}
onPress={(e) => {
if (Platform.OS !== 'web') {
// Prevent the default behavior of linking to the default browser on native.
e.preventDefault();
// Open the link in an in-app browser.
WebBrowser.openBrowserAsync(props.href as string);
}
}}
/>
);
}

View File

@@ -1,17 +0,0 @@
import { cva } from 'class-variance-authority';
import { Text as RNText, TextProps } from 'react-native';
import { cn } from '@/lib/utils';
const textVariants = cva('text-white');
export function Text({ className, ...props }: TextProps) {
return (
<RNText
className={cn(className, textVariants(), {
'font-sans': !className?.includes('font-'),
})}
{...props}
/>
);
}

View File

@@ -1,14 +0,0 @@
export default {
primary: {
100: '#C082FF',
300: '#8D44D6',
400: '#7831BF',
},
secondary: {
50: '#676790',
200: '#3F3F60',
300: '#32324F',
700: '#131322',
},
background: '#0a0a12',
};

View File

@@ -1,6 +0,0 @@
import { ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

View File

@@ -1,14 +0,0 @@
module.exports = function (api) {
api.cache(true);
return {
presets: [
['babel-preset-expo', { jsxImportSource: 'nativewind' }],
'nativewind/babel',
],
plugins: [
// Required for expo-router
'expo-router/babel',
'react-native-reanimated/plugin',
],
};
};

View File

@@ -1,13 +0,0 @@
module.exports = {
displayName: 'mobile',
resolver: '@nx/jest/plugins/resolver',
preset: 'jest-expo',
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)',
],
moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
moduleNameMapper: {
'\\.svg$': '@nx/expo/plugins/jest/svg-mock',
},
};

View File

@@ -1,48 +0,0 @@
const { withNxMetro } = require('@nx/expo');
const { getDefaultConfig } = require('@expo/metro-config');
const { mergeConfig } = require('metro-config');
const { withNativeWind } = require('nativewind/metro');
const exclusionList = require('metro-config/src/defaults/exclusionList');
const defaultConfig = getDefaultConfig(__dirname, {
isCSSEnabled: true,
});
const { assetExts, sourceExts } = defaultConfig.resolver;
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/
const customConfig = {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
resolver: {
assetExts: assetExts.filter((ext) => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg', 'mjs'],
blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
// unstable_enableSymlinks: true,
// unstable_enablePackageExports: true,
},
};
const nativeWindConfig = withNativeWind(
mergeConfig(defaultConfig, customConfig),
{
input: './app/styles/global.css',
configPath: './tailwind.config.ts',
},
);
const nxConfig = withNxMetro(nativeWindConfig, {
// Change this to true to see debugging info.
// Useful if you have issues resolving modules
debug: false,
// all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx', 'json'
extensions: [],
// Specify folders to watch, in addition to Nx defaults (workspace libraries and node_modules)
watchFolders: [],
});
module.exports = nxConfig;

View File

@@ -1,77 +0,0 @@
{
"name": "mobile",
"main": "expo-router/entry",
"version": "1.0.0",
"jest": {
"preset": "jest-expo"
},
"private": true,
"dependencies": {
"@babel/core": "*",
"@expo/metro-config": "*",
"@expo/vector-icons": "^13.0.0",
"@nx/expo": "*",
"@react-navigation/native": "^6.1.9",
"@rnx-kit/metro-config": "*",
"@rnx-kit/metro-resolver-symlinks": "*",
"@testing-library/jest-native": "*",
"@testing-library/react-native": "*",
"@types/react": "*",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"eslint-plugin-react": "*",
"eslint-plugin-react-hooks": "*",
"expo": "*",
"expo-font": "^11.4.0",
"expo-linking": "^5.0.2",
"expo-router": "^2.0.14",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "*",
"expo-system-ui": "^2.6.0",
"expo-web-browser": "^12.5.0",
"jest": "*",
"jest-expo": "*",
"metro": "*",
"metro-config": "*",
"nativewind": "^4.0.23",
"pod-install": "*",
"react": "*",
"react-dom": "18.2.0",
"react-native": "*",
"react-native-gesture-handler": "^2.14.1",
"react-native-reanimated": "~3.3.0",
"react-native-safe-area-context": "^4.8.2",
"react-native-screens": "^3.29.0",
"react-native-svg": "*",
"react-native-svg-transformer": "*",
"react-native-web": "^0.19.10",
"react-test-renderer": "*",
"tailwind-merge": "^2.2.1",
"tailwindcss": "3.3.2",
"typescript": "*",
"prettier-plugin-tailwindcss": "*"
},
"scripts": {
"eas-build-pre-install": "cd ../../ && node tools/scripts/eas-build-pre-install.mjs . apps/mobile && cp pnpm-lock.yaml apps/mobile",
"eas-build-post-install": "cd ../../ && node tools/scripts/eas-build-post-install.mjs . apps/mobile",
"android": "expo run:android",
"ios": "expo run:ios",
"test": "jest --watchAll",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"format": "prettier --write ."
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@rnx-kit/metro-config": "^1.3.14",
"@rnx-kit/metro-resolver-symlinks": "^0.1.34",
"@types/react": "18.0.28",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"jest": "^29.4.1",
"jest-expo": "~49.0.0",
"pod-install": "^0.1.39",
"prettier-plugin-tailwindcss": "^0.5.11",
"react-test-renderer": "18.2.0",
"typescript": "~5.2.2"
}
}

View File

@@ -1,95 +0,0 @@
{
"name": "mobile",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/mobile/src",
"projectType": "application",
"targets": {
"start": {
"executor": "@nx/expo:start",
"dependsOn": ["ensure-symlink", "sync-deps"],
"options": {
"port": 8081,
"clear": true
}
},
"serve": {
"executor": "nx:run-commands",
"options": {
"command": "nx start mobile"
}
},
"run-ios": {
"executor": "@nx/expo:run",
"dependsOn": ["ensure-symlink", "sync-deps"],
"options": {
"platform": "ios"
}
},
"run-android": {
"executor": "@nx/expo:run",
"dependsOn": ["ensure-symlink", "sync-deps"],
"options": {
"platform": "android"
}
},
"build": {
"executor": "@nx/expo:build",
"options": {}
},
"submit": {
"executor": "@nx/expo:submit",
"options": {}
},
"build-list": {
"executor": "@nx/expo:build-list",
"options": {}
},
"sync-deps": {
"executor": "@nx/expo:sync-deps",
"options": {}
},
"ensure-symlink": {
"executor": "@nx/expo:ensure-symlink",
"options": {}
},
"prebuild": {
"executor": "@nx/expo:prebuild",
"dependsOn": ["ensure-symlink", "sync-deps"],
"options": {}
},
"install": {
"executor": "@nx/expo:install",
"options": {}
},
"update": {
"executor": "@nx/expo:update",
"options": {}
},
"export": {
"executor": "@nx/expo:export",
"dependsOn": ["ensure-symlink", "sync-deps"],
"options": {
"platform": "all",
"outputDir": "../../dist/apps/mobile"
}
},
"export-web": {
"executor": "@nx/expo:export",
"options": {
"bundler": "metro"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/mobile/jest.config.ts"
}
}
},
"tags": []
}

View File

@@ -1,27 +0,0 @@
// @ts-expect-error - no types
import nativewind from 'nativewind/preset';
import type { Config } from 'tailwindcss';
import colors from './app/constants/Colors';
export default {
content: ['./app/**/*.{js,jsx,ts,tsx}'],
presets: [
nativewind,
{
theme: {
extend: {
colors,
fontFamily: {
sans: ['OpenSansRegular'],
thin: ['OpenSansLight'],
normal: ['OpenSansRegular'],
medium: ['OpenSansMedium'],
semibold: ['OpenSansSemiBold'],
bold: ['OpenSansBold'],
extrabold: ['OpenSansExtra'],
},
},
},
},
],
} satisfies Config;

View File

@@ -1 +0,0 @@
import '@testing-library/jest-native/extend-expect';

View File

@@ -1,22 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "../../dist/out-tsc",
"types": ["node"],
},
"files": ["../../node_modules/@nx/expo/typings/svg.d.ts"],
"exclude": [
"jest.config.ts",
"**/*.spec.ts",
"**/*.spec.tsx",
"test-setup.ts"
],
"include": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"tailwind.config.ts"
]
}

View File

@@ -1,30 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"jsx": "react-native",
"lib": ["dom", "esnext"],
"moduleResolution": "node",
"skipLibCheck": true,
"resolveJsonModule": true,
"strict": true,
"declaration": true,
"allowJs": true,
"baseUrl": "./",
"paths": {
"@/*": [
"./app/*"
],
}
},
"files": [],
"include": [".expo/types/**/*.ts", "expo-env.d.ts"],
"references": [
{
"path": "./tsconfig.app.json",
},
{
"path": "./tsconfig.spec.json",
},
],
}

View File

@@ -1,21 +0,0 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"composite": true,
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}

View File

@@ -1,3 +0,0 @@
{
"babelrcRoots": ["*"]
}

View File

@@ -1,5 +0,0 @@
import { getJestProjects } from '@nx/jest';
export default {
projects: getJestProjects(),
};

View File

@@ -1,3 +0,0 @@
const nxPreset = require('@nx/jest/preset').default;
module.exports = { ...nxPreset };

41
nx.json
View File

@@ -1,41 +0,0 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"affected": {
"defaultBase": "master"
},
"targetDefaults": {
"build": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"lint": {
"cache": true
},
"@nx/jest:jest": {
"cache": true,
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/jest.config.[jt]s",
"!{projectRoot}/src/test-setup.[jt]s",
"!{projectRoot}/test-setup.[jt]s"
],
"sharedGlobals": []
}
}

View File

@@ -1,75 +1,36 @@
{ {
"name": "@movie-web/native-app", "name": "create-t3-turbo",
"version": "0.0.0",
"license": "MIT",
"scripts": {},
"private": true, "private": true,
"engines": {
"node": ">=20.11.0"
},
"packageManager": "pnpm@8.15.0",
"scripts": {
"build": "turbo build",
"clean": "git clean -xdf node_modules",
"clean:workspaces": "turbo clean",
"db:push": "pnpm -F db push",
"db:studio": "pnpm -F db studio",
"dev": "turbo dev --parallel",
"format": "turbo format --continue -- --cache --cache-location node_modules/.cache/.prettiercache",
"format:fix": "turbo format --continue -- --write --cache --cache-location node_modules/.cache/.prettiercache",
"lint": "turbo lint --continue -- --cache --cache-location node_modules/.cache/.eslintcache",
"lint:fix": "turbo lint --continue -- --fix --cache --cache-location node_modules/.cache/.eslintcache",
"lint:ws": "pnpm dlx sherif@latest",
"postinstall": "pnpm lint:ws",
"typecheck": "turbo typecheck"
},
"devDependencies": { "devDependencies": {
"@config-plugins/detox": "~6.0.0", "@movie-web/prettier-config": "workspace:^0.1.0",
"@expo/cli": "~0.10.13", "@turbo/gen": "^1.11.3",
"@nx/detox": "17.2.8", "prettier": "^3.1.1",
"@nx/expo": "17.2.8", "turbo": "^1.11.3",
"@nx/jest": "17.2.8", "typescript": "^5.3.3"
"@nx/js": "17.2.8",
"@nx/workspace": "17.2.8",
"@swc-node/register": "~1.6.8",
"@swc/core": "~1.3.102",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/jest-native": "~5.4.3",
"@testing-library/react-native": "~12.3.0",
"@types/jest": "^29.4.0",
"@types/node": "18.16.9",
"@types/react": "18.2.14",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"babel-jest": "^29.4.1",
"babel-preset-expo": "~9.5.2",
"detox": "^20.11.1",
"eas-cli": "~5.2.0",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"jest": "^29.4.1",
"jest-circus": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest-expo": "~49.0.0",
"metro": "0.76.8",
"metro-resolver": "0.76.8",
"nx": "17.2.8",
"prettier": "^3.0.3",
"react-test-renderer": "18.2.0",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.2.2"
},
"dependencies": {
"@expo/metro-config": "~0.10.7",
"expo": "49.0.16",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.6",
"react-native-svg": "13.9.0",
"react-native-svg-transformer": "1.3.0",
"react-native-web": "~0.19.9",
"tslib": "^2.3.0"
}, },
"prettier": "@movie-web/prettier-config",
"pnpm": { "pnpm": {
"patchedDependencies": { "patchedDependencies": {
"nativewind@4.0.23": "patches/nativewind@4.0.23.patch" "nativewind@4.0.23": "patches/nativewind@4.0.23.patch"
} }
},
"overrides": {
"react-refresh": "~0.14.0"
},
"resolutions": {
"react-refresh": "~0.14.0"
} }
} }

View File

9352
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,4 @@
packages: packages:
- packages/*
- apps/* - apps/*
- packages/*
- tooling/*

43
tooling/eslint/base.js Normal file
View File

@@ -0,0 +1,43 @@
/** @type {import("eslint").Linter.Config} */
const config = {
extends: [
"turbo",
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"prettier",
],
env: {
es2022: true,
node: true,
},
parser: "@typescript-eslint/parser",
parserOptions: { project: true },
plugins: ["@typescript-eslint", "import"],
rules: {
"turbo/no-undeclared-env-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/consistent-type-imports": [
"warn",
{ prefer: "type-imports", fixStyle: "separate-type-imports" },
],
"@typescript-eslint/no-misused-promises": [
2,
{ checksVoidReturn: { attributes: false } },
],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
},
ignorePatterns: [
"**/*.config.js",
"**/*.config.cjs",
"**/.eslintrc.cjs",
"dist",
"pnpm-lock.yaml",
],
reportUnusedDisableDirectives: true,
};
module.exports = config;

View File

@@ -0,0 +1,41 @@
{
"name": "@movie-web/eslint-config",
"version": "0.2.0",
"private": true,
"license": "MIT",
"files": [
"./base.js",
"./react.js"
],
"scripts": {
"clean": "rm -rf .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint .",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^1.11.3",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0"
},
"devDependencies": {
"@movie-web/prettier-config": "workspace:^0.1.0",
"@movie-web/tsconfig": "workspace:^0.1.0",
"@types/eslint": "^8.56.2",
"eslint": "^8.56.0",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
},
"eslintConfig": {
"root": true,
"extends": [
"./base.js"
]
},
"prettier": "@movie-web/prettier-config"
}

24
tooling/eslint/react.js vendored Normal file
View File

@@ -0,0 +1,24 @@
/** @type {import('eslint').Linter.Config} */
const config = {
extends: [
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
rules: {
"react/prop-types": "off",
},
globals: {
React: "writable",
},
settings: {
react: {
version: "detect",
},
},
env: {
browser: true,
},
};
module.exports = config;

View File

@@ -0,0 +1,8 @@
{
"extends": "@movie-web/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
},
"include": ["."],
"exclude": ["node_modules"],
}

View File

@@ -0,0 +1,3 @@
{
"name": "@movie-web/github"
}

View File

@@ -0,0 +1,17 @@
name: "Setup and install"
description: "Common setup steps for Actions"
runs:
using: composite
steps:
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- shell: bash
run: pnpm add -g turbo
- shell: bash
run: pnpm install

35
tooling/prettier/index.js Normal file
View File

@@ -0,0 +1,35 @@
import { fileURLToPath } from "url";
/** @typedef {import("prettier").Config} PrettierConfig */
/** @typedef {import("prettier-plugin-tailwindcss").PluginOptions} TailwindConfig */
/** @typedef {import("@ianvs/prettier-plugin-sort-imports").PluginConfig} SortImportsConfig */
/** @type { PrettierConfig | SortImportsConfig | TailwindConfig } */
const config = {
plugins: [
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss",
],
tailwindConfig: fileURLToPath(
new URL("../../tooling/tailwind/web.ts", import.meta.url),
),
tailwindFunctions: ["cn", "cva"],
importOrder: [
"<TYPES>",
"^(react/(.*)$)|^(react$)|^(react-native(.*)$)",
"^(expo(.*)$)|^(expo$)",
"<THIRD_PARTY_MODULES>",
"",
"<TYPES>^@movie-web",
"^@movie-web/(.*)$",
"",
"<TYPES>^[.|..|~]",
"^~/",
"^[../]",
"^[./]",
],
importOrderParserPlugins: ["typescript", "jsx", "decorators-legacy"],
importOrderTypeScriptVersion: "4.4.0",
};
export default config;

View File

@@ -0,0 +1,24 @@
{
"name": "@movie-web/prettier-config",
"private": true,
"version": "0.1.0",
"type": "module",
"exports": {
".": "./index.js"
},
"scripts": {
"clean": "rm -rf .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"prettier": "^3.1.1",
"prettier-plugin-tailwindcss": "^0.5.10"
},
"devDependencies": {
"@movie-web/tsconfig": "workspace:^0.1.0",
"typescript": "^5.3.3"
},
"prettier": "@movie-web/prettier-config"
}

View File

@@ -0,0 +1,8 @@
{
"extends": "@movie-web/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
},
"include": ["."],
"exclude": ["node_modules"],
}

12
tooling/tailwind/base.ts Normal file
View File

@@ -0,0 +1,12 @@
import type { Config } from "tailwindcss";
import colors from "./colors";
export default {
content: ["src/**/*.{ts,tsx}"],
theme: {
extend: {
colors,
},
},
} satisfies Config;

View File

@@ -0,0 +1,14 @@
export default {
primary: {
100: "#C082FF",
300: "#8D44D6",
400: "#7831BF",
},
secondary: {
50: "#676790",
200: "#3F3F60",
300: "#32324F",
700: "#131322",
},
background: "#0a0a12",
};

View File

@@ -0,0 +1,9 @@
import type { Config } from "tailwindcss";
import base from "./base";
export default {
content: base.content,
presets: [base],
theme: {},
} satisfies Config;

View File

@@ -0,0 +1,39 @@
{
"name": "@movie-web/tailwind-config",
"version": "0.1.0",
"private": true,
"type": "module",
"exports": {
"./native": "./native.ts",
"./web": "./web.ts",
"./colors": "./colors.ts"
},
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint .",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"autoprefixer": "^10.4.17",
"postcss": "^8.4.32",
"tailwindcss": "^3.4.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@movie-web/eslint-config": "workspace:^0.2.0",
"@movie-web/prettier-config": "workspace:^0.1.0",
"@movie-web/tsconfig": "workspace:^0.1.0",
"eslint": "^8.56.0",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
},
"eslintConfig": {
"root": true,
"extends": [
"@movie-web/eslint-config/base"
]
},
"prettier": "@movie-web/prettier-config"
}

Some files were not shown because too many files have changed in this diff Show More