Skip to content

Commit

Permalink
chore: use Bob to build the library (#7)
Browse files Browse the repository at this point in the history
* chore: configure bob

* chore: improve tsconfig

* chore: publish package locally in CI
  • Loading branch information
sehyod authored Nov 22, 2023
1 parent 4943b47 commit 3b6b397
Show file tree
Hide file tree
Showing 18 changed files with 1,062 additions and 1,859 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,19 @@ jobs:
with:
node-version: 20
cache: "yarn"
cache-dependency-path: "${{ matrix.scheme }}/yarn.lock"
- name: Install node dependencies
cache-dependency-path: |
yarn.lock
${{ matrix.scheme }}/yarn.lock
- name: Install package node dependencies
run: yarn install --immutable
- name: Publish package locally
run: yarn dlx yalc publish
- name: Install local package
working-directory: ${{ matrix.scheme }}
run: yarn install --frozen-lockfile
run: yarn dlx yalc add rn-tvos-tab-bar
- name: Install example project node dependencies
working-directory: ${{ matrix.scheme }}
run: yarn install --no-immutable
- name: Install pods
working-directory: ${{ matrix.scheme }}/ios
run: ${{ matrix.pod_install_command }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ yarn-error.log*
.yarn/install-state.gz
.yarn/build-state.yml
.yarn/unplugged

# generated by bob
lib/
6 changes: 5 additions & 1 deletion FabricTvOSExample/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,8 @@ buck-out/
.yarn/cache
.yarn/install-state.gz
.yarn/build-state.yml
.yarn/unplugged
.yarn/unplugged

#yalc
.yalc
yalc.lock
893 changes: 0 additions & 893 deletions FabricTvOSExample/.yarn/releases/yarn-4.0.2.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion FabricTvOSExample/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {Button, StyleSheet, Text, View} from 'react-native';
import {TabBar} from 'rn-tvos-tab-bar/components/TabBar';
import {TabBar} from 'rn-tvos-tab-bar';

function App(): JSX.Element {
const currentIndex = React.useRef(1);
Expand Down
2 changes: 1 addition & 1 deletion FabricTvOSExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"expo": "^49.0.18",
"react": "18.2.0",
"react-native": "npm:react-native-tvos@^0.72.6-0",
"rn-tvos-tab-bar": "portal:../"
"rn-tvos-tab-bar": "file:.yalc/rn-tvos-tab-bar"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
11 changes: 6 additions & 5 deletions FabricTvOSExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3353,7 +3353,7 @@ __metadata:
react: "npm:18.2.0"
react-native: "npm:react-native-tvos@^0.72.6-0"
react-test-renderer: "npm:18.2.0"
rn-tvos-tab-bar: "portal:../"
rn-tvos-tab-bar: "file:.yalc/rn-tvos-tab-bar"
typescript: "npm:4.8.4"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -10234,14 +10234,15 @@ __metadata:
languageName: node
linkType: hard

"rn-tvos-tab-bar@portal:../::locator=FabricTvOSExample%40workspace%3A.":
version: 0.0.0-use.local
resolution: "rn-tvos-tab-bar@portal:../::locator=FabricTvOSExample%40workspace%3A."
"rn-tvos-tab-bar@file:.yalc/rn-tvos-tab-bar::locator=FabricTvOSExample%40workspace%3A.":
version: 0.1.0
resolution: "rn-tvos-tab-bar@file:.yalc/rn-tvos-tab-bar#.yalc/rn-tvos-tab-bar::hash=d1cc42&locator=FabricTvOSExample%40workspace%3A."
peerDependencies:
react: "*"
react-native: "*"
checksum: d5c871cb78d1978a03c11e3ff97d21a9773530e3939600955d9b2d4cab186499521aca5c89ae3f747db52553e002df67014e0a9cf42b58dad72de38648be8b21
languageName: node
linkType: soft
linkType: hard

"run-parallel@npm:^1.1.9":
version: 1.2.0
Expand Down
6 changes: 5 additions & 1 deletion TvOSExample/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,8 @@ buck-out/
.yarn/cache
.yarn/install-state.gz
.yarn/build-state.yml
.yarn/unplugged
.yarn/unplugged

#yalc
.yalc
yalc.lock
893 changes: 0 additions & 893 deletions TvOSExample/.yarn/releases/yarn-4.0.2.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion TvOSExample/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {Button, StyleSheet, Text, View} from 'react-native';
import {TabBar} from 'rn-tvos-tab-bar/components/TabBar';
import {TabBar} from 'rn-tvos-tab-bar';

function App(): JSX.Element {
const currentIndex = React.useRef(1);
Expand Down
2 changes: 1 addition & 1 deletion TvOSExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"expo": "^49.0.18",
"react": "18.2.0",
"react-native": "npm:react-native-tvos@^0.72.6-0",
"rn-tvos-tab-bar": "portal:../"
"rn-tvos-tab-bar": "file:.yalc/rn-tvos-tab-bar"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down
11 changes: 6 additions & 5 deletions TvOSExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3353,7 +3353,7 @@ __metadata:
react: "npm:18.2.0"
react-native: "npm:react-native-tvos@^0.72.6-0"
react-test-renderer: "npm:18.2.0"
rn-tvos-tab-bar: "portal:../"
rn-tvos-tab-bar: "file:.yalc/rn-tvos-tab-bar"
typescript: "npm:4.8.4"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -10234,14 +10234,15 @@ __metadata:
languageName: node
linkType: hard

"rn-tvos-tab-bar@portal:../::locator=TvOSExample%40workspace%3A.":
version: 0.0.0-use.local
resolution: "rn-tvos-tab-bar@portal:../::locator=TvOSExample%40workspace%3A."
"rn-tvos-tab-bar@file:.yalc/rn-tvos-tab-bar::locator=TvOSExample%40workspace%3A.":
version: 0.1.0
resolution: "rn-tvos-tab-bar@file:.yalc/rn-tvos-tab-bar#.yalc/rn-tvos-tab-bar::hash=d1cc42&locator=TvOSExample%40workspace%3A."
peerDependencies:
react: "*"
react-native: "*"
checksum: d5c871cb78d1978a03c11e3ff97d21a9773530e3939600955d9b2d4cab186499521aca5c89ae3f747db52553e002df67014e0a9cf42b58dad72de38648be8b21
languageName: node
linkType: soft
linkType: hard

"run-parallel@npm:^1.1.9":
version: 1.2.0
Expand Down
43 changes: 34 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
"name": "rn-tvos-tab-bar",
"version": "0.1.0",
"description": "Native Component for UITabBar on tvOS",
"react-native": "js/index",
"source": "js/index",
"react-native": "src/index.tsx",
"source": "src/index.tsx",
"files": [
"src",
"lib",
"!**/__tests__",
"!**/__fixtures__",
"!**/__mocks__",
"js",
"ios",
"rn-tvos-tab-bar.podspec",
"!ios/build",
"!**/__tests__",
"!**/__fixtures__",
"!**/__mocks__"
"!ios/build"
],
"keywords": [
"react-native",
Expand Down Expand Up @@ -40,6 +42,7 @@
"prettier": "^3.1.0",
"react": "^18.2.0",
"react-native": "npm:react-native-tvos@0.72.6-1",
"react-native-builder-bob": "^0.23.1",
"typescript": "^5.3.2"
},
"peerDependencies": {
Expand All @@ -52,9 +55,31 @@
"jsSrcsDir": "js"
},
"scripts": {
"format:js": "prettier --write --list-different './{js,components}/**/*.{js,ts,tsx}'",
"format:js": "prettier --write --list-different './{js,src}/**/*.{js,ts,tsx}'",
"format:ios": "find ios/ -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' -o -iname '*.mm' | xargs clang-format -i",
"format": "yarn format:js && yarn format:ios",
"lint": "eslint --max-warnings=0 --ext '.js,.ts,.tsx' --fix js components && prettier --max-warnings=0 --check './{js,components}/**/*.{js,ts,tsx}'"
}
"lint": "eslint --max-warnings=0 --ext '.js,.ts,.tsx' --fix js src && prettier --check './{js,src}/**/*.{js,ts,tsx}'",
"prepare": "bob build"
},
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
"types": "lib/typescript/src/index.d.ts",
"react-native-builder-bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
[
"typescript",
{
"project": "tsconfig.build.json"
}
]
]
},
"eslintIgnore": [
"node_modules/",
"lib/"
]
}
File renamed without changes.
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { TabBar } from "./TabBar";
4 changes: 4 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig",
"exclude": ["FabricTvOSExample", "TvOSExample"]
}
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
{
"compilerOptions": {
"paths": {
"rn-tvos-tab-bar": ["./src"],
},
"jsx": "react",
"lib": ["esnext"],
"module": "esnext",
"moduleResolution": "node",
"skipLibCheck": true,
"target": "esnext"
},
"include": ["components/**/*.ts", "components/**/*.tsx", "js/**/*.ts", "js/**/*.tsx"]
"include": ["src/**/*.ts", "src/**/*.tsx", "js/**/*.ts", "js/**/*.tsx"]
}
Loading

0 comments on commit 3b6b397

Please sign in to comment.