Skip to content

Commit

Permalink
feat!: transitioning to ESM (#476)
Browse files Browse the repository at this point in the history
* feat!: transitioning to ESM

* chore: formatting

* chore: added exports and different tsconfig

* chore: changing target to ES2021

* chore: potentially building cjs and esm

* fix: cucumber imports

* chore: adding a script to build package files

* fix: exports

* chore(release): v10.0.0-canary.2
  • Loading branch information
nicholasgriffintn authored Mar 14, 2024
1 parent 392e921 commit a1db8c3
Show file tree
Hide file tree
Showing 29 changed files with 822 additions and 786 deletions.
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
examples
test
public
.nyc_output
.nyc_output
scripts
8 changes: 5 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = {
/** @type {import("prettier").Config} */

export const config = {
singleQuote: true,
arrowParens: 'always',
trailingComma: 'none'
arrowParens: "always",
trailingComma: "none",
};
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ Visit [https://bbc.github.io/sqs-consumer/](https://bbc.github.io/sqs-consumer/)
## Usage
```js
import { Consumer } from 'sqs-consumer';
import { Consumer } from "sqs-consumer";
const app = Consumer.create({
queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name',
queueUrl: "https://sqs.eu-west-1.amazonaws.com/account-id/queue-name",
handleMessage: async (message) => {
// do some work with `message`
}
},
});
app.on('error', (err) => {
app.on("error", (err) => {
console.error(err.message);
});
app.on('processing_error', (err) => {
app.on("processing_error", (err) => {
console.error(err.message);
});
Expand Down Expand Up @@ -75,32 +75,32 @@ export AWS_ACCESS_KEY_ID=...
If you need to specify your credentials manually, you can use a pre-configured instance of the [SQS Client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-sqs/classes/sqsclient.html) client.
```js
import { Consumer } from 'sqs-consumer';
import { SQSClient } from '@aws-sdk/client-sqs';
import { Consumer } from "sqs-consumer";
import { SQSClient } from "@aws-sdk/client-sqs";
const app = Consumer.create({
queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name',
queueUrl: "https://sqs.eu-west-1.amazonaws.com/account-id/queue-name",
handleMessage: async (message) => {
// ...
},
sqs: new SQSClient({
region: 'my-region',
region: "my-region",
credentials: {
accessKeyId: 'yourAccessKey',
secretAccessKey: 'yourSecret'
}
})
accessKeyId: "yourAccessKey",
secretAccessKey: "yourSecret",
},
}),
});
app.on('error', (err) => {
app.on("error", (err) => {
console.error(err.message);
});
app.on('processing_error', (err) => {
app.on("processing_error", (err) => {
console.error(err.message);
});
app.on('timeout_error', (err) => {
app.on("timeout_error", (err) => {
console.error(err.message);
});
Expand Down
115 changes: 49 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a1db8c3

Please sign in to comment.