Skip to content

Added scripts to change environments #27

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

Merged
merged 6 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ web-build/

# macOS
.DS_Store

# ignore local builds for project
/digital-art-dealers-react-native-component-lib-v**

# ignore yarn error log
yarn-error.log
2 changes: 1 addition & 1 deletion App.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from "./storybook";
export { default } from "./src";
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
<a href="https://munchkinreact.app/">munchkinreact.app</a>
</p>

<p align="center">👾Munchkin - A react native component lib compatible with TailWind CSS</p>
<p align="center">👾 Munchkin - A react native component lib compatible with TailWind CSS</p>

<p align="center">
⭐Help us out by giving a star⭐
Help us out by giving a star
</p>



## Features
1. Get buttons, loaders, and other components to bootstrap your app development
2. TailWind CSS compatiable
2. TailWind CSS compatible
3. Written in TypeScript

## Try it out now
Expand All @@ -32,3 +32,12 @@ To add this component lib to your project manually:

## View the code
To view code to the sample storybook [here](https://github.com/daboigbae/react-native-component-lib)

#### Run locally for development
To run the test project locally run `yarn change:package:dev` then run `yarn ios` or `yarn android`,

#### Build library for release
To build the library, run `yarn change:package:prod`, set version in `package.json` then run `yarn build` this will create a `dist` file that will allow you to install the library in your project.

##### Build library for local testing (optional)
To make a test version of the library (.tgz) run `yarn pack`
4 changes: 4 additions & 0 deletions bash/change-package-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
value=`cat package.dev.json`
echo $value > package.json
rm -f yarn.lock
yarn install
4 changes: 4 additions & 0 deletions bash/change-package-prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
value=`cat package.prod.json`
echo $value > package.json
rm -f yarn.lock
yarn install
7 changes: 3 additions & 4 deletions .package.expo.json → package.dev.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digital-art-dealers/react-native-component-lib",
"version": "1.0.10",
"version": "2.0.0",
"main": "node_modules/expo/AppEntry.js",
"module": "dist/esm/index.js",
"files": [
Expand All @@ -17,9 +17,8 @@
"storybook": "start-storybook -p 7007",
"build-storybook": "build-storybook",
"prettier-format": "prettier --config .prettierrc.js 'src/**/*.js' --write",
"build": "rm -rf /dist && npm run build:esm && npm run build:cjs",
"build:esm": "tsc",
"build:cjs": "tsc --module CommonJS --outDir dist/cjs"
"change:package:prod": "bash/change-package-prod.sh",
"change:package:dev": "bash/change-package-dev.sh"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@
],
"title": "React Native Component Lib",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"storybook": "start-storybook -p 7007",
"build-storybook": "build-storybook",
"prettier-format": "prettier --config .prettierrc.js 'src/**/*.js' --write",
"build": "rm -rf /dist && npm run build:esm && npm run build:cjs",
"build:esm": "tsc",
"build:cjs": "tsc --module CommonJS --outDir dist/cjs"
"build:cjs": "tsc --module CommonJS --outDir dist/cjs",
"change:package:prod": "bash/change-package-prod.sh",
"change:package:dev": "bash/change-package-dev.sh"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down
93 changes: 93 additions & 0 deletions package.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"name": "@digital-art-dealers/react-native-component-lib",
"version": "1.0.13",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"files": [
"dist",
"package.json",
"README.md"
],
"title": "React Native Component Lib",
"scripts": {
"prettier-format": "prettier --config .prettierrc.js 'src/**/*.js' --write",
"build": "rm -rf /dist && npm run build:esm && npm run build:cjs",
"build:esm": "tsc",
"build:cjs": "tsc --module CommonJS --outDir dist/cjs",
"change:package:prod": "bash/change-package-prod.sh",
"change:package:dev": "bash/change-package-dev.sh"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"prettier --write",
"eslint --fix"
]
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^14.1.0",
"@rollup/plugin-typescript": "^8.5.0",
"@storybook/addon-actions": "^5.3",
"@storybook/addon-knobs": "^5.3",
"@storybook/addon-links": "^5.3",
"@storybook/addon-ondevice-actions": "^5.3.23",
"@storybook/addon-ondevice-knobs": "^5.3.26",
"@storybook/react-native": "^5.3.25",
"@storybook/react-native-server": "^5.3.23",
"@tsconfig/recommended": "^1.0.1",
"@types/react": "~18.0.14",
"@types/react-native": "~0.69.1",
"babel-jest": "^28.1.3",
"babel-loader": "^8.2.5",
"detox": "^19.7.1",
"eslint": "^8.23.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-detox": "^1.0.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.3.0",
"metro-react-native-babel-preset": "^0.70.3",
"prettier": "^2.7.1",
"react-native-storybook-loader": "^2.0.5",
"react-test-renderer": "18.0.0",
"regenerator-runtime": "^0.13.9",
"rollup": "^2.79.1",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-terser": "^7.0.2",
"tailwindcss": "^3.1.8",
"typescript": "~4.3.5"
},
"description": "This is the repo for a TailWind (NativeWind) react native component library that aims and improving the speed at which mobile apps are made.",
"repository": {
"type": "git",
"url": "git+https://github.com/daboigbae/react-native-component-lib.git"
},

