Skip to content
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
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintrc.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/lactame.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ on:
types: [published]

env:
NODE_VERSION: 18.x
NODE_VERSION: 24.x

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Get package name
run: echo "PACKAGE_NAME=$(jq .name package.json | tr -d '"')" >> $GITHUB_ENV
- uses: actions/setup-node@v4
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm install
run: npm ci
- name: Build project
run: npm run build
- name: Deploy to lactame.com
Expand Down
File renamed without changes.
33 changes: 8 additions & 25 deletions .github/workflows/typedoc.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
name: Deploy TypeDoc on GitHub pages
name: TypeDoc

on:
workflow_dispatch:
release:
types: [published]

env:
NODE_VERSION: 18.x
ENTRY_FILE: 'src/index.ts'

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm install
- name: Build documentation
uses: zakodium/typedoc-action@v2
with:
entry: ${{ env.ENTRY_FILE }}
- name: Deploy to GitHub pages
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
token: ${{ secrets.BOT_TOKEN }}
branch: gh-pages
folder: docs
clean: true
typedoc:
# Documentation: https://github.com/zakodium/workflows#typedoc
uses: zakodium/workflows/.github/workflows/typedoc.yml@typedoc-v1
with:
entry: 'src/index.ts'
secrets:
github-token: ${{ secrets.BOT_TOKEN }}
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
package-lock=false
ignore-scripts=true
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# mrz

Parse MRZ (Machine Readable Zone) from identity documents.

<h3 align="center">

<a href="https://www.zakodium.com">
<img src="https://www.zakodium.com/brand/zakodium-logo-white.svg" width="50" alt="Zakodium logo" />
</a>

<p>
Maintained by <a href="https://www.zakodium.com">Zakodium</a>
</p>
</h3>

[![NPM version][npm-image]][npm-url]
[![build status][ci-image]][ci-url]
[![npm download][download-image]][download-url]
# mrz

</h3>
[![NPM version](https://img.shields.io/npm/v/mrz.svg)](https://www.npmjs.com/package/mrz)
[![npm download](https://img.shields.io/npm/dm/mrz.svg)](https://www.npmjs.com/package/mrz)
[![test coverage](https://img.shields.io/codecov/c/github/cheminfo/mrz.svg)](https://codecov.io/gh/cheminfo/mrz)
[![license](https://img.shields.io/npm/l/mrz.svg)](https://github.com/cheminfo/mrz/blob/main/LICENSE)

Parse MRZ (Machine Readable Zone) from identity documents.

## Installation

`$ npm install mrz`
```console
npm install mrz
```

## Example

Expand Down Expand Up @@ -128,10 +128,3 @@ https://fr.wikipedia.org/wiki/Carte_nationale_d%27identit%C3%A9_en_France#Codage
## License

[MIT](./LICENSE)

[npm-image]: https://img.shields.io/npm/v/mrz.svg
[npm-url]: https://npmjs.org/package/mrz
[ci-image]: https://github.com/cheminfo/mrz/workflows/Node.js%20CI/badge.svg?branch=main
[ci-url]: https://github.com/cheminfo/mrz/actions?query=workflow%3A%22Node.js+CI%22
[download-image]: https://img.shields.io/npm/dm/mrz.svg
[download-url]: https://npmjs.org/package/mrz
4 changes: 0 additions & 4 deletions babel.config.js

This file was deleted.

2 changes: 0 additions & 2 deletions builder/.eslintrc.yml

This file was deleted.

30 changes: 15 additions & 15 deletions builder/createStatesJs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use strict';

const fs = require('fs');
import fs from 'node:fs';

function readIsoStates() {
const states = fs
.readFileSync(`${__dirname}/states-iso3166.tsv`, 'utf8')
.readFileSync(`${import.meta.dirname}/states-iso3166.tsv`, 'utf8')
.split('\n')
.filter(
(c) =>
Expand All @@ -22,16 +20,14 @@ function readIsoStates() {

function readAdditionalStates() {
const states = fs
.readFileSync(`${__dirname}/states.txt`, 'utf8')
.readFileSync(`${import.meta.dirname}/states.txt`, 'utf8')
.split('\n')
.filter((c) => c !== '' && !c.startsWith('#'));

const statesObject = {};
for (let state of states) {
const split = state.split(' ');
statesObject[split[split.length - 1]] = split
.slice(0, split.length - 2)
.join(' ');
statesObject[split.at(-1)] = split.slice(0, -2).join(' ');
}

return statesObject;
Expand All @@ -42,10 +38,14 @@ const statesObject = {
...readAdditionalStates(),
};

const result = [];
result.push(`const states = ${JSON.stringify(statesObject, null, 2)};`);
result.push('Object.freeze(states);');
result.push('export default states;');
result.push('');

fs.writeFileSync(`${__dirname}/../src/generated/states.ts`, result.join('\n'));
const result = [
`const states: Record<string, string> = ${JSON.stringify(statesObject, null, 2)};`,
'Object.freeze(states);',
'export default states;',
'',
];

fs.writeFileSync(
`${import.meta.dirname}/../src/generated/states.ts`,
result.join('\n'),
);
9 changes: 9 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig, globalIgnores } from 'eslint/config';
import ts from 'eslint-config-cheminfo-typescript/base';
import unicorn from 'eslint-config-cheminfo-typescript/unicorn';

export default defineConfig(
globalIgnores(['coverage', 'dist', 'lib']),
ts,
unicorn,
);
Loading