Skip to content

Commit 56c0e91

Browse files
committed
refactor: improvements
1 parent 58ba750 commit 56c0e91

File tree

129 files changed

+126
-137
lines changed

Some content is hidden

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

129 files changed

+126
-137
lines changed

.circleci/config.yml

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,65 +8,79 @@ 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: .
32-
lint:
33-
executor: default
34-
steps:
35-
- attach_workspace:
36-
at: ~/project
37-
- run:
38-
name: Lint
39-
command: |
40-
yarn lint
41-
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
37+
38+
lint-and-typecheck:
39+
executor: default
40+
steps:
41+
- attach_project
42+
- run:
43+
name: Lint files
44+
command: yarn lint
45+
- run:
46+
name: Typecheck files
47+
command: yarn typescript
48+
49+
unit-tests:
50+
executor: default
51+
steps:
52+
- attach_project
53+
- run:
54+
name: Run unit tests
55+
command: yarn test --maxWorkers=2 --coverage
56+
- run:
57+
name: Upload test coverage
58+
command: yarn codecov
59+
- store_artifacts:
60+
path: coverage
61+
destination: coverage
62+
63+
build-packages:
64+
executor: default
65+
steps:
66+
- attach_project
67+
- run:
68+
name: Build packages in the monorepo
69+
command: yarn lerna run prepare
70+
- run:
71+
name: Verify built type definitions are correct
72+
command: yarn typescript
5973

6074
workflows:
6175
build-and-test:
6276
jobs:
6377
- install-dependencies
64-
- lint:
78+
- lint-and-typecheck:
6579
requires:
6680
- install-dependencies
67-
- typescript:
81+
- unit-tests:
6882
requires:
6983
- install-dependencies
70-
- build-package:
84+
- build-packages:
7185
requires:
7286
- install-dependencies

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
lib/
3+
templates/

.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/

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
"node": ">= 10.0.0"
1313
},
1414
"scripts": {
15-
"lint": "eslint \"packages/**/*.{js,ts,tsx}\"",
16-
"typescript": "lerna run typescript",
17-
"build": "lerna run build"
15+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
16+
"typescript": "tsc --noEmit",
17+
"watch": "concurrently 'yarn typescript --watch' 'lerna run --parallel prepare -- --watch'"
1818
},
1919
"dependencies": {
2020
"@babel/core": "^7.12.10",
@@ -32,6 +32,7 @@
3232
"@commitlint/config-conventional": "^11.0.0",
3333
"@release-it/conventional-changelog": "^2.0.0",
3434
"commitlint": "^11.0.0",
35+
"concurrently": "^5.3.0",
3536
"eslint": "^7.15.0",
3637
"eslint-config-satya164": "^3.1.8",
3738
"husky": "^4.3.6",
@@ -61,9 +62,8 @@
6162
"eslintIgnore": [
6263
"node_modules/",
6364
"coverage/",
64-
"packages/cli/lib/",
65-
"packages/builder/lib/",
66-
"packages/builder/templates/"
65+
"packages/*/lib/",
66+
"packages/create-react-native-library/templates/"
6767
],
6868
"prettier": {
6969
"singleQuote": true,

packages/builder/tsconfig.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/cli/tsconfig.json

Lines changed: 0 additions & 15 deletions
This file was deleted.
File renamed without changes.
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: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
{
2-
"name": "react-native-builder-bob",
2+
"name": "create-react-native-library",
33
"version": "0.17.1",
44
"description": "CLI to build JavaScript files for React Native libraries",
55
"repository": "[email protected]:callstack/react-native-builder-bob.git",
66
"homepage": "https://github.com/callstack/react-native-builder-bob/blob/main/README.md",
77
"author": "Satyajit Sahoo <[email protected]>",
88
"license": "MIT",
99
"main": "lib/index.js",
10+
"bin": {
11+
"create-react-native-library": "bin/create-react-native-library"
12+
},
1013
"files": [
1114
"lib",
1215
"templates"
@@ -19,12 +22,7 @@
1922
"registry": "https://registry.npmjs.org/"
2023
},
2124
"scripts": {
22-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
23-
"typescript": "tsc --noEmit",
24-
"build": "babel --root-mode upward --extensions .ts,.tsx src --out-dir lib --ignore '**/__tests__/**' --source-maps --delete-dir-on-start",
25-
"watch": "concurrently 'yarn typescript --watch' 'yarn build --watch'",
26-
"prepare": "yarn build",
27-
"release": "release-it"
25+
"prepare": "babel --extensions .ts,.tsx src --out-dir lib --ignore '**/__tests__/**' --source-maps --delete-dir-on-start"
2826
},
2927
"dependencies": {
3028
"chalk": "^4.1.0",
@@ -43,33 +41,13 @@
4341
"devDependencies": {
4442
"@babel/cli": "^7.12.10",
4543
"@commitlint/config-conventional": "^11.0.0",
46-
"@release-it/conventional-changelog": "^2.0.0",
4744
"@types/chalk": "^2.2.0",
4845
"@types/cross-spawn": "^6.0.2",
4946
"@types/dedent": "^0.7.0",
5047
"@types/ejs": "^3.0.5",
5148
"@types/fs-extra": "^9.0.5",
5249
"@types/prompts": "^2.0.9",
5350
"@types/validate-npm-package-name": "^3.0.2",
54-
"@types/yargs": "^15.0.12",
55-
"concurrently": "^5.3.0",
56-
"release-it": "^14.2.2"
57-
},
58-
"release-it": {
59-
"git": {
60-
"commitMessage": "chore: release ${version}",
61-
"tagName": "v${version}"
62-
},
63-
"npm": {
64-
"publish": true
65-
},
66-
"github": {
67-
"release": true
68-
},
69-
"plugins": {
70-
"@release-it/conventional-changelog": {
71-
"preset": "angular"
72-
}
73-
}
51+
"@types/yargs": "^15.0.12"
7452
}
7553
}

0 commit comments

Comments
 (0)