diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 22787b4..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore index c2dd9a5..0a5121f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules dist -.vscode \ No newline at end of file +.vscode +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index f3c1245..c6f8394 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![Tests](https://github.com/prisma/try-prisma/actions/workflows/test.yml/badge.svg)](https://github.com/prisma/try-prisma/actions/workflows/test.yml) [![Linting](https://github.com/prisma/try-prisma/actions/workflows/lint.yml/badge.svg)](https://github.com/prisma/try-prisma/actions/workflows/lint.yml) + `try-prisma` is a CLI tool that helps you easily get up and running with any project from the [`prisma/prisma-examples`](https://github.com/prisma/prisma-examples) repository. diff --git a/src/cli/index.ts b/src/cli/index.ts index d0d17e3..2e58ab5 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -16,7 +16,7 @@ export default class Cli { async initialize() { // Grab projects const result = await getProjects(); - + this.projects = result?.[0] ?? [] this.projectsWithSubfolders = result?.[1] ?? [] @@ -72,10 +72,14 @@ export default class Cli { // Collect user input if (!this.args.folder.length) { const projects = await prompts.selectORMorPDP() - if( projects !== "orm" ) { + if (projects !== "orm") { this.args.folder = projects; } else { - this.args.folder = await prompts.getRootDir(); + // hack from #DA-1540 + this.args.folder = 'typescript' + if (this.projects.filter((project) => project.startsWith(this.args.folder)).length === 0) { + this.args.folder = 'orm' + } } this.projects = this.projects.filter((project) => project.startsWith(this.args.folder), diff --git a/src/cli/prompts.ts b/src/cli/prompts.ts index 22b4922..9f21991 100644 --- a/src/cli/prompts.ts +++ b/src/cli/prompts.ts @@ -63,30 +63,6 @@ const selectORMorPDP = async (): Promise => { return start; }; -const getRootDir = async (): Promise => { - logger.success( - `\nThese options correspond to the root directories in the prisma-examples repository:\n`, - ); - const { rootDir } = await inquirer.prompt({ - // @ts-expect-error Inquirer doesn't register the type. - type: "search-list", - message: `Which language do you want to use?`, - name: "rootDir", - choices: [ - { - name: "TypeScript", - value: "typescript", - }, - { - name: "JavaScript", - value: "javascript", - }, - ], - }); - - return rootDir; -}; - const getInstallSelection = async (): Promise => { const { packages } = await inquirer.prompt({ type: "confirm", @@ -154,5 +130,4 @@ export default { getProjectName, selectManager, getTemplate, - getRootDir, };