ghost-static
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -17,3 +17,3 @@ #!/usr/bin/env node | ||
.option('publish', 'The url that will point to the static Ghost site', 'http://localhost:8080') | ||
.option('to-replace', 'List of comma-separated urls, if you want to replace other URLs than [source] by [publish].') | ||
.option('to-replace', 'List of comma-separated urls, if you want to replace other URLs than [source] by [publish].', null) | ||
@@ -39,5 +39,3 @@ | ||
let data = fs.readFileSync(resPath, 'utf8') | ||
for (const url of this.replaceUrls) { | ||
data = data.replace(new RegExp(scraper.localURL, 'g'), url) | ||
} | ||
data = data.replace(new RegExp(scraper.replaceUrls, 'g'), scraper.publishURL) | ||
fs.writeFileSync(resPath, data, 'utf8') | ||
@@ -67,7 +65,7 @@ } catch (e) { | ||
this.tmpFolder = path.resolve('tmp') | ||
this.replaceUrls = flags['to-replace'] ? flags['to-replace'].replace(/\s/g, '').split(',') : [this.publishURL] | ||
this.replaceUrls = flags.toReplace ? flags.toReplace.replace(/\s/g, '').split(',').join('|') : [this.publishURL] | ||
console.log('----') | ||
console.log(`Will download from ${this.localURL} to ${path.resolve(this.destFolder)}`) | ||
console.log(`All references to ${this.localURL} will be replaced by ${this.publishURL}`) | ||
console.log(`All references to ${this.replaceUrls} will be replaced by ${this.publishURL}`) | ||
console.log('----') | ||
@@ -74,0 +72,0 @@ } |
{ | ||
"name": "ghost-static", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A tool to convert you Ghost blog to a static website", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,3 +28,4 @@ # Ghost static | ||
-p, --publish [value] The url that will point to the static Ghost site (defaults to "http://localhost:8080") | ||
-s, --source [value] The current running instance of Ghost (defaults to "http://localhost:2368") | ||
-s, --source [value] The current running instance of Ghost. This url will be replaced by the [publish] one. (defaults to "http://localhost:2368") | ||
-t, --to-replace List of comma-separated urls, if you want to replace other URLs than [source] by [publish]. (defaults to null) | ||
-v, --version Output the version number | ||
@@ -31,0 +32,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7779
40
150