mirror of https://github.com/sgoudham/carbon.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
660 B
JavaScript
32 lines
660 B
JavaScript
6 years ago
|
const url = require('url')
|
||
|
const clipboardy = require('clipboardy')
|
||
|
|
||
|
module.exports = async markdown => {
|
||
|
const URL = process.env.URL || process.env.NOW_URL || clipboardy.readSync()
|
||
|
const { host } = url.parse(URL)
|
||
|
|
||
|
if (host) {
|
||
|
let name
|
||
|
try {
|
||
|
name = require('./now.json').name
|
||
|
} catch (e) {
|
||
|
/* pass */
|
||
|
}
|
||
|
|
||
|
if (!name) {
|
||
|
try {
|
||
|
name = require('./package.json').name
|
||
|
} catch (e) {
|
||
|
/* pass */
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const prefix = name ? `\`${name}\`: ` : ''
|
||
|
|
||
|
return [`${prefix}https://${host}`, '', markdown].join('\n')
|
||
|
}
|
||
|
|
||
|
// Use the available data to create a custom release
|
||
|
return markdown
|
||
|
}
|