Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# From the .gitignore
coverage
dist
dist-cjs
node_modules
*.log

# Currently many config files are in commonjs
*rc.js
*.cjs
9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { buildEslintConfig } = require("@snowcoders/renovate-config");

module.exports = {
...buildEslintConfig({
esm: true,
prettier: true,
typescript: true,
}),
};
79 changes: 57 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,70 @@
# This is a basic workflow to help you get started with Actions
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: CI
name: Node.js CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
back-compat-react-17:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install
run: |
npm ci --ignore-scripts
npm i -D -E @testing-library/react@12 @types/react@17

- name: Build
run: npm run build --if-present

- name: Test
run: npm test

build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
strategy:
matrix:
node-version: [16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Setup Node.js environment
uses: actions/setup-node@v3.6.0

- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install
run: npm ci
run: npm ci --ignore-scripts

- name: Build
run: npm run build --if-present

- name: Test
run: npm run test -- -w 100%
run: npm test

- name: Publish to coveralls.io
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: NPM Publish

on:
push:
branches: ["main"]

jobs:
publish:
runs-on: ubuntu-latest

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use Node.js lts
uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: "https://registry.npmjs.org"

- name: Git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"

- name: Install
run: npm ci --ignore-scripts

- name: Build
run: npm run build --if-present

- name: Test
run: npm test

- name: Publish to coveralls.io
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: NPM config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN

- name: Publish
run: npx --no release-it -- --ci
continue-on-error: true
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
*.log
# Locally generated files
.DS_Store
.rpt2_cache
coverage
dist
node_modules
dist-cjs
node_modules
*.log
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run husky:commit-msg
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run husky:pre-commit
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run husky:pre-push
3 changes: 0 additions & 3 deletions .huskyrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const configs = require("@snowcoders/renovate-config");

module.exports = configs.lintStaged;
3 changes: 0 additions & 3 deletions .lintstagedrc.js

This file was deleted.

17 changes: 9 additions & 8 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.*
coverage
src
renovate.json
tsconfig.json
tsconfig.prod.json
jest.config.js
webpack.config.js
# Use an allow list system so we don't accidentally publish something we don't mean to
**

!/bin/**
!/dist-cjs/**
!/dist/**
!/LICENSE
!/CHANGELOG.md
!/README.md
3 changes: 3 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const configs = require("@snowcoders/renovate-config");

module.exports = configs.prettier;
3 changes: 0 additions & 3 deletions .prettierrc.js

This file was deleted.

3 changes: 3 additions & 0 deletions .release-it.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const configs = require("@snowcoders/renovate-config");

module.exports = configs.releaseIt;
6 changes: 6 additions & 0 deletions .sortierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# From the gitignore
coverage
dist
dist-cjs
node_modules
*.log
2 changes: 1 addition & 1 deletion .eslintrc.js → .sortierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const configs = require("@snowcoders/renovate-config");

module.exports = configs.eslint;
module.exports = configs.sortier;
3 changes: 0 additions & 3 deletions .sortierrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"name": "Debug Relative Jest Tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest",
"request": "launch",
"runtimeArgs": ["--experimental-vm-modules"],
"sourceMaps": true,
"type": "node"
}
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "./node_modules/typescript/lib"
}
2 changes: 1 addition & 1 deletion changelog.md → CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.1.1] - 2022-10-13

- Fixed peer dependencies to include everything greater than 16
- Widened React peer dependencies to include everything greater than 16

## [1.1.0] - 2021-05-24

Expand Down
22 changes: 18 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Copyright 2021 Snowcoders
MIT License

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:
Copyright (c) 2022 Snowcoders

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
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 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.
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.
7 changes: 5 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const configs = require("@snowcoders/renovate-config");
import { jest } from "@snowcoders/renovate-config";

module.exports = configs.jest;
export default {
...jest,
testEnvironment: "jsdom",
};
Loading