Skip to content

Commit dbf71fa

Browse files
authored
Merge pull request #29 from quran/dev
Merge dev
2 parents e02b49a + aa49feb commit dbf71fa

File tree

195 files changed

+15052
-9646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+15052
-9646
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{
6+
"repo": "quran/api-js"
7+
}
8+
],
9+
"baseBranch": "main",
10+
"commit": false,
11+
"fixed": [],
12+
"linked": [],
13+
"access": "public",
14+
"updateInternalDependencies": "patch",
15+
"ignore": [
16+
"@quranjs/docs"
17+
]
18+
}

.changeset/late-parks-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@quranjs/api": major
3+
---
4+
5+
Migrate to the new quran.foundation API

.cursor/rules/clean-code.mdc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
description: Guidelines for writing clean, maintainable, and human-readable code. Apply these rules when writing or reviewing code to ensure consistency and quality.
3+
globs:
4+
alwaysApply: true
5+
---
6+
7+
# Clean Code Guidelines
8+
9+
## Constants Over Magic Numbers
10+
11+
- Replace hard-coded values with named constants
12+
- Use descriptive constant names that explain the value's purpose
13+
- Keep constants at the top of the file or in a dedicated constants file
14+
15+
## Meaningful Names
16+
17+
- Variables, functions, and classes should reveal their purpose
18+
- Names should explain why something exists and how it's used
19+
- Avoid abbreviations unless they're universally understood
20+
21+
## Smart Comments
22+
23+
- Don't comment on what the code does - make the code self-documenting
24+
- Use comments to explain why something is done a certain way
25+
- Document APIs, complex algorithms, and non-obvious side effects
26+
27+
## Single Responsibility
28+
29+
- Each function should do exactly one thing
30+
- Functions should be small and focused
31+
- If a function needs a comment to explain what it does, it should be split
32+
33+
## DRY (Don't Repeat Yourself)
34+
35+
- Extract repeated code into reusable functions
36+
- Share common logic through proper abstraction
37+
- Maintain single sources of truth
38+
39+
## Clean Structure
40+
41+
- Keep related code together
42+
- Organize code in a logical hierarchy
43+
- Use consistent file and folder naming conventions
44+
45+
## Encapsulation
46+
47+
- Hide implementation details
48+
- Expose clear interfaces
49+
- Move nested conditionals into well-named functions
50+
51+
## Code Quality Maintenance
52+
53+
- Refactor continuously
54+
- Fix technical debt early
55+
- Leave code cleaner than you found it

.cursor/rules/general.mdc

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
7+
# Overview
8+
9+
You are an expert in TypeScript library development with excellent taste in API design.
10+
11+
- Follow the user's requirements carefully & to the letter.
12+
- First think step-by-step - describe your plan for what to build in pseudocode, written out in great detail.
13+
14+
## Tech Stack
15+
16+
You're working in a monorepo using:
17+
18+
- TypeScript
19+
- Pnpm
20+
- Vitest
21+
22+
## Core Principles
23+
24+
- Write straightforward, readable, and maintainable code. Use explicit types on exported functions.
25+
- Use strong typing, avoid 'any'.
26+
- Restate what the objective is of what you are being asked to change clearly in a short summary.
27+
- Do not use any third party library. The library must confirm to [Standard Schema](mdc:https:/standardschema.dev) and not be tied to any one schema validation library.
28+
- Reason about the API design before implementing changes. Is it possible to achieve strong and generic typing for your chosen API? If not, reconsider.
29+
- Create clearly documented changesets for your introduced changes using `pnpm changeset`.
30+
31+
## Coding Standards
32+
33+
### Naming Conventions
34+
35+
- Variables, functions, methods: camelCase
36+
- Files, directories: kebab-case
37+
- Constants, env variables: UPPERCASE
38+
39+
### Functions
40+
41+
- Use descriptive names: verbs & nouns (e.g., getUserData)
42+
- Prefer the `function` keyword over arrow functions where their differences doesn't matter.
43+
- Document with JSDoc annotations
44+
45+
### Types and Interfaces
46+
47+
- Prefer custom interfaces over inline types
48+
- Use 'readonly' for immutable properties
49+
- If an import is only used as a type in the file, use 'import type' instead of 'import'
50+
51+
### Validating changes
52+
53+
- Always validate your changes confirm to the project lint configuration by running `pnpm lint`.
54+
- Write tests for changes and validate they pass using `pnpm test`.
55+
56+
## Code Review Checklist
57+
58+
- Ensure proper typing
59+
- Check for code duplication
60+
- Verify error handling
61+
- Confirm test coverage
62+
- Review naming conventions
63+
- Assess overall code structure and readability
64+
65+
## Documentation
66+
67+
- Use the active voice
68+
- Use the present tense
69+
- Write in a clear and concise manner
70+
- Present information in a logical order
71+
- Use lists and tables when appropriate
72+
- When writing JSDocs, only use TypeDoc compatible tags.
73+
- Always write JSDocs for all code: classes, functions, methods, fields, types, interfaces.

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/setup/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Setup and install"
2+
description: "Common setup steps for Actions"
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- uses: pnpm/action-setup@v4
8+
- uses: actions/setup-node@v4
9+
with:
10+
node-version-file: ".nvmrc"
11+
cache: "pnpm"
12+
13+
- shell: bash
14+
run: pnpm add -g turbo
15+
16+
- shell: bash
17+
run: pnpm install

