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.
- package/package.json +9 -11
- package/src/app.js +80 -27
- package/src/commands/class.js +63 -0
- package/src/commands/css.js +36 -0
- package/src/commands/index.js +8 -6
- package/src/commands/init.js +166 -0
- package/src/commands/javascript.js +36 -0
- package/src/commands/release/change-version.js +61 -45
- package/src/commands/release/changelog.js +2 -2
- package/src/commands/release/composer.js +8 -16
- package/src/commands/release/git.js +5 -25
- package/src/commands/release/github.js +2 -4
- package/src/commands/release/prompts.js +1 -1
- package/src/commands/release/semver.js +2 -2
- package/src/commands/release/translations.js +10 -32
- package/src/commands/release.js +55 -0
- package/src/commands/updates.js +31 -0
- package/src/commands/views.js +31 -0
- package/src/utilities/filesystem.js +148 -0
- package/src/utilities/formatting.js +6 -2
- package/src/utilities/index.js +4 -5
- package/src/utilities/misc.js +12 -0
- package/src/utilities/semver.js +6 -1
- package/src/utilities/settings.js +94 -0
- package/src/utilities/shell.js +17 -0
- package/template/files/class-empty.php +26 -0
- package/template/{make/file-initializer.php → files/class-initializer.php} +5 -4
- package/template/{make/file-integration.php → files/class-integration.php} +5 -4
- package/template/{make/file-routes.php → files/class-rest.php} +5 -4
- package/template/{make/file-singleton.php → files/class-singleton.php} +5 -4
- package/template/files/javascript.js +13 -0
- package/template/files/stylesheet.css +8 -0
- package/template/files/update.php +21 -0
- package/template/{make/file.php → files/view.php} +3 -10
- package/src/commands/backup/index.js +0 -50
- package/src/commands/file/create-file.js +0 -127
- package/src/commands/file/index.js +0 -29
- package/src/commands/help/index.js +0 -16
- package/src/commands/patch/index.js +0 -84
- package/src/commands/release/index.js +0 -68
- package/src/commands/release/webpack.js +0 -30
- package/src/commands/setup/index.js +0 -28
- package/src/commands/setup/prompts.js +0 -111
- package/src/utilities/cache.js +0 -23
- package/src/utilities/command.js +0 -29
- package/src/utilities/file.js +0 -57
- package/src/utilities/folder.js +0 -64
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
<?php
|
|
2
2
|
/**
|
|
3
3
|
* {{heading}}.
|
|
4
|
+
* {{description}}
|
|
4
5
|
*
|
|
5
|
-
* @package {{php.package}}
|
|
6
|
-
* @author {{author.name}} <{{author.email}}>
|
|
7
6
|
* @since {{wp.version}}
|
|
7
|
+
* @package {{misc.package}}
|
|
8
|
+
* @author {{author.name}} <{{author.email}}>
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
|
-
namespace {{
|
|
11
|
+
namespace {{misc.package}}{{namespace}};
|
|
11
12
|
|
|
12
13
|
use AdvancedAds\Framework\Interfaces\Initializer_Interface;
|
|
13
14
|
|
|
14
15
|
defined( 'ABSPATH' ) || exit;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* {{
|
|
18
|
+
* {{className}} class.
|
|
18
19
|
*/
|
|
19
20
|
class {{className}} implements Initializer_Interface {
|
|
20
21
|
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
<?php
|
|
2
2
|
/**
|
|
3
3
|
* {{heading}}.
|
|
4
|
+
* {{description}}
|
|
4
5
|
*
|
|
5
|
-
* @package {{php.package}}
|
|
6
|
-
* @author {{author.name}} <{{author.email}}>
|
|
7
6
|
* @since {{wp.version}}
|
|
7
|
+
* @package {{misc.package}}
|
|
8
|
+
* @author {{author.name}} <{{author.email}}>
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
|
-
namespace {{
|
|
11
|
+
namespace {{misc.package}}{{namespace}};
|
|
11
12
|
|
|
12
13
|
use AdvancedAds\Framework\Interfaces\Integration_Interface;
|
|
13
14
|
|
|
14
15
|
defined( 'ABSPATH' ) || exit;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* {{
|
|
18
|
+
* {{className}} class.
|
|
18
19
|
*/
|
|
19
20
|
class {{className}} implements Integration_Interface {
|
|
20
21
|
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
<?php
|
|
2
2
|
/**
|
|
3
3
|
* {{heading}}.
|
|
4
|
+
* {{description}}
|
|
4
5
|
*
|
|
5
|
-
* @package {{php.package}}
|
|
6
|
-
* @author {{author.name}} <{{author.email}}>
|
|
7
6
|
* @since {{wp.version}}
|
|
7
|
+
* @package {{misc.package}}
|
|
8
|
+
* @author {{author.name}} <{{author.email}}>
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
|
-
namespace {{
|
|
11
|
+
namespace {{misc.package}}{{namespace}};
|
|
11
12
|
|
|
12
13
|
use AdvancedAds\Framework\Interfaces\Routes_Interface;
|
|
13
14
|
|
|
14
15
|
defined( 'ABSPATH' ) || exit;
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* {{
|
|
18
|
+
* {{className}} class.
|
|
18
19
|
*/
|
|
19
20
|
class {{className}} implements Routes_Interface {
|
|
20
21
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
<?php
|
|
2
2
|
/**
|
|
3
3
|
* {{heading}}.
|
|
4
|
+
* {{description}}
|
|
4
5
|
*
|
|
5
|
-
* @package {{php.package}}
|
|
6
|
-
* @author {{author.name}} <{{author.email}}>
|
|
7
6
|
* @since {{wp.version}}
|
|
7
|
+
* @package {{misc.package}}
|
|
8
|
+
* @author {{author.name}} <{{author.email}}>
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
|
-
namespace {{
|
|
11
|
+
namespace {{misc.package}}{{namespace}};
|
|
11
12
|
|
|
12
13
|
defined( 'ABSPATH' ) || exit;
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
* {{
|
|
16
|
+
* {{className}} class.
|
|
16
17
|
*/
|
|
17
18
|
class {{className}} {
|
|
18
19
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{heading}}
|
|
3
|
+
*
|
|
4
|
+
* @since {{wp.version}}
|
|
5
|
+
* @package {{misc.package}}
|
|
6
|
+
* @author {{author.name}} <{{author.email}}>
|
|
7
|
+
* @description {{description}}
|
|
8
|
+
*/
|
|
9
|
+
import jquery from 'jquery';
|
|
10
|
+
|
|
11
|
+
export default function() {
|
|
12
|
+
// Code goes here...
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
defined( 'ABSPATH' ) || exit;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Description goes here
|
|
15
|
+
*
|
|
16
|
+
* @return void
|
|
17
|
+
*/
|
|
18
|
+
function {{prefix}}_upgrade_{{version}}(): void {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
{{prefix}}_upgrade_{{version}}();
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
<?php
|
|
2
2
|
/**
|
|
3
3
|
* {{heading}}.
|
|
4
|
+
* {{description}}
|
|
4
5
|
*
|
|
5
|
-
* @package {{php.package}}
|
|
6
|
-
* @author {{author.name}} <{{author.email}}>
|
|
7
6
|
* @since {{wp.version}}
|
|
7
|
+
* @package {{misc.package}}
|
|
8
|
+
* @author {{author.name}} <{{author.email}}>
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
|
-
namespace {{php.package}}{{namespace}};
|
|
11
|
-
|
|
12
11
|
defined( 'ABSPATH' ) || exit;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* {{heading}}.
|
|
16
|
-
*/
|
|
17
|
-
class {{className}} {
|
|
18
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { waterfall } from 'async'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal Dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { heading, getCurrentFolder, backupFile, deleteFile, msgErrorTitle, msgSuccessTitle } from "../../utilities/index.js"
|
|
10
|
-
|
|
11
|
-
function backupFiles(next) {
|
|
12
|
-
backupFile('Pre commit hook', getCurrentFolder() + '/.git/hooks/pre-commit')
|
|
13
|
-
next()
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function deleteFiles(next) {
|
|
17
|
-
deleteFile('EditorConfig', getCurrentFolder() + '/.editorconfig')
|
|
18
|
-
deleteFile('Git Attribute', getCurrentFolder() + '/.gitattributes')
|
|
19
|
-
deleteFile('Git Ignore', getCurrentFolder() + '/.gitignore')
|
|
20
|
-
deleteFile('PHPCS diff', getCurrentFolder() + '/.phpcs-diff.txt')
|
|
21
|
-
deleteFile('PHPCS json', getCurrentFolder() + '/.phpcs.json')
|
|
22
|
-
deleteFile('PHPCS xml', getCurrentFolder() + '/.phpcs.xml')
|
|
23
|
-
deleteFile('Package lock', getCurrentFolder() + '/package-lock.json')
|
|
24
|
-
deleteFile('Package json', getCurrentFolder() + '/package.json')
|
|
25
|
-
deleteFile('Package local', getCurrentFolder() + '/package.local.json')
|
|
26
|
-
|
|
27
|
-
next()
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export default function() {
|
|
32
|
-
heading('Doing backup now...')
|
|
33
|
-
console.log('');
|
|
34
|
-
|
|
35
|
-
waterfall(
|
|
36
|
-
[
|
|
37
|
-
backupFiles,
|
|
38
|
-
deleteFiles
|
|
39
|
-
],
|
|
40
|
-
( err, results ) => {
|
|
41
|
-
console.log('');
|
|
42
|
-
if (err) {
|
|
43
|
-
msgErrorTitle('We failed!!!')
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
msgSuccessTitle('All done!')
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import fs from 'fs-extra'
|
|
5
|
-
import Handlebars from 'handlebars'
|
|
6
|
-
import { series, eachSeries } from 'async'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { getSettings, getRootFolder, getTemplateFolder, runCommand } from "../../utilities/index.js"
|
|
12
|
-
|
|
13
|
-
class CreateFile {
|
|
14
|
-
run( args, callback ) {
|
|
15
|
-
const { file } = args
|
|
16
|
-
const namespace = file.split('\\')
|
|
17
|
-
|
|
18
|
-
this.template = getTemplateFolder()
|
|
19
|
-
|
|
20
|
-
// Settings
|
|
21
|
-
this.settings = getSettings()
|
|
22
|
-
this.settings.namespace = ''
|
|
23
|
-
this.settings.className = namespace.pop()
|
|
24
|
-
this.settings.heading = file
|
|
25
|
-
.replace(/\\/g, ' ')
|
|
26
|
-
.replace(/_/g, ' ')
|
|
27
|
-
|
|
28
|
-
// Filename
|
|
29
|
-
this.fileName = this.settings.className
|
|
30
|
-
.toLowerCase()
|
|
31
|
-
.replace(/_/g, '-')
|
|
32
|
-
this.fileName = `class-${this.fileName}.php`
|
|
33
|
-
|
|
34
|
-
// Folder
|
|
35
|
-
this.folder = getRootFolder() + '/includes/'
|
|
36
|
-
|
|
37
|
-
// Files
|
|
38
|
-
this.files = this.getTemplates(args)
|
|
39
|
-
|
|
40
|
-
if (namespace.length > 0) {
|
|
41
|
-
this.settings.namespace = '\\' + namespace.join('\\')
|
|
42
|
-
this.folder = this.folder + namespace.join('/').toLowerCase() + '/'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
series(
|
|
46
|
-
[
|
|
47
|
-
this.directories,
|
|
48
|
-
this.prepareFiles,
|
|
49
|
-
(next) => {
|
|
50
|
-
runCommand( 'composer', [ 'dump' ], next )
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
( err, results ) => {
|
|
54
|
-
callback()
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
directories = ( next ) => {
|
|
60
|
-
console.log( 'Creating directories!!' )
|
|
61
|
-
this.dirs = [
|
|
62
|
-
// Root
|
|
63
|
-
this.folder,
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
eachSeries( this.dirs, ( dir, nextDir ) => {
|
|
67
|
-
fs.ensureDir( dir ).then( nextDir )
|
|
68
|
-
}, () => {
|
|
69
|
-
next()
|
|
70
|
-
} )
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
prepareFiles = ( next ) => {
|
|
74
|
-
console.log( 'Preparing plugin files!!' )
|
|
75
|
-
const template = this.template + '/make'
|
|
76
|
-
|
|
77
|
-
eachSeries( this.files, ( file, nextFile ) => {
|
|
78
|
-
this.renderFile( template + file, this.folder + this.fileName, nextFile )
|
|
79
|
-
}, () => {
|
|
80
|
-
next()
|
|
81
|
-
} )
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
renderFile = ( src, dest, next ) => {
|
|
85
|
-
const content = fs.readFileSync( src, 'utf8' )
|
|
86
|
-
const template = Handlebars.compile( content )
|
|
87
|
-
const rendered = template( this.settings )
|
|
88
|
-
|
|
89
|
-
fs.outputFile( dest, rendered ).then( next )
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
getTemplates = (args) => {
|
|
93
|
-
const {
|
|
94
|
-
s = false,
|
|
95
|
-
singleton = false,
|
|
96
|
-
i = false,
|
|
97
|
-
integration = false,
|
|
98
|
-
r = false,
|
|
99
|
-
routes = false,
|
|
100
|
-
init = false,
|
|
101
|
-
initializer = false
|
|
102
|
-
} = args
|
|
103
|
-
|
|
104
|
-
if ( singleton || s ) {
|
|
105
|
-
return [ '/file-singleton.php' ]
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if ( integration || i ) {
|
|
109
|
-
return [ '/file-integration.php' ]
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if ( routes || r ) {
|
|
113
|
-
return [ '/file-routes.php' ]
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if ( initializer || init ) {
|
|
117
|
-
return [ '/file-initializer.php' ]
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return [ '/file.php' ]
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export default ( fileName, next ) => {
|
|
125
|
-
const generator = new CreateFile()
|
|
126
|
-
generator.run( fileName, next )
|
|
127
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Dependencies
|
|
3
|
-
*/
|
|
4
|
-
import chalk from 'chalk'
|
|
5
|
-
import { waterfall } from 'async'
|
|
6
|
-
import logSymbols from 'log-symbols'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal Dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { heading } from "../../utilities/index.js"
|
|
12
|
-
import createFile from './create-file.js'
|
|
13
|
-
|
|
14
|
-
export default function(args) {
|
|
15
|
-
heading('Scaffoling plugin...')
|
|
16
|
-
console.log('');
|
|
17
|
-
|
|
18
|
-
waterfall(
|
|
19
|
-
[
|
|
20
|
-
function( next ) {
|
|
21
|
-
next(null, args)
|
|
22
|
-
},
|
|
23
|
-
createFile,
|
|
24
|
-
],
|
|
25
|
-
( err, results ) => {
|
|
26
|
-
console.log( `${logSymbols.success} ${chalk.bold.green(`All done!`)}` )
|
|
27
|
-
}
|
|
28
|
-
)
|
|
29
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal Dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { heading, onNewLine } from "../../utilities/index.js"
|
|
5
|
-
|
|
6
|
-
export default function() {
|
|
7
|
-
heading('Help Command Menu')
|
|
8
|
-
onNewLine('List of commands')
|
|
9
|
-
console.log(' npx wp-advads backup');
|
|
10
|
-
console.log(' npx wp-advads make:plugin');
|
|
11
|
-
console.log(' npx wp-advads make:plugin --folder=my-awesome-plugin');
|
|
12
|
-
console.log(' npx wp-advads make:file --file="Dashboard"');
|
|
13
|
-
console.log(' npx wp-advads make:file --file="Admin\\Report\\Dashboard"');
|
|
14
|
-
console.log(' npx wp-advads make:file --file="Admin\\Report\\Dashboard" --singleton');
|
|
15
|
-
console.log(' npx wp-advads make:release');
|
|
16
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Dependencies
|
|
3
|
-
*/
|
|
4
|
-
import fs from 'fs'
|
|
5
|
-
import logSymbols from 'log-symbols'
|
|
6
|
-
import { waterfall } from 'async'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal Dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { heading, getCacheStore, msgSuccessOnSameLine, msgErrorTitle, msgSuccessTitle, onSameLine, SemVer } from "../../utilities/index.js"
|
|
12
|
-
|
|
13
|
-
let pluginVersion = false
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get version from readme.txt file
|
|
17
|
-
*/
|
|
18
|
-
function getVersion(next) {
|
|
19
|
-
heading( 'Parsing readme.txt for version' )
|
|
20
|
-
|
|
21
|
-
fs.readFile('./readme.txt', (err, buffer) => {
|
|
22
|
-
if ( null !== err ) {
|
|
23
|
-
onSameLine(`${logSymbols.error} Failed to get Readme file`)
|
|
24
|
-
return next(true)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const content = buffer.toString()
|
|
28
|
-
let regex = new RegExp('^(?<prefix>Stable tag:\\h*)(?<version>(.*))$', 'mi')
|
|
29
|
-
regex = regex.exec(content)
|
|
30
|
-
if (null !== regex) {
|
|
31
|
-
regex = regex.groups
|
|
32
|
-
pluginVersion = regex.version.trim()
|
|
33
|
-
msgSuccessOnSameLine('Version found: ' + pluginVersion)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
next()
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function updateVersion(next, args) {
|
|
41
|
-
const cache = getCacheStore()
|
|
42
|
-
const answers = cache.getKey('answers')
|
|
43
|
-
const semver = new SemVer(pluginVersion)
|
|
44
|
-
const increment = {
|
|
45
|
-
major: false,
|
|
46
|
-
minor: false,
|
|
47
|
-
patch: false,
|
|
48
|
-
...args
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let strIncrement = 'patch'
|
|
52
|
-
if ( increment.major ) {
|
|
53
|
-
strIncrement = 'major'
|
|
54
|
-
} else if ( increment.minor ) {
|
|
55
|
-
strIncrement = 'minor'
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
answers.wp.version = semver.inc(strIncrement)
|
|
59
|
-
cache.setKey( 'answers', answers )
|
|
60
|
-
cache.save()
|
|
61
|
-
onSameLine(`${logSymbols.success} New version: ${answers.wp.version}`)
|
|
62
|
-
next()
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export default function(args) {
|
|
66
|
-
heading('Incrementing Version...')
|
|
67
|
-
console.log('');
|
|
68
|
-
|
|
69
|
-
waterfall(
|
|
70
|
-
[
|
|
71
|
-
getVersion,
|
|
72
|
-
(next) => updateVersion(next, args)
|
|
73
|
-
],
|
|
74
|
-
( err, results ) => {
|
|
75
|
-
console.log('');
|
|
76
|
-
if (err) {
|
|
77
|
-
msgErrorTitle('We failed!!!')
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
msgSuccessTitle('All done!')
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Dependencies
|
|
3
|
-
*/
|
|
4
|
-
import chalk from 'chalk'
|
|
5
|
-
import { waterfall } from 'async'
|
|
6
|
-
import logSymbols from 'log-symbols'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal Dependencies
|
|
10
|
-
*/
|
|
11
|
-
import prompts from './prompts.js'
|
|
12
|
-
import { heading } from "../../utilities/index.js"
|
|
13
|
-
import { wpPot, updateTranslations } from './translations.js'
|
|
14
|
-
import { updateChangelog } from './changelog.js'
|
|
15
|
-
import { getSemVer } from './semver.js'
|
|
16
|
-
import { githubPreTasks, githubFinalTasks } from './github.js'
|
|
17
|
-
import { updateComposer } from './composer.js'
|
|
18
|
-
import { updateVersionNumber } from './change-version.js'
|
|
19
|
-
import { buildAssets } from './webpack.js'
|
|
20
|
-
|
|
21
|
-
export const pluginData = {
|
|
22
|
-
commitMessages: [],
|
|
23
|
-
changelogChanges: false
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function getPackage( next ) {
|
|
27
|
-
(async () => {
|
|
28
|
-
const rootPath = process.cwd()
|
|
29
|
-
const { default: data } = await import( rootPath + '/package.json', { assert: { type: "json" } });
|
|
30
|
-
|
|
31
|
-
return data
|
|
32
|
-
})().then((data) => {
|
|
33
|
-
pluginData.glotpress = data.glotpress
|
|
34
|
-
pluginData.wpPot = data.wpPot
|
|
35
|
-
|
|
36
|
-
next()
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default function(args) {
|
|
41
|
-
heading('Releasing the plugin...')
|
|
42
|
-
console.log('')
|
|
43
|
-
waterfall(
|
|
44
|
-
[
|
|
45
|
-
prompts,
|
|
46
|
-
getPackage,
|
|
47
|
-
getSemVer,
|
|
48
|
-
githubPreTasks,
|
|
49
|
-
updateComposer,
|
|
50
|
-
// wpPot,
|
|
51
|
-
buildAssets,
|
|
52
|
-
updateTranslations,
|
|
53
|
-
updateVersionNumber,
|
|
54
|
-
updateChangelog,
|
|
55
|
-
githubFinalTasks
|
|
56
|
-
],
|
|
57
|
-
( err, results ) => {
|
|
58
|
-
if (err) {
|
|
59
|
-
console.log('');
|
|
60
|
-
console.log( `${logSymbols.error} ${chalk.bold.red(`We failed somewhere! Work hard mate...`)}` )
|
|
61
|
-
return
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
console.log('');
|
|
65
|
-
console.log( `${logSymbols.success} ${chalk.bold.green(`All done!`)}` )
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Dependencies
|
|
3
|
-
*/
|
|
4
|
-
import logSymbols from 'log-symbols'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal Dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { pluginData } from './index.js'
|
|
10
|
-
import { heading, execCommand } from "../../utilities/index.js"
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Execute routine to run webpack
|
|
14
|
-
*/
|
|
15
|
-
export function buildAssets( next ) {
|
|
16
|
-
heading('Building assets')
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
execCommand(
|
|
20
|
-
'npm run build',
|
|
21
|
-
() => {
|
|
22
|
-
pluginData.commitMessages.push('update CSS, JS and POT files')
|
|
23
|
-
console.log( logSymbols.success + ' Assets successfully generated!' )
|
|
24
|
-
next()
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
} catch {
|
|
28
|
-
throw new Error( logSymbols.error + ' Error' )
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External Dependencies
|
|
3
|
-
*/
|
|
4
|
-
import chalk from 'chalk'
|
|
5
|
-
import { waterfall } from 'async'
|
|
6
|
-
import logSymbols from 'log-symbols'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal Dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { heading } from "../../utilities/index.js"
|
|
12
|
-
import prompts from './prompts.js'
|
|
13
|
-
import createPlugin from './create-plugin.js'
|
|
14
|
-
|
|
15
|
-
export default function() {
|
|
16
|
-
heading('Setting up...')
|
|
17
|
-
console.log('');
|
|
18
|
-
|
|
19
|
-
waterfall(
|
|
20
|
-
[
|
|
21
|
-
prompts,
|
|
22
|
-
createPlugin,
|
|
23
|
-
],
|
|
24
|
-
( err, results ) => {
|
|
25
|
-
console.log( `${logSymbols.success} ${chalk.bold.green(`All done!`)}` )
|
|
26
|
-
}
|
|
27
|
-
)
|
|
28
|
-
}
|