-
-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7e47ef
commit ca6354f
Showing
7 changed files
with
234 additions
and
229 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import chalk from 'chalk'; | ||
import { execa } from 'execa'; | ||
import type { GenerateProjectOptions } from './types'; | ||
import generateProject from './generateProject'; | ||
import writeFiles from './writeFiles'; | ||
|
||
export async function scaffoldCoreProject(options: GenerateProjectOptions): Promise<void> { | ||
// eslint-disable-next-line no-console | ||
console.log(); | ||
// eslint-disable-next-line no-console | ||
console.log( | ||
`${chalk.cyan('info')} - Creating Toolpad Core project in ${chalk.cyan(options.absolutePath)}`, | ||
); | ||
// eslint-disable-next-line no-console | ||
console.log(); | ||
|
||
const packageManager = options.packageManager; | ||
|
||
const files = generateProject(options); | ||
await writeFiles(options.absolutePath, files); | ||
|
||
if (options.install) { | ||
// 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: options.absolutePath, | ||
}); | ||
|
||
// eslint-disable-next-line no-console | ||
console.log(); | ||
} | ||
|
||
// eslint-disable-next-line no-console | ||
console.log( | ||
`${chalk.green('success')} - Created Toolpad Core project at ${chalk.cyan(options.absolutePath)}`, | ||
); | ||
// eslint-disable-next-line no-console | ||
console.log(); | ||
|
||
if (options.auth) { | ||
// eslint-disable-next-line no-console | ||
console.log( | ||
`${chalk.cyan('info')} - Bootstrapped ${chalk.cyan('env.local')} with empty values. See https://authjs.dev/getting-started on how to add your credentials.`, | ||
); | ||
// eslint-disable-next-line no-console | ||
console.log(); | ||
} | ||
} |
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
Oops, something went wrong.