Skip to content

Commit

Permalink
Version 0.0.2 (#1)
Browse files Browse the repository at this point in the history
### Changed
- Renaming
- Publish to npm via GitHub actions
- Test in GitHub actions
- Publish to npm via GitHub actions
- Support Imperial Aramaic
  • Loading branch information
amerharb authored Jan 6, 2024
1 parent 62c505c commit 3d4e5e0
Show file tree
Hide file tree
Showing 29 changed files with 520 additions and 73 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint and Test

on:
push:
branches: [ "main", "version/*" ]
pull_request:

jobs:
lint-test:
name: Lint & Test
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
node-version: [ 20.x, 18.x, 16.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn
- run: yarn lint
- run: yarn build
- run: yarn test
62 changes: 62 additions & 0 deletions .github/workflows/publish-latest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish Latest
on:
release:
types: [ released ]

env:
TAG_NAME: ${{ github.event.release.tag_name }}
PACKAGE_VERSION: "" # to be filled later after checkout

jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: fill package version
run: |
PACKAGE_VERSION=$(jq -r '.version' packages/abjad-convert/package.json)
echo "🔢 Package version: $PACKAGE_VERSION"
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: validate tag name
run: |
if [[ ! $TAG_NAME =~ ^v([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)$ ]]; then
echo "❌ Invalid tag name: $TAG_NAME not suitable for latest release"
exit 1
else
echo "✅ Valid tag name: $TAG_NAME"
fi
- name: validate version in package.json
run: |
if [[ ! $PACKAGE_VERSION =~ ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)$ ]]; then
echo "❌ Invalid version name: $PACKAGE_VERSION not suitable for latest release"
exit 1
else
echo "✅ Valid version: $PACKAGE_VERSION"
fi
- name: check if version in package.json is matching tag name
run: |
if [[ "v$PACKAGE_VERSION" != $TAG_NAME ]]; then
echo "❌ Version in package.json of abjad-convert: $PACKAGE_VERSION is not matching with tag name: $TAG_NAME"
exit 1
else
echo "✅ Version in package.json of abjad-convert is matching with tag name"
fi
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
always-auth: true
cache: yarn

- run: yarn workspace abjad-convert install --frozen-lockfile

- name: publish abjad-convert to npm
run: yarn workspace abjad-convert publish --access public --no-git-tag-version --new-version $PACKAGE_VERSION --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.ABJAD_CONVERT_PUBLISH_AUTH_TOKEN }}
60 changes: 60 additions & 0 deletions .github/workflows/publish-next.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish Next
on:
release:
types: [ prereleased ]

env:
TAG_NAME: ${{ github.event.release.tag_name }}
PACKAGE_VERSION: "" # to be filled later after checkout

