Skip to content

Commit 5c681ca

Browse files
committed
scaffold monorepo project
1 parent 978af0f commit 5c681ca

33 files changed

+462
-0
lines changed

.gitignore

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Monorepo
2+
apps/*/credentials.json
3+
apps/*/dist
4+
packages/*/dist
5+
6+
# Turborepo
7+
.turbo
8+
9+
# Expo
10+
.expo
11+
__generated__
12+
web-build
13+
14+
# macOS
15+
.DS_Store
16+
17+
# Node
18+
node_modules
19+
npm-debug.log
20+
yarn-error.log
21+
package-lock.json
22+
23+
# Ruby
24+
.direnv
25+
26+
# Emacs
27+
*~
28+
29+
# Vim
30+
.*.swp
31+
.*.swo
32+
.*.swn
33+
.*.swm
34+
35+
# Sublime Text
36+
*.sublime-project
37+
*.sublime-workspace
38+
39+
# Xcode
40+
*.pbxuser
41+
!default.pbxuser
42+
*.xccheckout
43+
*.xcscmblueprint
44+
xcuserdata
45+
46+
# Android Studio
47+
*.iml
48+
.gradle
49+
.idea/libraries
50+
.idea/workspace.xml
51+
.idea/gradle.xml
52+
.idea/misc.xml
53+
.idea/modules.xml
54+
.idea/vcs.xml
55+
56+
# Eclipse
57+
.project
58+
.settings
59+
60+
# VSCode
61+
.history/

.storybook/main.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { StorybookConfig } from "@storybook/react-vite";
2+
3+
const config: StorybookConfig = {
4+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
5+
addons: [
6+
"@storybook/addon-links",
7+
"@storybook/addon-essentials",
8+
"@storybook/addon-onboarding",
9+
"@storybook/addon-interactions",
10+
],
11+
framework: {
12+
name: "@storybook/react-vite",
13+
options: {},
14+
},
15+
docs: {
16+
autodocs: "tag",
17+
},
18+
};
19+
export default config;

.storybook/preview.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { Preview } from "@storybook/react";
2+
3+
const preview: Preview = {
4+
parameters: {
5+
actions: { argTypesRegex: "^on[A-Z].*" },
6+
controls: {
7+
matchers: {
8+
color: /(background|color)$/i,
9+
date: /Date$/i,
10+
},
11+
},
12+
},
13+
};
14+
15+
export default preview;

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["esbenp.prettier-vscode"]
3+
}

.vscode/settings.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"[typescriptreact]": {
4+
"editor.defaultFormatter": "esbenp.prettier-vscode"
5+
},
6+
"[json]": {
7+
"editor.defaultFormatter": "esbenp.prettier-vscode"
8+
},
9+
"[typescript]": {
10+
"editor.defaultFormatter": "esbenp.prettier-vscode"
11+
}
12+
}

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# react-native-flash-calendar
2+
3+
To install dependencies:
4+
5+
```bash
6+
bun install
7+
```
8+
9+
To run:
10+
11+
```bash
12+
bun run src/index.ts
13+
```
14+
15+
This project was created using `bun init` in bun v1.0.26. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

apps/example/.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
11+
# Native
12+
*.orig.*
13+
*.jks
14+
*.p8
15+
*.p12
16+
*.key
17+
*.mobileprovision
18+
19+
# Metro
20+
.metro-health-check*
21+
22+
# debug
23+
npm-debug.*
24+
yarn-debug.*
25+
yarn-error.*
26+
27+
# macOS
28+
.DS_Store
29+
*.pem
30+
31+
# local env files
32+
.env*.local
33+
34+
# typescript
35+
*.tsbuildinfo

apps/example/.watchmanconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

apps/example/app.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"expo": {
3+
"name": "example",
4+
"slug": "example",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"splash": {
10+
"image": "./assets/splash.png",
11+
"resizeMode": "contain",
12+
"backgroundColor": "#ffffff"
13+
},
14+
"assetBundlePatterns": [
15+
"**/*"
16+
],
17+
"ios": {
18+
"supportsTablet": true
19+
},
20+
"android": {
21+
"adaptiveIcon": {
22+
"foregroundImage": "./assets/adaptive-icon.png",
23+
"backgroundColor": "#ffffff"
24+
}
25+
},
26+
"web": {
27+
"favicon": "./assets/favicon.png"
28+
}
29+
}
30+
}

apps/example/assets/adaptive-icon.png

17.1 KB
Loading

apps/example/assets/favicon.png

1.43 KB
Loading

apps/example/assets/icon.png

21.9 KB
Loading

apps/example/assets/splash.png

46.2 KB
Loading

apps/example/babel.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

apps/example/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { registerRootComponent } from "expo";
2+
import App from "./src/App";
3+
4+
registerRootComponent(App);

apps/example/metro.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const { getDefaultConfig } = require('expo/metro-config');
2+
const path = require('path');
3+
4+
// Find the project and workspace directories
5+
const projectRoot = __dirname;
6+
// This can be replaced with `find-yarn-workspace-root`
7+
const monorepoRoot = path.resolve(projectRoot, '../..');
8+
9+
const config = getDefaultConfig(projectRoot);
10+
11+
// 1. Watch all files within the monorepo
12+
config.watchFolders = [monorepoRoot];
13+
// 2. Let Metro know where to resolve packages and in what order
14+
config.resolver.nodeModulesPaths = [
15+
path.resolve(projectRoot, 'node_modules'),
16+
path.resolve(monorepoRoot, 'node_modules'),
17+
];
18+
19+
module.exports = config;

