forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up skeleton for "rush-pnpm" command binary
- Loading branch information
1 parent
8dcb67b
commit 88cb4cc
Showing
8 changed files
with
88 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
import colors from 'colors/safe'; | ||
|
||
import { RushConfiguration } from '../api/RushConfiguration'; | ||
import { NodeJsCompatibility } from '../logic/NodeJsCompatibility'; | ||
|
||
export interface ILaunchRushPnpmInternalOptions { | ||
isManaged: boolean; | ||
alreadyReportedNodeTooNewError?: boolean; | ||
} | ||
|
||
export class RushPnpmCommandLine { | ||
public static launch(launcherVersion: string, options: ILaunchRushPnpmInternalOptions): void { | ||
// Node.js can sometimes accidentally terminate with a zero exit code (e.g. for an uncaught | ||
// promise exception), so we start with the assumption that the exit code is 1 | ||
// and set it to 0 only on success. | ||
process.exitCode = 1; | ||
|
||
try { | ||
// Are we in a Rush repo? | ||
let rushConfiguration: RushConfiguration | undefined = undefined; | ||
if (RushConfiguration.tryFindRushJsonLocation()) { | ||
rushConfiguration = RushConfiguration.loadFromDefaultLocation({ showVerbose: true }); | ||
} | ||
|
||
NodeJsCompatibility.warnAboutCompatibilityIssues({ | ||
isRushLib: true, | ||
alreadyReportedNodeTooNewError: !!options.alreadyReportedNodeTooNewError, | ||
rushConfiguration | ||
}); | ||
|
||
console.log('Success'); | ||
process.exitCode = 0; | ||
|
||
} catch (error) { | ||
console.log(colors.red('Error: ' + error.message)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
import { Rush } from './api/Rush'; | ||
|
||
Rush.launchRushPnpm(Rush.version, { isManaged: false }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
require('../lib/start.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters