Skip to content

Commit

Permalink
Upgrade npm packages (#149)
Browse files Browse the repository at this point in the history
This commit upgrades all npm packages, including `normalize-url`, `trim-newlines` and `ws` which were reported vulnerable.

Among the upgraded packages was `prettier`, which required some code style changes.
  • Loading branch information
edeckers authored Jun 12, 2021
1 parent 5cf7391 commit d3dee10
Show file tree
Hide file tree
Showing 5 changed files with 1,399 additions and 1,518 deletions.
5 changes: 2 additions & 3 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,8 @@ interface DVProps {

const DownloaderView = (props: DVProps) => {
const [isDownloading, setIsDownloading] = useState(false);
const [useAndroidDownloadManager, setUseAndroidDownloadManager] = useState(
false
);
const [useAndroidDownloadManager, setUseAndroidDownloadManager] =
useState(false);
const [received, setReceived] = useState<number>(0);
const [expected, setExpected] = useState<number | undefined>(0);
const [cancelDownload, setCanceller] = useState<() => void>(() => () => {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@
"jest-junit": "^12.0.0",
"pod-install": "^0.1.0",
"prettier": "^2.0.5",
"react-native-builder-bob": "^0.18.0",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-builder-bob": "^0.18.0",
"release-it": "^13.5.8",
"typescript": "4.0.6"
},
"peerDependencies": {
"react-native": "*",
"react": "*"
"react": "*",
"react-native": "*"
},
"resolutions": {
"xmldom": "0.5.0"
Expand Down
35 changes: 17 additions & 18 deletions src/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ import type {
TargetType,
} from 'src/ExposedTypes';

const {
BlobCourier: BlobCourierNative,
BlobCourierEventEmitter,
} = NativeModules;
const { BlobCourier: BlobCourierNative, BlobCourierEventEmitter } =
NativeModules;

const NATIVE_EVENT_EMITTER_SINGLETON = new NativeEventEmitter(
BlobCourierEventEmitter
Expand Down Expand Up @@ -65,12 +63,13 @@ const DEFAULT_MULTIPART_UPLOAD_REQUEST: BlobMultipartMapUploadRequest = {
url: 'https://github.com/edeckers/react-native-blob-courier',
};

const DEFAULT_MULTIPART_ARRAY_UPLOAD_REQUEST: BlobMultipartArrayUploadRequest = {
...DEFAULT_MULTIPART_UPLOAD_REQUEST,
parts: convertMappedMultipartsWithSymbolizedKeysToArray(
sanitizeMappedMultiparts(DEFAULT_MULTIPART_UPLOAD_REQUEST.parts)
),
};
const DEFAULT_MULTIPART_ARRAY_UPLOAD_REQUEST: BlobMultipartArrayUploadRequest =
{
...DEFAULT_MULTIPART_UPLOAD_REQUEST,
parts: convertMappedMultipartsWithSymbolizedKeysToArray(
sanitizeMappedMultiparts(DEFAULT_MULTIPART_UPLOAD_REQUEST.parts)
),
};

const RANDOM_VALUE_GENERATORS: { [key: string]: () => any } = {
boolean: () => Math.random() >= 0.5,
Expand Down Expand Up @@ -165,7 +164,8 @@ describe('Given fallback parameters are provided through a constant', () => {
target: DEFAULT_FETCH_TARGET,
},
method: 'GET',
progressIntervalMilliseconds: DEFAULT_PROGRESS_UPDATE_INTERVAL_MILLISECONDS,
progressIntervalMilliseconds:
DEFAULT_PROGRESS_UPDATE_INTERVAL_MILLISECONDS,
});
});

Expand Down Expand Up @@ -329,7 +329,8 @@ describe('Given a fluent fetch request', () => {
testAsync(
'The native module is called with all required values and the provided settings',
async () => {
const progressIntervalMilliseconds = DEFAULT_PROGRESS_UPDATE_INTERVAL_MILLISECONDS;
const progressIntervalMilliseconds =
DEFAULT_PROGRESS_UPDATE_INTERVAL_MILLISECONDS;

await BlobCourier.settings({
progressIntervalMilliseconds,
Expand Down Expand Up @@ -454,9 +455,8 @@ describe('Given a fluent fetch request', () => {
},
};

const parameterIntersection = dict(calledWithParameters).intersect(
expectedParameters
);
const parameterIntersection =
dict(calledWithParameters).intersect(expectedParameters);

expect(expectedParameters).toEqual(parameterIntersection);
expect(BlobCourierEventEmitter.addListener).toHaveBeenCalled();
Expand Down Expand Up @@ -493,9 +493,8 @@ describe('Given a fluent fetch request', () => {
},
};

const parameterIntersection = dict(calledWithParameters).intersect(
expectedParameters
);
const parameterIntersection =
dict(calledWithParameters).intersect(expectedParameters);

expect(expectedParameters).toEqual(parameterIntersection);
verifyPropertyExistsAndIsDefined(calledWithParameters, 'taskId');
Expand Down
12 changes: 2 additions & 10 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,8 @@ const sanitizeSettingsData = <T extends BlobRequestSettings>(
const sanitizeFetchData = <T extends BlobFetchNativeInput>(
input: Readonly<T>
): BlobFetchNativeInput => {
const {
android,
filename,
headers,
ios,
method,
mimeType,
taskId,
url,
} = input;
const { android, filename, headers, ios, method, mimeType, taskId, url } =
input;

const settings = sanitizeSettingsData(input);

Expand Down
Loading

0 comments on commit d3dee10

Please sign in to comment.