@anmiles/downloader 3.0.1 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [4.0.1](../../tags/v4.0.1) - 2024-01-29
9
+ ### Changed
10
+ - Explicitly specify ignores from .gitignore in .eslintrc.js
11
+
12
+ ## [4.0.0](../../tags/v4.0.0) - 2024-01-16
13
+ ### Changed
14
+ - Update project configurations
15
+ - Update dependencies
16
+
8
17
  ## [3.0.1](../../tags/v3.0.1) - 2023-11-12
9
18
  ### Changed
10
19
  - Update dependencies
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { download, downloadString, downloadJSON } from './lib/downloader';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
@@ -13,3 +13,4 @@ declare function download(url: string, file: string, options?: {
13
13
  }): Promise<void>;
14
14
  declare function downloadString(url: string, encoding?: BufferEncoding): Promise<string>;
15
15
  declare function downloadJSON(url: string, encoding?: BufferEncoding): Promise<any>;
16
+ //# sourceMappingURL=downloader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"downloader.d.ts","sourceRoot":"","sources":["../../src/lib/downloader.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;;;;;;AAClD,wBAA0D;AAE1D,KAAK,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAExD,iBAAS,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAChD,iBAAS,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAgD5F,iBAAe,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAuB,mBAO3E;AAED,iBAAe,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,cAAuB,gBAGzE"}
@@ -42,7 +42,7 @@ function download(url, file, options) {
42
42
  });
43
43
  }
44
44
  else {
45
- res.pipe(fs_1.default.createWriteStream(file, { flags: (options === null || options === void 0 ? void 0 : options.append) ? 'a' : 'w' }));
45
+ res.pipe(fs_1.default.createWriteStream(file, { flags: options?.append ? 'a' : 'w' }));
46
46
  res.on('end', function () {
47
47
  resolve();
48
48
  });
@@ -1 +1 @@
1
- {"version":3,"file":"downloader.js","sourceRoot":"","sources":["../../src/lib/downloader.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAC1B,4DAA+B;AAE/B,8DAAsC;AAGtC,kBAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;AAM1D,SAAS,QAAQ,CAAC,GAAW,EAAE,IAAa,EAAE,OAA8B;IAC3E,OAAO,IAAI,OAAO,CAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,IAAI,QAAqC,CAAC;QAE1C,IAAI,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;YAC/B,QAAQ,GAAG,eAAK,CAAC;SACjB;aAAM,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YACrC,QAAQ,GAAG,cAAI,CAAC;SAChB;aAAM;YACN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C,GAAW,EAAE,WAA2B,MAAM;IAC3E,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClC,MAAM,oBAAoB,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,oBAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9C,OAAO,oBAAK,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC;AA7DkB,wCAAc;AA+DjC,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,WAA2B,MAAM;IACzE,MAAM,IAAI,GAAG,MAAM,oBAAU,CAAC,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAlEkC,oCAAY"}
package/jest.config.js CHANGED
@@ -1,12 +1,14 @@
1
1
  module.exports = {
2
- preset : 'ts-jest',
2
+ preset : 'ts-jest',
3
+ transform : {
4
+ '^.+\\.tsx?$' : 'ts-jest',
5
+ },
6
+
3
7
  clearMocks : true,
4
8
 
5
9
  roots : [ '<rootDir>/src' ],
6
10
  testMatch : [ '<rootDir>/src/**/__tests__/*.test.ts' ],
7
- transform : {
8
- '^.+\\.ts$' : 'ts-jest',
9
- },
11
+
10
12
  collectCoverageFrom : [
11
13
  '<rootDir>/src/**/*.ts',
12
14
  '!<rootDir>/src/**/*.d.ts',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anmiles/downloader",
3
- "version": "3.0.1",
3
+ "version": "4.0.1",
4
4
  "description": "Wrapper for downloading data as string, buffer or complex types",
5
5
  "keywords": [
6
6
  "download",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "main": "dist/index.js",
18
18
  "scripts": {
19
- "build": "rimraf dist && tsc",
19
+ "build": "rimraf dist && tsc -p ./tsconfig.build.json",
20
20
  "lint": "eslint --ext .js,.ts .",
21
21
  "lint:fix": "npm run lint -- --fix",
22
22
  "test": "jest --verbose",
@@ -30,20 +30,21 @@
30
30
  "iconv-lite": "^0.6.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@anmiles/eslint-config": "^2.0.2",
33
+ "@anmiles/eslint-config": "^5.0.0",
34
+ "@anmiles/tsconfig": "^2.0.0",
34
35
  "@types/event-emitter": "^0.3.5",
35
- "@types/jest": "^29.5.8",
36
- "@typescript-eslint/eslint-plugin": "^6.10.0",
37
- "@typescript-eslint/parser": "^6.10.0",
38
- "eslint": "^8.53.0",
36
+ "@types/jest": "^29.5.11",
37
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
38
+ "@typescript-eslint/parser": "^6.19.0",
39
+ "eslint": "^8.56.0",
39
40
  "eslint-plugin-align-assignments": "^1.1.2",
40
- "eslint-plugin-import": "^2.29.0",
41
- "eslint-plugin-jest": "^27.6.0",
41
+ "eslint-plugin-import": "^2.29.1",
42
+ "eslint-plugin-jest": "^27.6.3",
42
43
  "event-emitter": "^0.3.5",
43
44
  "jest": "^29.7.0",
44
45
  "nyc": "^15.1.0",
45
46
  "rimraf": "^5.0.5",
46
47
  "ts-jest": "^29.1.1",
47
- "typescript": "^5.2.2"
48
+ "typescript": "^5.3.3"
48
49
  }
49
50
  }
@@ -15,7 +15,7 @@ jest.mock<Partial<typeof downloader>>('../downloader', () => ({
15
15
  let request: http.ClientRequest;
16
16
  let response: http.IncomingMessage;
17
17
 
18
- function get(url: string | URL, options: https.RequestOptions, callback?: ((res: http.IncomingMessage) => void) | undefined): http.ClientRequest {
18
+ function get(_url: string | URL, _options: https.RequestOptions, callback?: ((res: http.IncomingMessage) => void) | undefined): http.ClientRequest {
19
19
  if (callback) {
20
20
  callback(response);
21
21
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+
4
+ "exclude": [
5
+ "**/__tests__/",
6
+ ],
7
+ }
package/tsconfig.json CHANGED
@@ -1,26 +1,12 @@
1
1
  {
2
- "compilerOptions": {
3
- "module": "CommonJS",
4
- "target": "ES2019",
5
-
6
- "moduleResolution": "node",
7
- "resolveJsonModule": true,
2
+ "extends": "./node_modules/@anmiles/tsconfig/tsconfig.json",
8
3
 
4
+ "compilerOptions": {
9
5
  "rootDir": "./src",
10
6
  "outDir": "./dist",
11
-
12
- "allowJs": false,
13
- "sourceMap": true,
14
- "declaration": true,
15
- "noImplicitAny": true,
16
- "esModuleInterop": true,
17
- "strictNullChecks": true,
18
- "allowSyntheticDefaultImports": true,
19
7
  },
20
- "exclude": [
21
- "**/node_modules/",
22
- "**/__tests__/",
23
- "coverage/",
24
- "dist/",
8
+
9
+ "include": [
10
+ "src",
25
11
  ],
26
12
  }