Skip to content

Commit

Permalink
docs: prepare for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
li0ard committed Aug 28, 2024
1 parent 485f958 commit bf140cf
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 2 deletions.
21 changes: 21 additions & 0 deletions .config/typedoc/config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// thx for @teidesu
const fs = require('node:fs')
const path = require('node:path')

module.exports = {
includeVersion: true,

excludePrivate: true,
excludeExternals: true,
excludeNotDocumented: true,
excludeInternal: true,
exclude: [
'**/*/node_modules',
'**/*.test.ts',
],
externalPattern: ['**/dist/**'],
name: 'tsemrtd',
out: '../../docs',
entryPoints: fs.readdirSync(path.join(__dirname, '../../src')).map(it => `../../src/${it}`),
entryPointStrategy: "expand"
}
55 changes: 55 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# thx for @teidesu

name: Docs

on:
push:
branches:
- main
pull_request:
branches: [ main ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build
run: |
bun i --frozen-lockfile
bun run build
- name: Build docs
run: |
bun run docs
touch docs/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs
# Deployment job
deploy:
# only run on releases
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,6 @@ dist
# WSQ fingerprint images
*.wsq

/index.ts
/index.ts

docs/
Binary file modified bun.lockb
Binary file not shown.
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@
"module": "index.ts",
"version": "0.1.1",
"type": "module",
"author": "li0ard",
"repository": {
"type": "git",
"url": "git+https://github.com/li0ard/tsemrtd.git"
},
"bugs": {
"url": "https://github.com/li0ard/tsemrtd/issues"
},
"homepage": "https://github.com/li0ard/tsemrtd#readme",
"description": "simple library for eMRTD. supports browsers, node, bun and more!",
"license": "MIT",
"scripts": {
"build": "rm -rf dist/ && tsc --project tsconfig.build.json",
"docs": "typedoc --options .config/typedoc/config.cjs"
},
"devDependencies": {
"@types/bun": "latest",
"@types/node-tlv": "^1.5.4"
"@types/node-tlv": "^1.5.4",
"typedoc": "^0.26.6"
},
"peerDependencies": {
"typescript": "^5.0.0"
Expand Down
3 changes: 3 additions & 0 deletions src/consts/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ interface AbstractBioTemplate {
imageData: Buffer
}

/** Decoded EF.COM datagroup */
export interface DecodedCom {
ldsVersion: string,
unicodeVersion: string,
tags: Buffer
}

/** Decoded EF.DG2 datagroup */
export interface DecodedImage extends AbstractBioTemplate {
/** Number of facial images */
numberOfFacialImages: number,
Expand Down Expand Up @@ -55,6 +57,7 @@ export interface DecodedImage extends AbstractBioTemplate {
deviceType: number
}

/** Decoded EF.DG3 datagroup */
export interface DecodedFingerprint extends AbstractBioTemplate {
/** ID of the biometric scanner */
captureDeviceId: number,
Expand Down
28 changes: 28 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
"declaration": true,

// Bundler mode
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,

// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false,
"outDir": "dist",
},
"include": ["src/index.ts"]
}

0 comments on commit bf140cf

Please sign in to comment.