Skip to content

Commit 6663260

Browse files
authored
Initial commit
0 parents  commit 6663260

16 files changed

Lines changed: 8762 additions & 0 deletions

File tree

.github/workflows/main.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Extension
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: main
6+
paths:
7+
- "src/**"
8+
- "README.md"
9+
- "package.json"
10+
- ".github/workflows/main.yaml"
11+
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.ROAMJS_RELEASE_TOKEN }}
14+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
15+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
16+
AWS_REGION: ${{ vars.AWS_REGION }}
17+
ROAMJS_PROXY: ${{ vars.ROAMJS_PROXY }}
18+
19+
jobs:
20+
deploy:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: install
25+
run: npm install
26+
- name: build
27+
run: npx samepage build

.github/workflows/pr.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Publish Extension
2+
on: pull_request
3+
4+
env:
5+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
6+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7+
AWS_REGION: ${{ vars.AWS_REGION }}
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: install
15+
run: npm install
16+
- name: build
17+
run: npx samepage build

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
build
3+
dist
4+
out
5+
.env
6+
extension.js
7+
extension.js.LICENSE.txt

.prettierrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": ["prettier-plugin-tailwindcss"]
3+
}

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"prettier.requireConfig": true,
4+
"prettier.prettierPath": "./node_modules/prettier",
5+
"editor.defaultFormatter": "esbenp.prettier-vscode",
6+
"eslint.useFlatConfig": true,
7+
"eslint.workingDirectories": [{ "mode": "auto" }]
8+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) RoamJS
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# RoamJS Extension Base
2+
3+
Stock base for [RoamJS](https://roamjs.com) Roam Research extensions. **Fork this repo** to start a new extension.
4+
5+
## What's included
6+
7+
- **roamjs-components** — shared utilities, DOM helpers, queries, writes, and UI components
8+
- **Samepage build**`samepage build` produces the Roam Depot–ready bundle
9+
- **Settings panel** — example `extensionAPI.settings.panel.create` with an Enable switch
10+
- **TypeScript** — tsconfig extending `@samepage/scripts`
11+
- **CI** — GitHub Actions to build on push/PR (uses RoamJS secrets for publish)
12+
13+
## After forking
14+
15+
1. **Rename the repo** and update `package.json`:
16+
- `name`: your extension slug (e.g. `my-extension`)
17+
- `description`: one line describing the extension
18+
19+
2. **Implement in `src/index.ts`**:
20+
- Keep or replace the settings panel
21+
- Add your logic using `roamjs-components` (e.g. `createHTMLObserver`, `createBlock`, `renderToast`)
22+
- Return `{ unload }` to clean up on unload
23+
24+
3. **Optional**: Add React components under `src/components/` (see [autocomplete](https://github.com/RoamJS/autocomplete), [giphy](https://github.com/RoamJS/giphy) for examples).
25+
26+
4. **Secrets (for publish)** — in the forked repo, configure:
27+
- `ROAMJS_RELEASE_TOKEN`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`
28+
- `AWS_REGION`, `ROAMJS_PROXY` (vars)
29+
30+
## Scripts
31+
32+
- `npm start` — samepage dev (local development)
33+
- `npm run build:roam` — build for Roam (dry run; CI runs `npx samepage build`)
34+
35+
## License
36+
37+
MIT

agents.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
You are an expert senior software engineer specializing in modern web development, with deep expertise in TypeScript, React, Next.js (App Router), and Tailwind CSS. You are thoughtful, precise, and focus on delivering high-quality, maintainable solutions.
2+
3+
You are creating a Roam Research extension.
4+
5+
# Agent Guidelines
6+
7+
## Style Guide
8+
9+
### UI Guidelines
10+
11+
- Use Tailwind CSS for styling where possible
12+
- When refactoring inline styles, use tailwind classes
13+
- Use platform-native UI components (blueprintjs 3)
14+
- Maintain visual consistency with the host application's design system
15+
- Follow responsive design principles
16+
17+
### TypeScript Guidelines
18+
19+
- Prefer `type` over `interface`
20+
- Use explicit return types for functions
21+
- Avoid `any` types when possible
22+
- Prefer arrow functions over regular function declarations
23+
- Use named parameters (object destructuring) when a function has more than 2 parameters
24+
25+
### Code Formatting
26+
27+
- Use Prettier with the project's configuration
28+
- Maintain consistent naming conventions:
29+
- PascalCase for components and types
30+
- camelCase for variables and functions
31+
- UPPERCASE for constants
32+
- Use `~` instead of `..` for imports. The `~` alias maps to `src/`, so prefer:
33+
34+
### Code Organization
35+
36+
- Prefer small, focused functions over inline code
37+
- Extract complex logic into well-named functions
38+
- Function names should describe their purpose clearly
39+
- Choose descriptive function names that make comments unnecessary
40+
- Break down complex operations into smaller, meaningful functions
41+
- Prefer early returns over nested conditionals for better readability
42+
- Prefer util functions for reusable logic and common operations
43+
44+
### Documentation
45+
46+
- Add comments only when necessary; descriptive names should minimize the need for comments
47+
- Explain the why, not the what, focusing on reasoning, trade-offs, and approaches
48+
- Document limitations, known bugs, or edge cases where behavior may not align with expectations
49+
50+
### Testing
51+
52+
- Write unit tests for new functionality
53+
- Ensure tests are meaningful and maintainable

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run build:roam

0 commit comments

Comments
 (0)