Skip to content

Publish to NPM #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 13, 2022
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
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish to NPM
on:
release:
types: [published]

jobs:
publish:
environment: deploy
runs-on: ubuntu-latest

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

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 14
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: Yarn Install
run: yarn install --network-concurrency 1

- name: Publish (NPM)
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,15 @@ Need advanced task functionality like dedicated worker threads or OS services? E
## Installation

```bash
$ npm install --save react-native-queue
$ npm install --save @sourcetoad/react-native-queue
```

Or

```bash
$ yarn add react-native-queue
$ yarn add @sourcetoad/react-native-queue
```

Then, because this package has a depedency on [Realm](https://github.com/realm/realm-js) you will need to link this native package by running:

```bash
$ react-native link realm
```

Linking realm **should only be done once**, reinstalling node_modules with npm or yarn does not require running the above command again.

To troubleshoot linking, refer to [the realm installation instructions](https://realm.io/docs/javascript/latest/#getting-started).

## Basic Usage

React Native Queue is a standard job/task queue built specifically for react native applications. If you have a long-running task, or a large number of tasks, consider turning that task into a job(s) and throwing it/them onto the queue to be processed in the background instead of blocking your UI until task(s) complete.
Expand All @@ -84,7 +74,7 @@ Creating and processing jobs consists of:
4. Starting the queue (note this happens automatically on job creation, but sometimes the queue must be explicitly started such as in a OS background task or on app restart). Queue can be started with a lifespan in order to limit queue processing time.

```js
import queueFactory from 'react-native-queue';
import queueFactory from '@sourcetoad/react-native-queue';

// Of course this line needs to be in the context of an async function,
// otherwise use queueFactory.then((queue) => { console.log('add workers and jobs here'); });
Expand Down Expand Up @@ -249,7 +239,7 @@ import {
Button
} from 'react-native';

import queueFactory from 'react-native-queue';
import queueFactory from '@sourcetoad/react-native-queue';

export default class App extends Component<{}> {

Expand Down Expand Up @@ -420,7 +410,7 @@ import {
} from 'react-native';

import BackgroundTask from 'react-native-background-task'
import queueFactory from 'react-native-queue';
import queueFactory from '@sourcetoad/react-native-queue';

BackgroundTask.define(async () => {

Expand Down
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"name": "react-native-queue",
"version": "2.0.2",
"name": "@sourcetoad/react-native-queue",
"version": "2.0.3",
"description": "A React Native Job Queue",
"main": "index.js",
"files": [
"config",
"Models",
"index.js",
"!**/__tests__",
"!**/__fixtures__",
"!**/__mocks__",
"!**/.*"
],
"scripts": {
"test": "jest --coverage --detectOpenHandles --forceExit",
"lint": "eslint ."
Expand Down