-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PATCH: Fix generators (merge pull request #4 from boostercloud/boost-…
…280-fix-generators)
- Loading branch information
Showing
32 changed files
with
286 additions
and
160 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function withinWorkingDirectory<TReturn>(workingDirectory: string, actions: () => TReturn): TReturn { | ||
const currentWorkingDirectory = process.cwd() | ||
process.chdir(workingDirectory) | ||
const result = actions() | ||
process.chdir(currentWorkingDirectory) | ||
return result | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as fs from 'fs-extra' | ||
import * as path from 'path' | ||
|
||
function checkIndexFileIsBooster(indexFilePath: string): void { | ||
const contents = fs.readFileSync(indexFilePath) | ||
if (!contents.includes('Booster.start()')) { | ||
throw new Error( | ||
'The main application file does not start a Booster application. Verify you are in the right project' | ||
) | ||
} | ||
} | ||
|
||
export async function checkItIsABoosterProject(): Promise<void> { | ||
const currentPath = process.cwd() | ||
try { | ||
const tsConfigJsonContents = require(path.join(currentPath, 'tsconfig.json')) | ||
const indexFilePath = path.normalize( | ||
path.join(currentPath, tsConfigJsonContents.compilerOptions.rootDir, 'index.ts') | ||
) | ||
checkIndexFileIsBooster(indexFilePath) | ||
} catch (e) { | ||
throw new Error( | ||
`There was an error when recognizing the application. Make sure you are in the root path of a Booster project:\n${e.message}` | ||
) | ||
} | ||
} |
Oops, something went wrong.