Skip to content

Commit 55de02f

Browse files
Merge pull request #61 from dreamsicle-io/release/3.5.0
Release/3.5.0
2 parents d96e961 + 72b4fe9 commit 55de02f

File tree

5 files changed

+39
-20
lines changed

5 files changed

+39
-20
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ jobs:
5656
# the path to `tests` and enable the `verbose` option for debugging.
5757
- name: Create Theme
5858
id: create_theme
59-
run: npm test test-theme -- -v -f -P "tests" -N "Test Theme" -X "1.0.0" -T "parent-theme" -U "https://github.com/dreamsicle-io/test" -B "https://github.com/dreamsicle-io/test/issues" -R "git+ssh://git@github.com:dreamsicle-io/test.git" -r "git" -D "Just another WordPress theme." -A "Dreamsicle" -E "hello@dreamsicle.io" -u "https://www.dreamsicle.io" -L "gpl-3.0" -t "accessibility-ready,translation-ready" -W "6.1.0" -w "6.4.0" -F "test" -C "Test" -c "TEST" -e "testthemedev"
59+
run: npm test test-theme -- -v -f -P "tests" -N "Test Theme" -X "1.0.0" -T "parent-theme" -U "https://github.com/dreamsicle-io/test" -B "https://github.com/dreamsicle-io/test/issues" -R "https://github.com/dreamsicle-io/test.git" -S "git@github.com:dreamsicle-io/test.git" -r "git" -D "Just another WordPress theme." -A "Dreamsicle" -E "hello@dreamsicle.io" -u "https://www.dreamsicle.io" -L "gpl-3.0" -t "accessibility-ready,translation-ready" -W "6.1.0" -w "6.4.0" -F "test" -C "Test" -c "TEST" -e "testthemedev"

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ Theme Name: (WP Theme)
3737
Template: ()
3838
Theme URI: (https://github.com/example/wp-theme)
3939
Theme Bugs URI: (https://github.com/example/wp-theme/issues)
40-
Theme Repository URI: (git+ssh://git@github.com:example/wp-theme.git)
40+
Theme Repository URI: (https://github.com/example/wp-theme.git)
41+
Theme Repository SSH: ()
4142
Theme Repository Type: (git)
4243
Description: (This theme was generated using create-wp-theme.)
4344
Author: (Example, INC.)
@@ -50,6 +51,7 @@ WP Version Tested: (6.0.0)
5051
Function Prefix: (wp_theme)
5152
Class Prefix: (WP_Theme)
5253
Constant Prefix: (WP_THEME)
54+
WP Engine Environment: (wpthemedev)
5355
```
5456

5557
> **Note:** Any promptable options that have values already provided by the user will not be prompted for. If the tool detects that all possible option values have already been provided by the user, it won't display the prompt, and will instead jump directly into creation.
@@ -70,7 +72,7 @@ The tool will log its progress and errors in the console, exiting on completion
7072
📄 License written ― LICENSE
7173
📚 Theme relocated ― tests\wp-theme
7274
📁 Repo initialized ― Repo type: "git"
73-
🔗 Remote repo added ― git+ssh://git@github.com:example/wp-theme.git
75+
🔗 Remote repo added ― git@github.com:example/wp-theme.git
7476
💾 Initial files committed ― [main (root-commit) 37be1d1] ― 56 files changed, 4276 insertions(+)
7577
7678
🚀 Theme created ― Created "WP Theme" in tests\wp-theme
@@ -111,13 +113,14 @@ The tool will rename files and generate file contents if it detects placeholders
111113

112114
### File Content Replacement
113115

114-
| Placeholder | Replacement | Description |
115-
| ----------- | ------------------------ | ------------------------------------------- |
116-
| `wp-theme` | `<dir>` | The kebab-cased directory argument. |
117-
| `wp_theme` | `-F`, `--functionPrefix` | The snake-cased function prefix option. |
118-
| `WP_Theme` | `-C`, `--classPrefix` | The pascal-snake-cased class prefix option. |
119-
| `WP_THEME` | `-c`, `--constantPrefix` | The constant-cased constant prefix option. |
120-
| `WP Theme` | `-N`, `--themeName` | The unmodified theme name option. |
116+
| Placeholder | Replacement | Description |
117+
| ----------- | ------------------------ | -------------------------------------------- |
118+
| `WP Theme` | `-N`, `--themeName` | The unmodified theme name option. |
119+
| `wp_theme` | `-F`, `--functionPrefix` | The snake-cased function prefix option. |
120+
| `WP_THEME` | `-c`, `--constantPrefix` | The constant-cased constant prefix option. |
121+
| `WP_Theme` | `-C`, `--classPrefix` | The pascal-snake-cased class prefix option. |
122+
| `class-wp-theme-*` | `-C`, `--classPrefix` | The parsed class prefix option, kebab-cased. |
123+
| `wp-theme` | `<dir>` | The kebab-cased directory argument. |
121124

122125
### File Renaming
123126

@@ -158,7 +161,8 @@ Options:
158161
-T, --themeTemplate [string] The parent theme if this is a child theme (default: "")
159162
-U, --themeURI <string> The theme URI (default: "https://github.com/example/wp-theme")
160163
-B, --themeBugsURI <string> The theme bugs URI (default: "https://github.com/example/wp-theme/issues")
161-
-R, --themeRepoURI <string> The theme repository URI (default: "git+ssh://git@github.com:example/wp-theme.git")
164+
-R, --themeRepoURI <string> The theme repository HTTPS URI (default: "https://github.com/example/wp-theme.git")
165+
-S, --themeRepoSSH [string] The theme repository SSH URI (default: "")
162166
-r, --themeRepoType <string> The theme repository type (default: "git")
163167
-D, --themeDescription <string> The theme description (default: "This theme was generated using create-wp-theme.")
164168
-A, --themeAuthor <string> The theme author (default: "Example, INC.")

index.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { Command } from 'commander';
2121
* @property {string} themeURI
2222
* @property {string} themeBugsURI
2323
* @property {string} themeRepoURI
24+
* @property {string} themeRepoSSH
2425
* @property {string} themeRepoType
2526
* @property {string} themeDescription
2627
* @property {string} themeAuthor
@@ -198,13 +199,26 @@ const optionDefs = [
198199
alias: 'R',
199200
type: 'string',
200201
title: 'Theme Repository URI',
201-
description: 'The theme repository URI',
202-
default: 'git+ssh://git@github.com:example/wp-theme.git',
202+
description: 'The theme repository HTTPS URI',
203+
default: 'https://github.com/example/wp-theme.git',
203204
isRequired: true,
204205
isPrompted: true,
206+
sanitize: (value => {
207+
return zod.string().trim().url().safeParse(value).data || '';
208+
}),
209+
},
210+
{
211+
key: 'themeRepoSSH',
212+
alias: 'S',
213+
type: 'string',
214+
title: 'Theme Repository SSH',
215+
description: 'The theme repository SSH URI',
216+
default: '',
217+
isRequired: false,
218+
isPrompted: true,
205219
sanitize: (value => {
206220
// Parse this is a string rather than a URL, because the
207-
// SSH repo URI format does not pass Zod URL validation.
221+
// SSH URI format does not pass Zod URL validation.
208222
return zod.string().trim().safeParse(value).data || '';
209223
}),
210224
},
@@ -923,10 +937,11 @@ function initGitRepo() {
923937
data: stdoutInit.toString().trim(),
924938
});
925939
// Add remote origin.
926-
const stdoutAddRemote = execSync(`git remote add origin ${options.themeRepoURI}`, { stdio: 'pipe' });
940+
const remoteOrigin = options.themeRepoSSH || options.themeRepoURI;
941+
const stdoutAddRemote = execSync(`git remote add origin ${remoteOrigin}`, { stdio: 'pipe' });
927942
logInfo({
928943
title: 'Remote repo added',
929-
description: options.themeRepoURI,
944+
description: remoteOrigin,
930945
emoji: '🔗',
931946
verbose: options.verbose,
932947
dataLabel: 'Add remote response',

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dreamsicle.io/create-wp-theme",
3-
"version": "3.4.1",
3+
"version": "3.5.0",
44
"type": "module",
55
"description": "A command line tool for creating modern, optimized WordPress themes.",
66
"main": "index.js",
@@ -10,7 +10,7 @@
1010
},
1111
"repository": {
1212
"type": "git",
13-
"url": "git+ssh://git@github.com:dreamsicle-io/create-wp-theme.git"
13+
"url": "https://github.com/dreamsicle-io/create-wp-theme.git"
1414
},
1515
"homepage": "https://github.com/dreamsicle-io/create-wp-theme",
1616
"bugs": {

0 commit comments

Comments
 (0)