-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: warning for non-composable projects
- Loading branch information
Showing
3 changed files
with
32 additions
and
4 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
21 changes: 21 additions & 0 deletions
21
packages/composable-cli/src/lib/composable-project-middleware.ts
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,21 @@ | ||
import yargs, { MiddlewareFunction } from "yargs" | ||
import { CommandContext } from "../types/command" | ||
import boxen from "boxen" | ||
|
||
export function createComposableProjectMiddleware( | ||
ctx: CommandContext, | ||
): MiddlewareFunction { | ||
return async function composableProjectMiddleware( | ||
_args: yargs.ArgumentsCamelCase<{}>, | ||
) { | ||
if (!ctx.composableRc) { | ||
ctx.logger.info( | ||
boxen( | ||
"Failed to find .composablerc, is this a Composable Frontend workspace?\nThis command expects to be run in a composable frontend workspace and may not work as expected. It could be you're not inside your project folder.", | ||
{ padding: 1, margin: 1, borderColor: "yellow" }, | ||
), | ||
) | ||
} | ||
return | ||
} | ||
} |