Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpiler WIP #23

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: testing
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
unit_test:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: '20'
- uses: actions/checkout@v3
- name: Prepare env
run: |
rm -Rf transpiled
rm package*.json
npm -g install @abaplint/transpiler-cli
npm install @abaplint/runtime
- name: Build unit tests
run: |
echo "Building ..."
abap_transpile abap_transpile.json
- name: Run unit tests
run: |
echo "Running unit tests ..."
node transpiled/index.mjs
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
abaplint-deps
transpiled
node_modules
# package.json
# package-lock.json
30 changes: 30 additions & 0 deletions abap_transpile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"input_folder": "{src,deps}",
"input_filter": [
"deps/",
"src/zcl*",
"src/zif*",
"src/zcx*"
],
"output_folder": "transpiled",
"libs": [
{
"url": "https://github.com/open-abap/open-abap-core"
}
],
"write_unit_tests": true,
"write_source_map": true,
"options": {
"ignoreSyntaxCheck": false,
"addFilenames": true,
"addCommonJS": true,
"unknownTypes": "runtimeError",
"keywords": ["return", "in", "class"],
"skip": [
{ "object": "ZCL_TEXT2TAB_SERIALIZER", "class": "ltcl_text2tab_serializer_test", "method": "serialize_field_cunit", "note": "CUNIT issue" },
{ "object": "ZCL_TEXT2TAB_PARSER", "class": "ltcl_text2tab_parser_test", "method": "parse_field_special", "note": "CUNIT issue" },
{ "object": "ZCL_TEXT2TAB_PARSER", "class": "ltcl_text2tab_parser_test", "method": "parse_df16", "note": "TypeError: abap.types.typeTodoDecFloat16Type is not a constructor" },
{ "object": "ZCL_TEXT2TAB_PARSER", "class": "ltcl_text2tab_parser_test", "method": "parse_ignore_convexit", "note": "CUNIT issue" }
]
}
}
16 changes: 16 additions & 0 deletions deps/veri_alpha.doma.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DOMA" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DD01V>
<DOMNAME>VERI_ALPHA</DOMNAME>
<DDLANGUAGE>E</DDLANGUAGE>
<DATATYPE>CHAR</DATATYPE>
<LENG>000010</LENG>
<OUTPUTLEN>000010</OUTPUTLEN>
<CONVEXIT>ALPHA</CONVEXIT>
<DDTEXT>VERI_ALPHA</DDTEXT>
</DD01V>
</asx:values>
</asx:abap>
</abapGit>
21 changes: 21 additions & 0 deletions deps/veri_alpha.dtel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_DTEL" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DD04V>
<ROLLNAME>VERI_ALPHA</ROLLNAME>
<DDLANGUAGE>E</DDLANGUAGE>
<DOMNAME>VERI_ALPHA</DOMNAME>
<SCRLEN1>10</SCRLEN1>
<SCRLEN2>15</SCRLEN2>
<SCRLEN3>20</SCRLEN3>
<DDTEXT>VERI_ALPHA</DDTEXT>
<SCRTEXT_S>ALPHA</SCRTEXT_S>
<SCRTEXT_M>ALPHA</SCRTEXT_M>
<SCRTEXT_L>ALPHA</SCRTEXT_L>
<DTELMASTER>D</DTELMASTER>
<REFKIND>D</REFKIND>
</DD04V>
</asx:values>
</asx:abap>
</abapGit>
95 changes: 57 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"name": "text2tab",
"version": "1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a trick: you can set private: true so that it cannot accidently be published to npm

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"private": true,
"description": "abap tab-delimited tax parser/serializer",
"main": "js-transpiled/index.mjs",
"scripts": {
"test": "node js-transpiled/index.mjs",
"transpile": "abap_transpile abap_transpile.json"
"test": "npm run build && npm run run_ut",
"run_ut": "node transpiled/index.mjs",
"build": "abap_transpile abap_transpile.json"
},
"repository": {
"type": "git",
Expand All @@ -19,8 +18,8 @@
},
"homepage": "https://github.com/sbcgua/text2tab#readme",
"dependencies": {
"@abaplint/cli": "^2.79.29",
"@abaplint/runtime": "^1.6.47",
"@abaplint/transpiler-cli": "^1.6.47"
"@abaplint/cli": "^2.113.63",
"@abaplint/runtime": "^2.10.20",
"@abaplint/transpiler-cli": "^2.10.20"
}
}
Loading