Skip to content

Commit 58f9134

Browse files
authored
Merge pull request microsoft#571 from Microsoft/pgonzal/rush-fixes
Fix two minor Rush issues
2 parents 6a10172 + 1dc3eb4 commit 58f9134

6 files changed

Lines changed: 64 additions & 34 deletions

File tree

‎apps/rush-lib/src/cli/logic/pnpm/PnpmShrinkwrapFile.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ import * as semver from 'semver';
66
import Utilities from '../../../utilities/Utilities';
77
import { BaseShrinkwrapFile } from '../base/BaseShrinkwrapFile';
88

9+
// This is based on PNPM's own configuration:
10+
// https://github.com/pnpm/pnpm-shrinkwrap/blob/master/src/write.ts
11+
const SHRINKWRAP_YAML_FORMAT: yaml.DumpOptions = {
12+
lineWidth: 1000,
13+
noCompatMode: true,
14+
noRefs: true,
15+
sortKeys: true
16+
};
17+
918
interface IShrinkwrapDependencyJson {
1019
/** Information about the resolved package */
1120
resolution: {
@@ -118,9 +127,7 @@ export class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
118127
* Serializes the PNPM Shrinkwrap file
119128
*/
120129
protected serialize(): string {
121-
return yaml.safeDump(this._shrinkwrapJson, {
122-
sortKeys: true
123-
});
130+
return yaml.safeDump(this._shrinkwrapJson, SHRINKWRAP_YAML_FORMAT);
124131
}
125132

126133
/**

‎apps/rush-lib/src/start.ts‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4-
import * as colors from 'colors';
5-
import * as semver from 'semver';
6-
7-
const nodeVersion: string = process.versions.node;
8-
9-
// tslint:disable-next-line
10-
11-
// We are on an ancient version of NodeJS that is known not to work with Rush
12-
if (semver.satisfies(nodeVersion, '<= 6.4.0')) {
13-
console.error(colors.red(`Your version of Node.js (${nodeVersion}) is very old and incompatible with Rush.`
14-
+ ` Please upgrade to the latest Long-Term Support (LTS) version.`));
15-
process.exit(1);
16-
}
17-
18-
// We are on a much newer release than we have tested and support
19-
// tslint:disable-next-line
20-
else if (semver.satisfies(nodeVersion, '>=9.0.0')) {
21-
console.warn(colors.yellow(`Your version of Node.js (${nodeVersion}) has not been tested with this release of Rush.`
22-
+ ` The Rush team will not accept issue reports for it.`
23-
+ ` Please consider upgrading Rush or downgrading Node.js.`));
24-
}
25-
26-
// We are not on an LTS release
27-
// tslint:disable-next-line
28-
else if (!semver.satisfies(nodeVersion, '^6.9.0')
29-
&& !semver.satisfies(nodeVersion, '^8.9.0')) {
30-
console.warn(colors.yellow(`Your version of Node.js (${nodeVersion}) is not a Long-Term Support (LTS) release.`
31-
+ ` These versions frequently contain bugs, and the Rush team will not accept issue reports for them.`
32-
+ ` Please consider installing a stable release.`));
33-
}
34-
354
import Rush from './Rush';
365

376
Rush.launch(Rush.version, false);

‎apps/rush/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"dependencies": {
3333
"@microsoft/node-core-library": "1.0.0",
3434
"@microsoft/rush-lib": "4.3.0",
35+
"colors": "~1.1.2",
3536
"fs-extra": "~0.26.7",
3637
"semver": "~5.3.0"
3738
},

‎apps/rush/src/start.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22
// See LICENSE in the project root for license information.
33

4+
import * as colors from 'colors';
5+
import * as semver from 'semver';
6+
7+
const nodeVersion: string = process.versions.node;
8+
9+
// tslint:disable-next-line
10+
11+
// We are on an ancient version of NodeJS that is known not to work with Rush
12+
if (semver.satisfies(nodeVersion, '<= 6.4.0')) {
13+
console.error(colors.red(`Your version of Node.js (${nodeVersion}) is very old and incompatible with Rush.`
14+
+ ` Please upgrade to the latest Long-Term Support (LTS) version.`));
15+
process.exit(1);
16+
}
17+
18+
// We are on a much newer release than we have tested and support
19+
// tslint:disable-next-line
20+
else if (semver.satisfies(nodeVersion, '>=9.0.0')) {
21+
console.warn(colors.yellow(`Your version of Node.js (${nodeVersion}) has not been tested with this release of Rush.`
22+
+ ` The Rush team will not accept issue reports for it.`
23+
+ ` Please consider upgrading Rush or downgrading Node.js.`));
24+
}
25+
26+
// We are not on an LTS release
27+
// tslint:disable-next-line
28+
else if (!semver.satisfies(nodeVersion, '^6.9.0')
29+
&& !semver.satisfies(nodeVersion, '^8.9.0')) {
30+
console.warn(colors.yellow(`Your version of Node.js (${nodeVersion}) is not a Long-Term Support (LTS) release.`
31+
+ ` These versions frequently contain bugs, and the Rush team will not accept issue reports for them.`
32+
+ ` Please consider installing a stable release.`));
33+
}
34+
435
import * as path from 'path';
536
import { JsonFile, IPackageJson } from '@microsoft/node-core-library';
637

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Move the environment checks from rush-lib to rush",
5+
"packageName": "@microsoft/rush",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "pgonzal@users.noreply.github.com"
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "Fix an annoyance where common/temp/shrinkwrap.yaml was formatted in a way that made diffs less readable",
5+
"packageName": "@microsoft/rush",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush",
10+
"email": "pgonzal@users.noreply.github.com"
11+
}

0 commit comments

Comments
 (0)