Skip to content

Commit

Permalink
[cli] Fix core example (#3847)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharatkashyap authored Jul 28, 2024
1 parent da6c96b commit bdfd9fd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 0 additions & 1 deletion examples/core-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"eslint": "^9.6.0",
"eslint-config-next": "^14.2.4"
}
}
2 changes: 0 additions & 2 deletions packages/create-toolpad-app/src/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export async function downloadAndExtractExample(root: string, name: string) {
filter: (p) => p.includes(`mui-toolpad-master/examples/${name}/`),
});

// eslint-disable-next-line no-console
console.log();
// eslint-disable-next-line no-console
console.log(
`${chalk.green('success')} - Downloaded and extracted "${name}" to ${chalk.cyan(root)}`,
Expand Down
16 changes: 16 additions & 0 deletions packages/create-toolpad-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,22 @@ const run = async () => {
// If the user has provided an example, download and extract it
if (args.example) {
await downloadAndExtractExample(absolutePath, args.example);

if (installFlag) {
// eslint-disable-next-line no-console
console.log(`${chalk.cyan('info')} - Installing dependencies`);
// eslint-disable-next-line no-console
console.log();
await execa(packageManager, ['install'], { stdio: 'inherit', cwd: absolutePath });
// eslint-disable-next-line no-console
console.log();
// eslint-disable-next-line no-console
console.log(
`${chalk.green('success')} - Installed "${args.example}" at ${chalk.cyan(absolutePath)}`,
);
// eslint-disable-next-line no-console
console.log();
}
}
// If the core flag is set, create a new project with Toolpad Core
else if (coreFlag) {
Expand Down

0 comments on commit bdfd9fd

Please sign in to comment.