Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sevvaleygul0 committed Jul 31, 2022
0 parents commit b4c48d6
Show file tree
Hide file tree
Showing 81 changed files with 15,176 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"header-max-length": [0, "always", 150],
"subject-case": [0, "always", "sentence-case"],
"type-enum": [
2,
"always",
[
"ci",
"chore",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test"
]
]
}
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/**
123 changes: 123 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"@react-native-community",
"prettier",
],
ignorePatterns: [
"**/*/*.js",
"*.js",
"*.svg",
"*.json",
"*.png",
"package.json",
"package-lock.json",
],
parser: "@typescript-eslint/parser",
plugins: [
"import",
"react",
"react-native",
"prettier",
"react-hooks",
"@typescript-eslint",
"promise",
"jest",
"unused-imports",
],
env: {
browser: true,
es2021: true,
"jest/globals": true,
"react-native/react-native": true,
},
settings: {
"import/resolver": {
node: {
extensions: [
".js",
".jsx",
".ts",
".tsx",
".d.ts",
".android.js",
".android.jsx",
".android.ts",
".android.tsx",
".ios.js",
".ios.jsx",
".ios.ts",
".ios.tsx",
".web.js",
".web.jsx",
".web.ts",
".web.tsx",
],
},
},
},
rules: {
quotes: [
"error",
"double",
{
avoidEscape: true,
},
],
"import/extensions": [
"error",
"never",
{
svg: "always",
model: "always",
style: "always",
png: "always",
jpg: "always",
json: "always",
constant: "always",
},
],
"no-useless-catch": 0,
"react-hooks/exhaustive-deps": 0,
"max-len": ["error", 120],
"@typescript-eslint/ban-ts-comment": 1,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-explicit-any": 1,
"@typescript-eslint/explicit-module-boundary-types": 0,
"react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
"react-native/no-unused-styles": 2,
"react-native/split-platform-components": 2,
"react-native/no-inline-styles": 0,
"react-native/no-color-literals": 0,
"react-native/no-raw-text": 0,
"import/no-extraneous-dependencies": 2,
"import/no-named-as-default-member": 2,
"import/order": 0,
"import/no-duplicates": 2,
"import/no-useless-path-segments": 2,
"import/no-cycle": 2,
"import/prefer-default-export": 0,
"import/no-anonymous-default-export": 0,
"import/named": 0,
"@typescript-eslint/no-empty-interface": 0,
"import/namespace": 0,
"import/default": 0,
"import/no-named-as-default": 0,
"import/no-unused-modules": 0,
"import/no-deprecated": 0,
"@typescript-eslint/indent": 0,
"react-hooks/rules-of-hooks": 2,
camelcase: 2,
"prefer-destructuring": 2,
"no-nested-ternary": 2,
"prettier/prettier": [
"error",
{
endOfLine: "auto",
},
],
},
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# Visual Studio Code
#
.vscode/

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run prettier
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Node Modules
**/node_modules
node_modules
# Example
example
# Assets
Assets
assets
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/**
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"bracketSpacing": true,
"jsxBracketSameLine": false,
"singleQuote": false,
"trailingComma": "all",
"tabWidth": 2,
"semi": true
}
118 changes: 118 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<img alt="React Native Typescript Library Starter" src="assets/logo.png" width="1050"/>

[![Battle Tested ✅](https://img.shields.io/badge/-Battle--Tested%20%E2%9C%85-03666e?style=for-the-badge)](https://github.com/WrathChaos/react-native-typescript-library-starter)

[![React Native Typescript Library Starter](https://img.shields.io/badge/-Extremely%20easy%20to%20create%20a%20React%20Native%20Component%20Library%20with%20both%20Stateful%20and%20Functional%20Component%20Examples-orange?style=for-the-badge)](https://github.com/WrathChaos/react-native-typescript-library-starter)

[![npm version](https://img.shields.io/npm/v/react-native-typescript-library-starter.svg?style=for-the-badge)](https://www.npmjs.com/package/react-native-typescript-library-starter)
[![npm](https://img.shields.io/npm/dt/react-native-typescript-library-starter.svg?style=for-the-badge)](https://www.npmjs.com/package/react-native-typescript-library-starter)
![Platform - Android and iOS](https://img.shields.io/badge/platform-Android%20%7C%20iOS-blue.svg?style=for-the-badge)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge)](https://opensource.org/licenses/MIT)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=for-the-badge)](https://github.com/prettier/prettier)

<p align="center">
<img alt="React Native Typescript Library Starter"
src="assets/Screenshots/typescript.jpg" />
</p>

## Library Usage

- `npm i`
- `npm run husky:setup`
- Delete example folder
- Delete build folder
- Make your own library into the `lib` folder
- Change package.json
- Change README for your own documentation
- `npm run build`

```
> [email protected] build /Users/kuray/Coursion/MyLibraries/ReactNative/react-native-typescript-library-starter
> cd lib && tsc && cp ../package.json ../build/dist/ && Echo Build completed!
Build completed!
```

- Test your build/dist into the new project
- Finally, time to npm publish :)

### Below part is for Documentation ! Remove above Library Usage

# Installation

Add the dependency:

```bash
npm i react-native-typescript-library-starter
```

## Peer Dependencies

<h5><i>IMPORTANT! You need install them</i></h5>

```js
"react": ">= 16.x.x",
"react-native": ">= 0.55.x",
```

# Usage

## Import

```jsx
import MyComponent from "react-native-typescript-library-starter";
```

## Fundamental Usage

```jsx
<MyComponent />
```

## Example Project 😍

You can checkout the example project 🥰

Simply run

- `npm i`
- `react-native run-ios/android`

should work of the example project.

# Configuration - Props

## Fundamentals

| Property | Type | Default | Description |
| ----------- | :----: | :-------: | --------------------- |
| title | string | undefined | change the title |
| description | string | undefined | change the descrition |

## Customization (Optionals)

| Property | Type | Default | Description |
| -------------- | :-------: | :-------: | ---------------------------------------------------------------------- |
| enableButton | boolean | false | let you enable the button (must use it for button) |
| onPress | function | undefined | set your own logic for the button functionality when it is pressed |
| buttonText | string | undefined | change the button's text |
| style | ViewStyle | default | set or override the style object for the main container |
| buttonStyle | ViewStyle | default | set or override the style object for the button style |
| ImageComponent | Image | default | set your own component instead of default react-native Image component |

## Future Plans

- [x] ~~LICENSE~~
- [ ] Write an article about the lib on Medium

# Change Log

Change log will be here !

## Author

FreakyCoder, [email protected]

## License

React Native Typescript Library Starter is available under the MIT license. See the LICENSE file for more info.
Binary file added assets/Screenshots/typescript.jpg
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 assets/logo.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 example/.buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
4 changes: 4 additions & 0 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
Loading

0 comments on commit b4c48d6

Please sign in to comment.