Skip to content

Commit

Permalink
feat: add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
macoley committed Apr 10, 2022
1 parent 0066332 commit 6f5debb
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- name: Prepare
run: |
npm install
- name: Test
run: |
npm run test
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Prepare
run: |
npm install
- name: Test
run: |
npm run test
- name: Codecov
uses: codecov/[email protected]
with:
directory: coverage

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2 changes: 2 additions & 0 deletions src/common.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from 'react'

/* istanbul ignore next */
export const isDev = process.env.NODE_ENV !== 'production'

const canUseDOM = (): boolean =>
typeof window !== 'undefined' &&
!!(window.document && window.document.createElement)

/* istanbul ignore next */
export const useIsomorphicLayoutEffect: typeof React.useEffect = canUseDOM()
? React.useLayoutEffect
: React.useEffect
16 changes: 0 additions & 16 deletions src/compare.ts

This file was deleted.

1 change: 1 addition & 0 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const createProvider = <Value>(
)
}

/* istanbul ignore next */
if (isDev) {
Provider.displayName = 'BitAboutEvent.Provider'
}
Expand Down
1 change: 1 addition & 0 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type EventDispatcher = React.Dispatch<React.SetStateAction<EventState>>

const EVENT_STATE_NULL: EventState = { type: '', payload: {} }
const EVENT_DISPATCHED_NULL: EventDispatcher = () => {
/* istanbul ignore next */
if (isDev) {
console.warn('Tried to dispatch event without Provider')
}
Expand Down

0 comments on commit 6f5debb

Please sign in to comment.