-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(*): rewrite entire lib from scratch
The lib has been entirely rewritten in order to have the source code in TypeScript and leveraging the "tsdx" package for bundling, testing and linting. BREAKING CHANGE: As part of the rewrite, the global exports are gone. Please use CommonJS or ESM style imports as specified in the README. fixes #55 closes #57
- Loading branch information
Showing
53 changed files
with
17,978 additions
and
4,994 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"projectName": "react-if", | ||
"projectOwner": "romac", | ||
"repoType": "github", | ||
"repoHost": "https://github.com", | ||
"files": [ | ||
"README.md" | ||
], | ||
"imageSize": 100, | ||
"commit": false, | ||
"commitConvention": "angular", | ||
"contributors": [ | ||
], | ||
"contributorsPerLine": 7 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
extends: ['@favware/eslint-config-react-app', 'plugin:prettier/recommended'], | ||
overrides: [ | ||
{ | ||
files: ['./tsdx.config.js'], | ||
rules: { | ||
'@typescript-eslint/no-var-requires': 0 | ||
} | ||
} | ||
] | ||
}; |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/src/ @romac @favna |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Contributing | ||
|
||
To contribute to this repository, feel free to create a new fork of the repository and | ||
submit a pull request. We highly suggest [ESLint] to be installed | ||
in your text editor or IDE of your choice to ensure builds from GitHub Actions do not fail. | ||
|
||
1. Fork, clone, and select the **main** branch. | ||
2. Create a new branch in your fork. | ||
3. Make your changes. | ||
4. Ensure your linting and tests pass by running `yarn test && yarn lint` | ||
5. Commit your changes, and push them. | ||
6. Submit a Pull Request [here]! | ||
|
||
## Commands | ||
|
||
TSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`. | ||
|
||
The recommended workflow is to run TSDX in one terminal: | ||
|
||
```bash | ||
npm start # or yarn start | ||
``` | ||
|
||
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`. | ||
|
||
Then run the example inside another: | ||
|
||
```bash | ||
cd example | ||
npm i # or yarn to install dependencies | ||
npm start # or yarn start | ||
``` | ||
|
||
The default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases). | ||
|
||
To do a one-off build, use `npm run build` or `yarn build`. | ||
|
||
To run tests, use `npm test` or `yarn test`. | ||
|
||
[here]: https://github.com/romac/react-if/pulls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Continuous Delivery | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
Docgen: | ||
name: Docgen | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- name: Checkout Project | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js 14 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14 | ||
- name: Restore CI Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-14-${{ hashFiles('**/yarn.lock') }} | ||
- name: Install Dependencies | ||
run: yarn --ignore-scripts --frozen-lockfile | ||
- name: Build documentation | ||
run: yarn docs | ||
- name: Publish Docs | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
run: | | ||
echo -e "\n# Initialize some useful variables" | ||
REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | ||
BRANCH_OR_TAG=`awk -F/ '{print $2}' <<< $GITHUB_REF` | ||
CURRENT_BRANCH=`awk -F/ '{print $NF}' <<< $GITHUB_REF` | ||
if [ "$BRANCH_OR_TAG" == "heads" ]; then | ||
SOURCE_TYPE="branch" | ||
else | ||
SOURCE_TYPE="tag" | ||
fi | ||
echo -e "\n# Checkout the repo in the target branch" | ||
TARGET_BRANCH="gh-pages" | ||
git clone $REPO out -b $TARGET_BRANCH | ||
echo -e "\n# Remove any old files in the out folder" | ||
rm -rfv out/assets/* | ||
rm -rfv out/interfaces/* | ||
rm -rfv out/*.html | ||
echo -e "\n# Move the generated docs to the newly-checked-out repo, to be committed and pushed" | ||
rsync -vaI .all-contributorsrc out/ | ||
rsync -vaI LICENSE.md out/ | ||
rsync -vaI README.md out/ | ||
rsync -vaI docs/ out/ | ||
echo -e "\n# Commit and push" | ||
cd out | ||
git add --all . | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_EMAIL}" | ||
git commit -m "docs: api docs build for ${GITHUB_SHA}" || true | ||
git push origin $TARGET_BRANCH | ||
env: | ||
GITHUB_ACTOR: Favware-bot | ||
GITHUB_EMAIL: [email protected] | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
Linting: | ||
name: Linting | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- name: Checkout Project | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js 14 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14 | ||
- name: Restore CI Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-14-${{ hashFiles('**/yarn.lock') }} | ||
- name: Install Dependencies | ||
run: yarn --ignore-scripts --frozen-lockfile | ||
- name: Run ESLint | ||
uses: yarn lint | ||
|
||
Testing: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- name: Checkout Project | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js 14 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14 | ||
- name: Restore CI Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-14-${{ hashFiles('**/yarn.lock') }} | ||
- name: Install Dependencies | ||
run: yarn --frozen-lockfile | ||
- name: Run tests | ||
run: yarn test --ci --coverage --maxWorkers=2 | ||
|
||
Building: | ||
name: Compile source code | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, '[skip ci]')" | ||
steps: | ||
- name: Checkout Project | ||
uses: actions/checkout@v2 | ||
- name: Use Node.js 14 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14 | ||
- name: Restore CI Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-14-${{ hashFiles('**/yarn.lock') }} | ||
- name: Install Dependencies | ||
run: yarn --ignore-scripts --frozen-lockfile | ||
- name: Build Code | ||
run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: CI | ||
on: [push] | ||
jobs: | ||
build: | ||
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }} | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node: ['10.x', '12.x', '14.x'] | ||
os: [ubuntu-latest, windows-latest, macOS-latest] | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node ${{ matrix.node }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
|
||
- name: Install deps and build (with cache) | ||
uses: bahmutov/npm-install@v1 | ||
|
||
- name: Lint | ||
run: yarn lint | ||
|
||
- name: Test | ||
run: yarn test --ci --coverage --maxWorkers=2 | ||
|
||
- name: Build | ||
run: yarn build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: size | ||
on: [pull_request] | ||
jobs: | ||
size: | ||
runs-on: ubuntu-latest | ||
env: | ||
CI_JOB_NUMBER: 1 | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: andresz1/size-limit-action@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
node_modules/ | ||
*.log | ||
.DS_Store | ||
node_modules | ||
.cache | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "http://json.schemastore.org/prettierrc", | ||
"endOfLine": "lf", | ||
"printWidth": 140, | ||
"quoteProps": "as-needed", | ||
"semi": true, | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"trailingComma": "none", | ||
"useTabs": false, | ||
"arrowParens": "avoid" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# The MIT License (MIT) | ||
|
||
Copyright © `2014` `Romain Ruetschi` | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the “Software”), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
Oops, something went wrong.