html-snapshots 0.18.3 → 1.0.0
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/.eslintrc.json +4 -5
- package/.github/workflows/verify.yml +2 -2
- package/HISTORY.md +42 -0
- package/README.md +109 -256
- package/examples/README.md +149 -0
- package/examples/custom/myFilter.js +2 -2
- package/examples/custom/package-lock.json +2021 -5
- package/examples/custom/package.json +1 -1
- package/examples/custom/snapshot.js +8 -10
- package/examples/debug-phantomjs/package-lock.json +6 -6
- package/examples/debug-phantomjs/package.json +1 -1
- package/examples/debug-phantomjs/snapshot.js +13 -14
- package/examples/debug-puppeteer/README.md +18 -0
- package/examples/debug-puppeteer/package-lock.json +2804 -0
- package/examples/debug-puppeteer/package.json +12 -0
- package/examples/debug-puppeteer/snapshot.js +30 -0
- package/examples/html5rocks/package-lock.json +1306 -5
- package/examples/html5rocks/package.json +1 -1
- package/examples/html5rocks/snapshot.js +14 -23
- package/examples/process-limit/package-lock.json +1306 -5
- package/examples/process-limit/package.json +1 -1
- package/examples/process-limit/snapshot.js +8 -10
- package/examples/simple-promise/package-lock.json +1306 -5
- package/examples/simple-promise/package.json +1 -1
- package/examples/simple-promise/snapshot.js +6 -8
- package/examples/sitemap-index/package-lock.json +1306 -5
- package/examples/sitemap-index/package.json +1 -1
- package/examples/sitemap-index/snapshot.js +6 -6
- package/examples/utils/index.js +2 -4
- package/examples/verbose/package-lock.json +1306 -5
- package/examples/verbose/package.json +1 -1
- package/examples/verbose/snapshot.js +12 -14
- package/lib/async/index.js +0 -1
- package/lib/common/index.js +1 -1
- package/lib/common/sitemap/index.js +16 -0
- package/lib/common/sitemap/sitemap-collection.js +94 -0
- package/lib/common/sitemap/sitemap-index.js +68 -0
- package/lib/common/{sitemap.js → sitemap/sitemap.js} +68 -57
- package/lib/html-snapshots.js +87 -5
- package/lib/input-generators/_base.js +7 -1
- package/lib/input-generators/array.js +0 -1
- package/lib/input-generators/robots.js +98 -58
- package/lib/input-generators/sitemap-index.js +3 -124
- package/lib/input-generators/sitemap.js +3 -7
- package/lib/input-generators/textfile.js +2 -6
- package/lib/puppeteer/index.js +98 -0
- package/lib/puppeteer/removeScripts.js +8 -0
- package/package.json +9 -4
- package/test/helpers/options.js +4 -2
- package/test/mocha/browsers/puppeteer.js +106 -0
- package/test/mocha/browsers/server/index.html +9 -0
- package/test/mocha/browsers/test.js +11 -0
- package/test/mocha/html-snapshots/basics.js +60 -47
- package/test/mocha/html-snapshots/phantomjs-options.js +54 -60
- package/test/mocha/html-snapshots/process-limit.js +126 -120
- package/test/mocha/html-snapshots/puppeteer.js +47 -0
- package/test/mocha/html-snapshots/robots.js +156 -121
- package/test/mocha/html-snapshots/server/public/page-sitemap.xml +16 -0
- package/test/mocha/html-snapshots/server/test_robots.txt +13 -0
- package/test/mocha/html-snapshots/server/test_robots_sitemap.txt +15 -0
- package/test/mocha/html-snapshots/server/test_robots_sitemap.xml +22 -0
- package/test/mocha/html-snapshots/sitemap-index.js +100 -90
- package/test/mocha/html-snapshots/sitemap.js +75 -31
- package/test/mocha/html-snapshots/snapshot-scripts.js +150 -145
- package/test/mocha/html-snapshots/test.js +23 -14
- package/test/mocha/html-snapshots/test_robots.txt +0 -2
- package/test/mocha/html-snapshots/use-jquery.js +65 -64
- package/test/mocha/html-snapshots/utils.js +29 -30
- package/test/mocha/input-generators/server/test_robots.txt +0 -2
- package/test/mocha/input-generators/server/test_robots_bad.txt +0 -2
- package/test/mocha/input-generators/server/test_robots_sitemap.txt +17 -0
- package/test/mocha/input-generators/server/test_robots_sitemap_bad.txt +17 -0
- package/test/mocha/input-generators/server/test_robots_sitemap_multi.txt +18 -0
- package/test/mocha/input-generators/server/test_sitemap_index_empty.xml +3 -0
- package/test/mocha/input-generators/server/test_sitemap_index_malformed.xml +2 -0
- package/test/mocha/input-generators/sitemap-index.js +65 -9
- package/test/mocha/input-generators/test.js +276 -280
- package/test/mocha/input-generators/test_robots.txt +0 -2
- package/test/mocha/input-generators/test_robots_bad.txt +0 -2
- package/test/mocha/input-generators/test_robots_sitemap.txt +17 -0
- package/test/mocha/input-generators/test_robots_sitemap_bad.txt +17 -0
- package/test/mocha/input-generators/test_robots_sitemap_multi.txt +18 -0
- package/lib/common/node.js +0 -26
- package/test/mocha/common/node.js +0 -100
|
@@ -5,28 +5,26 @@
|
|
|
5
5
|
* Uses robots.txt to drive website snapshot.
|
|
6
6
|
* Limits the number of browser processes to 1 (1 at a time).
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
const htmlSnapshots = require("html-snapshots");
|
|
9
9
|
|
|
10
10
|
// where the snapshots go
|
|
11
|
-
|
|
11
|
+
const outputDir = require("path").join(__dirname, "./tmp");
|
|
12
12
|
|
|
13
13
|
// The hostname of the website
|
|
14
|
-
|
|
14
|
+
const hostname = "nodejs.org";
|
|
15
15
|
|
|
16
16
|
// Do it:
|
|
17
17
|
htmlSnapshots.run({
|
|
18
|
-
source:
|
|
18
|
+
source: `https://${hostname}/robots.txt`,
|
|
19
19
|
hostname: hostname,
|
|
20
20
|
outputDir: outputDir,
|
|
21
21
|
outputDirClean: true,
|
|
22
|
-
selector: "
|
|
23
|
-
timeout:
|
|
22
|
+
selector: "body",
|
|
23
|
+
timeout: 9000,
|
|
24
24
|
processLimit: 1 // no parallel fetch, one browser process at a time
|
|
25
25
|
})
|
|
26
|
-
.then(
|
|
26
|
+
.then(completed => {
|
|
27
27
|
console.log("completed snapshots:");
|
|
28
28
|
console.log(require("util").inspect(completed));
|
|
29
29
|
})
|
|
30
|
-
.catch(
|
|
31
|
-
console.error(err);
|
|
32
|
-
});
|
|
30
|
+
.catch(console.error);
|