Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const buildTasks = options => {
const { version } = options
const isPrerelease = includes('-', version)
const tag = isPrerelease ? 'next' : 'latest'
// eslint-disable-next-line
console.warn(`Will publish with NPM tag ${tag}`)
return [
{
title: 'ping npm registry',
task: () =>
timeout(
execa('npm', ['ping']).catch(throwError('connection to npm registry failed')),
5000,
'Connection to npm registry timed out',
),
},
...(isPrerelease
const {
either,
includes,
when,
} = require('rambdax')
const REPL_URL = 'https://rambda.now.sh'
const getConsoleLog = includes('console.log')
const getResultVariableLog = either(
includes('const result ='),
includes('const result='),
)
function attachResultVariable(input){
const [ firstLineRaw, ...otherLines ] = input.split('\n')
const firstLine = `const result = ${ firstLineRaw }`
return otherLines.length === 0 ?
firstLine :
[ firstLine, ...otherLines ].join('\n')
}
function rambdaREPL(input){
const consoleLogFlag = getConsoleLog(input)
const resultVariableFlag = getResultVariableLog(input)
const flag = resultVariableFlag || consoleLogFlag
const code = when(!flag, attachResultVariable)(input)
async function generateLinks(bookmarksContent){
const allLinks = bookmarksContent
.split('\n')
.s(reject(includes('gist.')))
.s(reject(includes('?tab')))
.s(reject(includes('trending')))
.s(filter(x => x.includes('github.com') || x.includes('npmjs')))
const withCorrectLinks = await mapAsync(async x => {
if (x.includes('github.com')) return x
const url = await toGithubURL(x)
return url
}, allLinks)
return withCorrectLinks.s(filter(Boolean)).s(
map(x => {
const replaced = replace(/(git:)|(ssh:)/, 'https:', x)
return remove('git@', replaced)
})