@microsoft/rush-lib
Advanced tools
Comparing version 3.0.12 to 3.0.14
@@ -36,3 +36,3 @@ /** | ||
export declare class ApprovedPackagesConfiguration { | ||
private static _validator; | ||
private static _jsonSchema; | ||
items: ApprovedPackagesItem[]; | ||
@@ -39,0 +39,0 @@ private _itemsByName; |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -8,4 +8,3 @@ var fsx = require("fs-extra"); | ||
var os = require("os"); | ||
var JsonSchemaValidator_1 = require("../utilities/JsonSchemaValidator"); | ||
var JsonFile_1 = require("../utilities/JsonFile"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var Utilities_1 = require("../utilities/Utilities"); | ||
@@ -78,12 +77,3 @@ /** | ||
ApprovedPackagesConfiguration.prototype.loadFromFile = function () { | ||
var _this = this; | ||
if (!ApprovedPackagesConfiguration._validator) { | ||
var schemaFilename = path.join(__dirname, '../approved-packages.schema.json'); | ||
ApprovedPackagesConfiguration._validator = JsonSchemaValidator_1.default.loadFromFile(schemaFilename); | ||
} | ||
var approvedPackagesJson = JsonFile_1.default.loadJsonFile(this._jsonFilename); | ||
ApprovedPackagesConfiguration._validator.validateObject(approvedPackagesJson, function (errorDescription) { | ||
throw new Error("Error parsing file '" + path.basename(_this._jsonFilename) + "':\n" | ||
+ errorDescription); | ||
}); | ||
var approvedPackagesJson = node_core_library_1.JsonFile.loadAndValidate(this._jsonFilename, ApprovedPackagesConfiguration._jsonSchema); | ||
this.clear(); | ||
@@ -161,7 +151,7 @@ for (var _i = 0, _a = approvedPackagesJson.packages; _i < _a.length; _i++) { | ||
}; | ||
ApprovedPackagesConfiguration._jsonSchema = node_core_library_1.JsonSchema.fromFile(path.join(__dirname, '../approved-packages.schema.json')); | ||
return ApprovedPackagesConfiguration; | ||
}()); | ||
ApprovedPackagesConfiguration._validator = undefined; | ||
exports.ApprovedPackagesConfiguration = ApprovedPackagesConfiguration; | ||
//# sourceMappingURL=ApprovedPackagesConfiguration.js.map |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var path = require("path"); |
import RushConfiguration from './RushConfiguration'; | ||
import { IChangeFile } from './ChangeManagement'; | ||
import { IChangeFile, IChangeInfo } from './ChangeManagement'; | ||
/** | ||
@@ -12,7 +12,17 @@ * This class represents a single change file. | ||
/** | ||
* Write the change file to disk in sync mode | ||
* Adds a change entry into the change file | ||
* @param data - change information | ||
*/ | ||
addChange(data: IChangeInfo): void; | ||
/** | ||
* Gets all the change entries about the specified package from the change file. | ||
* @param packageName - package name | ||
*/ | ||
getChanges(packageName: string): IChangeInfo[]; | ||
/** | ||
* Writes the change file to disk in sync mode | ||
*/ | ||
writeSync(): void; | ||
/** | ||
* Generate a file path for storing the change file to disk | ||
* Generates a file path for storing the change file to disk | ||
*/ | ||
@@ -19,0 +29,0 @@ generatePath(): string; |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -8,3 +8,2 @@ var fsx = require("fs-extra"); | ||
var gitInfo = require("git-repo-info"); | ||
var RushConstants_1 = require("../RushConstants"); | ||
/** | ||
@@ -26,4 +25,25 @@ * This class represents a single change file. | ||
/** | ||
* Write the change file to disk in sync mode | ||
* Adds a change entry into the change file | ||
* @param data - change information | ||
*/ | ||
ChangeFile.prototype.addChange = function (data) { | ||
this._changeFileData.changes.push(data); | ||
}; | ||
/** | ||
* Gets all the change entries about the specified package from the change file. | ||
* @param packageName - package name | ||
*/ | ||
ChangeFile.prototype.getChanges = function (packageName) { | ||
var changes = []; | ||
for (var _i = 0, _a = this._changeFileData.changes; _i < _a.length; _i++) { | ||
var info = _a[_i]; | ||
if (info.packageName === packageName) { | ||
changes.push(info); | ||
} | ||
} | ||
return changes; | ||
}; | ||
/** | ||
* Writes the change file to disk in sync mode | ||
*/ | ||
ChangeFile.prototype.writeSync = function () { | ||
@@ -35,3 +55,3 @@ var filePath = this.generatePath(); | ||
/** | ||
* Generate a file path for storing the change file to disk | ||
* Generates a file path for storing the change file to disk | ||
*/ | ||
@@ -50,4 +70,3 @@ ChangeFile.prototype.generatePath = function () { | ||
this._getTimestamp() + ".json"); | ||
var filePath = path.join.apply(path, [this._rushConfiguration.commonFolder, | ||
RushConstants_1.RushConstants.changeFilesFolderName].concat(this._changeFileData.packageName.split('/'), [filename])); | ||
var filePath = path.join.apply(path, [this._rushConfiguration.changesFolder].concat(this._changeFileData.packageName.split('/'), [filename])); | ||
return filePath; | ||
@@ -54,0 +73,0 @@ }; |
@@ -39,3 +39,10 @@ /** | ||
comments: { | ||
[changeType: string]: IChangeLogComment[]; | ||
/** Describes changes which cause a patch-level SemVer bump */ | ||
patch?: IChangeLogComment[]; | ||
/** Describes changes which cause a minor-level SemVer bump */ | ||
minor?: IChangeLogComment[]; | ||
/** Describes changes which cause a major-level SemVer bump */ | ||
major?: IChangeLogComment[]; | ||
/** Describes changes to the package's dependencies */ | ||
dependency?: IChangeLogComment[]; | ||
}; | ||
@@ -42,0 +49,0 @@ } |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ /** |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ /** |
@@ -29,7 +29,7 @@ /** | ||
readonly size: number; | ||
private _serialize(); | ||
/** | ||
* Preferred to use PinnedVersionsConfiguration.loadFromFile() | ||
*/ | ||
private constructor(pinnedVersionJson, _filename); | ||
private constructor(); | ||
private _serialize(); | ||
} |
@@ -0,8 +1,8 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fs = require("fs"); | ||
var semver = require("semver"); | ||
var JsonFile_1 = require("../utilities/JsonFile"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
/** | ||
@@ -38,3 +38,3 @@ * Pinned Versions is a Rush feature designed to mimic the behavior of NPM | ||
if (fs.existsSync(jsonFilename)) { | ||
pinnedVersionJson = JsonFile_1.default.loadJsonFile(jsonFilename); | ||
pinnedVersionJson = node_core_library_1.JsonFile.load(jsonFilename); | ||
} | ||
@@ -62,3 +62,3 @@ return new PinnedVersionsConfiguration(pinnedVersionJson, jsonFilename); | ||
PinnedVersionsConfiguration.prototype.save = function () { | ||
JsonFile_1.default.saveJsonFile(this._serialize(), this._filename); | ||
node_core_library_1.JsonFile.save(this._serialize(), this._filename); | ||
return this; | ||
@@ -65,0 +65,0 @@ }; |
@@ -31,2 +31,11 @@ import RushConfigurationProject, { IRushConfigurationProjectJson } from './RushConfigurationProject'; | ||
/** | ||
* Part of IRushConfigurationJson. | ||
*/ | ||
export interface IRushRepositoryJson { | ||
/** | ||
* The remote url of the repository. It helps 'Rush change' finds the right remote to compare against. | ||
*/ | ||
url: string; | ||
} | ||
/** | ||
* This represents the JSON data structure for the "rush.json" configuration file. | ||
@@ -39,2 +48,3 @@ * See rush.schema.json for documentation. | ||
rushMinimumVersion: string; | ||
repository?: IRushRepositoryJson; | ||
nodeSupportedVersionRange?: string; | ||
@@ -64,3 +74,6 @@ projectFolderMinDepth?: number; | ||
export default class RushConfiguration { | ||
private static _jsonSchema; | ||
private _rushJsonFile; | ||
private _rushJsonFolder; | ||
private _changesFolder; | ||
private _commonFolder; | ||
@@ -82,2 +95,3 @@ private _commonTempFolder; | ||
private _gitSampleEmail; | ||
private _repositoryUrl; | ||
private _eventHooks; | ||
@@ -110,2 +124,6 @@ private _pinnedVersions; | ||
/** | ||
* The Rush configuration file | ||
*/ | ||
readonly rushJsonFile: string; | ||
/** | ||
* The folder that contains rush.json for this project. | ||
@@ -115,2 +133,6 @@ */ | ||
/** | ||
* The folder that contains all change files. | ||
*/ | ||
readonly changesFolder: string; | ||
/** | ||
* The fully resolved path for the "common" folder where Rush will store settings that | ||
@@ -224,2 +246,6 @@ * affect all Rush projects. This is always a subfolder of the folder containing "rush.json". | ||
/** | ||
* The remote url of the repository. It helps 'Rush change' finds the right remote to compare against. | ||
*/ | ||
readonly repositoryUrl: string; | ||
/** | ||
* Indicates whether telemetry collection is enabled for Rush runs. | ||
@@ -263,3 +289,2 @@ * @alpha | ||
readonly versionPolicyConfiguration: VersionPolicyConfiguration; | ||
private _populateDownstreamDependencies(dependencies, packageName); | ||
/** | ||
@@ -269,3 +294,4 @@ * Use RushConfiguration.loadFromConfigurationFile() or Use RushConfiguration.loadFromDefaultLocation() | ||
*/ | ||
private constructor(rushConfigurationJson, rushJsonFilename); | ||
private constructor(); | ||
private _populateDownstreamDependencies(dependencies, packageName); | ||
} |
@@ -0,11 +1,10 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var fsx = require("fs-extra"); | ||
var os = require("os"); | ||
var semver = require("semver"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var rushVersion_1 = require("../rushVersion"); | ||
var JsonFile_1 = require("../utilities/JsonFile"); | ||
var RushConfigurationProject_1 = require("./RushConfigurationProject"); | ||
@@ -16,3 +15,2 @@ var PinnedVersionsConfiguration_1 = require("./PinnedVersionsConfiguration"); | ||
var ApprovedPackagesPolicy_1 = require("./ApprovedPackagesPolicy"); | ||
var JsonSchemaValidator_1 = require("../utilities/JsonSchemaValidator"); | ||
var EventHooks_1 = require("./EventHooks"); | ||
@@ -55,2 +53,3 @@ var VersionPolicyConfiguration_1 = require("./VersionPolicyConfiguration"); | ||
} | ||
this._rushJsonFile = rushJsonFilename; | ||
this._rushJsonFolder = path.dirname(rushJsonFilename); | ||
@@ -63,2 +62,3 @@ this._commonFolder = path.resolve(path.join(this._rushJsonFolder, RushConstants_1.RushConstants.commonFolderName)); | ||
this._npmTmpFolder = path.resolve(path.join(this._commonTempFolder, 'npm-tmp')); | ||
this._changesFolder = path.join(this._commonFolder, RushConstants_1.RushConstants.changeFilesFolderName); | ||
this._committedShrinkwrapFilename = path.join(this._commonRushConfigFolder, RushConstants_1.RushConstants.npmShrinkwrapFilename); | ||
@@ -99,2 +99,5 @@ this._tempShrinkwrapFilename = path.join(this._commonTempFolder, RushConstants_1.RushConstants.npmShrinkwrapFilename); | ||
} | ||
if (rushConfigurationJson.repository) { | ||
this._repositoryUrl = rushConfigurationJson.repository.url; | ||
} | ||
this._telemetryEnabled = !!rushConfigurationJson.telemetryEnabled; | ||
@@ -149,3 +152,3 @@ if (rushConfigurationJson.eventHooks) { | ||
RushConfiguration.loadFromConfigurationFile = function (rushJsonFilename) { | ||
var rushConfigurationJson = JsonFile_1.default.loadJsonFile(rushJsonFilename); | ||
var rushConfigurationJson = node_core_library_1.JsonFile.load(rushJsonFilename); | ||
// Check the Rush version *before* we validate the schema, since if the version is outdated | ||
@@ -162,9 +165,3 @@ // then the schema may have changed. | ||
} | ||
var rushSchemaFilename = path.join(__dirname, '../rush.schema.json'); | ||
var validator = JsonSchemaValidator_1.default.loadFromFile(rushSchemaFilename); | ||
validator.validateObject(rushConfigurationJson, function (errorDescription) { | ||
var errorMessage = "Error parsing file '" + rushJsonFilename + "':" | ||
+ os.EOL + errorDescription; | ||
throw new Error(errorMessage); | ||
}); | ||
RushConfiguration._jsonSchema.validateObject(rushConfigurationJson, rushJsonFilename); | ||
return new RushConfiguration(rushConfigurationJson, rushJsonFilename); | ||
@@ -253,2 +250,12 @@ }; | ||
}; | ||
Object.defineProperty(RushConfiguration.prototype, "rushJsonFile", { | ||
/** | ||
* The Rush configuration file | ||
*/ | ||
get: function () { | ||
return this._rushJsonFile; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(RushConfiguration.prototype, "rushJsonFolder", { | ||
@@ -264,2 +271,12 @@ /** | ||
}); | ||
Object.defineProperty(RushConfiguration.prototype, "changesFolder", { | ||
/** | ||
* The folder that contains all change files. | ||
*/ | ||
get: function () { | ||
return this._changesFolder; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(RushConfiguration.prototype, "commonFolder", { | ||
@@ -469,2 +486,12 @@ /** | ||
}); | ||
Object.defineProperty(RushConfiguration.prototype, "repositoryUrl", { | ||
/** | ||
* The remote url of the repository. It helps 'Rush change' finds the right remote to compare against. | ||
*/ | ||
get: function () { | ||
return this._repositoryUrl; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(RushConfiguration.prototype, "telemetryEnabled", { | ||
@@ -588,2 +615,3 @@ /** | ||
}; | ||
RushConfiguration._jsonSchema = node_core_library_1.JsonSchema.fromFile(path.join(__dirname, '../rush.schema.json')); | ||
return RushConfiguration; | ||
@@ -590,0 +618,0 @@ }()); |
@@ -26,3 +26,3 @@ import IPackageJson from '../utilities/IPackageJson'; | ||
private _tempProjectName; | ||
private _tempPackageJsonFilename; | ||
private _unscopedTempProjectName; | ||
private _cyclicDependencyProjects; | ||
@@ -83,7 +83,7 @@ private _versionPolicyName; | ||
/** | ||
* The absolute path of the package.json file for the temp project. | ||
* The unscoped temporary project name | ||
* | ||
* Example: "C:\MyRepo\common\temp\projects\my-project-2\package.json" | ||
* Example: "my-project-2" | ||
*/ | ||
readonly tempPackageJsonFilename: string; | ||
readonly unscopedTempProjectName: string; | ||
/** | ||
@@ -90,0 +90,0 @@ * A flag which indicates whether changes to this project should be published. This controls |
@@ -0,10 +1,9 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var fsx = require("fs-extra"); | ||
var JsonFile_1 = require("../utilities/JsonFile"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var Utilities_1 = require("../utilities/Utilities"); | ||
var RushConstants_1 = require("../RushConstants"); | ||
/** | ||
@@ -51,3 +50,3 @@ * This represents the configuration of a project that is built by Rush, based on | ||
var packageJsonFilename = path.join(this._projectFolder, 'package.json'); | ||
this._packageJson = JsonFile_1.default.loadJsonFile(packageJsonFilename); | ||
this._packageJson = node_core_library_1.JsonFile.load(packageJsonFilename); | ||
if (this._packageJson.name !== this._packageName) { | ||
@@ -61,5 +60,3 @@ throw new Error("The package name \"" + this._packageName + "\" specified in rush.json does not" | ||
// Example: "my-project-2" | ||
var unscopedTempProjectName = Utilities_1.default.parseScopedPackageName(tempProjectName).name; | ||
// Example: "C:\MyRepo\common\temp\projects\my-project-2\package.json" | ||
this._tempPackageJsonFilename = path.join(rushConfiguration.commonTempFolder, RushConstants_1.RushConstants.rushTempProjectsFolderName, unscopedTempProjectName, RushConstants_1.RushConstants.packageJsonFilename); | ||
this._unscopedTempProjectName = Utilities_1.default.parseScopedPackageName(tempProjectName).name; | ||
this._cyclicDependencyProjects = new Set(); | ||
@@ -172,10 +169,10 @@ if (projectJson.cyclicDependencyProjects) { | ||
}); | ||
Object.defineProperty(RushConfigurationProject.prototype, "tempPackageJsonFilename", { | ||
Object.defineProperty(RushConfigurationProject.prototype, "unscopedTempProjectName", { | ||
/** | ||
* The absolute path of the package.json file for the temp project. | ||
* The unscoped temporary project name | ||
* | ||
* Example: "C:\MyRepo\common\temp\projects\my-project-2\package.json" | ||
* Example: "my-project-2" | ||
*/ | ||
get: function () { | ||
return this._tempPackageJsonFilename; | ||
return this._unscopedTempProjectName; | ||
}, | ||
@@ -182,0 +179,0 @@ enumerable: true, |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ /** |
@@ -9,7 +9,8 @@ import * as semver from 'semver'; | ||
export declare enum BumpType { | ||
'prerelease' = 0, | ||
'release' = 1, | ||
'none' = 0, | ||
'prerelease' = 1, | ||
'patch' = 2, | ||
'minor' = 3, | ||
'major' = 4, | ||
'preminor' = 3, | ||
'minor' = 4, | ||
'major' = 5, | ||
} | ||
@@ -31,7 +32,41 @@ /** | ||
private _definitionName; | ||
/** | ||
* Loads from version policy json | ||
* | ||
* @param versionPolicyJson - version policy Json | ||
*/ | ||
static load(versionPolicyJson: IVersionPolicyJson): VersionPolicy; | ||
constructor(versionPolicyJson: IVersionPolicyJson); | ||
/** | ||
* Version policy name | ||
*/ | ||
readonly policyName: string; | ||
/** | ||
* Version policy definition name | ||
*/ | ||
readonly definitionName: VersionPolicyDefinitionName; | ||
/** | ||
* Returns an updated package json that satisfies the policy. | ||
* | ||
* @param project - package json | ||
*/ | ||
abstract ensure(project: IPackageJson): IPackageJson | undefined; | ||
/** | ||
* Bumps version based on the policy | ||
* | ||
* @param bumpType - (optional) override bump type | ||
* @param identifier - (optional) override prerelease Id | ||
*/ | ||
abstract bump(bumpType?: BumpType, identifier?: string): void; | ||
/** | ||
* Serialized json for the policy | ||
*/ | ||
readonly abstract json: IVersionPolicyJson; | ||
/** | ||
* Validates the specified version and throws if the version does not satisfy the policy. | ||
* | ||
* @param versionString - version string | ||
* @param packageName - package name | ||
*/ | ||
abstract validate(versionString: string, packageName: string): void; | ||
} | ||
@@ -46,5 +81,36 @@ /** | ||
constructor(versionPolicyJson: ILockStepVersionJson); | ||
/** | ||
* The value of the lockstep version | ||
*/ | ||
readonly version: semver.SemVer; | ||
/** | ||
* The type of bump for next bump. | ||
*/ | ||
readonly nextBump: BumpType; | ||
/** | ||
* Serialized json for this policy | ||
*/ | ||
readonly json: ILockStepVersionJson; | ||
/** | ||
* Returns an updated package json that satisfies the version policy. | ||
* | ||
* @param project - input package json | ||
*/ | ||
ensure(project: IPackageJson): IPackageJson | undefined; | ||
/** | ||
* Bumps the version of the lockstep policy | ||
* | ||
* @param bumpType - Overwrite bump type in version-policy.json with the provided value. | ||
* @param identifier - Prerelease identifier if bump type is prerelease. | ||
*/ | ||
bump(bumpType?: BumpType, identifier?: string): void; | ||
/** | ||
* Validates the specified version and throws if the version does not satisfy lockstep version. | ||
* | ||
* @param versionString - version string | ||
* @param packageName - package name | ||
*/ | ||
validate(versionString: string, packageName: string): void; | ||
private _updatePackageVersion(project, newVersion); | ||
private _getReleaseType(bumpType); | ||
} | ||
@@ -58,4 +124,31 @@ /** | ||
constructor(versionPolicyJson: IIndividualVersionJson); | ||
/** | ||
* The major version that has been locked | ||
*/ | ||
readonly lockedMajor: number | undefined; | ||
/** | ||
* Serialized json for this policy | ||
*/ | ||
readonly json: IIndividualVersionJson; | ||
/** | ||
* Returns an updated package json that satisfies the version policy. | ||
* | ||
* @param project - input package json | ||
*/ | ||
ensure(project: IPackageJson): IPackageJson | undefined; | ||
/** | ||
* Bumps version. | ||
* Individual version policy lets change files drive version bump. This method currently does not do anything. | ||
* | ||
* @param bumpType - bump type | ||
* @param identifier - prerelease id | ||
*/ | ||
bump(bumpType?: BumpType, identifier?: string): void; | ||
/** | ||
* Validates the specified version and throws if the version does not satisfy the policy. | ||
* | ||
* @param versionString - version string | ||
* @param packageName - package name | ||
*/ | ||
validate(versionString: string, packageName: string): void; | ||
} |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -23,7 +23,14 @@ var extendStatics = Object.setPrototypeOf || | ||
(function (BumpType) { | ||
BumpType[BumpType["prerelease"] = 0] = "prerelease"; | ||
BumpType[BumpType["release"] = 1] = "release"; | ||
// No version bump | ||
BumpType[BumpType["none"] = 0] = "none"; | ||
// Prerelease version bump | ||
BumpType[BumpType["prerelease"] = 1] = "prerelease"; | ||
// Patch version bump | ||
BumpType[BumpType["patch"] = 2] = "patch"; | ||
BumpType[BumpType["minor"] = 3] = "minor"; | ||
BumpType[BumpType["major"] = 4] = "major"; | ||
// Preminor version bump | ||
BumpType[BumpType["preminor"] = 3] = "preminor"; | ||
// Minor version bump | ||
BumpType[BumpType["minor"] = 4] = "minor"; | ||
// Major version bump | ||
BumpType[BumpType["major"] = 5] = "major"; | ||
})(BumpType = exports.BumpType || (exports.BumpType = {})); | ||
@@ -48,8 +55,15 @@ /** | ||
} | ||
/** | ||
* Loads from version policy json | ||
* | ||
* @param versionPolicyJson - version policy Json | ||
*/ | ||
VersionPolicy.load = function (versionPolicyJson) { | ||
var definition = VersionPolicyDefinitionName[versionPolicyJson.definitionName]; | ||
if (definition === VersionPolicyDefinitionName.lockStepVersion) { | ||
// tslint:disable-next-line:no-use-before-declare | ||
return new LockStepVersionPolicy(versionPolicyJson); | ||
} | ||
else if (definition === VersionPolicyDefinitionName.individualVersion) { | ||
// tslint:disable-next-line:no-use-before-declare | ||
return new IndividualVersionPolicy(versionPolicyJson); | ||
@@ -60,2 +74,5 @@ } | ||
Object.defineProperty(VersionPolicy.prototype, "policyName", { | ||
/** | ||
* Version policy name | ||
*/ | ||
get: function () { | ||
@@ -68,2 +85,5 @@ return this._policyName; | ||
Object.defineProperty(VersionPolicy.prototype, "definitionName", { | ||
/** | ||
* Version policy definition name | ||
*/ | ||
get: function () { | ||
@@ -91,2 +111,5 @@ return this._definitionName; | ||
Object.defineProperty(LockStepVersionPolicy.prototype, "version", { | ||
/** | ||
* The value of the lockstep version | ||
*/ | ||
get: function () { | ||
@@ -99,2 +122,5 @@ return this._version; | ||
Object.defineProperty(LockStepVersionPolicy.prototype, "nextBump", { | ||
/** | ||
* The type of bump for next bump. | ||
*/ | ||
get: function () { | ||
@@ -106,2 +132,22 @@ return this._nextBump; | ||
}); | ||
Object.defineProperty(LockStepVersionPolicy.prototype, "json", { | ||
/** | ||
* Serialized json for this policy | ||
*/ | ||
get: function () { | ||
return { | ||
policyName: this.policyName, | ||
definitionName: VersionPolicyDefinitionName[this.definitionName], | ||
version: this.version.format(), | ||
nextBump: BumpType[this.nextBump] | ||
}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Returns an updated package json that satisfies the version policy. | ||
* | ||
* @param project - input package json | ||
*/ | ||
LockStepVersionPolicy.prototype.ensure = function (project) { | ||
@@ -118,6 +164,34 @@ var packageVersion = new semver.SemVer(project.version); | ||
} | ||
return this._updatePackageVersion(project, this._version); | ||
}; | ||
/** | ||
* Bumps the version of the lockstep policy | ||
* | ||
* @param bumpType - Overwrite bump type in version-policy.json with the provided value. | ||
* @param identifier - Prerelease identifier if bump type is prerelease. | ||
*/ | ||
LockStepVersionPolicy.prototype.bump = function (bumpType, identifier) { | ||
this.version.inc(this._getReleaseType(bumpType || this.nextBump), identifier); | ||
}; | ||
/** | ||
* Validates the specified version and throws if the version does not satisfy lockstep version. | ||
* | ||
* @param versionString - version string | ||
* @param packageName - package name | ||
*/ | ||
LockStepVersionPolicy.prototype.validate = function (versionString, packageName) { | ||
var versionToTest = new semver.SemVer(versionString, false); | ||
if (this.version.compare(versionToTest) !== 0) { | ||
throw new Error("Invalid version " + versionString + " in " + packageName); | ||
} | ||
}; | ||
LockStepVersionPolicy.prototype._updatePackageVersion = function (project, newVersion) { | ||
var updatedProject = lodash_1.cloneDeep(project); | ||
updatedProject.version = this._version.format(); | ||
updatedProject.version = newVersion.format(); | ||
return updatedProject; | ||
}; | ||
LockStepVersionPolicy.prototype._getReleaseType = function (bumpType) { | ||
// Eventually we should just use ReleaseType and get rid of bump type. | ||
return BumpType[bumpType]; | ||
}; | ||
return LockStepVersionPolicy; | ||
@@ -138,2 +212,5 @@ }(VersionPolicy)); | ||
Object.defineProperty(IndividualVersionPolicy.prototype, "lockedMajor", { | ||
/** | ||
* The major version that has been locked | ||
*/ | ||
get: function () { | ||
@@ -145,2 +222,21 @@ return this._lockedMajor; | ||
}); | ||
Object.defineProperty(IndividualVersionPolicy.prototype, "json", { | ||
/** | ||
* Serialized json for this policy | ||
*/ | ||
get: function () { | ||
return { | ||
policyName: this.policyName, | ||
definitionName: VersionPolicyDefinitionName[this.definitionName], | ||
lockedMajor: this.lockedMajor | ||
}; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* Returns an updated package json that satisfies the version policy. | ||
* | ||
* @param project - input package json | ||
*/ | ||
IndividualVersionPolicy.prototype.ensure = function (project) { | ||
@@ -162,2 +258,26 @@ if (this.lockedMajor) { | ||
}; | ||
/** | ||
* Bumps version. | ||
* Individual version policy lets change files drive version bump. This method currently does not do anything. | ||
* | ||
* @param bumpType - bump type | ||
* @param identifier - prerelease id | ||
*/ | ||
IndividualVersionPolicy.prototype.bump = function (bumpType, identifier) { | ||
// individual version policy lets change files drive version bump. | ||
}; | ||
/** | ||
* Validates the specified version and throws if the version does not satisfy the policy. | ||
* | ||
* @param versionString - version string | ||
* @param packageName - package name | ||
*/ | ||
IndividualVersionPolicy.prototype.validate = function (versionString, packageName) { | ||
var versionToTest = new semver.SemVer(versionString, false); | ||
if (this._lockedMajor !== undefined) { | ||
if (this._lockedMajor !== versionToTest.major) { | ||
throw new Error("Invalid major version " + versionString + " in " + packageName); | ||
} | ||
} | ||
}; | ||
return IndividualVersionPolicy; | ||
@@ -164,0 +284,0 @@ }(VersionPolicy)); |
@@ -1,2 +0,2 @@ | ||
import { VersionPolicy } from './VersionPolicy'; | ||
import { VersionPolicy, BumpType } from './VersionPolicy'; | ||
/** | ||
@@ -27,2 +27,3 @@ * @alpha | ||
private _jsonFileName; | ||
private static _jsonSchema; | ||
private _versionPolicies; | ||
@@ -34,3 +35,2 @@ constructor(_jsonFileName: string); | ||
* @param policyName - Name of the version policy | ||
* @alpha | ||
*/ | ||
@@ -40,6 +40,14 @@ getVersionPolicy(policyName: string): VersionPolicy; | ||
* Gets all the version policies | ||
* @alpha | ||
*/ | ||
readonly versionPolicies: Map<string, VersionPolicy>; | ||
/** | ||
* Bumps up versions for the specified version policy or all version policies | ||
* | ||
* @param versionPolicyName - version policy name | ||
* @param bumpType - bump type to override what policy has defined. | ||
* @param identifier - prerelease identifier to override what policy has defined. | ||
* @param shouldCommit - should save to disk | ||
*/ | ||
bump(versionPolicyName?: string, bumpType?: BumpType, identifier?: string, shouldCommit?: boolean): void; | ||
private _loadFile(); | ||
} |
@@ -0,9 +1,8 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var fsx = require("fs-extra"); | ||
var JsonSchemaValidator_1 = require("../utilities/JsonSchemaValidator"); | ||
var JsonFile_1 = require("../utilities/JsonFile"); | ||
var node_core_library_1 = require("@microsoft/node-core-library"); | ||
var VersionPolicy_1 = require("./VersionPolicy"); | ||
@@ -23,3 +22,2 @@ /** | ||
* @param policyName - Name of the version policy | ||
* @alpha | ||
*/ | ||
@@ -36,3 +34,2 @@ VersionPolicyConfiguration.prototype.getVersionPolicy = function (policyName) { | ||
* Gets all the version policies | ||
* @alpha | ||
*/ | ||
@@ -45,2 +42,32 @@ get: function () { | ||
}); | ||
/** | ||
* Bumps up versions for the specified version policy or all version policies | ||
* | ||
* @param versionPolicyName - version policy name | ||
* @param bumpType - bump type to override what policy has defined. | ||
* @param identifier - prerelease identifier to override what policy has defined. | ||
* @param shouldCommit - should save to disk | ||
*/ | ||
VersionPolicyConfiguration.prototype.bump = function (versionPolicyName, bumpType, identifier, shouldCommit) { | ||
if (versionPolicyName) { | ||
var policy = this.versionPolicies.get(versionPolicyName); | ||
if (policy) { | ||
policy.bump(bumpType, identifier); | ||
} | ||
} | ||
else { | ||
this.versionPolicies.forEach(function (versionPolicy) { | ||
if (versionPolicy) { | ||
versionPolicy.bump(bumpType, identifier); | ||
} | ||
}); | ||
} | ||
var versionPolicyJson = []; | ||
this.versionPolicies.forEach(function (versionPolicy) { | ||
versionPolicyJson.push(versionPolicy.json); | ||
}); | ||
if (shouldCommit) { | ||
node_core_library_1.JsonFile.save(versionPolicyJson, this._jsonFileName); | ||
} | ||
}; | ||
VersionPolicyConfiguration.prototype._loadFile = function () { | ||
@@ -51,9 +78,3 @@ var _this = this; | ||
} | ||
var versionPolicyJson = JsonFile_1.default.loadJsonFile(this._jsonFileName); | ||
var schemaPath = path.join(__dirname, '../version-policies.schema.json'); | ||
var validator = JsonSchemaValidator_1.default.loadFromFile(schemaPath); | ||
validator.validateObject(versionPolicyJson, function (errorDescription) { | ||
throw new Error("Error parsing file '" + path.basename(_this._jsonFileName) + "':\n" | ||
+ errorDescription); | ||
}); | ||
var versionPolicyJson = node_core_library_1.JsonFile.loadAndValidate(this._jsonFileName, VersionPolicyConfiguration._jsonSchema); | ||
versionPolicyJson.forEach(function (policyJson) { | ||
@@ -66,2 +87,3 @@ var policy = VersionPolicy_1.VersionPolicy.load(policyJson); | ||
}; | ||
VersionPolicyConfiguration._jsonSchema = node_core_library_1.JsonSchema.fromFile(path.join(__dirname, '../version-policies.schema.json')); | ||
return VersionPolicyConfiguration; | ||
@@ -68,0 +90,0 @@ }()); |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ /** |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var TestErrorDetector_1 = require("./TestErrorDetector"); |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ // tslint:disable:export-name |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ // tslint:disable:export-name |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ // tslint:disable:export-name |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
var __extends = (this && this.__extends) || (function () { | ||
@@ -5,0 +5,0 @@ var extendStatics = Object.setPrototypeOf || |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var child_process = require("child_process"); |
@@ -14,6 +14,4 @@ export { ApprovedPackagesPolicy } from './data/ApprovedPackagesPolicy'; | ||
export { default as IPackageJson } from './utilities/IPackageJson'; | ||
export { default as JsonFile, ISaveJsonFileOptions } from './utilities/JsonFile'; | ||
export { default as VersionControl } from './utilities/VersionControl'; | ||
export { default as Utilities } from './utilities/Utilities'; | ||
export { default as JsonSchemaValidator } from './utilities/JsonSchemaValidator'; | ||
export { Stopwatch, StopwatchState } from './utilities/Stopwatch'; | ||
@@ -20,0 +18,0 @@ export { RushConstants } from './RushConstants'; |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -32,4 +32,2 @@ var ApprovedPackagesPolicy_1 = require("./data/ApprovedPackagesPolicy"); | ||
exports.BuildTaskError = TaskError_1.BuildTaskError; | ||
var JsonFile_1 = require("./utilities/JsonFile"); | ||
exports.JsonFile = JsonFile_1.default; | ||
var VersionControl_1 = require("./utilities/VersionControl"); | ||
@@ -39,4 +37,2 @@ exports.VersionControl = VersionControl_1.default; | ||
exports.Utilities = Utilities_1.default; | ||
var JsonSchemaValidator_1 = require("./utilities/JsonSchemaValidator"); | ||
exports.JsonSchemaValidator = JsonSchemaValidator_1.default; | ||
var Stopwatch_1 = require("./utilities/Stopwatch"); | ||
@@ -43,0 +39,0 @@ exports.Stopwatch = Stopwatch_1.Stopwatch; |
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Rush Configuration", | ||
@@ -73,2 +74,13 @@ "description": "Configuration file for the Rush multi-package build tool", | ||
}, | ||
"repository": { | ||
"description": "The repository location", | ||
"type": "object", | ||
"properties": { | ||
"url": { | ||
"description": "The remote url of the repository. If a value is provided, \"Rush change\" will use it to find the right remote to compare against.", | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"telemetryEnabled": { | ||
@@ -123,3 +135,2 @@ "description": "Indicates whether telemetry data should be collected and stored in the Rush temp folder during Rush runs.", | ||
"type": "array", | ||
"optional": true, | ||
"items": { | ||
@@ -132,3 +143,2 @@ "type": "string" | ||
"type": "array", | ||
"optional": true, | ||
"items": { | ||
@@ -141,3 +151,2 @@ "type": "string" | ||
"type": "array", | ||
"optional": true, | ||
"items": { | ||
@@ -150,3 +159,2 @@ "type": "string" | ||
"type": "array", | ||
"optional": true, | ||
"items": { | ||
@@ -153,0 +161,0 @@ "type": "string" |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ /** |
@@ -0,7 +1,7 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var myPackageJsonFilename = path.resolve(path.join(module.filename, '..', '..', 'package.json')); | ||
var myPackageJsonFilename = path.resolve(path.join(__dirname, '..', 'package.json')); | ||
var myPackageJson = require(myPackageJsonFilename); | ||
@@ -8,0 +8,0 @@ /** |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var child_process = require("child_process"); |
@@ -0,6 +1,6 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=IPackageJson.js.map |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -28,5 +28,10 @@ var Utilities_1 = require("./Utilities"); | ||
var packageVersions = Utilities_1.default.executeCommandAndCaptureOutput('npm', ("view " + packageName + " versions --json").split(' '), cwd, env); | ||
(JSON.parse(packageVersions)).forEach(function (v) { | ||
versions.push(v); | ||
}); | ||
if (packageVersions && packageVersions.length > 0) { | ||
(JSON.parse(packageVersions)).forEach(function (v) { | ||
versions.push(v); | ||
}); | ||
} | ||
else { | ||
console.log("No version is found for " + packageName); | ||
} | ||
} | ||
@@ -33,0 +38,0 @@ } |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var Utilities_1 = require("./Utilities"); |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -5,0 +5,0 @@ var child_process = require("child_process"); |
@@ -7,8 +7,19 @@ /** | ||
static getChangedFiles(prefix?: string, targetBranch?: string): string[]; | ||
/** | ||
* Gets the remote master branch that maps to the provided repository url. | ||
* This method is used by 'Rush change' to find the default remote branch to compare against. | ||
* If repository url is not provided or if there is no match, returns the default remote | ||
* master branch 'origin/master'. | ||
* If there are more than one matches, returns the first remote's master branch. | ||
* | ||
* @param repositoryUrl - repository url | ||
*/ | ||
static getRemoteMasterBranch(repositoryUrl?: string): string; | ||
static hasUncommittedChanges(): boolean; | ||
/** | ||
* This lists files that have not been added/tracked in git. | ||
* The list of files changed but not commited | ||
*/ | ||
private static _hasUntrackedChanges(); | ||
private static _hasDiffOnHEAD(); | ||
static getUncommittedChanges(): ReadonlyArray<string>; | ||
private static _getUntrackedChanges(); | ||
private static _getDiffOnHEAD(); | ||
} |
@@ -0,4 +1,4 @@ | ||
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -44,19 +44,73 @@ var child_process = require("child_process"); | ||
}; | ||
/** | ||
* Gets the remote master branch that maps to the provided repository url. | ||
* This method is used by 'Rush change' to find the default remote branch to compare against. | ||
* If repository url is not provided or if there is no match, returns the default remote | ||
* master branch 'origin/master'. | ||
* If there are more than one matches, returns the first remote's master branch. | ||
* | ||
* @param repositoryUrl - repository url | ||
*/ | ||
VersionControl.getRemoteMasterBranch = function (repositoryUrl) { | ||
var defaultRemote = 'origin'; | ||
var defaultMaster = 'origin/master'; | ||
var useDefault = false; | ||
var matchingRemotes = []; | ||
if (!repositoryUrl) { | ||
useDefault = true; | ||
} | ||
else { | ||
var output = child_process | ||
.execSync("git remote") | ||
.toString(); | ||
matchingRemotes = output.split('\n').filter(function (remoteName) { | ||
if (remoteName) { | ||
var remoteUrl = child_process.execSync("git remote get-url " + remoteName) | ||
.toString() | ||
.trim(); | ||
if (remoteName === defaultRemote && remoteUrl === repositoryUrl) { | ||
useDefault = true; | ||
} | ||
return remoteUrl === repositoryUrl; | ||
} | ||
return false; | ||
}); | ||
} | ||
if (useDefault) { | ||
return defaultMaster; | ||
} | ||
else if (matchingRemotes.length > 0) { | ||
if (matchingRemotes.length > 1) { | ||
console.log("More than one remotes match the repository url. Use the first remote."); | ||
} | ||
return matchingRemotes[0] + "/master"; | ||
} | ||
// For backward-compatible | ||
return defaultMaster; | ||
}; | ||
VersionControl.hasUncommittedChanges = function () { | ||
return VersionControl._hasUntrackedChanges() || VersionControl._hasDiffOnHEAD(); | ||
return VersionControl.getUncommittedChanges().length > 0; | ||
}; | ||
/** | ||
* This lists files that have not been added/tracked in git. | ||
* The list of files changed but not commited | ||
*/ | ||
VersionControl._hasUntrackedChanges = function () { | ||
VersionControl.getUncommittedChanges = function () { | ||
var changes = []; | ||
changes.push.apply(changes, VersionControl._getUntrackedChanges()); | ||
changes.push.apply(changes, VersionControl._getDiffOnHEAD()); | ||
return changes.filter(function (change) { | ||
return change.trim().length > 0; | ||
}); | ||
}; | ||
VersionControl._getUntrackedChanges = function () { | ||
var output = child_process | ||
.execSync("git ls-files --exclude-standard --others") | ||
.toString(); | ||
return output.trim().length > 0; | ||
return output.trim().split('\n'); | ||
}; | ||
VersionControl._hasDiffOnHEAD = function () { | ||
VersionControl._getDiffOnHEAD = function () { | ||
var output = child_process | ||
.execSync("git diff HEAD --shortstat") | ||
.execSync("git diff HEAD --name-only") | ||
.toString(); | ||
return output.trim().length > 0; | ||
return output.trim().split('\n'); | ||
}; | ||
@@ -63,0 +117,0 @@ return VersionControl; |
{ | ||
"name": "@microsoft/rush-lib", | ||
"version": "3.0.12", | ||
"version": "3.0.14", | ||
"description": "A library for writing scripts that interact with the Rush tool", | ||
@@ -19,3 +19,4 @@ "repository": { | ||
"dependencies": { | ||
"@microsoft/stream-collator": "~2.0.2", | ||
"@microsoft/node-core-library": "~0.2.0", | ||
"@microsoft/stream-collator": "~2.0.5", | ||
"@types/es6-collections": "0.5.29", | ||
@@ -31,6 +32,6 @@ "@types/fs-extra": "0.0.37", | ||
"semver": "~5.3.0", | ||
"z-schema": "~3.17.0" | ||
"z-schema": "~3.18.3" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/node-library-build": "~3.1.0", | ||
"@microsoft/node-library-build": "~3.4.0", | ||
"chai": "~3.5.0", | ||
@@ -44,4 +45,4 @@ "gulp": "~3.9.1", | ||
"@types/chai": "3.4.34", | ||
"@types/semver": "5.3.31" | ||
"@types/semver": "5.3.33" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
12
395944
13
92
5009
+ Added@microsoft/node-core-library@0.2.11(transitive)
+ Addedlodash.isequal@4.5.0(transitive)
+ Addedvalidator@8.2.0(transitive)
+ Addedz-schema@3.18.4(transitive)
- Removedajv@6.12.6(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@1.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaws-sign2@0.7.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedfast-deep-equal@3.1.3(transitive)
- Removedfast-json-stable-stringify@2.1.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.3.3(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedhar-schema@2.0.0(transitive)
- Removedhar-validator@5.1.5(transitive)
- Removedhttp-signature@1.2.0(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-schema-traverse@0.4.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedoauth-sign@0.9.0(transitive)
- Removedperformance-now@2.1.0(transitive)
- Removedpsl@1.15.0(transitive)
- Removedpunycode@2.3.1(transitive)
- Removedqs@6.5.3(transitive)
- Removedrequest@2.88.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedtough-cookie@2.5.0(transitive)
- Removedtunnel-agent@0.6.0(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduri-js@4.4.1(transitive)
- Removeduuid@3.4.0(transitive)
- Removedvalidator@5.7.0(transitive)
- Removedverror@1.10.0(transitive)
- Removedz-schema@3.17.0(transitive)
Updatedz-schema@~3.18.3