Skip to content

Commit

Permalink
remove choice between TS and JS
Browse files Browse the repository at this point in the history
  • Loading branch information
jharrell committed Oct 18, 2024
1 parent 3515554 commit 690f6e2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 29 deletions.
Binary file removed .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
.vscode
.vscode
.DS_Store
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

</div>

`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.
Expand Down
10 changes: 7 additions & 3 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Cli {
async initialize() {
// Grab projects
const result = await getProjects();

this.projects = result?.[0] ?? []
this.projectsWithSubfolders = result?.[1] ?? []

Expand Down Expand Up @@ -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),
Expand Down
25 changes: 0 additions & 25 deletions src/cli/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,6 @@ const selectORMorPDP = async (): Promise<string> => {
return start;
};

const getRootDir = async (): Promise<string> => {
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<boolean> => {
const { packages } = await inquirer.prompt({
type: "confirm",
Expand Down Expand Up @@ -154,5 +130,4 @@ export default {
getProjectName,
selectManager,
getTemplate,
getRootDir,
};

0 comments on commit 690f6e2

Please sign in to comment.