Skip to content

Commit

Permalink
Publishing both sync and async apis
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jan 23, 2024
1 parent 957a66b commit 1cccc05
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
32 changes: 22 additions & 10 deletions typescript/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
TSC=$(shell pwd)/node_modules/.bin/tsc
PLUGDIR=$(shell r2 -H R2_USER_PLUGINS)
ESLINT=$(shell pwd)/node_modules/.bin/eslint
TSI=sh tools/tsi.sh

all: node_modules
$(MAKE) build

vs:
open -a "Visual Studio Code" async || vscode .


SYNCREGEX=
SYNCREGEX+=-e 's,await ,,g'
SYNCREGEX+=-e 's,async ,,g'
Expand All @@ -18,7 +18,6 @@ SYNCREGEX+=-e 's/Promise<\(.*\)>/\1/'

lint:
$(ESLINT) async/*.ts
#eslint async/*.ts

sync:
rm -rf sync/*.ts
Expand All @@ -27,6 +26,13 @@ sync:
rm -f sync/*.bak
cp async/tsconfig.json sync

abuild: sync
rm -rf build
mkdir build
cp -f async/*.ts build
cp -rf async/tsconfig.json build
cd build && $(TSC)

build: sync
rm -rf build
mkdir build
Expand Down Expand Up @@ -90,18 +96,24 @@ webdoc:
rm -rf .tmp

npm publish pub:
# Publishing the sync api
$(MAKE)
npm publish
cp -f package.json package-lock.json build
cd build && npm publish
# Publishing the async api
$(MAKE) abuild
sed -e 's,r2papi",r2papi-async",' < package.json > build/package.json
sed -e 's,r2papi",r2papi-async",' < package-lock.json > build/package-lock.json
cd build && npm publish

unpublish:
$(MAKE)
npm unpublish @${MODVER}
unpub unpublish:
npm unpublish r2papi@${MODVER}

r2wip.d.ts:
sh tsi.sh ij >> r2wip.d.ts
sh tsi.sh pdj >> r2wip.d.ts
sh tsi.sh afij >> r2wip.d.ts
sh tsi.sh abj >> r2wip.d.ts
$(TSI) ij >> r2wip.d.ts
$(TSI) pdj >> r2wip.d.ts
$(TSI) afij >> r2wip.d.ts
$(TSI) abj >> r2wip.d.ts

clean:
rm -rf *.qjs *.r2.js one.* dist __dist *.zip *.d.ts *.js
4 changes: 2 additions & 2 deletions typescript/package-lock.json

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

4 changes: 2 additions & 2 deletions typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "r2papi",
"version": "0.4.0",
"version": "0.4.4",
"description": "r2api on top of r2pipe for typescript and js",
"author": "[email protected]",
"homepage": "http://www.radare.org",
Expand All @@ -25,7 +25,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/radareorg/radare2-r2papi"
"url": "git+https://github.com/radareorg/radare2-r2papi.git"
},
"keywords": [
"radare",
Expand Down

0 comments on commit 1cccc05

Please sign in to comment.