Skip to content

Commit

Permalink
Added initial package
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Farooq committed Apr 3, 2024
1 parent 2ef0ab2 commit 0a18655
Show file tree
Hide file tree
Showing 7 changed files with 3,690 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Node.js Package

on:
push:
branches: ["main"]
paths-ignore:
- "**/*.md"
- ".gitignore"
- ".editorconfig"

jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: "Automated Version Bump"
uses: "phips28/gh-action-bump-version@master"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
minor-wording: "add,Adds,new"
major-wording: "MAJOR,cut-major"
patch-wording:
"patch,fixes" # Providing patch-wording will override commits
# defaulting to a patch bump.
rc-wording: "RELEASE,alpha"
tag-prefix: "v"
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# rekhta-downloader-js
Downloader for rekhta books

17 changes: 17 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html>

<head>
<link rel="icon" type="image/png" />
<title>Rekhta downloader</title>
<script src="./index.js" type="module"></script>
</head>

<body>
<form id="download-form">
<input type="text" name="url" placeholder="Enter the url"
value="https://www.rekhta.org/ebooks/bela-mein-mela-gadar-ki-mari-shahzadiyan-rashidul-khairi-ebooks?lang=ur" />
<input type="submit" value="Download" />
</form>
</body>

</html>
10 changes: 10 additions & 0 deletions demo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import downloadBook from "../src";

const form = document.getElementById("download-form");
form.addEventListener("submit", onFormSubmit);

function onFormSubmit(e) {
e.preventDefault();
const url = document.getElementsByName('url')[0].value;
downloadBook(url)
}
Loading

0 comments on commit 0a18655

Please sign in to comment.