Skip to content

Commit

Permalink
feature/open redirection url (#88)
Browse files Browse the repository at this point in the history
* Open wp-admin and finish setting up redirection if user says yes

* update changelog and version
  • Loading branch information
lissmeister authored Oct 24, 2023
1 parent c9ffa88 commit 8e99b54
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.15.5 (2023-10-24)
### Features
✨ Ask user if the redirection page should be opened in default browser upon finishing app creation

## 2.15.4 (2023-10-24)
### Changes
🛠 Store credentials in 1password when creating new Lisa-app
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { set } from "./lib/store.js"
import { checkLisaVersion } from "./lib/versions.js"

export const program = new Command()
export const LISA_VERSION = "2.15.4"
export const LISA_VERSION = "2.15.5"

resetConf()
checkNodeVersion()
Expand Down
27 changes: 21 additions & 6 deletions lib/summary.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import chalk from "chalk"
import { exec } from "child_process"
import prompts from "prompts"

import { getAppName } from "./app-name.js"
import conf from "./conf.js"
import * as store from "./store.js"
import { getVaultPass } from "./vault.js"
import { writeInfo, writeStep } from "./write.js"

export async function writeSummary() {
let apiUrl = conf.get("apiUrl")
let appName = await getAppName()
let vaultPass = getVaultPass()
let { username, password } = store.get("admin")
const apiUrl = conf.get("apiUrl")
const appName = await getAppName()
const redirectUrl = `${apiUrl}/wp/wp-admin/tools.php?page=redirection.php`

writeStep(chalk.underline("Summary:"))
writeInfo(`API url: ${apiUrl}/wp/wp-admin`)
Expand All @@ -19,7 +18,23 @@ export async function writeSummary() {
chalk.underline(`cd ${appName} && yarn dev`),
)}`,
)

writeInfo(
`Before doing anything else, go to: ${apiUrl}/wp/wp-admin/tools.php?page=redirection.php and complete the installer.`,
)

const { confirm } = await prompts([
{
type: "confirm",
name: "confirm",
message: () => `Do you want to open ${redirectUrl} in your browser now?`,
initial: false,
},
])

if (confirm) {
try {
exec(`open ${redirectUrl}`)
} catch (error) {}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@triggerfishab/lisa-cli",
"version": "2.15.4",
"version": "2.15.5",
"description": "CLI commands to generate a new project based on Lisa",
"main": "./index.js",
"bin": {
Expand Down

0 comments on commit 8e99b54

Please sign in to comment.