Skip to content

Commit

Permalink
Merge pull request #50 from blocknative/develop
Browse files Browse the repository at this point in the history
Release 2.0.1
  • Loading branch information
lnbc1QWFyb24 authored Apr 17, 2020
2 parents d8a37ce + bf40812 commit 294d12c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 32 deletions.
12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:
- run: npm publish --dry-run
- run: ls -al
- run: pwd
- run: gzip -9 /root/project/dist/bnc-sdk.js
- run: mv /root/project/dist/bnc-sdk.js.gz /root/project/dist/bnc-sdk.js
- run: gzip -9 /root/project/dist/iife/index.js
- run: mv /root/project/dist/iife/index.js.gz /root/project/dist/iife/index.js
- run: ls -al
- run: echo export VERSION=`awk '/version/{gsub(/("|",)/,"",$2);print $2};' package.json | sed 's/\./-/g'` >> $BASH_ENV
- run: mkdir /root/project/deploy-temp
- run: mkdir /root/project/deploy-temp/${VERSION}
- run: mv /root/project/dist/*.js /root/project/deploy-temp/${VERSION}/
- run: mv /root/project/dist/iife/*.js /root/project/deploy-temp/${VERSION}/
- run: aws s3 sync /root/project/deploy-temp/${VERSION}/ s3://staging.sdk.blocknative.com/${VERSION}/ --content-type "text/javascript" --content-encoding "gzip" --cache-control "max-age=31536000" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
deploy_prod:
docker:
Expand All @@ -50,13 +50,13 @@ jobs:
- run: sudo npm i -g add npm-cli-login
- run: NPM_USER=$NPM_USERNAME NPM_EMAIL=$NPM_EMAIL NPM_PASS=$NPM_PASSWORD npm-cli-login
- run: npm publish
- run: gzip -9 /root/project/dist/bnc-sdk.js
- run: mv /root/project/dist/bnc-sdk.js.gz /root/project/dist/bnc-sdk.js
- run: gzip -9 /root/project/dist/iife/index.js
- run: mv /root/project/dist/iife/index.js.gz /root/project/dist/iife/index.js
- run: ls -al
- run: echo export VERSION=`awk '/version/{gsub(/("|",)/,"",$2);print $2};' package.json | sed 's/\./-/g'` >> $BASH_ENV
- run: mkdir /root/project/deploy-temp
- run: mkdir /root/project/deploy-temp/${VERSION}
- run: mv /root/project/dist/*.js /root/project/deploy-temp/${VERSION}/
- run: mv /root/project/dist/iife/*.js /root/project/deploy-temp/${VERSION}/
- run: aws s3 sync /root/project/deploy-temp/${VERSION}/ s3://sdk.blocknative.com/${VERSION}/ --content-type "text/javascript" --content-encoding "gzip" --cache-control "max-age=31536000" --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
workflows:
version: 2
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none"
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "bnc-sdk",
"version": "2.0.0",
"version": "2.0.1",
"description": "SDK to connect to the blocknative backend via a websocket connection",
"keywords": [
"ethereum",
"websocket",
"blocknative",
"notifications"
],
"main": "dist/bnc-sdk.js",
"module": "dist/bnc-sdk.esm.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"typings": "dist/types/src/index.d.ts",
"files": [
"dist"
Expand All @@ -21,7 +21,7 @@
},
"license": "MIT",
"scripts": {
"build": "rimraf dist && rollup -c && babel dist/bnc-sdk.esm.js -o dist/bnc-sdk.esm.js && babel dist/bnc-sdk.js -o dist/bnc-sdk.js",
"build": "rimraf dist && rollup -c && babel dist/esm/index.js -o dist/esm/index.js && babel dist/cjs/index.js -o dist/cjs/index.js",
"test": "echo \"TBD\" && exit 0"
},
"devDependencies": {
Expand Down
40 changes: 29 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,50 @@ import json from '@rollup/plugin-json'
import typescript from 'rollup-plugin-typescript2'
import commonjs from '@rollup/plugin-commonjs'

const pkg = require('./package.json')

export default [
{
input: `src/index.ts`,
output: {
file: pkg.main,
dir: 'dist/iife/',
format: 'iife',
name: 'bncSdk',
format: 'umd',
globals: ['SturdyWebSocket']
globals: ['SturdyWebSocket', 'crypto-es'],
},
plugins: [
json(),
resolve(),
commonjs(),
typescript({ useTsconfigDeclarationDir: true })
]
typescript({ useTsconfigDeclarationDir: true, clean: true }),
],
},
{
input: `src/index.ts`,
output: { file: pkg.module, format: 'esm' },
output: [
{
format: 'esm',
dir: 'dist/esm/',
},
],
external: ['sturdy-websocket', 'crypto-es'],
plugins: [
json(),
resolve(),
typescript({ useTsconfigDeclarationDir: true })
]
}
typescript({ useTsconfigDeclarationDir: true, clean: true }),
],
},
{
input: `src/index.ts`,
output: [
{
format: 'cjs',
dir: 'dist/cjs/',
},
],
plugins: [
json(),
resolve(),
commonjs({ include: /node_modules/ }),
typescript({ useTsconfigDeclarationDir: true, clean: true }),
],
},
]
6 changes: 3 additions & 3 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface TransactionData {
}

export interface TransactionEvent {
emitterResult: undefined | boolean | NotificationObject
emitterResult: void | boolean | NotificationObject
transaction: TransactionData
}

Expand All @@ -61,7 +61,7 @@ export interface Emitter {
[key: string]: EmitterListener
}
on: (eventCode: string, listener: EmitterListener) => void
emit: (state: TransactionData) => boolean | undefined | NotificationObject
emit: (state: TransactionData) => boolean | void | NotificationObject
}

export interface Ac {
Expand Down Expand Up @@ -109,7 +109,7 @@ export interface TransactionHandler {
}

export interface EmitterListener {
(state: TransactionData): boolean | undefined | NotificationObject
(state: TransactionData): boolean | undefined | NotificationObject | void
}

export interface Transaction {
Expand Down
11 changes: 4 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"compilerOptions": {
"moduleResolution": "node",
"target": "es5",
"module": "es2015",
"lib": ["es2015", "es2016", "es2017", "dom"],
"target": "ESNEXT",
"module": "ESNEXT",
"strict": true,
"sourceMap": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"declarationDir": "dist/types",
"outDir": "dist/lib",
"typeRoots": ["node_modules/@types"],
"esModuleInterop": true,
"resolveJsonModule": true
},
"include": ["src"]
"include": ["src/**/*"]
}

0 comments on commit 294d12c

Please sign in to comment.