Skip to content

Commit 347492e

Browse files
authored
Merge branch 'master' into patch-1
2 parents 98c7614 + 33d670b commit 347492e

File tree

109 files changed

+901
-330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+901
-330
lines changed

apps/api-documenter/CHANGELOG.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
{
22
"name": "@microsoft/api-documenter",
33
"entries": [
4+
{
5+
"version": "7.0.7",
6+
"tag": "@microsoft/api-documenter_v7.0.7",
7+
"date": "Thu, 13 Dec 2018 02:58:10 GMT",
8+
"comments": {
9+
"dependency": [
10+
{
11+
"comment": "Updating dependency \"@microsoft/api-extractor\" from `7.0.4` to `7.0.5`"
12+
},
13+
{
14+
"comment": "Updating dependency \"@microsoft/node-core-library\" from `3.8.1` to `3.8.2`"
15+
},
16+
{
17+
"comment": "Updating dependency \"@microsoft/rush-stack-compiler-3.0\" from `0.3.1` to `0.3.2`"
18+
},
19+
{
20+
"comment": "Updating dependency \"@microsoft/node-library-build\" from `6.0.20` to `6.0.21`"
21+
}
22+
]
23+
}
24+
},
425
{
526
"version": "7.0.6",
627
"tag": "@microsoft/api-documenter_v7.0.6",

apps/api-documenter/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Change Log - @microsoft/api-documenter
22

3-
This log was last generated on Wed, 12 Dec 2018 17:04:19 GMT and should not be manually modified.
3+
This log was last generated on Thu, 13 Dec 2018 02:58:10 GMT and should not be manually modified.
4+
5+
## 7.0.7
6+
Thu, 13 Dec 2018 02:58:10 GMT
7+
8+
*Version update only*
49

510
## 7.0.6
611
Wed, 12 Dec 2018 17:04:19 GMT

apps/api-documenter/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-documenter",
3-
"version": "7.0.6",
3+
"version": "7.0.7",
44
"description": "Read JSON files from api-extractor, generate documentation pages",
55
"repository": {
66
"type": "git",
@@ -15,16 +15,16 @@
1515
"api-documenter": "./bin/api-documenter"
1616
},
1717
"dependencies": {
18-
"@microsoft/api-extractor": "7.0.4",
19-
"@microsoft/node-core-library": "3.8.1",
18+
"@microsoft/api-extractor": "7.0.5",
19+
"@microsoft/node-core-library": "3.8.2",
2020
"@microsoft/ts-command-line": "4.2.3",
2121
"@microsoft/tsdoc": "0.12.4",
2222
"colors": "~1.2.1",
2323
"js-yaml": "~3.9.1"
2424
},
2525
"devDependencies": {
26-
"@microsoft/rush-stack-compiler-3.0": "0.3.1",
27-
"@microsoft/node-library-build": "6.0.20",
26+
"@microsoft/rush-stack-compiler-3.0": "0.3.2",
27+
"@microsoft/node-library-build": "6.0.21",
2828
"@types/js-yaml": "3.9.1",
2929
"@types/node": "8.5.8",
3030
"gulp": "~3.9.1",

apps/api-extractor/CHANGELOG.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
{
22
"name": "@microsoft/api-extractor",
33
"entries": [
4+
{
5+
"version": "7.0.5",
6+
"tag": "@microsoft/api-extractor_v7.0.5",
7+
"date": "Thu, 13 Dec 2018 02:58:10 GMT",
8+
"comments": {
9+
"patch": [
10+
{
11+
"comment": "Remove unused jju dependency"
12+
}
13+
],
14+
"dependency": [
15+
{
16+
"comment": "Updating dependency \"@microsoft/node-core-library\" from `3.8.1` to `3.8.2`"
17+
}
18+
]
19+
}
20+
},
421
{
522
"version": "7.0.4",
623
"tag": "@microsoft/api-extractor_v7.0.4",

apps/api-extractor/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log - @microsoft/api-extractor
22

3-
This log was last generated on Wed, 12 Dec 2018 17:04:19 GMT and should not be manually modified.
3+
This log was last generated on Thu, 13 Dec 2018 02:58:10 GMT and should not be manually modified.
4+
5+
## 7.0.5
6+
Thu, 13 Dec 2018 02:58:10 GMT
7+
8+
### Patches
9+
10+
- Remove unused jju dependency
411

512
## 7.0.4
613
Wed, 12 Dec 2018 17:04:19 GMT

apps/api-extractor/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/api-extractor",
3-
"version": "7.0.4",
3+
"version": "7.0.5",
44
"description": "Validate, document, and review the exported API for a TypeScript library",
55
"keywords": [
66
"typescript",
@@ -31,13 +31,12 @@
3131
"build": "gulp test --clean"
3232
},
3333
"dependencies": {
34-
"@microsoft/node-core-library": "3.8.1",
34+
"@microsoft/node-core-library": "3.8.2",
3535
"@microsoft/ts-command-line": "4.2.3",
3636
"@microsoft/tsdoc": "0.12.4",
3737
"@types/node": "8.5.8",
3838
"@types/z-schema": "3.16.31",
3939
"colors": "~1.2.1",
40-
"jju": "~1.3.0",
4140
"lodash": "~4.17.5",
4241
"typescript": "~3.1.6",
4342
"z-schema": "~3.18.3",

apps/rush-lib/package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/rush-lib",
3-
"version": "5.5.3",
3+
"version": "5.5.4",
44
"description": "A library for writing scripts that interact with the Rush tool",
55
"repository": {
66
"type": "git",
@@ -21,23 +21,22 @@
2121
},
2222
"license": "MIT",
2323
"dependencies": {
24-
"@microsoft/node-core-library": "3.8.1",
25-
"@microsoft/package-deps-hash": "2.2.111",
26-
"@microsoft/stream-collator": "3.0.26",
24+
"@microsoft/node-core-library": "3.8.2",
25+
"@microsoft/package-deps-hash": "2.2.112",
26+
"@microsoft/stream-collator": "3.0.27",
2727
"@microsoft/ts-command-line": "4.2.3",
2828
"@pnpm/link-bins": "~1.0.1",
2929
"@pnpm/logger": "~1.0.1",
3030
"@yarnpkg/lockfile": "~1.0.2",
3131
"builtins": "~1.0.3",
3232
"colors": "~1.2.1",
33-
"git-repo-info": "~1.1.4",
33+
"git-repo-info": "~2.1.0",
3434
"glob": "~7.0.5",
3535
"glob-escape": "~0.0.1",
3636
"https-proxy-agent": "~2.2.1",
3737
"@types/inquirer": "0.0.43",
3838
"inquirer": "~6.2.0",
3939
"js-yaml": "~3.9.1",
40-
"jju": "~1.3.0",
4140
"lodash": "~4.17.5",
4241
"minimatch": "~3.0.2",
4342
"node-fetch": "~2.1.2",
@@ -50,8 +49,8 @@
5049
"z-schema": "~3.18.3"
5150
},
5251
"devDependencies": {
53-
"@microsoft/rush-stack-compiler-3.0": "0.3.1",
54-
"@microsoft/node-library-build": "6.0.20",
52+
"@microsoft/rush-stack-compiler-3.0": "0.3.2",
53+
"@microsoft/node-library-build": "6.0.21",
5554
"@types/node": "8.5.8",
5655
"@types/node-fetch": "1.6.9",
5756
"@types/tar": "4.0.0",

apps/rush-lib/src/api/ChangeFile.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See LICENSE in the project root for license information.
33

44
import * as path from 'path';
5+
56
import gitInfo = require('git-repo-info');
67

78
import { JsonFile } from '@microsoft/node-core-library';
@@ -11,6 +12,7 @@ import {
1112
IChangeFile,
1213
IChangeInfo
1314
} from './ChangeManagement';
15+
import { Git } from '../logic/Git';
1416

1517
/**
1618
* This class represents a single change file.
@@ -80,9 +82,9 @@ export class ChangeFile {
8082
*/
8183
public generatePath(): string {
8284
let branch: string | undefined = undefined;
83-
try {
84-
branch = gitInfo().branch;
85-
} catch (error) {
85+
const repoInfo: gitInfo.GitRepoInfo | undefined = Git.getGitInfo();
86+
branch = repoInfo && repoInfo.branch;
87+
if (!branch) {
8688
console.log('Could not automatically detect git branch name, using timestamp instead.');
8789
}
8890

apps/rush-lib/src/logic/Git.ts

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import gitInfo = require('git-repo-info');
55
import * as os from 'os';
6+
import * as path from 'path';
67
import { Executable } from '@microsoft/node-core-library';
78

89
import { Utilities } from '../utilities/Utilities';
@@ -18,6 +19,8 @@ interface IResultOrError<TResult> {
1819
export class Git {
1920
private static _checkedGitPath: boolean = false;
2021
private static _gitPath: string | undefined;
22+
private static _checkedGitInfo: boolean = false;
23+
private static _gitInfo: gitInfo.GitRepoInfo | undefined;
2124

2225
private static _gitEmailResult: IResultOrError<string> | undefined = undefined;
2326

@@ -42,14 +45,15 @@ export class Git {
4245

4346
/**
4447
* Returns true if the Git binary was found and the current path is under a Git working tree.
48+
* @param repoInfo - If provided, do the check based on this Git repo info. If not provided,
49+
* the result of `Git.getGitInfo()` is used.
4550
*/
46-
public static isPathUnderGitWorkingTree(): boolean {
51+
public static isPathUnderGitWorkingTree(repoInfo?: gitInfo.GitRepoInfo): boolean {
4752
if (Git.isGitPresent()) { // Do we even have a Git binary?
48-
try {
49-
return !!gitInfo().sha;
50-
} catch (e) {
51-
return false; // Unexpected, but possible if the .git directory is corrupted.
53+
if (!repoInfo) {
54+
repoInfo = Git.getGitInfo();
5255
}
56+
return !!(repoInfo && repoInfo.sha);
5357
} else {
5458
return false;
5559
}
@@ -104,6 +108,40 @@ export class Git {
104108
return emailResult.result;
105109
}
106110

111+
/**
112+
* Get the folder where Git hooks should go for the current working tree.
113+
* Returns undefined if the current path is not under a Git working tree.
114+
*/
115+
public static getHooksFolder(): string | undefined {
116+
const repoInfo: gitInfo.GitRepoInfo | undefined = Git.getGitInfo();
117+
if (repoInfo && repoInfo.worktreeGitDir) {
118+
return path.join(repoInfo.worktreeGitDir, 'hooks');
119+
}
120+
return undefined;
121+
}
122+
123+
/**
124+
* Get information about the current Git working tree.
125+
* Returns undefined if the current path is not under a Git working tree.
126+
*/
127+
public static getGitInfo(): Readonly<gitInfo.GitRepoInfo> | undefined {
128+
if (!Git._checkedGitInfo) {
129+
let repoInfo: gitInfo.GitRepoInfo | undefined;
130+
try {
131+
// gitInfo() shouldn't usually throw, but wrapping in a try/catch just in case
132+
repoInfo = gitInfo();
133+
} catch (ex) {
134+
// if there's an error, assume we're not in a Git working tree
135+
}
136+
137+
if (repoInfo && Git.isPathUnderGitWorkingTree(repoInfo)) {
138+
Git._gitInfo = repoInfo;
139+
}
140+
Git._checkedGitInfo = true;
141+
}
142+
return Git._gitInfo;
143+
}
144+
107145
private static _tryGetGitEmail(): IResultOrError<string> {
108146
if (Git._gitEmailResult === undefined) {
109147
if (!Git.isGitPresent()) {

apps/rush-lib/src/logic/InstallManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
FileSystem,
2121
FileConstants,
2222
Sort,
23-
FolderConstants,
2423
PosixModeBits
2524
} from '@microsoft/node-core-library';
2625

@@ -30,6 +29,7 @@ import { BaseLinkManager } from '../logic/base/BaseLinkManager';
3029
import { BaseShrinkwrapFile } from '../logic/base/BaseShrinkwrapFile';
3130
import { PolicyValidator } from '../logic/policy/PolicyValidator';
3231
import { IRushTempPackageJson } from '../logic/base/BasePackage';
32+
import { Git } from '../logic/Git';
3333
import { LastInstallFlag } from '../api/LastInstallFlag';
3434
import { LinkManagerFactory } from '../logic/LinkManagerFactory';
3535
import { PurgeManager } from './PurgeManager';
@@ -272,9 +272,9 @@ export class InstallManager {
272272

273273
// Git hooks are only installed if the repo opts in by including files in /common/git-hooks
274274
const hookSource: string = path.join(this._rushConfiguration.commonFolder, 'git-hooks');
275-
const hookDestination: string = path.join(this._rushConfiguration.rushJsonFolder, FolderConstants.Git, 'hooks');
275+
const hookDestination: string | undefined = Git.getHooksFolder();
276276

277-
if (FileSystem.exists(hookSource)) {
277+
if (FileSystem.exists(hookSource) && hookDestination) {
278278
const hookFilenames: Array<string> = FileSystem.readFolder(hookSource);
279279
if (hookFilenames.length > 0) {
280280
console.log(os.EOL + colors.bold('Found files in the "common/git-hooks" folder.'));

0 commit comments

Comments
 (0)