Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert(!newDoc["dist-tags"], "redirected packages can't have dist-tags")
assert(!newDoc.versions, "redirected packages can't have versions")
return
}
// make sure all the dist-tags and versions are valid semver
assert(newDoc["dist-tags"], "must have dist-tags")
assert(newDoc.versions, "must have versions")
for (var i in newDoc["dist-tags"]) {
assert(semver.valid(newDoc["dist-tags"][i]),
"dist-tag "+i+" is not a valid version: "+newDoc["dist-tags"][i])
assert(newDoc["dist-tags"][i] in newDoc.versions,
"dist-tag "+i+" refers to non-existent version: "+newDoc["dist-tags"][i])
}
for (var i in newDoc.versions) {
assert(semver.valid(i), "version "+i+" is not a valid version")
}
}
Resolver.prototype.resolveDependency = function* (branch, name, ref) {
var child = branch.dependencies[name]
// already resolved
if (typeof child === 'object') return
// wait to resolve refs when we do all the semver calls
if (typeof child === 'string' && !this.resolvingSemver) return
// try to resolve these now
// may not be 100% optimal, but will be the fastest
if (semver.validRange(ref) && !semver.valid(ref)) {
if (this.resolvingSemver)
return yield* this.resolveSemver(branch, name, ref)
var version = this.resolveSemverLocally(branch, name, ref)
// resolved locally
if (version) ref = version
// we'll resolve this later
// to do: try every time a repo by `name` is resolved
// until one finally matches
else return branch.dependencies[name] = ref
}
child = yield* this.branchDependency(name, ref, branch)
branch.dependencies[name] = child
if (!~child.dependents.indexOf(branch)) child.dependents.push(branch);
debug('resolved dependencies of "%s"', branch.name);
}
var async = require('async');
var path = require('path');
var fs = require('fs');
var semver = require('semver');
var args = process.argv;
if (args.length != 4){
console.error("Usage: " + args[0] + " " + path.relative(process.cwd(), args[1]) + " [project] [version]");
process.exit(1);
}
var project = args[2];
var version = args[3];
if (!semver.valid(version)){
console.error("invalid semver version format (use vx.x.x)");
process.exit(1);
}
var pkgFile = __dirname + '/../package.json';
var pkg = require(pkgFile);
var projects = pkg._projects;
var builder = pkg._wrapupWebbuilderConfig;
if (!projects[project]){
console.error("project does not exist");
process.exit(1);
}
var versions = projects[project].versions;
exit(1)
}
const packageName = 'arranger'
const versionLoc = path.resolve(PACKAGES_SRC_DIR, 'VERSION')
const version = fs.readFileSync(versionLoc, 'utf8').trim()
let nextVersion = readline.question(
`Next version of ${packageName} (current version is ${version}): `,
)
while (
!(
!nextVersion ||
(semver.valid(nextVersion) && semver.gt(nextVersion, version))
)
) {
nextVersion = readline.question(
`Must provide a valid version that is greater than ${version}, ` +
'or leave blank to skip: ',
)
}
log('Running tests...')
if (exec('yarn run lint && yarn test').code !== 0) {
logError('The test command did not exit cleanly. Aborting release.')
exit(1)
}
logSuccess('Tests were successful.')
async function buildWebsiteApi({tag, apiPath, competencies}) {
if (!tag || !semver.valid(tag)) {
process.exitCode = 1;
return console.error('Error: CIRCLE_TAG environment variable must be set to a valid semver version');
} else {
const versionedApiPath = path.join(apiPath, `v${semver.major(tag)}`);
await createVersionEndpoint(semver.clean(tag), versionedApiPath);
await createCompetenciesEndpoint(competencies, versionedApiPath);
await createLevelsEndpoint(levels, versionedApiPath);
await createCompetenciesByLevelEndpoints(competencies, levels, versionedApiPath);
}
}
async function getDownloadInfo(version: string): Promise {
let platform = '';
let fileExtension = IS_WINDOWS ? '.zip' : '.tgz';
if (IS_WINDOWS) {
platform = `windows`;
} else {
if (process.platform === 'darwin') {
platform = `darwin`;
} else {
platform = `linux`;
}
}
if (version) {
let validVersion = semver.valid(version);
if (!validVersion) {
throw new Error(
`No valid download found for version ${version}. Check https://github.com/github/hub/releases for a list of valid releases`
);
}
//specific version, get that version from releases
return {
url: `https://github.com/github/hub/releases/download/v${version}/hub-${platform}-amd64-${version}${fileExtension}`,
version: version
} as DownloadInfo;
} else {
//get latest release
let http: httpm.HttpClient = new httpm.HttpClient('setup-hub');
let releaseJson = await (await http.get(
'https://api.github.com/repos/github/hub/releases/latest'
)).readBody();
export function getBuildrootUpdateAvailable(
state: State,
robot: ViewableRobot
): BuildrootUpdateType | null {
const updateVersion = getBuildrootUpdateVersion(state)
const currentVersion = getRobotApiVersion(robot)
const validCurrent: string | null = semver.valid(currentVersion)
const validUpdate: string | null = semver.valid(updateVersion)
let type = null
if (validUpdate) {
if (!validCurrent || semver.gt(validUpdate, validCurrent)) {
type = 'upgrade'
} else if (semver.lt(validUpdate, validCurrent)) {
type = 'downgrade'
} else if (semver.eq(validUpdate, validCurrent)) {
type = 'reinstall'
}
}
return type
}
const versions = Object.keys(packument.versions || {}).filter(v => {
return semver.valid(v, true)
})
const policyRestrictions = packument.policyRestrictions
function getSpecString(spec) {
var validVersion = semver.valid(spec, true);
return validVersion ? '~' + validVersion : spec;
}