"keywords": [
"react-native",
"tailwindcss",
"component library",
"typescript"
],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/daboigbae/react-native-component-lib/issues"
},
"homepage": "https://github.com/daboigbae/react-native-component-lib#readme",
"peerDependencies": {
"@react-native-async-storage/async-storage": "~1.17.3",
"nativewind": "^2.0.10",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.5",
"react-native-web": "~0.18.7"
}
}

2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import postcss from "rollup-plugin-postcss";
const packageJson = require("./package.json");

export default {
input: "src/index.ts",
input: "/src/components/index.ts",
external: ["react", "react-native"],
output: [
{
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions src/components/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export { default as Button } from "./Button";
export { default as Loader } from "./Loader";
export { default as ItemSeparator } from "./ItemSeparator";
export { default as TextInput } from "./TextInput";
export { default as Card } from "./Card";
export { default as Text } from "./Text";
export { default as Avatar } from "./Avatar";
10 changes: 3 additions & 7 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export { default as Button } from "./Button";
export { default as Loader } from "./Loader";
export { default as ItemSeparator } from "./ItemSeparator";
export { default as TextInput } from "./TextInput";
export { default as Card } from "./Card";
export { default as Text } from "./Text";
export { default as Avatar } from "./Avatar";
/// <reference types="nativewind/types" />

export * from './components';
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions src/index.ts

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { text, select, boolean } from "@storybook/addon-knobs";
import { storiesOf } from "@storybook/react-native";

import { View, Text } from "react-native";
import { Avatar } from "../../../src";
import { Avatar } from "../../components";

storiesOf("Avatar", module)
.addDecorator((getStory) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {text, select, boolean} from "@storybook/addon-knobs";
import { storiesOf } from "@storybook/react-native";

import { View, Text } from "react-native";
import { Button } from "../../../src";
import { Button } from "../../components";

storiesOf("Buttons", module)
.addDecorator((getStory) => <View className="w-full h-full items-center justify-center">{getStory()}</View>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { text, select, number } from "@storybook/addon-knobs";
import { storiesOf } from "@storybook/react-native";

import { Text, View } from "react-native";
import { Button, Card, ItemSeparator } from "../../../src";
import { action } from "@storybook/addon-actions";
import { Button, Card, ItemSeparator } from "../../components";

storiesOf("Cards", module)
.addDecorator((getStory) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from "react";
import { storiesOf } from "@storybook/react-native";
import { View, Text, FlatList } from "react-native";
import { ItemSeparator } from "../../../src";
import { ItemSeparator } from "../../components";

const SONGS = [{
artist: "Gucci Mane",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import React from "react";
import { View } from "react-native";

import { storiesOf } from "@storybook/react-native";
import { Loader } from "../../components";

import Loader from "../../../src/components/Loader/Loader";

storiesOf("Loader ", module)
.addDecorator((getStory) => <View className="w-full h-full items-center justify-center">{getStory()}</View>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { View, Text as RNText } from "react-native";

import { text, select } from "@storybook/addon-knobs";
import { storiesOf } from "@storybook/react-native";

import { Text } from "../../../src";
import { Text } from "../../components";

storiesOf("Text", module)
.addDecorator((getStory) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { storiesOf } from "@storybook/react-native";

import { View } from "react-native";

import FormInput from "../../../src/components/TextInput/TextInput";
import { text } from "@storybook/addon-knobs";
import { text } from "@storybook/addon-knobs";
import { TextInput } from "../../components";

storiesOf("Text Input", module)
.addDecorator((getStory) => (
Expand All @@ -17,7 +17,7 @@ storiesOf("Text Input", module)
))
.add("Standard", () => (
<View className="w-full px-4">
<FormInput
<TextInput
label={text("Label", "Label")}
placeholder={text("Placeholder", "Sample placeholder")}
error="Sample error message"
Expand All @@ -26,11 +26,15 @@ storiesOf("Text Input", module)
))
.add("Email", () => (
<View className="w-full px-4">
<FormInput type="email" />
<TextInput
type="email"
/>
</View>
))
.add("Password", () => (
<View className="w-full px-4">
<FormInput type="password" />
<TextInput
type="password"
/>
</View>
));
File renamed without changes.
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"strict": true,
"target": "ES6"
},
"include": ["src/**/*.ts", "src/**/*.tsx", "app.d.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx", "app.d.ts", "src/components/index.ts"],
"exclude": [
"storybook"
"src"
],
}
Loading