Skip to content

Commit dc56fc9

Browse files
Krzysztofsatya164
Krzysztof
andauthored
chore: migrate to a monorepo (#130)
Co-authored-by: Satyajit Sahoo <[email protected]>
1 parent dd7fbd0 commit dc56fc9

File tree

134 files changed

+2857
-997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+2857
-997
lines changed

.circleci/config.yml

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,54 +8,59 @@ executors:
88
environment:
99
YARN_CACHE_FOLDER: "~/.cache/yarn"
1010

11+
commands:
12+
attach_project:
13+
steps:
14+
- attach_workspace:
15+
at: ~/project
16+
1117
jobs:
1218
install-dependencies:
1319
executor: default
1420
steps:
1521
- checkout
16-
- attach_workspace:
17-
at: ~/project
22+
- attach_project
1823
- restore_cache:
1924
keys:
20-
- yarn-{{ checksum "package.json" }}
21-
- yarn-
25+
- yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
26+
- yarn-packages-v1-{{ .Branch }}-
27+
- yarn-packages-v1-
2228
- run:
23-
name: Install dependencies
24-
command: |
25-
yarn install --frozen-lockfile
29+
name: Install project dependencies
30+
command: yarn install --frozen-lockfile
2631
- save_cache:
27-
key: yarn-{{ checksum "package.json" }}
32+
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
2833
paths: ~/.cache/yarn
2934
- persist_to_workspace:
3035
root: .
3136
paths: .
37+
3238
lint:
33-
executor: default
34-
steps:
35-
- attach_workspace:
36-
at: ~/project
37-
- run:
38-
name: Lint
39-
command: |
40-
yarn lint
39+
executor: default
40+
steps:
41+
- attach_project
42+
- run:
43+
name: Lint files
44+
command: yarn lint
45+
4146
typescript:
42-
executor: default
43-
steps:
44-
- attach_workspace:
45-
at: ~/project
46-
- run:
47-
name: Typecheck
48-
command: |
49-
yarn typescript
50-
build-package:
51-
executor: default
52-
steps:
53-
- attach_workspace:
54-
at: ~/project
55-
- run:
56-
name: Compile
57-
command: |
58-
yarn prepare
47+
executor: default
48+
steps:
49+
- attach_project
50+
- run:
51+
name: Typecheck files
52+
command: yarn typescript
53+
54+
build-packages:
55+
executor: default
56+
steps:
57+
- attach_project
58+
- run:
59+
name: Build packages in the monorepo
60+
command: yarn lerna run prepare
61+
- run:
62+
name: Verify built type definitions are correct
63+
command: yarn typescript
5964

6065
workflows:
6166
build-and-test:
@@ -67,6 +72,6 @@ workflows:
6772
- typescript:
6873
requires:
6974
- install-dependencies
70-
- build-package:
75+
- build-packages:
7176
requires:
7277
- install-dependencies

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@ typings/
7575

7676
# generated files
7777
lib/
78+
typescript/

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# react-native-builder-bob
22

3-
[![Version][version-badge]][package]
3+
[![create-react-native-library][create-react-native-library-version-badge]][package]
4+
[![react-native-builder-bob][react-native-builder-bob-version-badge]][package]
45
[![Build Status][build-badge]][build]
56
[![MIT License][license-badge]][license]
67

@@ -40,7 +41,7 @@ Bob can build code for following targets:
4041
To create new project with Bob, run the following:
4142

4243
```sh
43-
npx react-native-builder-bob create react-native-awesome-module
44+
npx create-react-native-library react-native-awesome-module
4445
```
4546

4647
This will ask you few questions about your project and generate a new project in a folder named `react-native-awesome-module`.
@@ -234,10 +235,10 @@ yarn watch
234235
To test the CLI locally, you can point to the `bin/bob` executable:
235236

236237
```sh
237-
../bob/bin/bob create test-project
238+
../bob/packages/create-react-native-library/bin/create-react-native-library
238239
```
239240

240-
Before sending a pull rquest, make sure your code passes TypeScript and ESLint. Run the following to verify:
241+
Before sending a pull request, make sure your code passes TypeScript and ESLint. Run the following to verify:
241242

242243
```sh
243244
yarn typescript
@@ -263,7 +264,8 @@ MIT
263264

264265
<!-- badges -->
265266

266-
[version-badge]: https://img.shields.io/npm/v/react-native-builder-bob.svg?style=flat-square
267+
[create-react-native-library-version-badge]: https://img.shields.io/npm/v/create-react-native-library?label=create-react-native-library&style=flat-square
268+
[react-native-builder-bob-version-badge]: https://img.shields.io/npm/v/react-native-builder-bob?label=react-native-builder-bob&style=flat-square
267269
[package]: https://www.npmjs.com/package/react-native-builder-bob
268270
[build-badge]: https://img.shields.io/circleci/project/github/callstack/react-native-builder-bob/main.svg?style=flat-square
269271
[build]: https://circleci.com/gh/callstack/react-native-builder-bob

lerna.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"packages": [
3+
"packages/*"
4+
],
5+
"version": "independent",
6+
"npmClient": "yarn",
7+
"useWorkspaces": true
8+
}

package.json

Lines changed: 10 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,31 @@
11
{
2-
"name": "react-native-builder-bob",
3-
"version": "0.17.1",
4-
"description": "CLI to build JavaScript files for React Native libraries",
5-
"repository": "[email protected]:callstack/react-native-builder-bob.git",
6-
"homepage": "https://github.com/callstack/react-native-builder-bob/blob/main/README.md",
2+
"private": true,
3+
"workspaces": [
4+
"packages/*"
5+
],
76
"author": "Satyajit Sahoo <[email protected]>",
87
"license": "MIT",
9-
"main": "src/index.js",
10-
"bin": {
11-
"bob": "bin/bob"
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/react-navigation/react-navigation.git"
1211
},
13-
"files": [
14-
"bin",
15-
"lib",
16-
"templates"
17-
],
1812
"engines": {
1913
"node": ">= 10.0.0"
2014
},
21-
"publishConfig": {
22-
"access": "public",
23-
"registry": "https://registry.npmjs.org/"
24-
},
2515
"scripts": {
2616
"lint": "eslint \"**/*.{js,ts,tsx}\"",
2717
"typescript": "tsc --noEmit",
28-
"build": "babel --extensions .ts,.tsx src --out-dir lib --ignore '**/__tests__/**' --source-maps --delete-dir-on-start",
29-
"watch": "concurrently 'yarn typescript --watch' 'yarn build --watch'",
30-
"prepare": "yarn build",
31-
"release": "release-it"
32-
},
33-
"dependencies": {
34-
"@babel/core": "^7.12.10",
35-
"@babel/plugin-proposal-class-properties": "^7.12.1",
36-
"@babel/preset-env": "^7.12.11",
37-
"@babel/preset-flow": "^7.12.1",
38-
"@babel/preset-react": "^7.12.10",
39-
"@babel/preset-typescript": "^7.12.7",
40-
"browserslist": "^4.16.0",
41-
"chalk": "^4.1.0",
42-
"cosmiconfig": "^7.0.0",
43-
"cross-spawn": "^7.0.3",
44-
"dedent": "^0.7.0",
45-
"del": "^6.0.0",
46-
"ejs": "^3.1.5",
47-
"fs-extra": "^9.0.1",
48-
"github-username": "^5.0.1",
49-
"glob": "^7.1.6",
50-
"is-git-dirty": "^2.0.1",
51-
"json5": "^2.1.3",
52-
"prompts": "^2.4.0",
53-
"validate-npm-package-name": "^3.0.0",
54-
"which": "^2.0.2",
55-
"yargs": "^16.2.0"
56-
},
57-
"optionalDependencies": {
58-
"jetifier": "^1.6.6"
18+
"watch": "concurrently 'yarn typescript --watch' 'lerna run --parallel prepare -- --watch'"
5919
},
6020
"devDependencies": {
61-
"@babel/cli": "^7.12.10",
6221
"@commitlint/config-conventional": "^11.0.0",
63-
"@release-it/conventional-changelog": "^2.0.0",
64-
"@types/babel__core": "^7.1.12",
65-
"@types/browserslist": "^4.8.0",
66-
"@types/chalk": "^2.2.0",
67-
"@types/cross-spawn": "^6.0.2",
68-
"@types/dedent": "^0.7.0",
69-
"@types/del": "^4.0.0",
70-
"@types/ejs": "^3.0.5",
71-
"@types/fs-extra": "^9.0.5",
72-
"@types/glob": "^7.1.3",
73-
"@types/json5": "^0.0.30",
74-
"@types/prompts": "^2.0.9",
75-
"@types/validate-npm-package-name": "^3.0.2",
76-
"@types/which": "^1.3.2",
77-
"@types/yargs": "^15.0.12",
7822
"commitlint": "^11.0.0",
7923
"concurrently": "^5.3.0",
8024
"eslint": "^7.15.0",
8125
"eslint-config-satya164": "^3.1.8",
8226
"husky": "^4.3.6",
27+
"lerna": "^3.22.1",
8328
"prettier": "^2.2.1",
84-
"release-it": "^14.2.2",
8529
"typescript": "^4.1.3"
8630
},
8731
"husky": {
@@ -95,25 +39,9 @@
9539
"@commitlint/config-conventional"
9640
]
9741
},
98-
"release-it": {
99-
"git": {
100-
"commitMessage": "chore: release ${version}",
101-
"tagName": "v${version}"
102-
},
103-
"npm": {
104-
"publish": true
105-
},
106-
"github": {
107-
"release": true
108-
},
109-
"plugins": {
110-
"@release-it/conventional-changelog": {
111-
"preset": "angular"
112-
}
113-
}
114-
},
11542
"eslintConfig": {
11643
"extends": "satya164",
44+
"root": true,
11745
"env": {
11846
"node": true
11947
}
File renamed without changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# create-react-native-library
2+
3+
CLI to scaffold React Native libraries.
4+
5+
Usage:
6+
7+
```sh
8+
npx create-react-native-library react-native-awesome-module
9+
```
10+
11+
See more details on the [GitHub repository](https://github.com/callstack/react-native-builder-bob).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
// eslint-disable-next-line import/no-commonjs
4+
require('../lib/index');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
node "%~dp0\create-react-native-library" %*
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"name": "create-react-native-library",
3+
"version": "0.17.1",
4+
"description": "CLI to scaffold React Native libraries",
5+
"keywords": [
6+
"react-native",
7+
"library",
8+
"module",
9+
"view",
10+
"component",
11+
"ios",
12+
"android",
13+
"web",
14+
"expo"
15+
],
16+
"license": "MIT",
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/callstack/react-native-builder-bob.git",
20+
"directory": "packages/create-react-native-library"
21+
},
22+
"bugs": {
23+
"url": "https://github.com/callstack/react-native-builder-bob/issues"
24+
},
25+
"homepage": "https://github.com/callstack/react-native-builder-bob/blob/main/README.md",
26+
"main": "lib/index.js",
27+
"bin": {
28+
"create-react-native-library": "bin/create-react-native-library"
29+
},
30+
"files": [
31+
"lib",
32+
"templates"
33+
],
34+
"engines": {
35+
"node": ">= 10.0.0"
36+
},
37+
"publishConfig": {
38+
"access": "public",
39+
"registry": "https://registry.npmjs.org/"
40+
},
41+
"scripts": {
42+
"prepare": "babel --extensions .ts,.tsx src --out-dir lib --ignore '**/__tests__/**' --source-maps --delete-dir-on-start"
43+
},
44+
"dependencies": {
45+
"chalk": "^4.1.0",
46+
"cross-spawn": "^7.0.3",
47+
"dedent": "^0.7.0",
48+
"ejs": "^3.1.5",
49+
"fs-extra": "^9.0.1",
50+
"github-username": "^5.0.1",
51+
"prompts": "^2.4.0",
52+
"validate-npm-package-name": "^3.0.0",
53+
"yargs": "^16.2.0"
54+
},
55+
"optionalDependencies": {
56+
"jetifier": "^1.6.6"
57+
},
58+
"devDependencies": {
59+
"@babel/cli": "^7.12.10",
60+
"@babel/preset-env": "^7.12.11",
61+
"@babel/preset-typescript": "^7.12.7",
62+
"@commitlint/config-conventional": "^11.0.0",
63+
"@types/chalk": "^2.2.0",
64+
"@types/cross-spawn": "^6.0.2",
65+
"@types/dedent": "^0.7.0",
66+
"@types/ejs": "^3.0.5",
67+
"@types/fs-extra": "^9.0.5",
68+
"@types/prompts": "^2.0.9",
69+
"@types/validate-npm-package-name": "^3.0.2",
70+
"@types/yargs": "^15.0.12"
71+
}
72+
}

0 commit comments

Comments
 (0)