From de2c3fb572e019a5b76edcbef728536d4f193707 Mon Sep 17 00:00:00 2001 From: Scott Motte Date: Thu, 14 Apr 2022 15:51:12 -0700 Subject: [PATCH] Prefill project name --- src/services/new-service.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/services/new-service.ts b/src/services/new-service.ts index 01d0a2e..6e41112 100644 --- a/src/services/new-service.ts +++ b/src/services/new-service.ts @@ -18,6 +18,14 @@ class NewService { return vars.apiUrl + '/new' } + get urlWithProjectName(): string { + const dir = process.cwd() + const splitDir = dir.split('\\').join('/').split('/') // handle windows and unix paths + const projectName = splitDir[splitDir.length - 1] + + return `${this.url}?project_name=${projectName}` + } + get existingEnv(): boolean { return existsSync('.env') } @@ -48,7 +56,7 @@ class NewService { const answer = await CliUx.ux.confirm(`Open webpage at ${this.url}? Type yes (y) or no (n)`) if (answer) { - CliUx.ux.open(this.url) + CliUx.ux.open(this.urlWithProjectName) this._logProTip() const dotenvProject = await CliUx.ux.prompt('What is your .env.project identifier?', {type: 'mask'})