Skip to content

Commit c4a87a2

Browse files
committed
Updates defaults, adds readme.
1 parent f94ed25 commit c4a87a2

File tree

2 files changed

+69
-74
lines changed

2 files changed

+69
-74
lines changed

README.md

Lines changed: 30 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ Once the command has been run, and the tool finds that the directory is unique,
2828
The following tool will help you configure your new theme.
2929
For each setting, set a value and hit "Enter" to continue.
3030

31-
Theme Name: (WP Theme)
32-
Version: (1.0.0)
31+
Theme Name: (WP Theme)
32+
Version: (0.0.1)
3333
Template: ()
34-
Theme URI: (https://github.com/example/my-theme)
34+
Theme URI: (https://github.com/example/wp-theme)
3535
Theme Bugs URI: (https://github.com/example/wp-theme/issues)
36-
Theme Repository URI: (https://github.com/example/wp-theme.git)
36+
Theme Repository URI: (git@github.com:example/wp-theme.git)
3737
Theme Repository Type: (git)
3838
Description: (This theme was generated using create-wp-theme.)
39-
Author: (Example, INC.)
39+
Author: (Example, INC.)
4040
Author Email: (hello@example.com)
41-
Author URI: (https://example.com)
42-
License: (GPL-3.0)
41+
Author URI: (https://www.example.com)
42+
License: (UNLICENSED)
4343
Tags: (accessibility-ready, translation-ready)
44-
WP Version Required: (4.9.8)
45-
WP Version Tested: (4.9.8)
44+
WP Version Required: (5.0.0)
45+
WP Version Tested: (5.0.0)
4646
Function Prefix: (wp_theme)
4747
Class Prefix: (WP_Theme)
4848
```
@@ -52,52 +52,35 @@ Class Prefix: (WP_Theme)
5252
The tool will log its progress and errors in the console, exiting on completion and fatal errors.
5353

5454
```shell
55-
Creating theme: My Theme in C:\Users\noahm\Code\create-wp-theme-dev\app\public\wp-content\themes\my-theme
55+
Creating theme: WP Theme in C:\Users\noahm\Code\create-wp-theme-dev\app\public\wp-content\themes\my-theme
5656

5757
Repo cloned: https://github.com/dreamsicle-io/wp-theme-assets.git --> C:\Users\noahm\Code\create-wp-theme\tmp
5858
package-lock.json cleaned: C:\Users\noahm\Code\create-wp-theme\tmp\package\package-lock.json
5959
package.json written: C:\Users\noahm\Code\create-wp-theme\tmp\package\package.json
60-
File Renamed: C:\Users\noahm\Code\create-wp-theme\tmp\package\includes\class-my-theme-assets.php
61-
File built: C:\Users\noahm\Code\create-wp-theme\tmp\package\includes\class-my-theme-assets.php
62-
License fetched: GNU General Public License v3.0
60+
File Renamed: C:\Users\noahm\Code\create-wp-theme\tmp\package\includes\class-wp-theme-assets.php
61+
File built: C:\Users\noahm\Code\create-wp-theme\tmp\package\includes\class-wp-theme-assets.php
6362
License written: C:\Users\noahm\Code\create-wp-theme\tmp\package\LICENSE
6463
Theme copied: C:\Users\noahm\Code\create-wp-theme-dev\app\public\wp-content\themes\my-theme
6564
Repo cleaned: C:\Users\noahm\Code\create-wp-theme\tmp
6665

67-
Theme created: My Theme in C:\Users\noahm\Code\create-wp-theme-dev\app\public\wp-content\themes\my-theme
66+
Theme created: WP Theme in C:\Users\noahm\Code\create-wp-theme-dev\app\public\wp-content\themes\my-theme
6867
```
6968

7069
## Options
7170

7271
The tool offers several options that will serve as defaults for the tool's prompt. These options can be used to customize the default options of the tool allowing the developer to go through the prompts faster.
7372

7473
```shell
75-
create-wp-theme -X 1.0.0 -A "Example, INC." -E hello@example.com -u https://example.com my-theme
74+
create-wp-theme -X 1.0.0 -A Dreamsicle -E hello@dreamsicle.com -u https://www.dreamsicle.com my-theme
7675
```
76+
> **Note:** If the option value has spaces in it, wrap it in quotes. For example - `"Example, Inc"`.
7777
78-
**The above would ouput the following prompts:**
78+
**The above would set the defaults for the following prompts:**
7979

8080
```shell
81-
The following tool will help you configure your new theme.
82-
For each setting, set a value and hit "Enter" to continue.
83-
84-
Theme Name: (WP Theme)
85-
Version: (1.0.0)
86-
Template: ()
87-
Theme URI: (https://github.com/example/my-theme)
88-
Theme Bugs URI: (https://github.com/example/wp-theme/issues)
89-
Theme Repository URI: (https://github.com/example/wp-theme.git)
90-
Theme Repository Type: (git)
91-
Description: (This theme was generated using create-wp-theme.)
92-
Author: (Example, INC.)
93-
Author Email: (hello@example.com)
94-
Author URI: (https://example.com)
95-
License: (GPL-3.0)
96-
Tags: (accessibility-ready, translation-ready)
97-
WP Version Required: (4.9.8)
98-
WP Version Tested: (4.9.8)
99-
Function Prefix: (wp_theme)
100-
Class Prefix: (WP_Theme)
81+
Author: (Dreamsicle)
82+
Author Email: (hello@dreamsicle.com)
83+
Author URI: (https://www.dreamsicle.com)
10184
```
10285

10386
## Help
@@ -118,18 +101,18 @@ Options:
118101
-N, --themeName <name> The theme name (default: "WP Theme")
119102
-X, --themeVersion [version] The theme version (default: "0.0.1")
120103
-T, --themeTemplate [theme] The parent theme if this is a child theme (default: "")
121-
-U, --themeURI [uri] The theme URI (default: "https://github.com/dreamsicle-io/create-wp-theme")
122-
-B, --themeBugsURI [uri] The theme bugs URI (default: "https://github.com/dreamsicle-io/create-wp-theme/issues")
123-
-R, --themeRepoURI [uri] The theme repository URI (default: "https://github.com/dreamsicle-io/create-wp-theme.git")
104+
-U, --themeURI [uri] The theme URI (default: "https://github.com/example/wp-theme")
105+
-B, --themeBugsURI [uri] The theme bugs URI (default: "https://github.com/example/wp-theme/issues")
106+
-R, --themeRepoURI [uri] The theme repository URI (default: "git@github.com:example/wp-theme.git")
124107
-r, --themeRepoType [type] The theme repository type (default: "git")
125-
-d, --themeDescription [description] The theme description (default: "This theme was generated using create-wp-theme.")
126-
-A, --themeAuthor [name] The theme author (default: "Dreamsicle")
127-
-E, --themeAuthorEmail [email] The theme author email (default: "hello@dreamsicle.io")
128-
-u, --themeAuthorURI [uri] The theme author URI (default: "https://www.dreamsicle.io")
129-
-L, --themeLicense [spdx] The theme license as a valid SPDX expression (default: "GPL-3.0")
130-
-t, --themeTags [tags] A CSV of WordPress theme tags (default: "accessibility-ready, translation-ready")
131-
-W, --wpVersionRequired [version] The version of WordPress the theme requires (default: "4.9.8")
132-
-w, --wpVersionTested [version] The version of WordPress the theme has been tested up to (default: "4.9.8")
108+
-d, --themeDescription [description] The theme description (default: "This theme was generated using create-wp-theme.")
109+
-A, --themeAuthor [name] The theme author (default: "Example, INC.")
110+
-E, --themeAuthorEmail [email] The theme author email (default: "hello@example.com")
111+
-u, --themeAuthorURI [uri] The theme author URI (default: "https://www.example.com")
112+
-L, --themeLicense [spdx] The theme license as a valid SPDX expression (default: "UNLICENSED")
113+
-t, --themeTags [tags] A CSV of WordPress theme tags (default: "accessibility-ready, translation-ready")
114+
-W, --wpVersionRequired [version] The version of WordPress the theme requires (default: "5.0.0")
115+
-w, --wpVersionTested [version] The version of WordPress the theme has been tested up to (default: "5.0.0")
133116
-F, --functionPrefix [prefix] The prefix for PHP functions (default: "wp_theme")
134117
-C, --classPrefix [prefix] The prefix for PHP classes (default: "WP_Theme")
135118
-h, --help display help for command

index.js

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ const defaultArgs = {
1919
themeName: 'WP Theme',
2020
themeVersion: '0.0.1',
2121
themeTemplate: '',
22-
themeURI: 'https://github.com/dreamsicle-io/create-wp-theme',
23-
themeBugsURI: 'https://github.com/dreamsicle-io/create-wp-theme/issues',
24-
themeRepoURI: 'https://github.com/dreamsicle-io/create-wp-theme.git',
22+
themeURI: 'https://github.com/example/wp-theme',
23+
themeBugsURI: 'https://github.com/example/wp-theme/issues',
24+
themeRepoURI: 'git@github.com:example/wp-theme.git',
2525
themeRepoType: 'git',
2626
themeDescription: 'This theme was generated using create-wp-theme.',
27-
themeAuthor: 'Dreamsicle',
28-
themeAuthorEmail: 'hello@dreamsicle.io',
29-
themeAuthorURI: 'https://www.dreamsicle.io',
30-
themeLicense: 'GPL-3.0',
27+
themeAuthor: 'Example, INC.',
28+
themeAuthorEmail: 'hello@example.com',
29+
themeAuthorURI: 'https://www.example.com',
30+
themeLicense: 'UNLICENSED',
3131
themeTags: 'accessibility-ready, translation-ready',
32-
wpVersionRequired: '4.9.8',
33-
wpVersionTested: '4.9.8',
32+
wpVersionRequired: '5.0.0',
33+
wpVersionTested: '5.0.0',
3434
functionPrefix: 'wp_theme',
3535
classPrefix: 'WP_Theme',
3636
};
@@ -213,28 +213,40 @@ function putPackage(args = null) {
213213
}
214214

215215
function writeLicense(args = null) {
216-
fetch('https://api.github.com/licenses/' + encodeURIComponent(args.themeLicense.toLowerCase()))
217-
.then(function(response) {
218-
if (response.status === 200) {
219-
return response.json();
220-
} else {
221-
throw new Error(response.json().message);
222-
}
223-
}).then(function(data) {
224-
console.info(chalk.bold.yellow('License fetched:'), data.name);
225-
fs.writeFile(tmpThemeLicPath, data.body, function(error) {
226-
if (error) {
227-
console.error(chalk.bold.redBright('Error:'), error);
228-
process.exit();
216+
if (args.themeLicense !== 'UNLICENSED') {
217+
fetch('https://api.github.com/licenses/' + encodeURIComponent(args.themeLicense.toLowerCase()))
218+
.then(function(response) {
219+
if (response.status === 200) {
220+
return response.json();
229221
} else {
230-
console.info(chalk.bold.yellow('License written:'), tmpThemeLicPath);
231-
putPackage(args);
222+
throw new Error(response.json().message);
232223
}
224+
}).then(function(data) {
225+
console.info(chalk.bold.yellow('License fetched:'), data.name);
226+
fs.writeFile(tmpThemeLicPath, data.body, function(error) {
227+
if (error) {
228+
console.error(chalk.bold.redBright('Error:'), error);
229+
process.exit();
230+
} else {
231+
console.info(chalk.bold.yellow('License written:'), tmpThemeLicPath);
232+
putPackage(args);
233+
}
234+
});
235+
}).catch(function(error) {
236+
console.error(chalk.bold.redBright('Error:'), error);
237+
putPackage(args);
233238
});
234-
}).catch(function(error) {
235-
console.error(chalk.bold.redBright('Error:'), error);
236-
putPackage(args);
239+
} else {
240+
fs.writeFile(tmpThemeLicPath, 'UNLICENSED', function(error) {
241+
if (error) {
242+
console.error(chalk.bold.redBright('Error:'), error);
243+
process.exit();
244+
} else {
245+
console.info(chalk.bold.yellow('License written:'), tmpThemeLicPath);
246+
putPackage(args);
247+
}
237248
});
249+
}
238250
}
239251

240252
function replaceRename(args = null) {

0 commit comments

Comments
 (0)