diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..18045d4 --- /dev/null +++ b/.github/workflows/publish.yml @@ -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 }} diff --git a/README.md b/README.md index 3e4dec4..0bd6816 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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'); }); @@ -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<{}> { @@ -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 () => { diff --git a/package.json b/package.json index a537132..b8dd5ac 100644 --- a/package.json +++ b/package.json @@ -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 ."