From 1da2c887e508401184c0640a646c703218a04cb0 Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 09:17:04 +0200 Subject: [PATCH 01/10] test js cli --- .github/workflows/test-builds.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 72502b1..703c19d 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -46,6 +46,11 @@ jobs: - name: Test run: npm test + - name: Test CLI + run: | + npm install --global + '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' + build-py: runs-on: ubuntu-latest From d0108f6f7e75b3371c0a4b2ed7d7ca4f3efe0621 Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 09:20:35 +0200 Subject: [PATCH 02/10] wip --- .github/workflows/test-builds.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 703c19d..2c83cb1 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -49,7 +49,7 @@ jobs: - name: Test CLI run: | npm install --global - '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' + sh -c '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' build-py: @@ -64,6 +64,7 @@ jobs: build-swift: + if: 0 strategy: matrix: BUILD_TYPE: [debug, release] From 6e94788860f18db8874afc8fc58dd74183be5533 Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 09:28:54 +0200 Subject: [PATCH 03/10] wip --- .github/workflows/test-builds.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 2c83cb1..e901702 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -12,6 +12,7 @@ env: jobs: build-c: + if: 0 strategy: matrix: BUILD_TYPE: [Debug, Release] @@ -49,7 +50,7 @@ jobs: - name: Test CLI run: | npm install --global - sh -c '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' + sh -c '[ "$(npx uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' build-py: From 264d2bcd397b08920329ffd227c11919db6f07d7 Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 09:41:20 +0200 Subject: [PATCH 04/10] wip --- .github/workflows/test-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index e901702..1496917 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -49,7 +49,7 @@ jobs: - name: Test CLI run: | - npm install --global + npm install sh -c '[ "$(npx uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' From a069fbb935a3cf950a6045d83a469d30e578da58 Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 09:51:54 +0200 Subject: [PATCH 05/10] wip --- .github/workflows/test-builds.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 1496917..5cfc244 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -49,8 +49,8 @@ jobs: - name: Test CLI run: | - npm install - sh -c '[ "$(npx uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' + npm install git+https://github.com/paiv/uklatn.git#wip + sh -c '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' build-py: From 13da460c7c323754f93d4bf0ca69534210c43511 Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 09:54:20 +0200 Subject: [PATCH 06/10] wip --- .github/workflows/test-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 5cfc244..f374147 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -49,7 +49,7 @@ jobs: - name: Test CLI run: | - npm install git+https://github.com/paiv/uklatn.git#wip + npm install --global git+https://github.com/paiv/uklatn.git#wip sh -c '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' From 56fcb4eb87eede80cb85cef2b283baa65ea0bf2a Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 09:56:00 +0200 Subject: [PATCH 07/10] wip --- js/cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/cli.js b/js/cli.js index 2962011..5f0dd1a 100755 --- a/js/cli.js +++ b/js/cli.js @@ -1,6 +1,6 @@ #!/usr/bin/env node import path from 'node:path'; -import * as uklatn from 'uklatn'; +import * as uklatn from './uklatn.js'; const _Usage = '[-h] [-t TABLE] [-c] [-l] text [text ...]\n'; From ab854ae0859698c59ce0d39d93a98d259a370337 Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 10:02:01 +0200 Subject: [PATCH 08/10] wip7 --- .github/workflows/test-builds.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index f374147..09ea923 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -47,11 +47,18 @@ jobs: - name: Test run: npm test - - name: Test CLI + - name: Install run: | npm install --global git+https://github.com/paiv/uklatn.git#wip + + - name: Test CLI + run: | sh -c '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' + - name: Test import + run: | + echo 'import encode from "uklatn"; encode("імпорт");' | node - + build-py: runs-on: ubuntu-latest From 37e1cc5df3a8fd1ce3ef631e030c996a8d07815d Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 10:05:18 +0200 Subject: [PATCH 09/10] wip8 --- .github/workflows/test-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 09ea923..13296ad 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -57,7 +57,7 @@ jobs: - name: Test import run: | - echo 'import encode from "uklatn"; encode("імпорт");' | node - + echo 'const { encode } = require("uklatn"); encode("імпорт");' | node - build-py: From 1e7f6937680047b94d40644ebac3688fc8ef9481 Mon Sep 17 00:00:00 2001 From: Pavlo Ivashkov Date: Sun, 10 Nov 2024 10:12:26 +0200 Subject: [PATCH 10/10] wip --- .github/workflows/test-builds.yml | 6 +----- js/uklatn.js | 3 +++ tools/gen/gen_js.py | 3 +++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index 13296ad..5e35e32 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -49,16 +49,12 @@ jobs: - name: Install run: | - npm install --global git+https://github.com/paiv/uklatn.git#wip + npm install --global - name: Test CLI run: | sh -c '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]' - - name: Test import - run: | - echo 'const { encode } = require("uklatn"); encode("імпорт");' | node - - build-py: runs-on: ubuntu-latest diff --git a/js/uklatn.js b/js/uklatn.js index 729f7a4..869545e 100644 --- a/js/uklatn.js +++ b/js/uklatn.js @@ -252,3 +252,6 @@ export function decode(text, table) { if (tr === undefined) { throw new Error("unknown table " + JSON.stringify(table)); } return tr.transform(text); } + + +export default { encode, decode }; diff --git a/tools/gen/gen_js.py b/tools/gen/gen_js.py index 5c84dce..767f28a 100755 --- a/tools/gen/gen_js.py +++ b/tools/gen/gen_js.py @@ -195,6 +195,9 @@ def _emit_tr(cname, rules, file): if (tr === undefined) {{ throw new Error("unknown table " + JSON.stringify(table)); }} return tr.transform(text); }} + + +export default {{ encode, decode }}; ''' text = template.format(**context) return text