.github/workflows/main.yml

Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,69 @@
11
name: CI
22

3-
on: [push]
3+
on:
4+
pull_request:
5+
branches: ["*"]
6+
push:
7+
branches: ["main"]
8+
merge_group:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
413

514
env:
15+
FORCE_COLOR: 3
616
HUSKY: 0
717

818
jobs:
919
build:
10-
if: github.repository == 'quran/api-js' && (github.ref == 'refs/heads/master') && github.event_name != 'pull_request'
11-
name: ⚒️ Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
12-
20+
name: ⚒️ Build
1321
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
node: ['18.x', '20.x']
17-
1822
steps:
1923
- name: Checkout repo
2024
uses: actions/checkout@v4
25+
- uses: ./.github/setup
26+
- run: pnpm build --filter="./packages/*"
2127

22-
- name: Setup PNPM
23-
uses: pnpm/action-setup@v4
24-
25-
- name: Install Node.js ${{ matrix.node }}
26-
uses: actions/setup-node@v4
27-
with:
28-
node-version: ${{ matrix.node }}
29-
cache: "pnpm"
30-
31-
- name: Install dependencies
32-
shell: bash
33-
run: pnpm install
34-
35-
- name: Lint
36-
run: pnpm lint --quiet
37-
38-
- name: Test
39-
run: pnpm test:coverage
40-
41-
- name: Build
42-
run: pnpm build
28+
lint:
29+
name: ✨ Lint
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout repo
33+
uses: actions/checkout@v4
34+
- uses: ./.github/setup
35+
- run: pnpm lint --quiet
4336

44-
test-and-publish:
45-
name: 🎉 Publish to NPM
46-
needs: [build]
47-
if: github.repository == 'quran/api-js' && (github.ref == 'refs/heads/master') && github.event_name != 'pull_request'
37+
typecheck:
38+
name: 🔍 Typecheck
4839
runs-on: ubuntu-latest
4940
steps:
50-
- uses: actions/checkout@v4
41+
- name: Checkout repo
42+
uses: actions/checkout@v4
43+
- uses: ./.github/setup
44+
- run: pnpm typecheck
5145

52-
- name: Setup PNPM
53-
uses: pnpm/action-setup@v4
46+
test:
47+
name: 🧪 Test
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout repo
51+
uses: actions/checkout@v4
52+
- uses: ./.github/setup
53+
- run: pnpm test
5454

55-
- uses: actions/setup-node@v4
55+
size:
56+
name: 📦 Size
57+
runs-on: ubuntu-latest
58+
env:
59+
CI_JOB_NUMBER: 1
60+
steps:
61+
- name: Checkout repo
62+
uses: actions/checkout@v4
63+
- uses: ./.github/setup
64+
- uses: andresz1/[email protected]
5665
with:
57-
node-version: 20
58-
registry-url: https://registry.npmjs.org/
59-
cache: "pnpm"
60-
61-
- name: Install dependencies
62-
shell: bash
63-
run: pnpm install
64-
65-
- name: Build
66-
run: pnpm build
67-
68-
- run: npx semantic-release@17
69-
env:
70-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
71-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
directory: packages/api/
67+
skip_step: install
68+
package_manager: pnpm
69+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)