File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434 - name : Live Tests (TS ESM)
3535 run : npm run ts-test-live
3636 - name : CJS test
37- run : npm run test-cjs
37+ run : npm run test-cjs
38+ - name : Package test
39+ run : npm run package-test
Original file line number Diff line number Diff line change 1+ # Initally ignore all files
2+ *
3+
4+ # Files to include
5+ ! package.json
6+ ! package-lock.json
7+ ! LICENSE.txt
8+ ! README.md
9+
10+ # Folders to include
11+ ! src /** /*
12+ ! dist /** /*
13+
Original file line number Diff line number Diff line change 3434 "codacy" : " cat ./coverage/lcov.info | codacy-coverage -v" ,
3535 "codecov" : " codecov" ,
3636 "bundle-cjs" : " mkdir -p dist/cjs && rollup -c rollup.config.js" ,
37+ "package-test" : " ./tests/package.sh" ,
3738 "publishPackage" : " sh publish.sh && git push && git push --tags && npm publish" ,
3839 "rollup-plugin-execute" : " ^1.1.1"
3940 },
Original file line number Diff line number Diff line change 1+ const Binance = require ( 'node-binance-api' ) ;
2+
3+ const client = new Binance ( )
4+
5+ async function main ( ) {
6+ const ticker = await client . prices ( 'BTCUSDT' )
7+ console . log ( ticker )
8+ }
9+
10+ main ( )
Original file line number Diff line number Diff line change 1+ import Binance from 'node-binance-api'
2+ const client = new Binance ( )
3+
4+ async function main ( ) {
5+ const ticker = await client . bookTickers ( 'BTCUSDT' )
6+ const res = ticker [ 'BTCUSDT' ] ;
7+ console . log ( res )
8+ }
9+
10+ main ( )
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ npm pack . --silent
4+ mv node-binance-api* .tgz ./tests/package-test/
5+ cd ./tests/package-test
6+ npm init -y > /dev/null
7+ npm install node-binance-api* .tgz
8+ node test-esm.mjs
9+ return_code=$?
10+ node test-cjs.cjs
11+ cjs_return_code=$?
12+ rm -rf node_modules node-binance-api* .tgz package-lock.json package.json
13+
14+ if [ $return_code -eq 0 ] && [ $cjs_return_code -eq 0 ]; then
15+ echo " Package test successful"
16+ exit 0
17+ else
18+ echo " Package test failed"
19+ exit 1
20+ fi
You can’t perform that action at this time.
0 commit comments