Skip to content

Commit 2ec9d90

Browse files
committed
Add Makefile and update dependencies
1 parent 6b336cb commit 2ec9d90

File tree

13 files changed

+1896
-1501
lines changed

13 files changed

+1896
-1501
lines changed

.github/pull_request_template.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## 📖 Description
2+
3+
<!-- What does this pull request bring to this project? Why do we need it? -->
4+
5+
## ⚠️ Problem
6+
7+
<!-- Description of what is the problem that we're trying to solve -->
8+
9+
## 🤓 Solution
10+
11+
<!-- The most exhaustive description of what is the solution and WHY it's the best solution -->
12+
13+
## 📝 Notes
14+
15+
<!-- Any additional notes that might be helpful for reviewers? -->
16+
17+
## 📓 References
18+
19+
<!-- Does this pull request fix any reported issue (eg. `Fixes #34`) in this repository? -->
20+
21+
## 🦀 Dispatch
22+
23+
- `#dispatch/react`
24+
- `#dispatch/react-native`

.github/workflows/ci.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@ jobs:
2020
node-version: 16.14
2121
cache: 'yarn'
2222
- name: Install Dependencies
23-
run: yarn install --frozen-lockfile
24-
- name: Run eslint
25-
run: yarn run lint
26-
- name: Run Prettier
27-
run: yarn run prettier-check
28-
- name: Run type check
29-
run: yarn run type-check
23+
run: make ci-dependencies
24+
- name: Run checks
25+
run: make check-all
3026
- name: Run Tests
31-
run: yarn run test
27+
run: make ci-test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
lib
22
coverage
33
node_modules
4+
example/.expo

CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributing
2+
3+
When it comes to open source, there are different ways you can contribute, all of which are valuable. Here’s few guidelines that should help you as you prepare your contribution.
4+
5+
## Initial steps
6+
7+
Before you start working on a contribution, create an issue describing what you want to build. It’s possible someone else is already working on something similar, or perhaps there is a reason that feature isn’t implemented. The maintainers will point you in the right direction.
8+
9+
<!-- ## Submitting a Pull Request
10+
11+
- Fork the repo
12+
- Clone your forked repository: `git clone [email protected]:{your_username}/react-native-killswitch.git`
13+
- Enter the directory: `cd react-native-killswitch`
14+
- Create a new branch off the `main` branch: `git checkout -b your-feature-name`
15+
- Implement your contributions (see the Development section for more information)
16+
- Push your branch to the repo: `git push origin your-feature-name`
17+
- Go to https://github.com/mirego/react-native-killswitch/compare and select the branch you just pushed in the "compare:" dropdown
18+
- Submit the PR. The maintainers will follow up. -->
19+
20+
## Development
21+
22+
The following steps will get you setup to contribute changes to this repo:
23+
24+
1. Fork this repo.
25+
26+
2. Clone your forked repo: `git clone [email protected]:{your_username}/react-native-killswitch.git`
27+
28+
3. Run `make dependencies` to install dependencies for the library and the sample app.
29+
30+
4. Start playing with the code! You can do some experimentation with the sample app provided in the `example` folder or start implementing a feature right away.
31+
32+
### Commands
33+
34+
**`make test`**
35+
36+
- Runs all Jest tests
37+
38+
**`make check-all`**
39+
40+
- Runs linting, format-checking, type-checking
41+
42+
**`make format`**
43+
44+
- Runs formatting on the codebase
45+
46+
**`make start-example`**
47+
48+
- Runs the sample app with Expo
49+
50+
### Tests
51+
52+
react-native-killswitch uses Jest for testing. After implementing your contribution, write tests for it. Just create a new file under `src/__tests__` or add additional tests to the appropriate existing file.
53+
54+
Before submitting your PR, run `make test` to make sure there are no (unintended) breaking changes.
55+
56+
### Documentation
57+
58+
The react-native-killswitch documentation lives in the README.md. Be sure to document any API changes you implement.
59+
60+
## License
61+
62+
By contributing your code to the react-native-killswitch GitHub repository, you agree to license your contribution under the BSD 3-Clause license.

