Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getGithubRepo(githubUrl) {
const result = parseGithubUrl(githubUrl);
if (!result) {
throw new Error(`Invalid GitHub URI ${githubUrl}`);
}
return `${result[0]}/${result[1]}`;
}
function getParams( args, config ) {
const files = config.files || {};
const mainFile = args.file || files.main;
const type = args.type || config.type || 'plugin';
const gh = config.gh || {};
const repo = args.repo || gh.repo;
if ( ! repo ) {
throw new Error( 'Missing GitHub repo. Specify it via --repo or define `gh.repo` in .wpt.yml.' );
}
const repoParsed = ghParse( repo );
if ( ! Array.isArray( repoParsed ) ) {
throw new Error( 'Invalid gh.repo value, the format is "owner/repo"' );
}
const [ repoOwner, repoName, ] = repoParsed;
const originalBranch = git.getCurrentBranch();
const branch = args.branch || gh.branch || 'master';
const token = args.token || process.env.WPT_GITHUB_TOKEN;
const data = fh.getFileData( mainFile, type );
const version = data.Version;
const changelog = readme.getChangelog( version );
const draft = !! args.draft;
const preRelease = !! args.preRelease;
ghUser: function( cb ) {
const gh = ghParse( this.exports.default.ghRepo || '' );
const d = this.defaults.gh.username || Array.isArray( gh ) ? gh[ 0 ] : undefined;
const r = this.exports.useDefaults
? toStr( d )
: prompt( 'GitHub username', toStr( d ), toStr );
return cb( null, r );
},