Skip to content

Commit

Permalink
Update README.md and add coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
taichunmin committed Oct 22, 2022
1 parent 94486a9 commit deb4c09
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 35 deletions.
44 changes: 16 additions & 28 deletions .github/workflows/gh-pages.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: github pages
name: CI

on:
workflow_dispatch:
Expand All @@ -16,15 +16,17 @@ jobs:
with:
node-version: 16
cache: 'yarn'
- name: 安裝相依性套件
run: yarn
- name: 程式碼風格檢查
run: yarn lint
- name: 單元測試
run: yarn test
- name: 編譯網頁
run: yarn build
gh-pages:
- name: install, lint, test, build
run: |
yarn
yarn lint
yarn test --coverage
yarn build
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy:
if: github.ref == 'refs/heads/master'
needs: test
runs-on: ubuntu-latest
Expand All @@ -34,30 +36,16 @@ jobs:
with:
node-version: 16
cache: 'yarn'
- name: 安裝相依性套件
run: yarn
- name: 編譯網頁
run: yarn build
- name: install, build
run: |
yarn
yarn build
- name: 把網頁放到 GitHub Pages 的專屬分支上
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
force_orphan: true
npm-publish:
if: github.ref == 'refs/heads/master'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: 安裝相依性套件
run: yarn
- name: 編譯網頁
run: yarn build
- name: 發布至 npm
uses: JS-DevTools/npm-publish@v1
with:
Expand Down
31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# pn532.js
<div align="center">

pn532.js is a JavaScript library for PN532 base on Web Bluetooth and Web Serial.
<h1>PN532.js</h1>

<p>PN532.js is a JavaScript library for PN532 base on Web Bluetooth and Web Serial.</p>

[API Reference](https://taichunmin.idv.tw/pn532.js/docs/)

[![npm version](https://img.shields.io/npm/v/pn532.js.svg?logo=npm)](https://www.npmjs.org/package/pn532.js)
[![jsdelivr hits](https://img.shields.io/jsdelivr/npm/hm/pn532.js?logo=jsdelivr)](https://www.jsdelivr.com/package/npm/pn532.js)
[![Build status](https://img.shields.io/github/workflow/status/taichunmin/pn532.js/CI?label=CI&logo=github)](https://github.com/taichunmin/pn532.js/actions/workflows/ci.yml)
[![code coverage](https://img.shields.io/coveralls/github/taichunmin/pn532.js.svg)](https://coveralls.io/github/taichunmin/pn532.js)
[![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=pn532.js&query=$.install.pretty&label=install%20size)](https://packagephobia.now.sh/result?p=pn532.js)
[![npm bundle size](https://img.shields.io/bundlephobia/minzip/pn532.js)](https://bundlephobia.com/package/pn532.js@latest)
[![npm downloads](https://img.shields.io/npm/dm/pn532.js.svg)](https://npm-stat.com/charts.html?package=pn532.js)
[![code helpers](https://www.codetriage.com/taichunmin/pn532.js/badges/users.svg)](https://www.codetriage.com/taichunmin/pn532.js)
[![Known Vulnerabilities](https://snyk.io/test/npm/pn532.js/badge.svg)](https://snyk.io/test/npm/pn532.js)

</div>

## Browser & OS compatibility

Expand All @@ -18,6 +34,12 @@ The Web Serial API is available on all desktop platforms (ChromeOS, Linux, macOS

On Android, support for USB-based serial ports is possible using the WebUSB API and the [Serial API polyfill](https://github.com/google/web-serial-polyfill). This polyfill is limited to hardware and platforms where the device is accessible via the WebUSB API because it has not been claimed by a built-in device driver.

## Prepare PN532 hardware

PN532.js support Web Serial and Web Bluetooth. You can connect PN532 to PC via an USB2TTL module (e.g. `CH340`, `PL2303`) or via BLE UART module (e.g. `HC-08`, `JDY-33`).

See Mtools Tec's [How to make PN532 work on Bluetooth](https://shop.mtoolstec.com/how-to-make-pn532-work-on-bluetooth.html) and [How To Test PN532 Working With Bluetooth Module?](https://shop.mtoolstec.com/how-to-test-pn532-working-with-bluetooth-module.html) for more information.

## Installing

Using jsDelivr CDN:
Expand Down Expand Up @@ -213,11 +235,12 @@ let resp6 = await pn532.$hf14a.mfWipeGen1a({ sectorMax: 16, uid: Packet.fromHex(
console.log(JSON.stringify(resp6)) // {"success":[1,1,1,1,... (truncated)]}
```

## Documents & Related links
## Related links

* [PN532.js API Reference](https://taichunmin.idv.tw/pn532.js/docs/)
* [PN532 User Manual v1.6 | NXP](https://www.nxp.com/docs/en/user-guide/141520.pdf)
* [MF1S50YYX_V1 v3.2 | NXP](https://www.nxp.com/docs/en/data-sheet/MF1S50YYX_V1.pdf)
* [A 2018 practical guide to hacking NFC/RFID](https://smartlockpicking.com/slides/Confidence_A_2018_Practical_Guide_To_Hacking_RFID_NFC.pdf)
* [Magic Cards Notes](https://github.com/RfidResearchGroup/proxmark3/blob/master/doc/magic_cards_notes.md)
* [elechouse/PN532: NFC library for Arduino](https://github.com/elechouse/PN532)
* [nfc-tools/libnfc](https://github.com/nfc-tools/libnfc)
* [RfidResearchGroup/RFIDtools: RFID Tools android app](https://github.com/RfidResearchGroup/RFIDtools)
6 changes: 3 additions & 3 deletions web/m1-uid4b-writer.pug
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ block content
small.form-text.text-muted(v-if="cardName") 此卡片已儲存為「#[code {{ cardName }}]」。
small.form-text.text-muted(v-else) 此卡片尚未儲存,請點下方「儲存卡片」輸入卡片名稱以便下次使用。
.row.mx-n1.mt-2
.col.px-1: button.btn.btn-block.btn-outline-success(type="button", @click="btnSaveCard") #[i.fa.fa-fw.fa-download] 儲存卡片
.col.px-1: button.btn.btn-block.btn-success(type="button", @click="btnReadCard") #[i.fa.fa-fw.fa-sign-out] 讀取卡片
.col.px-1: button.btn.btn-block.btn-warning(type="button", @click="btnSetUid") #[i.fa.fa-fw.fa-sign-in] 寫入卡片
.row.mx-n1.mt-2
.col.px-1: button.btn.btn-block.btn-outline-primary(type="button", @click="btnSaveCard") #[i.fa.fa-fw.fa-download] 儲存卡片
.col.px-1: button.btn.btn-block.btn-outline-success(type="button", @click="btnPickCard", :disabled="!h.cards.length") #[i.fa.fa-fw.fa-upload] 選擇卡片
.col.px-1: button.btn.btn-block.btn-outline-primary(type="button", @click="btnPickCard", :disabled="!h.cards.length") #[i.fa.fa-fw.fa-upload] 選擇卡片
.col.px-1: button.btn.btn-block.btn-primary(type="button", @click="btnSetUid") #[i.fa.fa-fw.fa-sign-in] 寫入卡片
template(v-if="h.page === 'setting'")
.card-body
.card-title.d-flex.align-items-center
Expand Down

0 comments on commit deb4c09

Please sign in to comment.