wp-advads 1.0.22 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/package.json +9 -11
  2. package/src/app.js +80 -27
  3. package/src/commands/class.js +63 -0
  4. package/src/commands/css.js +36 -0
  5. package/src/commands/index.js +8 -6
  6. package/src/commands/init.js +166 -0
  7. package/src/commands/javascript.js +36 -0
  8. package/src/commands/release/change-version.js +61 -45
  9. package/src/commands/release/changelog.js +2 -2
  10. package/src/commands/release/composer.js +8 -16
  11. package/src/commands/release/git.js +5 -25
  12. package/src/commands/release/github.js +2 -4
  13. package/src/commands/release/prompts.js +1 -1
  14. package/src/commands/release/semver.js +2 -2
  15. package/src/commands/release/translations.js +10 -32
  16. package/src/commands/release.js +55 -0
  17. package/src/commands/updates.js +31 -0
  18. package/src/commands/views.js +31 -0
  19. package/src/utilities/filesystem.js +148 -0
  20. package/src/utilities/formatting.js +6 -2
  21. package/src/utilities/index.js +4 -5
  22. package/src/utilities/misc.js +12 -0
  23. package/src/utilities/semver.js +6 -1
  24. package/src/utilities/settings.js +94 -0
  25. package/src/utilities/shell.js +17 -0
  26. package/template/files/class-empty.php +26 -0
  27. package/template/{make/file-initializer.php → files/class-initializer.php} +5 -4
  28. package/template/{make/file-integration.php → files/class-integration.php} +5 -4
  29. package/template/{make/file-routes.php → files/class-rest.php} +5 -4
  30. package/template/{make/file-singleton.php → files/class-singleton.php} +5 -4
  31. package/template/files/javascript.js +13 -0
  32. package/template/files/stylesheet.css +8 -0
  33. package/template/files/update.php +21 -0
  34. package/template/{make/file.php → files/view.php} +3 -10
  35. package/src/commands/backup/index.js +0 -50
  36. package/src/commands/file/create-file.js +0 -127
  37. package/src/commands/file/index.js +0 -29
  38. package/src/commands/help/index.js +0 -16
  39. package/src/commands/patch/index.js +0 -84
  40. package/src/commands/release/index.js +0 -68
  41. package/src/commands/release/webpack.js +0 -30
  42. package/src/commands/setup/index.js +0 -28
  43. package/src/commands/setup/prompts.js +0 -111
  44. package/src/utilities/cache.js +0 -23
  45. package/src/utilities/command.js +0 -29
  46. package/src/utilities/file.js +0 -57
  47. package/src/utilities/folder.js +0 -64
@@ -1,37 +1,29 @@
1
1
  /**
2
2
  * External Dependencies
3
3
  */
4
- import fs from 'fs';
5
4
  import logSymbols from 'log-symbols'
6
5
 
7
6
  /**
8
7
  * Internal Dependencies
9
8
  */
10
- import { pluginData } from './index.js';
9
+ import { pluginData } from '../release.js';
11
10
  import { heading, execCommand, onSameLine } from "../../utilities/index.js"
12
11
 
13
12
  /**
14
13
  * Execute routine
15
14
  */
