wp-advads 1.0.6 → 1.0.7
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 +1 -1
- package/src/app.js +8 -14
- package/src/commands/help/index.js +1 -0
- package/src/commands/release/index.js +70 -0
- package/src/commands/setup/create-plugin.js +0 -1
- package/src/helpers.js +4 -2
- package/template/configs/package.json +5 -0
- package/template/tools/laravel-mix/wp-pot.js +0 -2
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -11,9 +11,11 @@ import logSymbols from 'log-symbols'
|
|
|
11
11
|
* Internal Dependencies
|
|
12
12
|
*/
|
|
13
13
|
import { getCommand } from './helpers.js'
|
|
14
|
-
import { execute as helpCommand } from './commands/help/index.js'
|
|
15
14
|
import { execute as backupCommand } from './commands/backup/index.js'
|
|
15
|
+
import { execute as helpCommand } from './commands/help/index.js'
|
|
16
|
+
import { execute as releaseCommand } from './commands/release/index.js'
|
|
16
17
|
import { execute as setupCommand } from './commands/setup/index.js'
|
|
18
|
+
import packageDetails from '../package.json' assert { type: "json" }
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* App
|
|
@@ -22,7 +24,7 @@ async function app() {
|
|
|
22
24
|
console.log(
|
|
23
25
|
[
|
|
24
26
|
chalk.hex('#FADC00').inverse.bold('Advanced Ads WordPress Plugin Scaffolding'),
|
|
25
|
-
chalk.white( '
|
|
27
|
+
chalk.white( 'v' + packageDetails.version ),
|
|
26
28
|
chalk.dim( 'by Shakeeb Ahmed' )
|
|
27
29
|
].join(" ")
|
|
28
30
|
);
|
|
@@ -41,6 +43,10 @@ async function app() {
|
|
|
41
43
|
setupCommand()
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
if ( 'release' === command ) {
|
|
47
|
+
releaseCommand(args)
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
// if ( 'make:file' === command ) {
|
|
45
51
|
// waterfall(
|
|
46
52
|
// [
|
|
@@ -54,18 +60,6 @@ async function app() {
|
|
|
54
60
|
// }
|
|
55
61
|
// )
|
|
56
62
|
// }
|
|
57
|
-
|
|
58
|
-
// if ( 'make:plugin' === command ) {
|
|
59
|
-
// waterfall(
|
|
60
|
-
// [
|
|
61
|
-
// prompts,
|
|
62
|
-
// createPlugin,
|
|
63
|
-
// ],
|
|
64
|
-
// ( err, results ) => {
|
|
65
|
-
// console.log( `${logSymbols.success} ${chalk.bold.green(`All done!`)}` )
|
|
66
|
-
// }
|
|
67
|
-
// )
|
|
68
|
-
// }
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
app()
|
|
@@ -0,0 +1,70 @@
|
|
|
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, runCommand } from "../../helpers.js"
|
|
12
|
+
|
|
13
|
+
async function getPackage() {
|
|
14
|
+
const rootPath = process.cwd()
|
|
15
|
+
const { default: data } = await import( rootPath + '/package.json', { assert: { type: "json" } });
|
|
16
|
+
|
|
17
|
+
return data
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function wpPot( next ) {
|
|
21
|
+
const rootPath = process.cwd()
|
|
22
|
+
const { wpPot = {} } = getPackage()
|
|
23
|
+
const {output, file, domain, exclude = [] } = wpPot
|
|
24
|
+
|
|
25
|
+
heading('Creating POT file...')
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
exclude.push(".github")
|
|
29
|
+
exclude.push("vendor")
|
|
30
|
+
exclude.push("tools")
|
|
31
|
+
runCommand( 'wp', [ 'i18n', 'make-pot', rootPath, `${rootPath}${output}${file} --domain=${domain} --exclude=${exclude.join(',')}` ], next )
|
|
32
|
+
|
|
33
|
+
console.log( logSymbols.success + ' Done' )
|
|
34
|
+
} catch {
|
|
35
|
+
console.log( logSymbols.error + ' Error' )
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function updateTranslations( next ) {
|
|
40
|
+
heading('Downloading translations')
|
|
41
|
+
runCommand( 'npm', [ 'run', 'translations' ], next )
|
|
42
|
+
console.log( logSymbols.success + ' Done' )
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function execute(args) {
|
|
46
|
+
heading('Releasing the plugin...')
|
|
47
|
+
console.log('')
|
|
48
|
+
|
|
49
|
+
const {
|
|
50
|
+
potOnly = false,
|
|
51
|
+
translationsOnly = false
|
|
52
|
+
} = args
|
|
53
|
+
|
|
54
|
+
const falls = []
|
|
55
|
+
|
|
56
|
+
if (potOnly) {
|
|
57
|
+
falls.push(wpPot)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (translationsOnly) {
|
|
61
|
+
falls.push(updateTranslations)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
waterfall(
|
|
65
|
+
falls,
|
|
66
|
+
( err, results ) => {
|
|
67
|
+
console.log( `${logSymbols.success} ${chalk.bold.green(`All done!`)}` )
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
package/src/helpers.js
CHANGED
|
@@ -41,10 +41,12 @@ export function onNewLine(text) {
|
|
|
41
41
|
|
|
42
42
|
export function getCommand() {
|
|
43
43
|
const args = getArguments()
|
|
44
|
+
const { _, ...rest } = args
|
|
45
|
+
const command = _[0] || 'help'
|
|
44
46
|
|
|
45
47
|
return {
|
|
46
|
-
command
|
|
47
|
-
args:
|
|
48
|
+
command,
|
|
49
|
+
args: rest || []
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -27,8 +27,6 @@ class WordPressPot {
|
|
|
27
27
|
|
|
28
28
|
const rootPath = process.cwd()
|
|
29
29
|
|
|
30
|
-
console.log(`${rootPath}${output}${file}`);
|
|
31
|
-
|
|
32
30
|
sh.exec(`wp i18n make-pot ${rootPath} ${rootPath}${output}${file} --domain=${domain} --exclude=${exclude.join(',')}`)
|
|
33
31
|
if ( false !== skipJS ) {
|
|
34
32
|
sh.exec(`wp i18n make-json ${rootPath}${output}`, { silent: true })
|