-
-
Save brandongregoryscott/4f473d3cb34ed8723ac50a6a191cf862 to your computer and use it in GitHub Desktop.
An example of a module calling another module.
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
// ----------------------------------------------------------------------------------------- | |
// #region Imports | |
// ----------------------------------------------------------------------------------------- | |
const shell = require("shelljs"); | |
const { | |
restoreDotnetSolution, | |
solutionPathOrExit, | |
} = require("./restore-dotnet-solution"); | |
// #endregion Imports | |
// ----------------------------------------------------------------------------------------- | |
// #region Functions | |
// ----------------------------------------------------------------------------------------- | |
function buildDotnetSolution() { | |
// Check for the solution path before continuing. If we cannot find it here, the dotnet | |
// restore will fail, but we're going to need the path later on anyway. | |
const solutionPath = solutionPathOrExit(); | |
restoreDotnetSolution(); | |
shell.echo("Running dotnet build on the solution..."); | |
const result = shell.exec(`dotnet build ${solutionPath} --no-restore`); | |
if (result.code !== 0) { | |
shell.echo("Error running dotnet build!"); | |
shell.exit(result.code); | |
} | |
shell.echo("Dotnet solution built"); | |
} | |
// #endregion Functions | |
// ----------------------------------------------------------------------------------------- | |
// #region Exports | |
// ----------------------------------------------------------------------------------------- | |
const buildDotnetSolutionModule = { | |
buildDotnetSolution, | |
}; | |
module.exports = buildDotnetSolutionModule; | |
// #endregion Exports |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment