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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "wp-advads",
4
- "version": "1.0.6",
4
+ "version": "1.0.7",
5
5
  "description": "Create a Advanced Ads wordPress plugin eco system.",
6
6
  "author": {
7
7
  "name": "Shakeeb Ahmed",
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( 'v1.0.0' ),
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()
@@ -5,4 +5,5 @@ export function execute() {
5
5
  onNewLine('List of commands')
6
6
  console.log(' npx wp-advads backup');
7
7
  console.log(' npx wp-advads setup');
8
+ console.log(' npx wp-advads release');
8
9
  }
@@ -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
+ }
@@ -158,7 +158,6 @@ class CreatePlugin {
158
158
  'sass',
159
159
  'sass-loader',
160
160
  'shelljs',
161
- 'stylelint',
162
161
  'webpack',
163
162
  ]
164
163
 
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: args._[0] || 'help',
47
- args: args._[1] || []
48
+ command,
49
+ args: rest || []
48
50
  }
49
51
  }
50
52
 
@@ -55,5 +55,10 @@
55
55
  "glotpress": {
56
56
  "project": "{{package.name}}",
57
57
  "destination": "./languages/"
58
+ },
59
+ "wpPot": {
60
+ "output": "/languages/",
61
+ "file": "{{wp.textDomain}}.pot",
62
+ "domain": "{{wp.textDomain}}"
58
63
  }
59
64
  }
@@ -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 })