Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize set-up #24

Merged
merged 4 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
name: CI

on:
pull_request:
push:
Expand All @@ -9,14 +7,13 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
id: yarn-cache
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
bun-version: 1.1.8

- name: Install dependencies
run: bun install

- name: Test the library
run: |
yarn
yarn test
- name: Run unit tests
run: bun run test
24 changes: 24 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
push:
branches: [master]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.8

- name: Install dependencies
run: bun install

- name: Build app
run: bun run build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist
22 changes: 22 additions & 0 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
tags:
- "v*"

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: npm publish --provenance --access public
Binary file added bun.lockb
Binary file not shown.
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
"types": "./src/index.d.ts",
"sideEffects": false,
"scripts": {
"dev": "rollup -cw",
"predeploy": "rollup -c",
"deploy": "gh-pages -d dist",
"test": "svelte-check --workspace test"
"dev": "bun --bun rollup -cw",
"build": "bun --bun rollup -c",
"test": "bun --bun svelte-check --workspace test"
},
"devDependencies": {
"gh-pages": "^4.0.0",
"svelte": "^3.52.0",
"svelte-check": "^2.9.2",
"svelte": "^4.2.17",
"svelte-check": "^3.7.1",
"svelte-readme": "^3.6.3"
},
"repository": {
Expand Down
14 changes: 7 additions & 7 deletions test/Pincode.test.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts">
import { onMount } from "svelte";
import { Pincode, PincodeInput } from "../src";
import { Code } from "../src/Pincode.svelte";
import UPincode, { Code as Code2 } from "../src/unstyled/Pincode.svelte";
import UPincodeInput, { PincodeInputProps } from "../src/unstyled/PincodeInput.svelte";
import { Pincode, PincodeInput } from "svelte-pincode";
import type { Code } from "svelte-pincode/src/Pincode.svelte";
import UPincode, { Code as Code2 } from "svelte-pincode/src/unstyled/Pincode.svelte";
import UPincodeInput, { type PincodeInputProps } from "svelte-pincode/src/unstyled/PincodeInput.svelte";

const correctCode = "1234";

Expand All @@ -17,9 +17,9 @@
$: error = complete && !success;

onMount(() => {
ref.focusFirstInput();
ref.focusNextEmptyInput();
ref.focusLastInput();
ref.focusFirstInput?.();
ref.focusNextEmptyInput?.();
ref.focusLastInput?.();
});
</script>

Expand Down
21 changes: 21 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

{
"compilerOptions": {
"noEmit": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"ignoreDeprecations": "5.0",
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"strict": true,
"types": ["svelte"],
"paths": {
"svelte-pincode": ["./src"],
"svelte-pincode/src/*": ["./src/*"]
}
},
"include": ["src", "test"]
}
Loading