Skip to content

Commit 8df3687

Browse files
committed
CD for JSR
1 parent 44f7cea commit 8df3687

File tree

12 files changed

+2169
-41
lines changed

12 files changed

+2169
-41
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# These are supported funding platforms
22

33
github: thesgj
4+
custom: ['https://www.buymeacoffee.com/thesgj']

.github/workflows/jsr-deploy.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish
2+
on:
3+
pull_request:
4+
branches:
5+
- jsr
6+
7+
jobs:
8+
publish:
9+
name: Build & Deploy for JSR.io
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
20+
- name: Delete Current README.md
21+
run: rm README.md
22+
23+
- name: Modify README for JSR.io
24+
run: mv JSR.md README.md
25+
26+
- name: Find yarn cache location
27+
id: yarn-cache
28+
run: echo "::set-output name=dir::$(yarn cache dir)"
29+
30+
- name: JS package cache
31+
uses: actions/cache@v1
32+
with:
33+
path: $(( steps.yarn-cache.outputs.dir ))
34+
key: $(( runner.os ))-yarn-$(( hashFiles('**/yarn.lock') ))
35+
restore-keys: |
36+
$(( runner.os ))-yarn-
37+
38+
- name: Install Dependencies
39+
run: yarn install
40+
41+
- name: Generate Types Manually using TSUP
42+
run: yarn build-lib
43+
44+
- name: Move index.d.ts in src directory for JSR
45+
run: cp dist/index.d.ts src/
46+
47+
- name: Add Use Client line
48+
run: sed -i '16s/^/\"use client\";/' src/index.tsx
49+
50+
- name: Install Deno
51+
run: curl -fsSL https://deno.land/install.sh | sh
52+
53+
- name: Publish JSR package using Deno
54+
run: deno publish --allow-slow-types --allow-dirty

.yarnrc.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
enableGlobalCache: true
2+
23
nodeLinker: node-modules
34

5+
npmScopes:
6+
jsr:
7+
npmRegistryServer: "https://npm.jsr.io"
8+
49
plugins:
510
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
6-
spec: '@yarnpkg/plugin-typescript'
11+
spec: "@yarnpkg/plugin-typescript"
712
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
8-
spec: '@yarnpkg/plugin-interactive-tools'
13+
spec: "@yarnpkg/plugin-interactive-tools"
914

1015
yarnPath: .yarn/releases/yarn-3.2.4.cjs

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,21 @@
101101

102102
- Fixed the TopLoader to work with special schemes such as mailto, sms, tel, etc
103103
- Fixed the TopLoader for "#" hash anchor
104+
105+
## v1.6.9
106+
107+
### Fixed
108+
109+
- Resolve progress bar when navigating back from external page
110+
- Fixed the TopLoader for anchor url having other domain name
111+
- Moved histry.pushState function outside the MouseEvent, it was triggering for every mouse click
112+
- Fixed TopLoader getting stuck on popstate events
113+
- Fixed the use of rest params and passing its type as any
114+
- Fixed for all Special Schemes, TopLoader will not run on special schemes now onwards
115+
- Fixed for shift key and alt key
116+
117+
### Updated
118+
119+
- Added Type declarations for few functions
120+
- Refactor the whole code to make it more readable
121+
- Updated to add support for the JSR Package Manager

