Skip to content

Commit

Permalink
feat: Add test JSR package
Browse files Browse the repository at this point in the history
  • Loading branch information
jhechtf committed Jun 29, 2024
1 parent b439139 commit 2ec27b0
Show file tree
Hide file tree
Showing 13 changed files with 3,367 additions and 2,700 deletions.
5 changes: 5 additions & 0 deletions .changeset/add-jsr-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@jhecht/jsr-test": patch
---

Adds in test JSR Package
18 changes: 11 additions & 7 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ jobs:
changesets:
name: Changeset Present?
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -14,14 +15,15 @@ jobs:
- uses: pnpm/action-setup@v2
name: Install PNPM
with:
versions: 8
version: 9.0.5
- uses: actions/cache@v3
name: setup PNPM cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os}}-pnpm-store
${{ runner.os}}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
${{ runner.os}}-pnpm-store-
- uses: actions/setup-node@v3
with:
node-version: '18.x'
Expand All @@ -41,14 +43,15 @@ jobs:
- uses: pnpm/action-setup@v2
name: Install PNPM
with:
version: 8
version: 9.0.5
- uses: actions/cache@v3
name: Setup PNPM cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os}}-pnpm-store
${{ runner.os}}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
${{ runner.os}}-pnpm-store-
- uses: actions/setup-node@v3
with:
node-version: '18.x'
Expand All @@ -67,14 +70,15 @@ jobs:
- uses: pnpm/action-setup@v2
name: Install PNPM
with:
version: 8
version: 9.0.5
- uses: actions/cache@v3
name: Setup PNPM cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os}}-pnpm-store
${{ runner.os}}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
${{ runner.os}}-pnpm-store-
- uses: actions/setup-node@v3
with:
node-version: '18.x'
Expand All @@ -88,7 +92,7 @@ jobs:
- uses: pnpm/action-setup@v2
name: Install PNPM
with:
version: 8
version: 9.0.5
- uses: actions/cache@v3
name: Setup PNPM cache
with:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .github/workflows/publish.yml

name: Publish

on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.
steps:
- uses: actions/checkout@v4
- run: npx jsr publish
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"deno.enable": true,
"deno.enablePaths": ["./scripts"]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"prettier": "^3.1.1",
"turbo": "latest"
},
"packageManager": "pnpm@8.9.0",
"packageManager": "pnpm@9.0.5",
"engines": {
"node": ">=18"
}
Expand Down
7 changes: 7 additions & 0 deletions packages/jsr-test/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @description The CLI that allows for adding
*/

if (import.meta.dirname) {
console.info('hi you');
}
5 changes: 5 additions & 0 deletions packages/jsr-test/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@jhecht/jsr-test",
"version": "0.1.0",
"exports": "./mod.ts"
}
12 changes: 12 additions & 0 deletions packages/jsr-test/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function add(...args: (number | bigint)[]): number | bigint {
if (args.length === 1) return args[0];
return args.reduce((sum, cur) => {
if (typeof cur === 'bigint' || typeof sum === 'bigint')
return BigInt(cur) + BigInt(sum);

return cur + sum;
}, 0);
return 0;
}

console.info(add(1, 10, 3, 5));
12 changes: 12 additions & 0 deletions packages/jsr-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@jhecht/jsr-test",
"version": "0.1.0",
"description": "",
"exports": "./mod.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Loading

0 comments on commit 2ec27b0

Please sign in to comment.