jobs:
publish:
name: Publish next to npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: fill package version
run: |
PACKAGE_VERSION=$(jq -r '.version' packages/abjad-convert/package.json)
echo "🔢 Package version: $PACKAGE_VERSION"
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: validate tag name
run: |
if [[ ! $TAG_NAME =~ ^v([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-next\.([0-9]|[1-9][0-9]*)$ ]]; then
echo "❌ Invalid tag name: $TAG_NAME not suitable for next tag publish"
exit 1
else
echo "✅ Valid tag name: $TAG_NAME"
fi
- name: validate version in package.json
run: |
if [[ ! $PACKAGE_VERSION =~ ^([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)-next\.([0-9]|[1-9][0-9]*)$ ]]; then
echo "❌ Invalid version name: $PACKAGE_VERSION not suitable for next tag publish"
exit 1
else
echo "✅ Valid @next version: $PACKAGE_VERSION"
fi
- name: check if version in package.json is matching tag name
run: |
if [[ "v$PACKAGE_VERSION" != $TAG_NAME ]]; then
echo "❌ Version in package.json of $PACKAGE_NAME: $PACKAGE_VERSION is not matching with tag name: $TAG_NAME"
exit 1
else
echo "✅ Version: $PACKAGE_VERSION in package.json of $PACKAGE_NAME is matching with tag name: $TAG_NAME"
fi
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: https://registry.npmjs.org
always-auth: true
cache: yarn

- run: yarn workspace abjad-convert install --frozen-lockfile

- name: publish abjad-convert @next to npm
run: yarn workspace abjad-convert publish --access public --no-git-tag-version --new-version $PACKAGE_VERSION --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.ABJAD_CONVERT_PUBLISH_AUTH_TOKEN }}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog
<!-- https://keepachangelog.com/en/1.0.0/ -->

## [0.0.2] 2024-01-05
### Changed
- Renaming
- Publish to npm via GitHub actions

## [0.0.1] 2024-01-04
### Added
- Root project structure
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Abjad Convert Mono Repo
# Abjad Mono Repo

This is a monorepo for the Abjad Convert project.
## Abajd Convert package
[README](https://github.com/amerharb/abjad-convert/blob/main/packages/abjad-convert/README.md)

## Packages
### Abajd Convert
[README](https://github.com/amerharb/abjad/blob/main/packages/abjad-convert/README.md)

### Abjad Client
example of a client for the abjad convert package
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "abjad-convert-root",
"name": "abjad-root",
"private": true,
"workspaces": [
"packages/abjad-convert",
"packages/abjad-convert-client"
"packages/abjad-client"
],
"version": "0.0.1",
"version": "0.0.2",
"author": "Amer Harb",
"license": "ISC",
"scripts": {
Expand Down
18 changes: 18 additions & 0 deletions packages/abjad-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "abjad-client",
"private": true,
"version": "0.0.2",
"main": "dist/index.js",
"scripts": {
"prebuild": "rm -rf dist",
"build": "tsc",
"start": "node dist/index.js",
"test": "echo \"Error: no test specified\" && exit 0",
"dev": "ts-node src/index.ts",
"lint": "npx eslint . --max-warnings 0",
"lint-fix": "npx eslint . --fix"
},
"dependencies": {
"abjad-convert": "next"
}
}
38 changes: 38 additions & 0 deletions packages/abjad-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { Abjad, convert } from 'abjad-convert'

log('Abjad Convert')

const arabic = 'ا ب ت ج د خ'
log(`convert Arabic text ${arabic} to Ugaritic`)
log(calmConvert(arabic, Abjad.Arabic, Abjad.Ugaritic))
log(`convert Arabic text ${arabic} to Phoenician`)
log(calmConvert(arabic, Abjad.Arabic, Abjad.Phoenician))

const ugaritic = '𐎀 𐎁 𐎚 𐎂 𐎄 𐎃'
log(`convert Ugaritic text ${ugaritic} to Arabic`)
log(calmConvert(ugaritic, Abjad.Ugaritic, Abjad.Arabic))
log(`convert Ugaritic text ${ugaritic} to Phoenician`)
log(calmConvert(ugaritic, Abjad.Ugaritic, Abjad.Phoenician))

const phoenician = '𐤀 𐤁 𐤂 𐤃 𐤄 𐤅'
log(`convert Phoenician text ${phoenician} to Arabic`)
log(calmConvert(phoenician, Abjad.Phoenician, Abjad.Arabic))
log(`convert Phoenician text ${phoenician} to Ugaritic`)
log(calmConvert(phoenician, Abjad.Phoenician, Abjad.Ugaritic))

log(calmConvert('مرحبا', Abjad.Arabic, Abjad.Phoenician))
log(calmConvert('مرحبا', Abjad.Arabic, Abjad.Ugaritic))
log(calmConvert('مرحبا', Abjad.Arabic, Abjad.ImperialAramaic))

function calmConvert(source: string, from: Abjad, to: Abjad): string {
try {
return convert(source, from, to)
} catch (e: any) {
return e.message
}
}

function log(message: string): void {
// eslint-disable-next-line no-console
console.log(message)
}
File renamed without changes.
15 changes: 0 additions & 15 deletions packages/abjad-convert-client/package.json

This file was deleted.

32 changes: 0 additions & 32 deletions packages/abjad-convert-client/src/index.ts

This file was deleted.

6 changes: 6 additions & 0 deletions packages/abjad-convert/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
<!-- https://keepachangelog.com/en/1.0.0/ -->

## [0.0.2] 2024-01-05
### Added
- Test in GitHub actions
- Publish to npm via GitHub actions
- Support Imperial Aramaic

## [0.0.1] 2024-01-04
### Added
- Initial project covert between 3 languages Arabic, Phoenician and Ugaritic
10 changes: 8 additions & 2 deletions packages/abjad-convert/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Abjad Convert

Abjad Convert is a package for converting Abjad alphabets phonetic word.
**abjad-convert** is a package for converting Abjad alphabets phonetically.

currently supported alphabets:
current supported alphabets:
- Arabic
- Uguritic
- Phoenician
- Imperial Aramaic

## How to use
npm:
Expand All @@ -22,8 +23,13 @@ Java Script:
import { convert, Abjad } from 'abjad-convert';

const arabicWord = 'مرحبا';

const phoenicianWord = convert(arabicWord, Abjad.Arabic, Abjad.Phoenician);
console.log(phoenicianWord); // 𐤌𐤓𐤇𐤁𐤀

const ugariticWord = convert(arabicWord, Abjad.Arabic, Abjad.Ugaritic);
console.log(ugariticWord); // 𐎎𐎗𐎈𐎁𐎀

const imperialAramaicWord = convert(arabicWord, Abjad.Arabic, Abjad.ImperialAramaic);
console.log(imperialAramaicWord); // 𐡌𐡓𐡇𐡁𐡀
```
5 changes: 3 additions & 2 deletions packages/abjad-convert/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "abjad-convert",
"version": "0.0.1",
"version": "0.0.2",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"files": [
Expand All @@ -9,7 +9,7 @@
"LICENSE",
"README.md"
],
"repository": "git@github.com:amerharb/abjad-convert.git",
"repository": "git@github.com:amerharb/abjad.git",
"author": "Amer Harb",
"email": "abjad@amerharb.com",
"keywords": [
Expand All @@ -21,6 +21,7 @@
],
"license": "ISC",
"scripts": {
"prebuild": "rm -rf dist",
"build": "tsc",
"start": "node dist/index.js",
"test": "jest",
Expand Down
Loading

0 comments on commit 3d4e5e0

Please sign in to comment.