Skip to content

Commit

Permalink
Merge pull request #22 from metricq/feat-github-packages
Browse files Browse the repository at this point in the history
GitHub npm packages
  • Loading branch information
kinnarr authored Jan 27, 2022
2 parents 60e8788 + e3b62d1 commit c9d490d
Show file tree
Hide file tree
Showing 13 changed files with 3,325 additions and 21 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish package to GitHub Packages
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
# Defaults to the user or organization that owns the workflow file
scope: '@metricq'
- run: npm publish history/
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm publish live/
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.github/
.idea/
dist/
webpack.config.js
*_example.html
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# metricq-js

## Install via npm/yarn

Add the following line to your `.npmrc` in the project root:

```
@metricq:registry=https://npm.pkg.github.com
```

After that install via

```bash
npm install @metricq/live
or
npm install @metricq/history
```

```bash
yarn add @metricq/live
or
yarn add @metricq/history
```

## Usage

```js
import MetricQHistory from "@metricq/history"
import MetricQLive from "@metricq/live"
```
File renamed without changes.
28 changes: 28 additions & 0 deletions history/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@metricq/history",
"version": "3.0.0",
"description": "MetricQ is a highly-scalable, distributed metric data processing framework based on RabbitMQ. This package provides a client library for the metricq-grafana endpoint.",
"repository": {
"type": "git",
"url": "https://github.com/metricq/metricq-js.git",
"directory": "history"
},
"main": "./metricq-history.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Mario Bielert <[email protected]>",
"license": "BSD-3-Clause",
"dependencies": {
"axios": "^0.21.2",
"moment": "^2.29.1"
},
"devDependencies": {
},
"browser": {
"child_process": false
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
}
}
2 changes: 1 addition & 1 deletion history_example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var MetricQHistory = require('./src/metricq-history.js')
var MetricQHistory = require('./history/metricq-history.js')
var moment = require('moment')

var mq = new MetricQHistory('https://grafana.metricq.zih.tu-dresden.de/metricq')
Expand Down
File renamed without changes.
28 changes: 28 additions & 0 deletions live/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@metricq/live",
"version": "3.0.0",
"description": "MetricQ is a highly-scalable, distributed metric data processing framework based on RabbitMQ. This package provides a client library for the metricq-sink-websocket endpoint.",
"repository": {
"type": "git",
"url": "https://github.com/metricq/metricq-js.git",
"directory": "live"
},
"main": "./metricq-live.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Mario Bielert <[email protected]>",
"license": "BSD-3-Clause",
"dependencies": {
"moment": "^2.29.1",
"websocket": "^1.0.33"
},
"devDependencies": {
},
"browser": {
"child_process": false
},
"publishConfig": {
"registry": "https://npm.pkg.github.com"
}
}
2 changes: 1 addition & 1 deletion live_example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var MetricQLive = require('./src/metricq-live.js')
var MetricQLive = require('./live/metricq-live.js')

MetricQLive.connect('wss://websocket.metricq.zih.tu-dresden.de').then(ws => {
ws.onData = (metric, time, value) => {
Expand Down
Loading

0 comments on commit c9d490d

Please sign in to comment.