Skip to content

Commit 02aa8cc

Browse files
authored
Merge pull request #236 from readthedocs/davidfischer/agents-file-client
Add agents file
2 parents 17622bf + 3962f06 commit 02aa8cc

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
/docs/_build/
44
/docs/_static/ethicalads.js
55
index.html
6+
.venv/
7+
node_modules/

AGENTS.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Project Standards & Agent Instructions
2+
3+
This is the JavaScript client for [EthicalAds](https://www.ethicalads.io/). It is responsible for detecting ad placements on publisher websites, fetching ads from the EthicalAds decision API, and rendering them.
4+
5+
## 1. Project Overview
6+
7+
- **Language:** Vanilla JavaScript (ES6+)
8+
- **Styling:** SCSS (compiled to CSS and injected via `style-loader`)
9+
- **Build Tool:** `webpack` (Module bundler)
10+
- **Testing:** `web-test-runner`
11+
- **Linting/Formatting:** `prettier`
12+
- **Documentation:** `sphinx`
13+
14+
### 1.1 Project Structure
15+
16+
- `index.js`: Main entry point. Contains the `Placement` class and logic for detecting placements and fetching ads.
17+
- `styles.scss`: SCSS for ad styling, bundled into the JS client.
18+
- `dist/`: Contains the built artifacts (`ethicalads.min.js` and `ethicalads.js`).
19+
- `tests/`: Unit and integration tests run in a browser environment via `web-test-runner`.
20+
- `docs/`: Sphinx documentation.
21+
22+
### 1.2 Key Dependencies
23+
24+
- `verge`: Used for viewport calculations.
25+
- `webpack`: Bundles JS and SCSS into a single file for distribution.
26+
- `babel`: Transpiles ES6+ code for browser compatibility.
27+
28+
## 2. Development Workflow
29+
30+
### 2.1 Local Development
31+
32+
To start a development server with hot reloading:
33+
34+
```bash
35+
npm run dev
36+
```
37+
38+
The test styleguide is available at `http://localhost:8080/`.
39+
40+
### 2.2 Formatting & Linting
41+
42+
Before committing, ensure the code is formatted:
43+
44+
```bash
45+
npm run format # Applies prettier formatting
46+
npm run lint # Checks formatting
47+
```
48+
49+
### 2.3 Building for Production
50+
51+
To generate the production-ready files in `dist/`:
52+
53+
```bash
54+
npm run build
55+
```
56+
57+
## 3. Testing Procedures
58+
59+
Tests must pass before tasks are considered complete.
60+
61+
```bash
62+
npm run test # Run all tests
63+
npm run test:dev # Run tests in watch mode
64+
npm run test:debug # Run tests with a manual browser for debugging
65+
```
66+
67+
## 4. Agent Workflow Instructions
68+
69+
1. **Source of Truth:** Always treat this `AGENTS.md` file as the primary source of project standards.
70+
2. **Context Loading:** At the start of a task, read `index.js` (for logic) and `styles.scss` (for UI) if relevant.
71+
3. **Planning:** Create a detailed task list. For complex changes, create an implementation plan.
72+
4. **Minimalism:** The client is served on third-party sites; keep the bundle size small and avoid heavy dependencies.
73+
5. **Vanilla JS:** Use vanilla JavaScript; avoid frameworks like React or Vue unless explicitly requested.
74+
6. **Verification:** Always run `npm run test` and `npm run lint` before declaring a task done.

0 commit comments

Comments
 (0)