JSR.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Next Js TopLoader
2+
3+
- A Next.js Top Loading Bar component made using nprogress, works with Next.js 14 and React.
4+
5+
[![NPM](https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/nextjs-toploader)
6+
[![NPM Downloads](https://img.shields.io/npm/dm/nextjs-toploader?&style=flat-square)](https://www.npmjs.com/package/nextjs-toploader)
7+
8+
For using npm package manager instead see: (https://www.npmjs.com/package/nextjs-toploader)
9+
10+
## Install
11+
12+
using jsr with npm:
13+
14+
```bash
15+
npx jsr add @thesgj/nextjs-toploader
16+
```
17+
18+
using jsr with yarn:
19+
20+
```bash
21+
yarn dlx jsr add @thesgj/nextjs-toploader
22+
```
23+
24+
using deno:
25+
26+
```bash
27+
deno add @thesgj/nextjs-toploader
28+
```
29+
30+
## Usage
31+
32+
import using:
33+
34+
```js
35+
import NextTopLoader from '@thesgj/nextjs-toploader';
36+
```
37+
38+
### Usage with `app/layout.js` for `app` folder structure
39+
40+
For rendering add `<NextTopLoader />` to your `return()` inside the `<body></body>` of `RootLayout()`:
41+
42+
```js
43+
import NextTopLoader from '@thesgj/nextjs-toploader';
44+
45+
export default function RootLayout({ children }) {
46+
return (
47+
<html lang="en">
48+
<body>
49+
<NextTopLoader />
50+
{children}
51+
</body>
52+
</html>
53+
);
54+
}
55+
```
56+
57+
### Usage with `pages/_app.js` for `pages` folder structure
58+
59+
For rendering add `<NextTopLoader />` to your `return()` in `MyApp()`:
60+
61+
```js
62+
import NextTopLoader from '@thesgj/nextjs-toploader';
63+
64+
export default function MyApp({ Component, pageProps }) {
65+
return (
66+
<>
67+
<NextTopLoader />
68+
<Component {...pageProps} />;
69+
</>
70+
);
71+
}
72+
```
73+
74+
### Default Configuration
75+
76+
If no props are passed to `<NextTopLoader />`, below is the default configuration applied.
77+
78+
```jsx
79+
<NextTopLoader
80+
color="#2299DD"
81+
initialPosition={0.08}
82+
crawlSpeed={200}
83+
height={3}
84+
crawl={true}
85+
showSpinner={true}
86+
easing="ease"
87+
speed={200}
88+
shadow="0 0 10px #2299DD,0 0 5px #2299DD"
89+
template='<div class="bar" role="bar"><div class="peg"></div></div>
90+
<div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
91+
zIndex={1600}
92+
showAtBottom={false}
93+
/>
94+
```
95+
96+
- `color`: to change the default color of TopLoader.
97+
- `initialPosition`: to change initial position for the TopLoader in percentage, : `0.08 = 8%`.
98+
- `crawlSpeed`: increment delay speed in `ms`.
99+
- `speed`: animation speed for the TopLoader in `ms`
100+
- `easing`: animation settings using easing (a CSS easing string).
101+
- `height`: height of TopLoader in `px`.
102+
- `crawl`: auto incrementing behavior for the TopLoader.
103+
- `showSpinner`: to show spinner or not.
104+
- `shadow`: a smooth shadow for the TopLoader. (set to `false` to disable it)
105+
- `template`: to include custom HTML attributes for the TopLoader.
106+
- `zIndex`: defines zIndex for the TopLoader.
107+
- `showAtBottom`: To show the TopLoader at bottom. (increase height for the TopLoader to ensure it's visibility at the mobile devices)
108+
109+
---
110+
111+
UPI ID: thesgj@sbi
112+
113+
[![Sponsor me on GitHub](https://img.shields.io/badge/Sponsor%20me%20on-GitHub-brightgreen)](https://github.com/sponsors/TheSGJ)
114+
115+
[!["Buy Me A Coffee"](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/thesgj)

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
- A Next.js Top Loading Bar component made using nprogress, works with Next.js 14.
44

5+
[![NPM](https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/nextjs-toploader)
6+
[![NPM Downloads](https://img.shields.io/npm/dm/nextjs-toploader?&style=flat-square)](https://www.npmjs.com/package/nextjs-toploader)
7+
58
## Install
69

710
using npm:
@@ -101,4 +104,4 @@ UPI ID: thesgj@sbi
101104

102105
[![Sponsor me on GitHub](https://img.shields.io/badge/Sponsor%20me%20on-GitHub-brightgreen)](https://github.com/sponsors/TheSGJ)
103106

104-
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/thesgj)
107+
[!["Buy Me A Coffee"](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/thesgj)

deno.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
declare namespace JSX {
3+
interface Element {
4+
// deno-lint-ignore no-explicit-any
5+
[elemName: string]: any;
6+
}
7+
}

deno.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "@thesgj/nextjs-toploader",
3+
"version": "1.6.9",
4+
"exports": "./src/index.tsx",
5+
"compilerOptions": {
6+
"jsx": "react-jsx",
7+
"jsxImportSource": "npm:preact",
8+
"types": ["./src/index.d.ts", "./deno.d.ts"]
9+
},
10+
"lib": ["dom", "dom.iterable", "esnext"],
11+
"imports": { "preact": "npm:preact@^10.19.7" }
12+
}

0 commit comments

Comments
 (0)