diff --git a/.gitignore b/.gitignore index fd7edac..5c297ed 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ umd/ coverage/ .nyc_output/ .vscode/ +.rts2* +dist/ package-lock.json diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..096d49c --- /dev/null +++ b/NOTICE @@ -0,0 +1,10 @@ +@axa-ch/retry-axios + +This product is a derivative work of the original software "retry-axios" developed by Justin Beckwith available at: +https://github.com/JustinBeckwith/retry-axios +License Apacha-2.0 + +This redistribution contains following contributions: + +Bundling and packaging for ES-Modules, CommonJS and UMD provided by Andreas Deuschlinger at: +https://github.com/JustinBeckwith/retry-axios/pull/107 \ No newline at end of file diff --git a/README.md b/README.md index c295257..e18c6d4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -# retry-axios +# @axa-ch/retry-axios + +**Note:** This is a redistribution of [`retry-axios`](https://github.com/JustinBeckwith/retry-axios) with following modifications: + +- Bundling and packaging for ES-Modules, CommonJS and UMD provided at: + https://github.com/JustinBeckwith/retry-axios/pull/107 > Use Axios interceptors to automatically retry failed requests. Super flexible. Built in exponential backoff. @@ -12,7 +17,7 @@ ## Installation ```sh -npm install retry-axios +npm install @axa-ch/retry-axios ``` ## Usage @@ -21,14 +26,14 @@ To use this library, import it alongside of `axios`: ```js // Just import rax and your favorite version of axios -const rax = require('retry-axios'); +const rax = require('@axa-ch/retry-axios'); const axios = require('axios'); ``` Or, if you're using TypeScript / es modules: ```js -import * as rax from 'retry-axios'; +import * as rax from '@axa-ch/retry-axios'; import axios from 'axios'; ``` diff --git a/package.json b/package.json index 58dd039..fa73c93 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,12 @@ { - "name": "retry-axios", - "version": "0.0.0", + "name": "@axa-ch/retry-axios", + "version": "2.1.2", "description": "Retry HTTP requests with Axios.", - "main": "./build/src/index.js", - "types": "./build/src/index.d.ts", + "source": "src/index.ts", + "main": "dist/index.js", + "module": "dist/index.module.js", + "unpkg": "dist/index.umd.js", + "types": "dist/index.d.ts", "engines": { "node": ">=10.0.0" }, @@ -16,10 +19,11 @@ "clean": "gts clean", "codecov": "c8 report --reporter=json && codecov -f coverage/*.json", "fix": "gts fix", - "compile": "tsc -p .", + "compile": "tsc -p tsconfig.compile.json", + "build": "microbundle --tsconfig=tsconfig.json", "umd": "rm -rf umd && babel build/src -d umd --source-maps", "test": "c8 mocha build/test", - "prepare": "npm run compile", + "prepare": "npm run build", "pretest": "npm run compile", "license-check": "jsgl --local ." }, @@ -28,8 +32,15 @@ "retry" ], "author": { - "name": "Justin Beckwith" + "name": "Justin Beckwith", + "url": "https://github.com/JustinBeckwith" }, + "contributors": [ + { + "name": "Andreas Deuschlinger", + "url": "https://github.com/axa-ch" + } + ], "license": "Apache-2.0", "peerDependencies": { "axios": "*" @@ -47,13 +58,14 @@ "codecov": "^3.5.0", "gts": "^2.0.0", "js-green-licenses": "^1.0.0", + "microbundle": "^0.11.0", "mocha": "^7.0.0", "nock": "^12.0.0", "semantic-release": "^17.0.4", "typescript": "~3.8.0" }, "files": [ - "build/src" + "dist" ], "c8": { "exclude": [ diff --git a/tsconfig.compile.json b/tsconfig.compile.json new file mode 100644 index 0000000..26f33cd --- /dev/null +++ b/tsconfig.compile.json @@ -0,0 +1,11 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build" + }, + "include": [ + "src/*.ts", + "test/*.ts" + ] +} diff --git a/tsconfig.json b/tsconfig.json index 26f33cd..e0f401a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,10 @@ { "extends": "./node_modules/gts/tsconfig-google.json", "compilerOptions": { - "rootDir": ".", - "outDir": "build" + "outDir": "dist", + "module": "ES2015" }, "include": [ - "src/*.ts", - "test/*.ts" + "src/*.ts" ] }