Skip to content

Commit 27c6573

Browse files
Bump website-scraper from 4.2.3 to 5.0.0 (#11)
* Bump website-scraper from 4.2.3 to 5.0.0 * Migrate from CommonJS to ESM Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ilya Antipenko <[email protected]>
1 parent 80d6821 commit 27c6573

File tree

5 files changed

+25
-19
lines changed

5 files changed

+25
-19
lines changed

.eslintrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
extends: "eslint:recommended"
22
parserOptions:
33
ecmaVersion: 8
4+
sourceType: module
45
env:
56
node: true
67
es6: true

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Plugin for [website-scraper](https://github.com/website-scraper/node-website-scr
1010
Please keep in mind that saving to existing directory may overwrite your files. Be careful with it!
1111

1212
## Requirements
13-
* nodejs version >= 14
14-
* website-scraper version >= 4
13+
* nodejs version >= 14.14
14+
* website-scraper version >= 5
1515

1616
## Installation
1717
```sh
@@ -20,10 +20,10 @@ npm install website-scraper website-scraper-existing-directory
2020

2121
## Usage
2222
```javascript
23-
const scrape = require('website-scraper');
24-
const SaveToExistingDirectoryPlugin = require('website-scraper-existing-directory');
23+
import scrape from 'website-scraper';
24+
import SaveToExistingDirectoryPlugin from 'website-scraper-existing-directory';
2525

26-
scrape({
26+
await scrape({
2727
urls: ['http://example.com'],
2828
directory: '/path/to/save',
2929
plugins: [ new SaveToExistingDirectoryPlugin() ]

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const path = require('path');
2-
const fs = require('fs-extra');
1+
import path from 'path';
2+
import fs from 'fs-extra';
33

44
class SaveResourceToExistingDirectoryPlugin {
55
apply (registerAction) {
@@ -22,4 +22,4 @@ class SaveResourceToExistingDirectoryPlugin {
2222
}
2323
}
2424

25-
module.exports = SaveResourceToExistingDirectoryPlugin;
25+
export default SaveResourceToExistingDirectoryPlugin;

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"name": "website-scraper-existing-directory",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "Plugin for website-scraper which allows to save resources to existing directory",
55
"readmeFilename": "README.md",
6-
"main": "index.js",
6+
"type": "module",
7+
"exports": {
8+
".": "./index.js"
9+
},
710
"scripts": {
811
"test": "c8 --all --reporter=text --reporter=lcov mocha --recursive",
912
"eslint": "eslint index.js"
@@ -29,15 +32,15 @@
2932
"chai": "^4.2.0",
3033
"eslint": "^8.5.0",
3134
"mocha": "^9.1.3",
32-
"website-scraper": "^4.0.0"
35+
"website-scraper": "^5.0.0"
3336
},
3437
"peerDependencies": {
35-
"website-scraper": "^4.0.0"
38+
"website-scraper": "^5.0.0"
3639
},
3740
"files": [
3841
"index.js"
3942
],
4043
"engines": {
41-
"node": ">=14"
44+
"node": ">=14.14"
4245
}
4346
}
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
const { expect } = require('chai');
2-
const scrape = require('website-scraper');
3-
const fs = require('fs-extra');
4-
const ExistingDirectoryPlugin = require('../index');
1+
import chai from 'chai';
2+
import scrape from 'website-scraper';
3+
import fs from 'fs-extra';
4+
import ExistingDirectoryPlugin from '../index.js';
5+
6+
const { expect } = chai;
57

68
describe('Existing Directory Plugin', () => {
7-
const directory = __dirname + '/directory-for-test';
9+
const directory = './test/directory-for-test';
810
const filename = directory + '/index.html';
911

1012
after('remove saved index.html from test directory', () => fs.removeSync(filename));
@@ -18,4 +20,4 @@ describe('Existing Directory Plugin', () => {
1820

1921
expect(fs.existsSync(filename)).to.eql(true);
2022
});
21-
});
23+
});

0 commit comments

Comments
 (0)