-
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.
Co-authored-by: TyagiSunny <[email protected]>
- Loading branch information
1 parent
ea1798a
commit 4c34a05
Showing
5 changed files
with
144 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// import yeomanenv from 'yeoman-environment'; | ||
const yeomanenv = require('yeoman-environment'); | ||
|
||
|
||
async function yeomanRun(workspace: string, name: string, args: string[] | undefined, opts: any) { | ||
const env = getEnv(workspace, name); | ||
await runWithEnv(env, name, args, opts); | ||
} | ||
|
||
function getEnv(workspace: string, name: string) { | ||
const env = yeomanenv.createEnv([], { cwd: workspace }); | ||
registerGenerators(env, name); | ||
return env; | ||
} | ||
|
||
async function runWithEnv(env: any, name: string, args: string[] | undefined, opts: any) { | ||
const yeomanArgs = [`sl:${name}`, ...(args ?? [])]; | ||
return env.run(yeomanArgs, opts); | ||
} | ||
|
||
async function registerGenerators(env: any, generator: string) { | ||
env.register( | ||
require.resolve(`@sourceloop/cli/lib/generators/${generator}/index`), | ||
`sl:${generator}`, | ||
); | ||
} | ||
|
||
const buildOptions = { | ||
loopbackBuild: true, | ||
eslint: true, | ||
prettier: true, | ||
mocha: true, | ||
vscode: true, | ||
docker: true, | ||
repositories: true, | ||
services: true, | ||
}; | ||
|
||
export { | ||
yeomanRun, | ||
getEnv, | ||
runWithEnv, | ||
registerGenerators, | ||
buildOptions, | ||
}; |