-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#20] Rename project config in post-create-project script
- Loading branch information
1 parent
7ba2dbe
commit ab46c36
Showing
4 changed files
with
64 additions
and
26 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
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,59 @@ | ||
<?php | ||
|
||
use craft\helpers\Console; | ||
|
||
require_once 'ScriptHelpers.php'; | ||
require_once 'vendor/autoload.php'; | ||
|
||
$cwd = getcwd(); | ||
|
||
/** | ||
* Prompt the user for input | ||
*/ | ||
$projectName = Console::prompt('What is the name of your project (Example: My Client Name)? ', [ | ||
'required' => true, | ||
]); | ||
|
||
Console::output("Great! We'll use the name: $projectName"); | ||
|
||
$suggestedProjectSlug = ScriptHelpers::kebabCase($projectName); | ||
|
||
$projectSlugPrompt = Console::prompt("Customize the project slug? This controls the DDEV URL, etc.", [ | ||
'default' => $suggestedProjectSlug, | ||
]); | ||
|
||
$projectSlug = !empty(trim($projectSlugPrompt)) ? ScriptHelpers::kebabCase($projectSlugPrompt) : $suggestedProjectSlug; | ||
|
||
ScriptHelpers::success("Great! We'll use $projectSlug"); | ||
|
||
/** | ||
* Update DDEV config | ||
*/ | ||
|
||
ScriptHelpers::replaceFileText( | ||
filePath: "$cwd/.ddev/config.yaml", | ||
pattern: "/name:\s+craft-starter/", | ||
replacement: "name: $projectSlug", | ||
); | ||
|
||
/** | ||
* Update project config | ||
*/ | ||
|
||
ScriptHelpers::replaceFileText( | ||
filePath: "$cwd/config/project/project.yaml", | ||
pattern: "/Viget Craft Starter/", | ||
replacement: "$projectName", | ||
); | ||
|
||
ScriptHelpers::replaceFileText( | ||
filePath: "$cwd/config/project/siteGroups/805d8826-faed-4186-9b88-f509eb9b07e6.yaml", | ||
pattern: "/Viget Craft Starter/", | ||
replacement: "$projectName", | ||
); | ||
|
||
ScriptHelpers::replaceFileText( | ||
filePath: "$cwd/config/project/sites/default--35b563a0-4662-40b9-b885-a8450a2868d9.yaml", | ||
pattern: "/Viget Craft Starter/", | ||
replacement: "$projectName", | ||
); |
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
This file was deleted.
Oops, something went wrong.