Skip to content

Commit 57f9d9a

Browse files
update readme
1 parent 7becf6c commit 57f9d9a

File tree

3 files changed

+90
-2
lines changed

3 files changed

+90
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ jobs:
4848
4949
- name: Clean npm cache
5050
run: npm cache clean --force
51+
52+
- name: Create empty cache directory
53+
run: mkdir -p /tmp/empty-cache
54+
5155
- name: Install dependencies
52-
run: npm ci
56+
run: npm ci --cache /tmp/empty-cache
5357

5458
semantic-release:
5559
runs-on: ubuntu-latest

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,58 @@
11
# SpaceCat Task Processor
22

3-
> SpaceCat Task Processor for processing spacecat tasks.
3+
## Overview
4+
5+
SpaceCat Task Processor is a Node.js service that processes messages from the AWS SQS queue `SPACECAT-TASK-PROCESSOR-JOBS`. Based on the `type` field in each message, it dispatches the message to the appropriate handler for processing various site-related tasks.
6+
7+
## Features
8+
- Receives and processes messages from SQS
9+
- Supports multiple task types via modular handlers
10+
- Handlers for audit status, demo URL preparation, and disabling imports/audits
11+
- Extensible and easy to add new handlers
12+
13+
## Handlers
14+
- **audit-status-processor**: Checks and reports audit status for a site
15+
- **demo-url-processor**: Prepares and shares a demo URL for a site
16+
- **disable-import-audit-processor**: Disables specified imports and audits for a site
17+
18+
## Project Structure
19+
- `src/` - Main source code
20+
- `audit-status-processor/handler.js`
21+
- `demo-url-processor/handler.js`
22+
- `disable-import-audit-processor/handler.js`
23+
- `index.js` - Main entry point and handler dispatcher
24+
- `test/` - Test files
25+
26+
## Setup
27+
1. Clone the repository
28+
2. Install dependencies:
29+
```sh
30+
npm ci
31+
```
32+
3. Configure AWS credentials and environment variables as needed
33+
34+
## Usage
35+
- The service is designed to run as a serverless function or background worker.
36+
- It listens for messages on the SQS queue and processes them automatically.
37+
38+
## Development
39+
- To run tests:
40+
```sh
41+
npm test
42+
```
43+
- To lint code:
44+
```sh
45+
npm run lint
46+
```
47+
48+
## Extending
49+
To add a new handler:
50+
1. Create a new folder in `src/` for your handler.
51+
2. Export your handler function.
52+
3. Add it to the handler mapping in `src/index.js`.
53+
54+
---
55+
For more details, see the documentation in `src/README.md`.
456

557
## Status
658
[![codecov](https://img.shields.io/codecov/c/github/adobe-rnd/spacecat-task-processor.svg)](https://codecov.io/gh/adobe-rnd/spacecat-task-processor)

docs/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# SpaceCat Task Processor Documentation
2+
3+
## Introduction
4+
SpaceCat Task Processor is a modular Node.js service that processes messages from the AWS SQS queue `SPACECAT-TASK-PROCESSOR-JOBS`. It dispatches each message to a handler based on the message's `type` field, supporting a variety of site-related automation tasks.
5+
6+
## Architecture Overview
7+
- **SQS Integration:** Listens to the `SPACECAT-TASK-PROCESSOR-JOBS` queue and processes incoming messages.
8+
- **Handler System:** Uses a mapping in `src/index.js` to route messages to the correct handler module. Handlers are located in subdirectories of `src/` (e.g., `audit-status-processor`, `demo-url-processor`, `disable-import-audit-processor`).
9+
- **Extensibility:** New handlers can be added by creating a new directory and registering the handler in `src/index.js`.
10+
11+
## Main Handlers
12+
- **audit-status-processor:** Checks and reports audit status for a site.
13+
- **demo-url-processor:** Prepares and shares a demo URL for a site.
14+
- **disable-import-audit-processor:** Disables specified imports and audits for a site.
15+
16+
## Project Structure
17+
- `src/` - Source code and handlers
18+
- `test/` - Test files
19+
- `docs/` - Documentation (this file)
20+
21+
## For Users
22+
- See the root `README.md` for setup, usage, and quick start instructions.
23+
24+
## For Developers
25+
- See `src/README.md` for handler interface, message format, and extension guidelines.
26+
27+
## Additional Resources
28+
- [npm documentation](https://docs.npmjs.com/)
29+
- [AWS SQS documentation](https://docs.aws.amazon.com/sqs/)
30+
31+
---
32+
For any questions or contributions, please refer to the repository's issue tracker or contact the maintainers.

0 commit comments

Comments
 (0)