wp-advads 1.0.14 → 1.0.15
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/commands/file/create-file.js +24 -2
- package/src/commands/setup/create-plugin.js +2 -9
- package/template/.github/pull_request_template.md +9 -9
- package/template/configs/.eslintrc.js +9 -0
- package/template/configs/.gitattributes +2 -1
- package/template/configs/.phpcs.xml.dist +12 -13
- package/template/configs/.prettierignore +1 -0
- package/template/configs/.stylelintrc +25 -4
- package/template/configs/composer.json +11 -5
- package/template/configs/package.json +2 -0
- package/template/configs/postcss.config.js +6 -0
- package/template/configs/tailwind.config.js +8 -0
- package/template/make/file-initializer.php +29 -0
- package/template/make/file-integration.php +29 -0
- package/template/make/file-routes.php +29 -0
- package/template/make/file-singleton.php +1 -9
- package/template/make/file.php +1 -9
- package/template/includes/interfaces/interface-integration.php +0 -23
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ import { getSettings, getRootFolder, getTemplateFolder, runCommand } from "../..
|
|
|
12
12
|
|
|
13
13
|
class CreateFile {
|
|
14
14
|
run( args, callback ) {
|
|
15
|
-
const { file
|
|
15
|
+
const { file } = args
|
|
16
16
|
const namespace = file.split('\\')
|
|
17
17
|
|
|
18
18
|
this.template = getTemplateFolder()
|
|
@@ -35,7 +35,7 @@ class CreateFile {
|
|
|
35
35
|
this.folder = getRootFolder() + '/includes/'
|
|
36
36
|
|
|
37
37
|
// Files
|
|
38
|
-
this.files =
|
|
38
|
+
this.files = this.getTemplates(args)
|
|
39
39
|
|
|
40
40
|
if (namespace.length > 0) {
|
|
41
41
|
this.settings.namespace = '\\' + namespace.join('\\')
|
|
@@ -88,6 +88,28 @@ class CreateFile {
|
|
|
88
88
|
|
|
89
89
|
fs.outputFile( dest, rendered ).then( next )
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
getTemplates = (args) => {
|
|
93
|
+
const { singleton = false, integration = false, routes = false, initializer = false } = args
|
|
94
|
+
|
|
95
|
+
if ( singleton ) {
|
|
96
|
+
return [ '/file-singleton.php' ]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if ( integration ) {
|
|
100
|
+
return [ '/file-integration.php' ]
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if ( routes ) {
|
|
104
|
+
return [ '/file-routes.php' ]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if ( initializer ) {
|
|
108
|
+
return [ '/file-initializer.php' ]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return [ '/file.php' ]
|
|
112
|
+
}
|
|
91
113
|
}
|
|
92
114
|
|
|
93
115
|
export default ( fileName, next ) => {
|
|
@@ -49,9 +49,7 @@ function setPluginData(next) {
|
|
|
49
49
|
pluginData.folder + '/includes',
|
|
50
50
|
pluginData.folder + '/includes/abstracts',
|
|
51
51
|
pluginData.folder + '/includes/admin',
|
|
52
|
-
pluginData.folder + '/includes/database',
|
|
53
52
|
pluginData.folder + '/includes/interfaces',
|
|
54
|
-
pluginData.folder + '/includes/models',
|
|
55
53
|
pluginData.folder + '/includes/traits',
|
|
56
54
|
pluginData.folder + '/includes/utilities',
|
|
57
55
|
]
|
|
@@ -121,13 +119,6 @@ function preparePluginFiles(next) {
|
|
|
121
119
|
const files =[
|
|
122
120
|
'/assets/src/app.js',
|
|
123
121
|
'/assets/scss/app.scss',
|
|
124
|
-
// '/includes/admin/class-admin.php',
|
|
125
|
-
// '/includes/interfaces/interface-integration.php',
|
|
126
|
-
// '/includes/class-assets.php',
|
|
127
|
-
// '/includes/class-frontend.php',
|
|
128
|
-
// '/includes/class-plugin.php',
|
|
129
|
-
// '/plugin.php',
|
|
130
|
-
// '/uninstall.php',
|
|
131
122
|
]
|
|
132
123
|
|
|
133
124
|
write('Preparing plugin files...')
|
|
@@ -169,6 +160,8 @@ function installNodePackages(next) {
|
|
|
169
160
|
'husky',
|
|
170
161
|
'laravel-mix',
|
|
171
162
|
'lint-staged',
|
|
163
|
+
'mix-tailwindcss',
|
|
164
|
+
'postcss',
|
|
172
165
|
'prettier',
|
|
173
166
|
'resolve-url-loader',
|
|
174
167
|
'sass',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Description
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Explain your approach to a solution and decisions that lead to it. E.g., which alternatives you evaluated and why you chose yours.
|
|
4
4
|
|
|
5
5
|
## Issue ticket number and link
|
|
6
6
|
Related to: #[Issue Number]
|
|
@@ -14,27 +14,28 @@ Describe the tests that were conducted to verify the changes. Include instructio
|
|
|
14
14
|
- [ ] Automated Test B (Purpose of Test B)
|
|
15
15
|
- [ ] Manual Test A (Purpose of Test A)
|
|
16
16
|
- [ ] Manual Test B (Purpose of Test B)
|
|
17
|
+
- [ ] Support / User A confirmed the fix
|
|
17
18
|
|
|
18
19
|
## Checklist:
|
|
19
20
|
|
|
20
21
|
### Developer -> Code Review:
|
|
21
22
|
- [ ] PR title is clear and descriptive
|
|
22
|
-
- [ ] Code
|
|
23
|
-
- [ ] I have performed a self-review of my own code
|
|
24
|
-
- [ ] Code is easily understandable and well-documented
|
|
25
|
-
- [ ] Request a code review from a peer or senior developer
|
|
23
|
+
- [ ] Code is understandable, readable and well-documented
|
|
26
24
|
|
|
27
25
|
### Developer -> Testing:
|
|
28
|
-
- [ ] My changes generate no new warnings
|
|
26
|
+
- [ ] My changes generate no new warnings in debug.log and Query Monitor
|
|
29
27
|
- [ ] New and existing unit tests pass locally with my changes
|
|
30
28
|
- [ ] I have added tests that prove my fix is effective or that my feature works
|
|
31
29
|
|
|
32
30
|
### Developer -> Documentation:
|
|
33
|
-
- [ ] I have made corresponding changelogs
|
|
31
|
+
- [ ] I have made corresponding changelogs that are grammatically correct according to ...
|
|
34
32
|
- [ ] (Optional) Update relevant documentation, such as API endpoints, configuration changes, or user guides
|
|
35
33
|
|
|
36
34
|
### Developer -> Dependencies:
|
|
37
|
-
- [ ]
|
|
35
|
+
- [ ] (Optional) If you introduced any external dependencies, explain your reasoning here.
|
|
36
|
+
|
|
37
|
+
### Reviewers -> Review:
|
|
38
|
+
... describe what they tested – and what they didn’t
|
|
38
39
|
|
|
39
40
|
### Assignee -> Review:
|
|
40
41
|
- [ ] Ensure the PR aligns with the original user story or feature requirement
|
|
@@ -43,7 +44,6 @@ Describe the tests that were conducted to verify the changes. Include instructio
|
|
|
43
44
|
### Assignee -> Testing:
|
|
44
45
|
- [ ] Conduct user acceptance testing to validate that the changes meet the user's needs
|
|
45
46
|
- [ ] Verify that the feature works as expected and doesn't introduce regressions
|
|
46
|
-
- [ ] No issues have been found on the staging environment
|
|
47
47
|
- [ ] PR reviewer has approved the release
|
|
48
48
|
- [ ] Final changelog has been determined/approved
|
|
49
49
|
|
|
@@ -53,35 +53,34 @@
|
|
|
53
53
|
<exclude-pattern>includes/**/interface-*.php</exclude-pattern>
|
|
54
54
|
</rule>
|
|
55
55
|
|
|
56
|
-
<!--
|
|
57
|
-
<rule ref="Generic.Formatting.MultipleStatementAlignment">
|
|
58
|
-
<type>error</type>
|
|
59
|
-
</rule>
|
|
60
|
-
|
|
61
|
-
<!-- Disable short arrays: -->
|
|
56
|
+
<!-- Disable disallow short arrays and enforce them: -->
|
|
62
57
|
<rule ref="WordPress-Extra">
|
|
63
58
|
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
|
|
64
59
|
</rule>
|
|
65
60
|
|
|
66
|
-
<!-- Enforce short arrays: -->
|
|
67
61
|
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
|
68
62
|
|
|
69
|
-
<!--
|
|
70
|
-
<rule ref="
|
|
63
|
+
<!-- Elevate these rules to an error, so it gets printed on commit -->
|
|
64
|
+
<rule ref="Generic.Formatting.MultipleStatementAlignment">
|
|
71
65
|
<type>error</type>
|
|
72
|
-
<message>Method name "%s" must not be prefixed with an underscore to indicate visibility</message>
|
|
73
66
|
</rule>
|
|
74
67
|
|
|
75
|
-
<rule ref="
|
|
68
|
+
<rule ref="Generic.CodeAnalysis.AssignmentInCondition">
|
|
76
69
|
<type>error</type>
|
|
77
70
|
</rule>
|
|
78
71
|
|
|
79
|
-
<rule ref="
|
|
72
|
+
<rule ref="Universal.Operators.StrictComparisons">
|
|
80
73
|
<type>error</type>
|
|
81
74
|
</rule>
|
|
82
75
|
|
|
83
|
-
<rule ref="WordPress.
|
|
76
|
+
<rule ref="WordPress.PHP.StrictInArray">
|
|
84
77
|
<type>error</type>
|
|
85
78
|
</rule>
|
|
86
79
|
|
|
80
|
+
<!-- Method names MUST NOT be prefixed with a single underscore to indicate protected or private visibility. That is, an underscore prefix explicitly has no meaning. -->
|
|
81
|
+
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
|
|
82
|
+
<type>error</type>
|
|
83
|
+
<message>Method name "%s" must not be prefixed with an underscore to indicate visibility</message>
|
|
84
|
+
</rule>
|
|
85
|
+
|
|
87
86
|
</ruleset>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "@wordpress/stylelint-config",
|
|
2
|
+
"extends": "@wordpress/stylelint-config/scss",
|
|
3
3
|
"ignoreFiles": [
|
|
4
4
|
"**/*.js",
|
|
5
5
|
"assets/css/*.min.css",
|
|
@@ -7,17 +7,38 @@
|
|
|
7
7
|
"vendor/**/*.css"
|
|
8
8
|
],
|
|
9
9
|
"rules": {
|
|
10
|
-
"at-rule-no-unknown": [
|
|
10
|
+
"scss/at-rule-no-unknown": [
|
|
11
11
|
true,
|
|
12
|
+
{
|
|
13
|
+
"ignoreAtRules": [
|
|
14
|
+
"apply",
|
|
15
|
+
"layer",
|
|
16
|
+
"responsive",
|
|
17
|
+
"screen",
|
|
18
|
+
"tailwind",
|
|
19
|
+
"variants"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"at-rule-empty-line-before": [
|
|
24
|
+
"always",
|
|
12
25
|
{
|
|
13
26
|
"ignoreAtRules": [
|
|
14
27
|
"tailwind",
|
|
15
28
|
"apply",
|
|
16
29
|
"variants",
|
|
17
30
|
"responsive",
|
|
18
|
-
"screen"
|
|
31
|
+
"screen",
|
|
32
|
+
"import"
|
|
19
33
|
]
|
|
20
34
|
}
|
|
21
|
-
]
|
|
35
|
+
],
|
|
36
|
+
"rule-empty-line-before": [
|
|
37
|
+
"always",
|
|
38
|
+
{
|
|
39
|
+
"ignore": ["first-nested" ]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"no-descending-specificity": null
|
|
22
43
|
}
|
|
23
44
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "{{package.vendor}}/{{package.name}}",
|
|
3
3
|
"description": "{{wp.description}}",
|
|
4
4
|
"homepage": "{{company.url}}",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "{{wp.version}}",
|
|
6
6
|
"type": "wordpress-plugin",
|
|
7
7
|
"license": "GPL-3.0-or-later",
|
|
8
8
|
"prefer-stable": true,
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"require": {
|
|
18
|
-
"php": ">=7.2"
|
|
18
|
+
"php": ">=7.2",
|
|
19
|
+
"advanced-ads/framework": "dev-main"
|
|
19
20
|
},
|
|
20
21
|
"require-dev": {
|
|
21
|
-
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
|
22
22
|
"phpcompatibility/phpcompatibility-wp": "*",
|
|
23
|
-
"wp-coding-standards/wpcs": "^
|
|
23
|
+
"wp-coding-standards/wpcs": "^3.0.0"
|
|
24
24
|
},
|
|
25
25
|
"config": {
|
|
26
26
|
"optimize-autoloader": true,
|
|
@@ -39,7 +39,13 @@
|
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"post-install-cmd": [
|
|
42
|
-
"composer global require wp-cli/wp-cli"
|
|
42
|
+
"composer global require wp-cli/wp-cli",
|
|
43
|
+
"composer global require wp-cli/i18n-command"
|
|
44
|
+
],
|
|
45
|
+
"build": [
|
|
46
|
+
"rm -r packages || true",
|
|
47
|
+
"COMPOSER_VENDOR_DIR=packages composer install -o -a -n --no-dev --no-scripts",
|
|
48
|
+
"composer dump"
|
|
43
49
|
]
|
|
44
50
|
}
|
|
45
51
|
}
|
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
"build": "mix --production",
|
|
23
23
|
"lint": "lint-staged",
|
|
24
24
|
"lint:css": "stylelint \"**/*.css\" --cache",
|
|
25
|
+
"lint:scss": "stylelint \"**/*.scss\" --cache",
|
|
25
26
|
"lint:js": "eslint . --cache",
|
|
26
27
|
"lint:p": "prettier -c .",
|
|
28
|
+
"lint:pw": "prettier -w .",
|
|
27
29
|
"lint:php": "vendor/bin/phpcs",
|
|
28
30
|
"translations": "node ./tools/wp-glotpress.js"
|
|
29
31
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* {{heading}}.
|
|
4
|
+
*
|
|
5
|
+
* @package {{php.package}}
|
|
6
|
+
* @author {{author.name}} <{{author.email}}>
|
|
7
|
+
* @since {{wp.version}}
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
namespace {{php.package}}{{namespace}};
|
|
11
|
+
|
|
12
|
+
use AdvancedAds\Framework\Interfaces\Initializer_Interface;
|
|
13
|
+
|
|
14
|
+
defined( 'ABSPATH' ) || exit;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* {{heading}}.
|
|
18
|
+
*/
|
|
19
|
+
class {{className}} implements Initializer_Interface {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Runs this initializer.
|
|
23
|
+
*
|
|
24
|
+
* @return void
|
|
25
|
+
*/
|
|
26
|
+
public function initialize(): void {
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* {{heading}}.
|
|
4
|
+
*
|
|
5
|
+
* @package {{php.package}}
|
|
6
|
+
* @author {{author.name}} <{{author.email}}>
|
|
7
|
+
* @since {{wp.version}}
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
namespace {{php.package}}{{namespace}};
|
|
11
|
+
|
|
12
|
+
use AdvancedAds\Framework\Interfaces\Integration_Interface;
|
|
13
|
+
|
|
14
|
+
defined( 'ABSPATH' ) || exit;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* {{heading}}.
|
|
18
|
+
*/
|
|
19
|
+
class {{className}} implements Integration_Interface {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Hook into WordPress.
|
|
23
|
+
*
|
|
24
|
+
* @return void
|
|
25
|
+
*/
|
|
26
|
+
public function hooks(): void {
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* {{heading}}.
|
|
4
|
+
*
|
|
5
|
+
* @package {{php.package}}
|
|
6
|
+
* @author {{author.name}} <{{author.email}}>
|
|
7
|
+
* @since {{wp.version}}
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
namespace {{php.package}}{{namespace}};
|
|
11
|
+
|
|
12
|
+
use AdvancedAds\Framework\Interfaces\Routes_Interface;
|
|
13
|
+
|
|
14
|
+
defined( 'ABSPATH' ) || exit;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* {{heading}}.
|
|
18
|
+
*/
|
|
19
|
+
class {{className}} implements Routes_Interface {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Registers routes with WordPress.
|
|
23
|
+
*
|
|
24
|
+
* @return void
|
|
25
|
+
*/
|
|
26
|
+
public function register_routes(): void {
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -9,14 +9,12 @@
|
|
|
9
9
|
|
|
10
10
|
namespace {{php.package}}{{namespace}};
|
|
11
11
|
|
|
12
|
-
use AdvancedAds\Framework\Interfaces\WordPress_Integration;
|
|
13
|
-
|
|
14
12
|
defined( 'ABSPATH' ) || exit;
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* {{heading}}.
|
|
18
16
|
*/
|
|
19
|
-
class {{className}}
|
|
17
|
+
class {{className}} {
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* Main instance
|
|
@@ -34,10 +32,4 @@ class {{className}} implements WordPress_Integration {
|
|
|
34
32
|
|
|
35
33
|
return $instance;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Hook into WordPress.
|
|
40
|
-
*/
|
|
41
|
-
public function hooks() {
|
|
42
|
-
}
|
|
43
35
|
}
|
package/template/make/file.php
CHANGED
|
@@ -9,18 +9,10 @@
|
|
|
9
9
|
|
|
10
10
|
namespace {{php.package}}{{namespace}};
|
|
11
11
|
|
|
12
|
-
use AdvancedAds\Framework\Interfaces\WordPress_Integration;
|
|
13
|
-
|
|
14
12
|
defined( 'ABSPATH' ) || exit;
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* {{heading}}.
|
|
18
16
|
*/
|
|
19
|
-
class {{className}}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Hook into WordPress.
|
|
23
|
-
*/
|
|
24
|
-
public function hooks() {
|
|
25
|
-
}
|
|
17
|
+
class {{className}} {
|
|
26
18
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
/**
|
|
3
|
-
* An interface for registering integrations with WordPress.
|
|
4
|
-
*
|
|
5
|
-
* @package {{php.package}}
|
|
6
|
-
* @author {{author.name}} <{{author.email}}>
|
|
7
|
-
* @since {{wp.version}}
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
namespace {{php.package}}\Interfaces;
|
|
11
|
-
|
|
12
|
-
defined( 'ABSPATH' ) || exit;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Integration interface.
|
|
16
|
-
*/
|
|
17
|
-
interface WordPress_Integration {
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Hook into WordPress.
|
|
21
|
-
*/
|
|
22
|
-
public function hooks();
|
|
23
|
-
}
|