NPM package for Pipebase.io
-
If you don't have a Pipebase workspace, go create one (30 seconds, free): app.pipebase.io
-
Note your
workspace id
andAPI key
(See here on how to get them) -
Install the package
npm install pipebase-io-js
-
Initialize the library
import {PipebaseClient} from 'pipebase-io-js'; const pipebaseClient = new PipebaseClient({ workspaceId: "<your workspace id>", apiKey: "<your API key>", defaultTable: 'demo-ingest-from-js', ingestConsoleLogs: true, // if true, will upload console logs to Pipebase suppressConsoleLogsToConsole: true // if true, will also suppress logs to console })
-
Upload logs
console.info("TEST this will be logged as info"); console.warn("TEST this will be logged as warning"); console.error("TEST this will be logged as error"); console.log("TEST parameters will also be logged", { hello: "world" } { anotherParam: 1 }); await pipebaseClient.flushAsync(); // Can call flush to upload the logs (log are flushed every second by default) pipebaseClient.track({ myEvent: "You can log anything you want", moreData: 1234 }, "customTableName"); await pipebaseClient.end(); // Flush and stop logging (will wait for logs t upload for up to 10 seconds) console.log(`This log will not be uploaded to Pipebase.io`);
-
Install dependencies
npm install
-
Run build. This will generate the compiled code with type definitions in the
dist
folder.npm run build
-
Formatting and linting.
npm run lint npm run format
-
Run tests
npm test
-
If you don't have an npm account, create one on: https://www.npmjs.com/signup or run the command:
npm adduser
-
If you already have an account, login by running the following command:
npm login
-
When you're successfully logged-in. Publish the package:
npm publish
-
You should now be able to
npm install
your published package. There is an npm package called reference-package which is generated from this cookiecutter. There is a sample usage in example/index.js.
This repo was bootstrapped by following this tutorial.