├── .eslintignore ├── .eslintrc ├── .github └── workflows │ ├── main.yml │ └── pr.yml ├── .gitignore ├── .prettierrc ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── docs ├── .gitignore ├── next-env.d.ts ├── next.config.mjs ├── package.json ├── postcss.config.js ├── public │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── apple-touch-icon.png │ ├── banner.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── src │ ├── pages │ │ ├── _app.js │ │ ├── _meta.json │ │ ├── audio.mdx │ │ ├── chapters.mdx │ │ ├── index.mdx │ │ ├── juzs.mdx │ │ ├── resources.mdx │ │ ├── search.mdx │ │ ├── techniques.mdx │ │ ├── utils.mdx │ │ └── verses.mdx │ └── styles │ │ └── global.css ├── tailwind.config.js ├── theme.config.tsx ├── tsconfig.json └── yarn.lock ├── media └── repo-header.png ├── mocks ├── handlers.ts └── server.ts ├── package.json ├── pnpm-lock.yaml ├── scripts └── postversion.mjs ├── src ├── index.ts ├── sdk │ ├── index.ts │ ├── utils.ts │ └── v4 │ │ ├── _fetcher.ts │ │ ├── audio.ts │ │ ├── chapters.ts │ │ ├── index.ts │ │ ├── juzs.ts │ │ ├── resources.ts │ │ ├── search.ts │ │ └── verses.ts ├── types │ ├── BaseApiOptions.ts │ ├── ChapterId.ts │ ├── FetchFn.ts │ ├── HizbNumber.ts │ ├── JuzNumber.ts │ ├── PageNumber.ts │ ├── RubNumber.ts │ ├── VerseKey.ts │ ├── api │ │ ├── ApiResponses.ts │ │ ├── AudioData.ts │ │ ├── AudioResponse.ts │ │ ├── Chapter.ts │ │ ├── ChapterInfo.ts │ │ ├── Footnote.ts │ │ ├── Juz.ts │ │ ├── Pagination.ts │ │ ├── Reciter.ts │ │ ├── Resources.ts │ │ ├── Segment.ts │ │ ├── Tafsir.ts │ │ ├── TafsirInfo.ts │ │ ├── TranslatedName.ts │ │ ├── Translation.ts │ │ ├── Transliteration.ts │ │ ├── Verse.ts │ │ ├── Word.ts │ │ └── index.ts │ ├── index.ts │ └── utils.ts └── utils │ └── misc.ts ├── test ├── audio.test.ts ├── chapters.test.ts ├── fetchFn.test.ts ├── juzs.test.ts ├── resources.test.ts ├── setup.ts ├── tsconfig.json ├── utils.test.ts ├── utils.ts └── verses.test.ts ├── tsconfig.json ├── tsup.config.ts ├── umd-wrapper-plugin.mjs └── vitest.config.ts /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/ -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "extends": [ 5 | "eslint:recommended", 6 | "plugin:@typescript-eslint/eslint-recommended", 7 | "plugin:@typescript-eslint/recommended", 8 | "prettier", 9 | "plugin:prettier/recommended" 10 | ], 11 | "plugins": ["@typescript-eslint", "prettier"], 12 | "rules": { 13 | "prettier/prettier": [ 14 | "error", 15 | {}, 16 | { 17 | "usePrettierrc": true 18 | } 19 | ] 20 | }, 21 | "env": { 22 | "es6": true 23 | }, 24 | "parserOptions": { 25 | "ecmaVersion": 2017 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push] 4 | 5 | env: 6 | HUSKY: 0 7 | 8 | jobs: 9 | 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 | 13 | runs-on: ubuntu-latest 14 | strategy: 15 | matrix: 16 | node: ['18.x', '20.x'] 17 | 18 | steps: 19 | - name: Checkout repo 20 | uses: actions/checkout@v4 21 | 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 43 | 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' 48 | runs-on: ubuntu-latest 49 | steps: 50 | - uses: actions/checkout@v4 51 | 52 | - name: Setup PNPM 53 | uses: pnpm/action-setup@v4 54 | 55 | - uses: actions/setup-node@v4 56 | 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 }} 72 | -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | name: PR 2 | 3 | on: [pull_request] 4 | 5 | env: 6 | HUSKY: 0 7 | 8 | jobs: 9 | build: 10 | name: ⚒️ Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }} 11 | 12 | runs-on: ubuntu-latest 13 | strategy: 14 | matrix: 15 | node: ['18.x', '20.x'] 16 | 17 | steps: 18 | - name: Checkout repo 19 | uses: actions/checkout@v4 20 | 21 | - name: Setup PNPM 22 | uses: pnpm/action-setup@v4 23 | 24 | - name: Install Node.js ${{ matrix.node }} 25 | uses: actions/setup-node@v4 26 | with: 27 | node-version: ${{ matrix.node }} 28 | cache: "pnpm" 29 | 30 | - name: Install dependencies 31 | shell: bash 32 | run: pnpm install 33 | 34 | - name: Lint 35 | run: pnpm lint --quiet 36 | 37 | - name: Test 38 | run: pnpm test:coverage 39 | 40 | - name: Build 41 | run: pnpm build 42 | 43 | size: 44 | runs-on: ubuntu-latest 45 | env: 46 | CI_JOB_NUMBER: 1 47 | steps: 48 | - name: Checkout repo 49 | uses: actions/checkout@v4 50 | 51 | - name: Setup PNPM 52 | uses: pnpm/action-setup@v4 53 | 54 | - uses: andresz1/size-limit-action@v1 55 | with: 56 | github_token: ${{ secrets.GITHUB_TOKEN }} 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .DS_Store 3 | node_modules 4 | dist 5 | coverage 6 | .husky -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "endOfLine": "auto", 3 | "printWidth": 80, 4 | "semi": true, 5 | "singleQuote": true, 6 | "trailingComma": "es5" 7 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Questions 4 | 5 | If you have questions about implementation details, help or support, then please use our dedicated community forum at [GitHub Discussions](https://github.com/quran/api-js/discussions) **PLEASE NOTE:** If you choose to instead open an issue for your question, your issue will be immediately closed and redirected to the forum. 6 | 7 | ## Reporting Issues 8 | 9 | If you have found what you think is a bug, please [file an issue](https://github.com/quran/api-js/issues/new). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues will be immediately closed and redirected to [GitHub Discussions](https://github.com/quran/api-js/discussions) 10 | 11 | ## Suggesting new features 12 | 13 | If you are here to suggest a feature, first create an issue if it does not already exist. From there, we will discuss use-cases for the feature and then finally discuss how it could be implemented. 14 | 15 | ## Development 16 | 17 | If you have been assigned to fix an issue or develop a new feature, please follow these steps to get started: 18 | 19 | - Fork this repository 20 | - Install dependencies by running `$ yarn` 21 | - Link `quran/api-js` locally by running `$ yarn link` 22 | - Auto-build files as you edit by running `$ yarn start` 23 | - Implement your changes and tests to files in the `src/` directory and corresponding test files 24 | - To run examples, follow their individual directions. Usually this is just `$ yarn && yarn start`. 25 | - To run examples using your local build, link to the local `@quranjs/api` by running `$ yarn link @quranjs/api` from the example's directory 26 | - Document your changes in the appropriate doc page, if needed 27 | - Git stage your required changes and commit (see below commit guidelines) 28 | - Submit PR for review 29 | 30 | ## Commit message conventions 31 | 32 | `quran/api-js` is using [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines). 33 | 34 | We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. 35 | 36 | ### Commit Message Format 37 | 38 | Each commit message consists of a **header**, a **body** and a **footer**. The header has a special 39 | format that includes a **type**, a **scope** and a **subject**: 40 | 41 | ``` 42 | (): 43 | 44 | 45 | 46 |