Comparing version 0.10.0 to 0.10.1
{ | ||
"name": "creamcrop", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "A cream-of-the-crop, top-of-the-top, slice-and-chop, absolutely minimalist news getter.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -7,2 +7,3 @@ #!/usr/bin/env node | ||
import * as web from '../utils/web.js' | ||
import { parse } from '../utils/parse.js' | ||
import { createRequire } from "module"; | ||
@@ -31,44 +32,2 @@ const require = createRequire(import.meta.url); | ||
function parse(url, type) { | ||
(async () => { | ||
if (type === 'none') { | ||
try { | ||
await rss.parse(url) // Check's if Rss is valid | ||
} | ||
catch { | ||
await jsonparser.parse(url) // Check's if Json is valid | ||
} | ||
} | ||
else if (type === 'rss') { | ||
await rss.parse(url) | ||
} | ||
else if (type === 'json') { | ||
await jsonparser.parse(url) | ||
} | ||
console.log("Valid feed... adding to config") | ||
if (fs.existsSync('./.creamcroprc')) { | ||
let rawconfig = fs.readFileSync('./.creamcroprc', 'utf8') | ||
let config = JSON.parse(rawconfig) | ||
if (type != 'none') { | ||
config.feeds.push([url, type]) | ||
} | ||
else { | ||
config.feeds.push(url) | ||
} | ||
fs.writeFileSync('./.creamcroprc', JSON.stringify(config, null, 2)) | ||
} else { | ||
let config = { | ||
feeds: [] | ||
} | ||
if (type != 'none') { | ||
config.feeds.push([url, type]) | ||
} | ||
else { | ||
config.feeds.push(url) | ||
} | ||
fs.writeFileSync('./.creamcroprc', JSON.stringify(config, null, 2)) | ||
} | ||
})(); | ||
} | ||
if (process.argv[2] == '--help' && process.argv.length == 3 || process.argv[2] == '-h' && process.argv.length == 3) { | ||
@@ -87,3 +46,3 @@ console.log(boxen('CreamCrop\n '+metadata.version, {padding: {left: 10, right: 10, bottom: 0, top: 0}, float: 'center', margin: {'bottom': 1},borderStyle: 'round', borderColor: 'cyan'})) | ||
type: 'string', | ||
description: 'The url of the feed to fetch.' | ||
description: 'The url of the feed to fetch, or if fetching a git repo, Owner/Repo/Type, where `type` is `releases`, `tags`, or `commits`.' | ||
}), | ||
@@ -93,3 +52,3 @@ yargs.option('type', { | ||
type: 'string', | ||
description: 'The type of feed. Accepted values are "json", "rss", or "none" for creamcrop to automatically find the type.', | ||
description: 'The type of feed. Accepted values are "json", "rss", "git", or "none" for creamcrop to automatically find the type.', | ||
default: 'none' | ||
@@ -180,3 +139,2 @@ }) | ||
export { about } | ||
export { version } | ||
export { about, version } |
import * as metadata from './utils/metadata' | ||
import { fetch, code, latest } from './utils/code' | ||
export var version = metadata.version | ||
export var about = metadata.about | ||
export var about = metadata.about | ||
export { fetch, code, latest } |
@@ -7,2 +7,4 @@ import * as http from 'http'; | ||
import * as jsonparser from '@creamcropdev/json' | ||
import { createRequire } from "module"; | ||
const require = createRequire(import.meta.url); | ||
@@ -159,3 +161,3 @@ /** | ||
customconf = customconf.replace(/%feed%/g, feed.items.map(item => ` | ||
${format(item.title, item.link, item.feedlink, item.feed, item.pubdate, `<div onClick="markRead(${item.link})">`, '</div>')} | ||
${format(item.title, item.link, item.feedlink, item.feed, item.pubdate, `<div onClick="markRead("${item.link})">`, '</div>')} | ||
`).join('\n')); | ||
@@ -342,2 +344,2 @@ | ||
export { serve } | ||
export { serve } |
Sorry, the diff of this file is not supported yet
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
164036
42
590
12