Makefile

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Build configuration
2+
# -------------------
3+
4+
APP_NAME = `grep -m1 name package.json | awk -F: '{ print $$2 }' | sed 's/[ ",]//g'`
5+
APP_VERSION = `grep -m1 version package.json | awk -F: '{ print $$2 }' | sed 's/[ ",]//g'`
6+
GIT_REVISION = `git rev-parse HEAD`
7+
8+
# Linter and formatter configuration
9+
# ----------------------------------
10+
11+
PRETTIER_FILES_PATTERN = '{src,example}/**/*.{js,ts,tsx,svg,json}' '**/*.md'
12+
SCRIPTS_PATTERN = '{src,example}/**/*.{js,ts,tsx}'
13+
14+
# Introspection targets
15+
# ---------------------
16+
17+
.PHONY: help
18+
help: header targets
19+
20+
.PHONY: header
21+
header:
22+
@echo "\033[34mEnvironment\033[0m"
23+
@echo "\033[34m---------------------------------------------------------------\033[0m"
24+
@printf "\033[33m%-23s\033[0m" "APP_NAME"
25+
@printf "\033[35m%s\033[0m" $(APP_NAME)
26+
@echo ""
27+
@printf "\033[33m%-23s\033[0m" "APP_VERSION"
28+
@printf "\033[35m%s\033[0m" $(APP_VERSION)
29+
@echo ""
30+
@printf "\033[33m%-23s\033[0m" "GIT_REVISION"
31+
@printf "\033[35m%s\033[0m" $(GIT_REVISION)
32+
@echo "\n"
33+
34+
.PHONY: targets
35+
targets:
36+
@echo "\033[34mTargets\033[0m"
37+
@echo "\033[34m---------------------------------------------------------------\033[0m"
38+
@perl -nle'print $& if m{^[a-zA-Z_-\d]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}'
39+
40+
# Development targets
41+
# -------------------
42+
43+
.PHONY: dependencies
44+
dependencies: ## Install dependencies required by the application
45+
- yarn install
46+
- yarn --cwd example install
47+
48+
.PHONY: ci-dependencies
49+
ci-dependencies: ## Install dependencies required by the application in CI
50+
yarn install --frozen-lockfile
51+
52+
.PHONY: ci-test
53+
ci-test: ## Run the test suite in CI
54+
CI=true yarn test --forceExit --detectOpenHandles
55+
56+
.PHONY: test
57+
test: ## Run the test suite
58+
yarn test --forceExit --detectOpenHandles
59+
60+
.PHONY: start-example
61+
start-example: ## Run the test suite
62+
yarn --cwd example start
63+
64+
# Check, lint and format targets
65+
# ------------------------------
66+
67+
.PHONY: check
68+
check: check-format lint
69+
70+
.PHONY: check-all
71+
check-all: check-format lint check-types
72+
73+
.PHONY: check-format
74+
check-format:
75+
yarn prettier --check $(PRETTIER_FILES_PATTERN)
76+
77+
.PHONY: check-types
78+
check-types:
79+
yarn tsc --noEmit
80+
81+
.PHONY: format
82+
format: ## Format project files
83+
- yarn prettier --write $(PRETTIER_FILES_PATTERN)
84+
- yarn eslint --fix $(SCRIPTS_PATTERN)
85+
86+
.PHONY: lint
87+
lint: ## Lint project files
88+
yarn eslint --max-warnings 0 $(SCRIPTS_PATTERN)
89+
90+
# Release
91+
# ------------------------------
92+
.PHONY: version
93+
version:
94+
- yarn version
95+
96+
.PHONY: release
97+
release:
98+
- yarn run release-it

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
<p>
55
<strong>React Native Killswitch</strong> is a library built by <a href="https://www.mirego.com">Mirego</a> that allows mobile developers to apply<br /> runtime version-specific behaviors to their React Native application.
66
</p>
7-
8-
<a href="https://github.com/mirego/react-native-killswitch/actions/workflows/ci.yaml"><img src="https://github.com/mirego/react-native-killswitch/actions/workflows/ci.yaml/badge.svg?branch=main" /></a>
9-
<a href="https://github.com/mirego/react-native-killswitch/tags"><img src="https://img.shields.io/npm/v/react-native-killswitch.svg"></a><br /><br />
7+
8+
<a href="https://github.com/mirego/react-native-killswitch/actions/workflows/ci.yaml"><img src="https://github.com/mirego/react-native-killswitch/actions/workflows/ci.yaml/badge.svg?branch=main" /></a>
9+
<a href="https://github.com/mirego/react-native-killswitch/tags"><img src="https://img.shields.io/npm/v/react-native-killswitch.svg"></a><br /><br />
10+
1011
</div>
1112

1213
## What is Killswitch?

example/.expo/README.md

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

example/.expo/devices.json

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

example/app.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
"updates": {
1515
"fallbackToCacheTimeout": 0
1616
},
17-
"assetBundlePatterns": [
18-
"**/*"
19-
],
17+
"assetBundlePatterns": ["**/*"],
2018
"ios": {
2119
"supportsTablet": true
2220
},

example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
"expo": "~47.0.8",
1313
"expo-status-bar": "~1.4.2",
1414
"react": "18.1.0",
15-
"react-native": "0.70.5"
15+
"react-native": "0.70.8"
1616
},
1717
"devDependencies": {
1818
"@babel/core": "^7.12.9",
1919
"babel-plugin-module-resolver": "^4.1.0"
2020
},
2121
"private": true
22-
}
22+
}

0 commit comments

Comments
 (0)