react-snapshot
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -39,3 +39,3 @@ 'use strict'; | ||
var filename = '' + path + (path.endsWith('/') ? 'index' : '') + '.html'; | ||
console.log('Saving ' + path + ' as ' + filename); | ||
console.log('✏️ Saving ' + path + ' as ' + filename); | ||
writer.write(filename, html); | ||
@@ -42,0 +42,0 @@ }); |
@@ -27,2 +27,4 @@ 'use strict'; | ||
this.baseUrl = baseUrl; | ||
var _url$parse = _url2.default.parse(baseUrl); | ||
@@ -44,3 +46,6 @@ | ||
this.handler = handler; | ||
return this.snap(); | ||
console.log('🕷 Starting crawling ' + this.baseUrl); | ||
return this.snap().then(function () { | ||
return console.log('🕸 Finished crawling.'); | ||
}); | ||
} | ||
@@ -52,3 +57,2 @@ }, { | ||
console.log(this.paths); | ||
var path = this.paths.shift(); | ||
@@ -55,0 +59,0 @@ if (!path) return Promise.resolve(); |
@@ -24,3 +24,2 @@ "use strict"; | ||
console.log(baseDir, file, port); | ||
this.start = function () { | ||
@@ -41,3 +40,3 @@ return new Promise(function (resolve, reject) { | ||
value: function stop() { | ||
console.log("STOPPING SERVER"); | ||
console.log("\nServer stopped."); | ||
this.instance.close(); | ||
@@ -44,0 +43,0 @@ process.exit(); /* fkn dunno why this doesnt work eh */ |
@@ -14,3 +14,2 @@ "use strict"; | ||
exports.default = function (protocol, host, path) { | ||
console.log({ host: host, path: path }); | ||
return new Promise(function (resolve, reject) { | ||
@@ -21,6 +20,4 @@ _jsdom2.default.env({ | ||
if (resource.url.host === host) { | ||
console.log("YEP " + resource.url.href); | ||
resource.defaultFetch(callback); | ||
} else { | ||
console.log("NOPE " + resource.url.href); | ||
callback(); | ||
@@ -27,0 +24,0 @@ } |
@@ -42,5 +42,3 @@ 'use strict'; | ||
value: function write(filename, content) { | ||
console.log(this.baseDir); | ||
var newPath = _path2.default.join(this.baseDir, filename); | ||
console.log(newPath); | ||
_fs2.default.writeFileSync(newPath, content); | ||
@@ -47,0 +45,0 @@ } |
{ | ||
"name": "react-snapshot", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -17,3 +17,3 @@ import path from 'path' | ||
const filename = `${path}${path.endsWith('/') ? 'index' : ''}.html` | ||
console.log(`Saving ${path} as ${filename}`) | ||
console.log(`✏️ Saving ${path} as ${filename}`) | ||
writer.write(filename, html) | ||
@@ -20,0 +20,0 @@ }) |
@@ -8,2 +8,3 @@ /* Loads a URL then starts looking for links. | ||
constructor(baseUrl) { | ||
this.baseUrl = baseUrl | ||
const { protocol, host, path } = url.parse(baseUrl) | ||
@@ -18,7 +19,8 @@ this.protocol = protocol | ||
this.handler = handler | ||
console.log(`🕷 Starting crawling ${this.baseUrl}`) | ||
return this.snap() | ||
.then(() => console.log(`🕸 Finished crawling.`)) | ||
} | ||
snap() { | ||
console.log(this.paths) | ||
let path = this.paths.shift() | ||
@@ -25,0 +27,0 @@ if (!path) return Promise.resolve() |
@@ -6,3 +6,2 @@ /* Spin up a simple pushstate server */ | ||
constructor(baseDir, file, port) { | ||
console.log(baseDir, file, port) | ||
this.start = () => { | ||
@@ -21,3 +20,3 @@ return new Promise((resolve, reject) => { | ||
stop() { | ||
console.log("STOPPING SERVER") | ||
console.log("\nServer stopped.") | ||
this.instance.close() | ||
@@ -24,0 +23,0 @@ process.exit() /* fkn dunno why this doesnt work eh */ |
@@ -6,3 +6,2 @@ /* Wraps a jsdom call and returns the full page */ | ||
export default (protocol, host, path) => { | ||
console.log({host, path}) | ||
return new Promise((resolve, reject) => { | ||
@@ -13,6 +12,4 @@ jsdom.env({ | ||
if (resource.url.host === host) { | ||
console.log(`YEP ${resource.url.href}`) | ||
resource.defaultFetch(callback); | ||
} else { | ||
console.log(`NOPE ${resource.url.href}`) | ||
callback() | ||
@@ -19,0 +16,0 @@ } |
@@ -20,7 +20,5 @@ /* Simple wrapper around fs so I can concentrate on what's going on */ | ||
write(filename, content) { | ||
console.log(this.baseDir) | ||
const newPath = path.join(this.baseDir, filename) | ||
console.log(newPath) | ||
fs.writeFileSync(newPath, content) | ||
} | ||
} |
22706
370