Skip to content

Commit 360a714

Browse files
authored
Add installation guide, improve README, fixed broken badges and create CONTRIBUTING.md (#1248)
1 parent 8c08c87 commit 360a714

File tree

3 files changed

+191
-48
lines changed

3 files changed

+191
-48
lines changed

CONTRIBUTING.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Contributing to Rollbar.js
2+
3+
Thank you for your interest in contributing to Rollbar.js! We welcome contributions from the community.
4+
5+
## Getting Started
6+
7+
### Prerequisites
8+
9+
- Node.js version 18 or higher
10+
- npm
11+
12+
### Setup
13+
14+
1. Fork the repository on GitHub
15+
2. Clone your fork locally:
16+
```bash
17+
git clone https://github.com/your-username/rollbar.js.git
18+
cd rollbar.js
19+
```
20+
3. Install dependencies:
21+
```bash
22+
npm install
23+
```
24+
4. Build the project:
25+
```bash
26+
npm run build
27+
```
28+
29+
## Development Workflow
30+
31+
### Running Tests
32+
33+
Run all tests:
34+
35+
```bash
36+
npm test
37+
```
38+
39+
Run only browser tests:
40+
41+
```bash
42+
npm run test-browser
43+
```
44+
45+
Run only server tests:
46+
47+
```bash
48+
npm run test-server
49+
```
50+
51+
### Code Style
52+
53+
- We use ESLint for code quality. Run `npm run lint` before submitting
54+
- Code should follow the existing style patterns in the codebase
55+
- Use 2 spaces for indentation
56+
- Use single quotes for strings
57+
58+
### Making Changes
59+
60+
1. Create a feature branch from `master`:
61+
62+
```bash
63+
git checkout -b my-feature-name
64+
```
65+
66+
2. Make your changes and ensure:
67+
- All tests pass
68+
- Code follows our style guidelines
69+
- New features include appropriate tests
70+
- Documentation is updated if needed
71+
- Examples are updated if needed
72+
73+
3. Commit your changes with a clear message:
74+
```bash
75+
git commit -m "Add feature: description of what you added"
76+
```
77+
78+
## Submitting a Pull Request
79+
80+
1. Push your changes to your fork:
81+
82+
```bash
83+
git push origin my-feature-name
84+
```
85+
86+
2. Open a pull request on GitHub against the `master` branch
87+
88+
3. In your pull request description:
89+
- Clearly describe what changes you've made
90+
- Reference any related issues
91+
- Include testing steps if applicable
92+
93+
4. Wait for review and address any feedback
94+
95+
## Reporting Issues
96+
97+
- Use GitHub Issues to report bugs
98+
- Include as much detail as possible:
99+
- Steps to reproduce
100+
- Expected behavior
101+
- Actual behavior
102+
- Environment details (browser, Node.js version, etc.)
103+
104+
## Questions?
105+
106+
If you have questions, please:
107+
108+
- Check existing issues and documentation
109+
- Open a GitHub issue for clarification
110+
- Email [email protected] for urgent matters
111+
112+
Thank you for contributing to Rollbar.js!

README.md

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</p>
1010

1111
![Build Status](https://github.com/rollbar/rollbar.js/workflows/Rollbar.js%20CI/badge.svg?tag=latest)
12-
[![Code Quality: Javascript](https://img.shields.io/lgtm/grade/javascript/g/rollbar/rollbar.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rollbar/rollbar.js/context:javascript)
13-
[![Total Alerts](https://img.shields.io/lgtm/alerts/g/rollbar/rollbar.js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rollbar/rollbar.js/alerts)
12+
[![npm version](https://img.shields.io/npm/v/rollbar.svg)](https://www.npmjs.com/package/rollbar)
13+
[![npm downloads](https://img.shields.io/npm/dm/rollbar.svg)](https://www.npmjs.com/package/rollbar)
1414

1515
---
1616

@@ -22,15 +22,56 @@
2222
- **Advanced search:** Filter items by many different properties. <a href="https://docs.rollbar.com/docs/search-items">Learn more about search</a>.
2323
- **Customizable notifications:** Rollbar supports several messaging and incident management tools where your team can get notified about errors and important events by real-time alerts. <a href="https://docs.rollbar.com/docs/notifications">Learn more about Rollbar notifications</a>.
2424

25-
## Setup Instructions
25+
## Installation
2626

27-
1. [Sign up for a Rollbar account](https://rollbar.com/signup).
28-
2. For client-side Javascript, follow the [Browser Quick Start](https://docs.rollbar.com/docs/javascript#section-quick-start-browser) instructions. For Node.js, follow the [Server Quick Start](https://docs.rollbar.com/docs/javascript#section-quick-start-server).
27+
Using npm:
28+
29+
```bash
30+
npm install --save rollbar
31+
```
32+
33+
Using yarn:
34+
35+
```bash
36+
yarn add rollbar
37+
```
38+
39+
For CDN/script tag installation, see [Quick Start → Browser](#browser)
40+
41+
## Quick Start
42+
43+
First, [**sign up for a Rollbar account**](https://rollbar.com/signup) if you haven't already.
44+
45+
### Browser
46+
47+
For the recommended snippet-based installation with automatic error capture and telemetry, see our [Browser JS – Quick Start documentation](https://docs.rollbar.com/docs/browser-js#quick-start).
48+
49+
### Node.js
50+
51+
```javascript
52+
const Rollbar = require('rollbar');
53+
54+
const rollbar = new Rollbar({
55+
accessToken: 'POST_SERVER_ITEM_ACCESS_TOKEN',
56+
captureUncaught: true,
57+
captureUnhandledRejections: true,
58+
payload: { code_version: '1.0.0' },
59+
});
60+
61+
// log a generic message and send to rollbar
62+
rollbar.log('Hello world!');
63+
```
64+
65+
For **framework** integrations (**Express**, **Koa**, **Hapi**, and more), custom error handlers, and advanced configuration, see our [Node.js server configuration documentation](https://docs.rollbar.com/docs/nodejs#server-configuration).
2966

3067
## Usage and Reference
3168

3269
For complete usage instructions and configuration reference, see our [Javascript SDK docs](https://docs.rollbar.com/docs/javascript).
3370

71+
### Examples
72+
73+
See the [examples directory](./examples/) for detailed integration examples with various frameworks and build tools including **React**, **Angular**, **Vue.js**, **Next.js**, and more.
74+
3475
## Release History & Changelog
3576

3677
See our [Releases](https://github.com/rollbar/rollbar.js/releases) page for a list of all releases, including changes.
@@ -41,19 +82,6 @@ If you run into any issues, please email us at [[email protected]](mailto:supp
4182

4283
For bug reports, please [open an issue on GitHub](https://github.com/rollbar/rollbar.js/issues/new).
4384

44-
## Developing
45-
46-
To set up a development environment, you'll need Node.js and npm.
47-
48-
2. `npm install -D`
49-
3. `make`
50-
51-
To run the tests, run `make test`.
52-
53-
## Contributing
85+
## Developing and Contributing
5486

55-
1. [Fork it](https://github.com/rollbar/rollbar.js).
56-
2. Create your feature branch (`git checkout -b my-new-feature`).
57-
3. Commit your changes (`git commit -am 'Added some feature'`).
58-
4. Push to the branch (`git push origin my-new-feature`).
59-
5. Create a new Pull Request.
87+
For development setup, guidelines, and instructions on submitting pull requests, please see our [Contributing Guide](CONTRIBUTING.md).

examples/README.md

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,70 +6,75 @@ This directory contains examples demonstrating various ways to integrate Rollbar
66

77
The following table shows all supported integration methods across different platforms:
88

9-
| Environment | Script Tag | CommonJS | ESM Import | TypeScript | AMD |
10-
|-------------|------------|----------|------------|------------|-----|
11-
| **Browser** |[script.html](./script.html) || ✅ via bundler | ✅ via bundler |[requirejs/](./requirejs/) |
12-
| **Node.js** ||`require('rollbar')` |`import` |||
13-
| **React** ||[react/](./react/) ||||
14-
| **Angular** |||[angular/](./angular/) |||
15-
| **Vue.js** |||[vuejs3/](./vuejs3/) |||
16-
| **Next.js** || ✅ SSR/Client | ✅ SSR/Client |||
17-
| **Browser Extension** |[v2](./browser_extension_v2/), [v3](./browser_extension_v3/) |||||
9+
| Environment | Script Tag | CommonJS | ESM Import | TypeScript | AMD |
10+
| --------------------- | -------------------------------------------------------------------- | ----------------------- | -------------------------------------- | -------------- | ----------------------------- |
11+
| **Browser** |[script.html](./script.html)<br>✅ [snippet.html](./snippet.html) || ✅ via bundler | ✅ via bundler |[requirejs/](./requirejs/) |
12+
| **Node.js** ||`require('rollbar')` |[`import`](#es-modules--typescript) |||
13+
| **React Native** ||||||
14+
| **React** ||[react/](./react/) ||||
15+
| **Angular** |||[angular/](./angular/) |||
16+
| **Vue.js** |||[vuejs3/](./vuejs3/) |||
17+
| **Next.js** || ✅ SSR/Client | ✅ SSR/Client |||
18+
| **Browser Extension** |[v2](./browser_extension_v2/), [v3](./browser_extension_v3/) |||||
1819

1920
## Quick Start
2021

21-
Each example includes its own README with specific setup instructions. Common patterns:
22+
First, [sign up for a Rollbar account](https://rollbar.com/signup) if you haven't already. Each example includes its own README with specific setup instructions.
23+
24+
Common patterns:
2225

2326
### Browser (Script Tag)
24-
```html
25-
<script src="https://cdn.rollbar.com/rollbarjs/refs/tags/v2.26.4/rollbar.min.js"></script>
26-
<script>
27-
var _rollbarConfig = {
28-
accessToken: "YOUR_ACCESS_TOKEN",
29-
captureUncaught: true,
30-
captureUnhandledRejections: true
31-
};
32-
</script>
33-
```
27+
28+
For the recommended snippet-based installation with automatic error capture and telemetry, see our [Browser JS – Quick Start documentation](https://docs.rollbar.com/docs/browser-js#quick-start).
3429

3530
### Node.js / CommonJS
31+
3632
```javascript
3733
const Rollbar = require('rollbar');
34+
3835
const rollbar = new Rollbar({
39-
accessToken: 'YOUR_ACCESS_TOKEN',
40-
environment: 'production'
36+
accessToken: 'POST_SERVER_ITEM_ACCESS_TOKEN',
37+
captureUncaught: true,
38+
captureUnhandledRejections: true,
39+
payload: { code_version: '1.0.0' },
4140
});
4241
```
4342

4443
### ES Modules / TypeScript
44+
4545
```javascript
4646
import Rollbar from 'rollbar';
47+
4748
const rollbar = new Rollbar({
48-
accessToken: 'YOUR_ACCESS_TOKEN',
49-
environment: 'production'
49+
accessToken: 'POST_SERVER_ITEM_ACCESS_TOKEN',
50+
environment: 'production',
5051
});
5152
```
5253

5354
## Available Examples
5455

5556
### Framework Examples
57+
5658
- **[angular/](./angular/)** - Angular 18+ with TypeScript and error handlers
5759
- **[react/](./react/)** - React with error boundaries
5860
- **[vuejs3/](./vuejs3/)** - Vue.js 3 with Vite
5961

6062
### Build Tool Examples
63+
6164
- **[browserify/](./browserify/)** - Browserify bundler integration
6265
- **[webpack/](./webpack/)** - Webpack bundler configuration
6366
- **[requirejs/](./requirejs/)** - AMD/RequireJS loader
6467

6568
### Environment Examples
69+
6670
- **[universal-browser/](./universal-browser/)** - Isomorphic JavaScript (browser)
6771
- **[universal-node/](./universal-node/)** - Isomorphic JavaScript (Node.js)
6872
- **[browser_extension_v2/](./browser_extension_v2/)** - Chrome extension (Manifest V2)
6973
- **[browser_extension_v3/](./browser_extension_v3/)** - Chrome extension (Manifest V3)
7074
- **[no-conflict/](./no-conflict/)** - Using Rollbar with noConflict mode
7175

7276
### Basic Examples
77+
7378
- **[snippet.html](./snippet.html)** - Async snippet integration
7479
- **[script.html](./script.html)** - Direct script tag
7580
- **[error.html](./error.html)** - Error handling examples
@@ -83,11 +88,13 @@ const rollbar = new Rollbar({
8388
To test these examples with your local Rollbar.js build:
8489

8590
1. Build the library:
91+
8692
```bash
8793
npm run build
8894
```
8995

9096
2. For Node.js examples:
97+
9198
```bash
9299
cd examples/universal-node
93100
npm install
@@ -130,7 +137,3 @@ When you use `require('rollbar')` or `import Rollbar from 'rollbar'`, you automa
130137
- `rollbar/dist/rollbar.min.js` - Vanilla minified
131138
- `rollbar/dist/rollbar.snippet.js` - Async snippet loader
132139
- `rollbar/dist/rollbar.named-amd.js` - AMD/RequireJS
133-
134-
### CDN
135-
136-
- `https://cdn.rollbar.com/rollbarjs/refs/tags/vVERSION/rollbar.min.js`

0 commit comments

Comments
 (0)