apps/example/package.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "example",
3+
"version": "1.0.0",
4+
"main": "./index.js",
5+
"scripts": {
6+
"start": "expo start",
7+
"android": "expo start --android",
8+
"ios": "expo start --ios",
9+
"web": "expo start --web",
10+
"dev": "expo start --ios",
11+
"clean": "rm -rf dist && rm -rf node_modules"
12+
},
13+
"dependencies": {
14+
"expo": "~50.0.6",
15+
"expo-status-bar": "~1.11.1",
16+
"react": "18.2.0",
17+
"react-native": "0.73.4",
18+
"@marceloterreiro/flash-calendar": "*"
19+
},
20+
"devDependencies": {
21+
"@marceloterreiro/tsconfig": "*",
22+
"@babel/core": "^7.20.0",
23+
"@types/react": "~18.2.45",
24+
"typescript": "^5.3.0"
25+
},
26+
"private": true
27+
}

apps/example/src/App.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Day, Month } from "@marceloterreiro/flash-calendar";
2+
import { StatusBar } from "expo-status-bar";
3+
import { StyleSheet, View } from "react-native";
4+
5+
export default function App() {
6+
return (
7+
<View style={styles.container}>
8+
<Month />
9+
<Day />
10+
<StatusBar style="auto" />
11+
</View>
12+
);
13+
}
14+
15+
const styles = StyleSheet.create({
16+
container: {
17+
flex: 1,
18+
backgroundColor: "#fff",
19+
alignItems: "center",
20+
justifyContent: "center",
21+
},
22+
});

apps/example/tsconfig.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "@marceloterreiro/tsconfig/base",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"paths": {
6+
"@marceloterreiro/flash-calendar": ["../../packages/flash-calendar/src"]
7+
}
8+
},
9+
"include": ["src"],
10+
"exclude": ["node_modules"]
11+
}

bun.lockb

442 KB
Binary file not shown.

package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "@marceloterreiro/monorepo",
3+
"private": true,
4+
"version": "1.0.0",
5+
"workspaces": [
6+
"apps/*",
7+
"packages/*"
8+
],
9+
"scripts": {
10+
"dev": "turbo dev",
11+
"lint": "turbo lint",
12+
"test": "turbo test",
13+
"build": "turbo build",
14+
"clean": "turbo clean && rm -rf node_modules"
15+
},
16+
"devDependencies": {
17+
"@marceloterreiro/tsconfig": "*",
18+
"typescript": "^5.3.0"
19+
}
20+
}

packages/eslint-config/index.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copied from Cedric's repo: https://github.com/byCedric/expo-monorepo-example/blob/main/packages/eslint-config/index.js
2+
3+
module.exports = {
4+
extends: "eslint-config-universe",
5+
// do some additional things with it
6+
rules: {
7+
"prettier/prettier": ["error", { endOfLine: "auto" }],
8+
},
9+
// Disable import/namespace due to https://github.com/facebook/react-native/issues/28549
10+
// By setting delimiters to `\|/`, this ignore is supported on Windows too
11+
settings: {
12+
"import/ignore": ["node_modules(\\\\|/)react-native(\\\\|/)index\\.js$"],
13+
},
14+
};

packages/eslint-config/package.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"private": true,
3+
"name": "@marceloterreiro/eslint-config",
4+
"version": "0.0.1",
5+
"description": "A shared eslint configuration for Marcelo's projects",
6+
"author": "Marcelo Prado <[email protected]>",
7+
"license": "MIT",
8+
"main": "index.js",
9+
"files": [
10+
"index.js"
11+
],
12+
"scripts": {
13+
"lint": "eslint --ext js,ts,tsx ."
14+
},
15+
"dependencies": {
16+
"@typescript-eslint/eslint-plugin": "^5.42.1",
17+
"@typescript-eslint/parser": "^5.42.1",
18+
"eslint": "^8.34.0",
19+
"eslint-config-universe": "^11.2.0",
20+
"prettier": "^2.7.1"
21+
},
22+
"eslintConfig": {
23+
"extends": "."
24+
}
25+
}

packages/flash-calendar/package.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "@marceloterreiro/flash-calendar",
3+
"version": "0.0.1",
4+
"description": "A better calendar for React Native.",
5+
"main": "./dist/index.js",
6+
"types": "./dist/index.d.ts",
7+
"react-native": "./src/index.ts",
8+
"repository": "github.com/marceloprado/flash-calendar",
9+
"author": "Marcelo Prado",
10+
"license": "MIT",
11+
"scripts": {
12+
"dev": "tsup --watch --silent",
13+
"lint": "eslint --ext js,ts,tsx .",
14+
"test": "jest",
15+
"build": "tsup --dts",
16+
"clean": "rm -rf dist && rm -rf node_modules"
17+
},
18+
"dependencies": {},
19+
"peerDependencies": {
20+
"react": "*",
21+
"react-native": "*"
22+
},
23+
"devDependencies": {
24+
"@marceloterreiro/eslint-config": "*",
25+
"@marceloterreiro/tsconfig": "*",
26+
"@types/bun": "^1.0.5",
27+
"react": "18.2.0",
28+
"react-native": "0.73.4",
29+
"tsup": "^8.0.1"
30+
},
31+
"private": false,
32+
"eslintConfig": {
33+
"extends": "@marceloterreiro/eslint-config",
34+
"ignorePatterns": [
35+
"node_modules",
36+
"build"
37+
]
38+
}
39+
}

0 commit comments

Comments
 (0)