Skip to content

Commit

Permalink
Feat/export package version constant (#4065)
Browse files Browse the repository at this point in the history
* Added auto-generated config module `env/data.js` for importing package environment vars without importing the whole `package.json`;
Refactored `http.js` to use `env/data.js` instead of package.json;

* Added `env/data.js`;
Added `env/README.md`;

* Export package version constant;
  • Loading branch information
DigitalBrainJS committed Sep 16, 2021
1 parent 66d188d commit fffa02c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export interface AxiosStatic extends AxiosInstance {
Cancel: CancelStatic;
CancelToken: CancelTokenStatic;
Axios: typeof Axios;
readonly VERSION: string;
isCancel(value: any): boolean;
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;
Expand Down
1 change: 1 addition & 0 deletions lib/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ axios.Axios = Axios;
axios.Cancel = require('./cancel/Cancel');
axios.CancelToken = require('./cancel/CancelToken');
axios.isCancel = require('./cancel/isCancel');
axios.VERSION = require('./env/data').version;

// Expose all/spread
axios.all = function all(promises) {
Expand Down
1 change: 1 addition & 0 deletions test/specs/instance.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('instance', function () {
'all',
'spread',
'isAxiosError',
'VERSION',
'default'].indexOf(prop) > -1) {
continue;
}
Expand Down

0 comments on commit fffa02c

Please sign in to comment.