16
- export function updateComposer(next) {
15
+ export default function updateComposer(next) {
17
16
  heading('Updating composer')
18
17
 
19
18
  process.stderr.write('Dumping....')
20
19
 
21
- if (fs.existsSync('./vendor')) {
22
- fs.rmSync('./vendor', { recursive: true, force: true });
23
- }
24
-
25
- if (fs.existsSync('./packages')) {
26
- fs.rmSync('./packages', { recursive: true, force: true });
27
- }
28
-
29
- execCommand('composer install -o -a -n --no-dev --no-scripts', function() {
30
- fs.renameSync('./vendor', './packages')
31
- execCommand('composer install --no-scripts', function() {
20
+ execCommand('composer build', function(stdout, error, stderr) {
21
+ if(stderr.includes('not defined')) {
22
+ onSameLine(`${logSymbols.error} Command "build" is not defined.`)
23
+ } else {
32
24
  pluginData.commitMessages.push('update 3rd party dependecies and composer dump-autoloader')
33
25
  onSameLine(`${logSymbols.success} composer updated`)
34
- next()
35
- })
26
+ }
27
+ next()
36
28
  })
37
29
  }
@@ -6,9 +6,8 @@ import logSymbols from 'log-symbols'
6
6
  /**
7
7
  * Internal Dependencies
8
8
  */
9
- import { pluginData } from './index.js';
10
- import { execCommand, onSameLine } from "../../utilities/index.js"
11
-
9
+ import { pluginData } from '../release.js'
10
+ import { execCommand, onSameLine, getSetting } from "../../utilities/index.js"
12
11
 
13
12
  /**
14
13
  * Get latest tag from GitHub
@@ -18,7 +17,8 @@ export function getLatestTag() {
18
17
  try {
19
18
  execCommand('git rev-list --tags --max-count=1', function(tags) {
20
19
  execCommand( 'git describe --tags ' + tags.trim(), function(version) {
21
- resolve(version.trim())
20
+ version = version.trim()
21
+ resolve( '' !== version ? version : getSetting( 'wp.version', '0.0.0' ) )
22
22
  } )
23
23
  })
24
24
  }
@@ -93,27 +93,7 @@ export function verifyNextVersion(next) {
93
93
  export function getCurrentBranchName(next) {
94
94
  execCommand('git rev-parse --abbrev-ref HEAD', function(result) {
95
95
  pluginData.gitCurrentBranch = result.trim()
96
- next()
97
- })
98
- }
99
96
 
100
- /**
101
- * Create new branch with the release version
102
- */
103
- export function createReleaseBranch(next) {
104
- const message = 'Creating release branch'
105
- const version = pluginData.semver.getNextVersionString()
106
- process.stdout.write(`${message}....`)
107
-
108
- execCommand(`git checkout -b release/v${version}`, function(result, error, stderr) {
109
- if (stderr.includes('fatal:') && stderr.includes('already exists')) {
110
- onSameLine(`${logSymbols.error} Branch named: release/v${version} already exists.`)
111
- return next(true)
112
- }
113
-
114
- execCommand(`git push --set-upstream origin release/v${version}`, function(result) {
115
- onSameLine(`${logSymbols.success} Release branch created`)
116
- next()
117
- })
97
+ next()
118
98
  })
119
99
  }
@@ -7,15 +7,14 @@ import logSymbols from 'log-symbols'
7
7
  /**
8
8
  * Internal Dependencies
9
9
  */
10
+ import { pluginData } from '../release.js'
10
11
  import { execCommand, heading, onSameLine } from "../../utilities/index.js"
11
12
  import {
12
13
  hasPermission,
13
14
  gitFetch,
14
15
  verifyNextVersion,
15
- getCurrentBranchName,
16
- createReleaseBranch
16
+ getCurrentBranchName
17
17
  } from './git.js'
18
- import { pluginData } from './index.js'
19
18
 
20
19
  /**
21
20
  * Execute routine
@@ -29,7 +28,6 @@ export function githubPreTasks(next) {
29
28
  gitFetch,
30
29
  verifyNextVersion,
31
30
  getCurrentBranchName,
32
- createReleaseBranch
33
31
  ],
34
32
  ( err, results ) => {
35
33
  if(err) {
@@ -6,7 +6,7 @@ import inquirer from 'inquirer'
6
6
  /**
7
7
  * Internal Dependencies
8
8
  */
9
- import { pluginData } from './index.js';
9
+ import { pluginData } from '../release.js'
10
10
 
11
11
  /**
12
12
  * Execute routine
@@ -7,7 +7,7 @@ import logSymbols from 'log-symbols'
7
7
  /**
8
8
  * Internal Dependencies
9
9
  */
10
- import { pluginData } from './index.js';
10
+ import { pluginData } from '../release.js'
11
11
  import { getLatestTag } from './git.js'
12
12
  import { heading, onSameLine } from "../../utilities/index.js"
13
13
 
@@ -176,7 +176,7 @@ class SemVer {
176
176
  /**
177
177
  * Execute routine
178
178
  */
179
- export function getSemVer(next) {
179
+ export default function getSemVer(next) {
180
180
  heading('Calculating next version')
181
181
 
182
182
  process.stdout.write('Fetching latest version from github....')
@@ -6,44 +6,22 @@ import logSymbols from 'log-symbols'
6
6
  /**
7
7
  * Internal Dependencies
8
8
  */
9
- import { pluginData } from './index.js'
10
- import { heading, execCommand } from "../../utilities/index.js"
9
+ import { pluginData } from '../release.js'
10
+ import { heading, execCommand, getSetting } from "../../utilities/index.js"
11
11
 
12
12
  /**
13
- * Execute routine to generate POT files
13
+ * Execute routine to download translations from GlotPress
14
14
  */
15
- export function wpPot( next ) {
16
- const rootPath = process.cwd()
17
- const { wpPot = {} } = pluginData
18
- const {output, file, domain, exclude = [] } = wpPot
15
+ export default function updateTranslations( next ) {
16
+ heading('Downloading translations from glotpress')
19
17
 
20
- heading('Creating POT file')
18
+ const glotpress = getSetting('wp.glotpress')
21
19
 
22
- try {
23
- exclude.push(".github")
24
- exclude.push(".husky")
25
- exclude.push(".wordpress-org")
26
- exclude.push("node_modules")
27
- exclude.push("tools")
28
- exclude.push("vendor")
29
- execCommand(
30
- [ 'wp', 'i18n', 'make-pot', rootPath, `${rootPath}${output}${file} --domain=${domain} --exclude=${exclude.join(',')}` ].join(' '),
31
- () => {
32
- pluginData.commitMessages.push('update POT file')
33
- console.log( logSymbols.success + ' POT file successfully generated!' )
34
- next()
35
- }
36
- )
37
- } catch {
38
- throw new Error( logSymbols.error + ' Error' )
20
+ if (!glotpress) {
21
+ console.log( logSymbols.warning + ' No glotpress project found' )
22
+ next()
23
+ return;
39
24
  }
40
- }
41
-
42
- /**
43
- * Execute routine to download translations from GlotPress
44
- */
45
- export function updateTranslations( next ) {
46
- heading('Downloading translations from glotpress')
47
25
 
48
26
  execCommand( 'npm run translations -- --no-console', function(locales) {
49
27
  locales = locales.split('\n').slice(4).slice(0,-1)
@@ -0,0 +1,55 @@
1
+ /**
2
+ * External Dependencies
3
+ */
4
+ import chalk from 'chalk'
5
+ import { waterfall } from 'async'
6
+ import logSymbols from 'log-symbols'
7
+
8
+ /**
9
+ * Node dependencies
10
+ */
11
+ import { heading } from '../utilities/index.js'
12
+
13
+ /**
14
+ * Internal Dependencies
15
+ */
16
+ import prompts from './release/prompts.js'
17
+ import getSemVer from './release/semver.js'
18
+ import { githubPreTasks, githubFinalTasks } from './release/github.js'
19
+ import updateTranslations from './release/translations.js'
20
+ import updateComposer from './release/composer.js'
21
+ import updateChangelog from './release/changelog.js'
22
+ import updateVersionNumber from './release/change-version.js'
23
+
24
+ export const pluginData = {
25
+ commitMessages: [],
26
+ changelogChanges: false
27
+ }
28
+
29
+ export default async () => {
30
+ heading('Releasing the plugin...')
31
+ console.log('------------------------------------------------');
32
+
33
+ waterfall(
34
+ [
35
+ prompts,
36
+ getSemVer,
37
+ githubPreTasks,
38
+ updateTranslations,
39
+ updateComposer,
40
+ updateVersionNumber,
41
+ updateChangelog,
42
+ githubFinalTasks
43
+ ],
44
+ ( err, results ) => {
45
+ if (err) {
46
+ console.log('');
47
+ console.log( `${logSymbols.error} ${chalk.bold.red(`We failed somewhere! Work hard mate...`)}` )
48
+ return
49
+ }
50
+
51
+ console.log('');
52
+ console.log( `${logSymbols.success} ${chalk.bold.green(`All done!`)}` )
53
+ }
54
+ )
55
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Node Dependencies
3
+ */
4
+ import path from 'path';
5
+ import fs from 'fs-extra';
6
+
7
+ /**
8
+ * Internal Dependencies
9
+ */
10
+ import { getSetting, writeFile, heading, getProjectRoot, msgErrorTitle, getTemplateFile, compileTemplate } from "../utilities/index.js";
11
+
12
+ export default (version) => {
13
+ heading('Creating update file...')
14
+
15
+ try {
16
+ const filename = `upgrade-${version}.php`;
17
+ const folder = path.join(getProjectRoot(), getSetting('paths.updates'));
18
+
19
+ // Data
20
+ const data = getSetting();
21
+ data.heading = `Update routine for version ${version}`;
22
+ data.version = version.replaceAll('.', '_');
23
+
24
+ const content = compileTemplate(getTemplateFile('files/update.php'), data);
25
+ writeFile(folder,filename, content)
26
+ }
27
+ catch (err) {
28
+ msgErrorTitle('We failed!!!');
29
+ throw err;
30
+ }
31
+ }
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * Node Dependencies
4
+ */
5
+ import path from 'path';
6
+
7
+ /**
8
+ * Internal Dependencies
9
+ */
10
+ import { getSetting, writeFile, heading, filenameToHeading, getProjectRoot, msgErrorTitle, getTemplateFile, compileTemplate } from "../utilities/index.js";
11
+
12
+ export default (name, header) => {
13
+ heading('Creating view file...')
14
+
15
+ try {
16
+ const paths = name.toLowerCase().split('/')
17
+ const filename = paths.pop() + '.php';
18
+ const folder = path.join(getProjectRoot(), getSetting('paths.views'), paths.join('/'));
19
+
20
+ // Data
21
+ const data = getSetting();
22
+ data.heading = header || filenameToHeading(filename) + ' template file';
23
+
24
+ const content = compileTemplate(getTemplateFile('files/view.php'), data);
25
+ writeFile(folder, filename, content);
26
+ }
27
+ catch (err) {
28
+ msgErrorTitle('We failed!!!');
29
+ throw err;
30
+ }
31
+ }
@@ -0,0 +1,148 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import chalk from 'chalk';
5
+ import logSymbols from 'log-symbols';
6
+ import template from 'lodash/template.js';
7
+
8
+ /**
9
+ * Node dependencies
10
+ */
11
+ import path from 'path';
12
+ import fs from 'fs-extra';
13
+
14
+ /**
15
+ * Internal Dependencies
16
+ */
17
+ import { write, msgSuccessOnSameLine, onSameLine } from './formatting.js'
18
+
19
+ let projectRoot = null
20
+
21
+ /**
22
+ * Get the root folder of the project by searching for a known root file (e.g., package.json).
23
+ *
24
+ * @throws {Error} - Throws an error if the root folder cannot be found.
25
+ *
26
+ * @param {string} startDir - The directory to start searching from. Defaults to the current directory.
27
+ *
28
+ * @returns {string} - The absolute path to the project root folder.
29
+ */
30
+ export function getProjectRoot(startDir = process.cwd()) {
31
+ if (projectRoot) {
32
+ return projectRoot;
33
+ }
34
+
35
+ projectRoot = startDir;
36
+
37
+ while (projectRoot !== path.parse(projectRoot).root) {
38
+ const possibleRootFile = path.join(projectRoot, 'wp.advads');
39
+ if (fs.existsSync(possibleRootFile)) {
40
+ return projectRoot;
41
+ }
42
+
43
+ // Move up one directory level
44
+ projectRoot = path.dirname(projectRoot);
45
+ }
46
+
47
+ throw new Error('Project root not found. Make sure there is a wp.advads file in the root directory.');
48
+ }
49
+
50
+ /**
51
+ * Retrieves the path to the template folder.
52
+ *
53
+ * This function uses `createRequire` to resolve the path to the `../../template` directory
54
+ * relative to the current module's URL and removes the `/index.js` part from the resolved path.
55
+ *
56
+ * @returns {string} The path to the template folder.
57
+ */
58
+ export function getTemplateFolder() {
59
+ const dirname = path.dirname(import.meta.url.replace('file://', ''))
60
+ return path.join(dirname, '../../template')
61
+ }
62
+
63
+ /**
64
+ * Retrieves the path to the specified template file.
65
+ *
66
+ * @param {string} file - The name of the file to retrieve.
67
+ *
68
+ * @returns {string} The path to the specified template file.
69
+ */
70
+ export function getTemplateFile( file ) {
71
+ return path.join( getTemplateFolder(), file )
72
+ }
73
+
74
+ /**
75
+ * Compiles a template file with the provided data.
76
+ *
77
+ * @param {string} filename - The path to the template file.
78
+ * @param {Object} data - The data to be used in the template.
79
+ *
80
+ * @returns {string} - The compiled template with the data.
81
+ */
82
+ export function compileTemplate( filename, data ) {
83
+ const fileContent = fs.readFileSync(filename, 'utf-8');
84
+ const compiled = template(fileContent,{ interpolate: /{{([\s\S]+?)}}/g });
85
+
86
+ return compiled(data);
87
+ }
88
+
89
+ /**
90
+ * Deletes a specified file if it exists.
91
+ *
92
+ * @param {string} name - The name of the file to be deleted.
93
+ * @param {string} file - The path to the file to be deleted.
94
+ *
95
+ * @returns {void}
96
+ */
97
+ export function deleteFile(name, file) {
98
+ if ( ! fs.existsSync(file) ) {
99
+ console.log( `${logSymbols.error} ${chalk.red(`${name} file not found!`)}` )
100
+ return
101
+ }
102
+
103
+ fs.rmSync(file)
104
+ console.log( `${logSymbols.success} ${chalk.dim(`${name} deleted!`)}` )
105
+ }
106
+
107
+ /**
108
+ * Updates the content of a specified file.
109
+ *
110
+ * @param {string} fileName - The name of the file to update.
111
+ * @param {Object} messages - The messages to display during the update process.
112
+ * @param {Function} next - The callback function to call after the update process is complete.
113
+ * @param {Function} callback - The callback function to process the file content.
114
+ *
115
+ * @returns {void}
116
+ */
117
+ export function updateFileContent(fileName, messages, next, callback) {
118
+ process.stdout.write(messages.updating)
119
+
120
+ fs.readFile(fileName, (err, buffer) => {
121
+ if ( null !== err ) {
122
+ onSameLine(`${logSymbols.error} ${messages.failed}`)
123
+ return next()
124
+ }
125
+
126
+ const content = callback(buffer.toString())
127
+
128
+ fs.writeFile(fileName, content, (err) => {
129
+ if ( null !== err ) {
130
+ onSameLine(`${logSymbols.error} ${messages.failed}`)
131
+ return next()
132
+ }
133
+
134
+ onSameLine(`${logSymbols.success} ${messages.updated}`)
135
+ next()
136
+ })
137
+ })
138
+ }
139
+
140
+ export function writeFile(folder, filename, content) {
141
+ write('Creating directories!!');
142
+ fs.ensureDirSync(folder);
143
+ msgSuccessOnSameLine('Directories created successfully');
144
+
145
+ write('Creating file!!');
146
+ fs.writeFileSync(path.join(folder, filename), content);
147
+ msgSuccessOnSameLine('File created successfully');
148
+ }
@@ -36,8 +36,12 @@ export function onNewLine(text) {
36
36
  * @returns {void}
37
37
  */
38
38
  export function onSameLine(text) {
39
- process.stdout.clearLine()
40
- process.stdout.cursorTo(0)
39
+ if (process.stdout.clearLine) {
40
+ process.stdout.clearLine(); // Clear the current line
41
+ process.stdout.cursorTo(0); // Move the cursor to the start of the line
42
+ // process.stdout.write(message);
43
+ }
44
+
41
45
  console.log(text)
42
46
  }
43
47
 
@@ -1,7 +1,6 @@
1
- export * from './cache.js'
2
- export * from './command.js'
3
- export * from './file.js'
4
- export * from './folder.js'
1
+ export * from './filesystem.js'
5
2
  export * from './formatting.js'
6
- export * from './shell.js'
7
3
  export * from './semver.js'
4
+ export * from './settings.js'
5
+ export * from './shell.js'
6
+ export * from './misc.js'
@@ -0,0 +1,12 @@
1
+ /**
2
+ * External Dependencies
3
+ */
4
+ import capitalize from 'lodash/capitalize.js';
5
+
6
+ export function filenameToHeading(filename) {
7
+ filename = filename.replace('.php', '');
8
+ filename = filename.replace('.js', '');
9
+ filename = filename.replace(/-/g, ' ');
10
+
11
+ return capitalize(filename);
12
+ }
@@ -20,7 +20,7 @@ export class SemVer {
20
20
  return this.rawVersion
21
21
  }
22
22
 
23
- inc(type) {
23
+ increment(type) {
24
24
  const nextVersion = { ...this.baseVersion }
25
25
  nextVersion[type] += 1
26
26
 
@@ -38,3 +38,8 @@ export class SemVer {
38
38
  return `${version.major}.${version.minor}.${version.patch}`
39
39
  }
40
40
  }
41
+
42
+ export function incrementVersion(version, type) {
43
+ const semver = new SemVer(version)
44
+ return semver.increment(type)
45
+ }
@@ -0,0 +1,94 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import get from 'lodash/get.js'
5
+ import set from 'lodash/set.js'
6
+
7
+ /**
8
+ * Node dependencies
9
+ */
10
+ import fs from 'fs'
11
+ import path from 'path'
12
+
13
+ /**
14
+ * Internal Dependencies
15
+ */
16
+ import { getProjectRoot } from './filesystem.js'
17
+
18
+ let settings = null
19
+
20
+ /**
21
+ * Checks if the configuration file exists at the specified path.
22
+ *
23
+ * @returns {boolean} True if the configuration file exists, false otherwise.
24
+ */
25
+ export function configFileExists() {
26
+ try {
27
+ const configPath = path.join(getProjectRoot(), 'wp.advads')
28
+ return fs.existsSync(configPath);
29
+ } catch (err) {
30
+ return false;
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Read JSON data from the config file asynchronously.
36
+ *
37
+ * @returns {Object} - JSON data from the file.
38
+ */
39
+ export function readConfigFile() {
40
+ try {
41
+ const configPath = path.join(getProjectRoot(), 'wp.advads')
42
+ const data = fs.readFileSync(configPath, 'utf-8');
43
+ return JSON.parse(data);
44
+ } catch (err) {
45
+ return {};
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Save config file
51
+ *
52
+ * @param {Object} data - The data object to save
53
+ */
54
+ export function saveConfig(data) {
55
+ process.stdout.write('Saving config file...');
56
+ try {
57
+ const savePath = path.join(process.cwd(), 'wp.advads')
58
+ const jsonData = JSON.stringify(data, null, 2);
59
+ fs.writeFileSync(savePath, jsonData);
60
+ settings = data;
61
+ } catch (err) {
62
+ process.stdout.write('Error writing config file:', err);
63
+ throw err;
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Get setting from the config file
69
+ *
70
+ * @param {string} key - The key to get the value for
71
+ * @param {string} defaultVal - The default value to return if key is not found
72
+ *
73
+ * @returns {string} - The value of the key
74
+ */
75
+ export function getSetting(key = 'all', defaultVal = '') {
76
+ if (!settings) {
77
+ settings = readConfigFile();
78
+ }
79
+
80
+ if ( 'all' === key ) {
81
+ return settings;
82
+ }
83
+
84
+ return get( settings, key, defaultVal );
85
+ }
86
+
87
+ export function updateSetting(key, value) {
88
+ if (!settings) {
89
+ settings = readConfigFile();
90
+ }
91
+
92
+ settings = set(settings, key, value);
93
+ saveConfig(settings);
94
+ }
@@ -8,6 +8,15 @@ import { exec, spawn } from 'node:child_process'
8
8
  */
9
9
  import { onSameLine } from './formatting.js'
10
10
 
11
+ /**
12
+ * Run a command in the terminal.
13
+ *
14
+ * @param {string} command Command to run
15
+ * @param {string[]} args Arguments to pass
16
+ * @param {Function} callback Callback function
17
+ *
18
+ * @returns {void}
19
+ */
11
20
  export function runCommand( command, args, callback ) {
12
21
  const commandSpawn = spawn( command, args, {
13
22
  shell: true,
@@ -27,6 +36,14 @@ export function runCommand( command, args, callback ) {
27
36
  })
28
37
  }
29
38
 
39
+ /**
40
+ * Execute a command in the terminal.
41
+ *
42
+ * @param {string} command Command to execute
43
+ * @param {Function} callback Callback function
44
+ *
45
+ * @returns {void}
46
+ */
30
47
  export function execCommand( command, callback ) {
31
48
  if ('string' !== typeof command) {
32
49
  command = command.join(' ')
@@ -0,0 +1,26 @@
1
+ <?php
2
+ /**
3
+ * {{heading}}.
4
+ * {{description}}
5
+ *
6
+ * @since {{wp.version}}
7
+ * @package {{misc.package}}
8
+ * @author {{author.name}} <{{author.email}}>
9
+ */
10
+
11
+ namespace {{misc.package}}{{namespace}};
12
+
13
+ defined( 'ABSPATH' ) || exit;
14
+
15
+ /**
16
+ * {{heading}} class.
17
+ */
18
+ class {{className}} {
19
+
20
+ /**
21
+ * Constructor.
22
+ */
23
+ public function __construct() {
24
+ // Add your code here.
25
+ }
26
+ }