async match(content){ const electron = content.json.dependencies && 'electron' in content.json.dependencies ? coerce(content.json.dependencies.electron) : undefined; const electronDev = content.json.devDependencies && 'electron' in content.json.devDependencies ? coerce(content.json.devDependencies.electron) : undefined; let location = []; if (electron) { location.push({ line: 1, column: 0, id: this.id, description: this.description, shortenedURL: this.shortenedURL, properties: { "versionNumber": electron.raw }, severity: severity.INFORMATIONAL, confidence: confidence.CERTAIN, manualReview: false }); } if (electronDev) { location.push({ line: 1, column: 0, id: this.id, description: this.description, shortenedURL: this.shortenedURL, properties: { "versionNumber": electronDev.raw }, severity: severity.INFORMATIONAL, confidence: confidence.CERTAIN, manualReview: true }); } return location; }
export function minMatchingVersion(versionString) { try { const v = minVersion(versionString); return v.raw; } catch (_) { return undefined; } }
/** * Publishes a package to NPM, if its version has changed */ export async function npmPublish(opts: Options = {}): Promise<Results> { let options = normalizeOptions(opts); // Get the old and new version numbers let manifest = await readManifest(options.package, options.debug); let publishedVersion = await npm.getLatestVersion(manifest.name, options); // Determine if/how the version has changed let diff = semver.diff(manifest.version, publishedVersion); if (diff || !options.checkVersion) { // Publish the new version to NPM await npm.publish(manifest, options); } let results: Results = { package: manifest.name, type: diff || "none", version: manifest.version.raw, oldVersion: publishedVersion.raw, dryRun: options.dryRun }; options.debug("OUTPUT:", results); return results; }