wp-advads 1.0.31 → 1.0.34

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 (89) hide show
  1. package/.github/workflows/test.yml +17 -0
  2. package/CHANGELOG.md +23 -1
  3. package/LICENSE +15 -0
  4. package/README.md +8 -7
  5. package/package.json +9 -7
  6. package/src/app.js +17 -11
  7. package/src/commands/build.js +72 -59
  8. package/src/commands/class.js +34 -40
  9. package/src/commands/css.js +13 -19
  10. package/src/commands/init.js +4 -1
  11. package/src/commands/javascript.js +13 -19
  12. package/src/commands/release/change-version.js +14 -17
  13. package/src/commands/release/changelog.js +23 -31
  14. package/src/commands/release/git.js +25 -13
  15. package/src/commands/release/github.js +63 -12
  16. package/src/commands/release/semver.js +22 -25
  17. package/src/commands/release/translations.js +17 -23
  18. package/src/commands/release.js +3 -4
  19. package/src/commands/updates.js +20 -17
  20. package/src/commands/views.js +16 -18
  21. package/src/commands/wp-glotpress.js +125 -126
  22. package/src/commands/wp-pot.js +17 -9
  23. package/src/utilities/filesystem.js +57 -36
  24. package/src/utilities/flow.js +21 -0
  25. package/src/utilities/formatting.js +13 -4
  26. package/src/utilities/index.js +1 -1
  27. package/src/utilities/misc.js +1 -6
  28. package/src/utilities/settings.js +34 -14
  29. package/src/utilities/shell.js +60 -8
  30. package/template/files/class-singleton.php +5 -0
  31. package/template/files/javascript.js +0 -2
  32. package/template/files/view.php +2 -0
  33. package/test/build.test.js +168 -0
  34. package/test/changelog-locales.test.js +49 -0
  35. package/test/class.test.js +47 -0
  36. package/test/compile-templates.test.js +70 -0
  37. package/test/deps-hygiene.test.js +46 -0
  38. package/test/engines.test.js +11 -0
  39. package/test/get-latest-tag.test.js +51 -0
  40. package/test/git-precheck.test.js +44 -0
  41. package/test/github-final.test.js +93 -0
  42. package/test/glotpress-download.test.js +176 -0
  43. package/test/nested-path.test.js +39 -0
  44. package/test/no-fs-extra.test.js +11 -0
  45. package/test/package-identity.test.js +19 -0
  46. package/test/path-confine.test.js +42 -0
  47. package/test/pot-docs.test.js +27 -0
  48. package/test/pot-headers.test.js +49 -0
  49. package/test/project-root.test.js +26 -0
  50. package/test/release-waterfall.test.js +62 -0
  51. package/test/semver.test.js +25 -0
  52. package/test/settings-clone.test.js +34 -0
  53. package/test/settings-path.test.js +31 -0
  54. package/test/shell.test.js +100 -0
  55. package/test/singleton.test.js +14 -0
  56. package/test/stable-tag.test.js +13 -0
  57. package/test/stub-security.test.js +37 -0
  58. package/test/template-folder.test.js +19 -0
  59. package/test/translations.test.js +51 -0
  60. package/test/update-file-content.test.js +38 -0
  61. package/test/updates.test.js +39 -0
  62. package/test/version.test.js +22 -0
  63. package/test/view-escape.test.js +17 -0
  64. package/test/view.test.js +33 -0
  65. package/test/write-force.test.js +47 -0
  66. package/src/utilities/semver.js +0 -45
  67. package/template/.github/pull_request_template.md +0 -52
  68. package/template/configs/.editorconfig +0 -27
  69. package/template/configs/.eslintignore +0 -13
  70. package/template/configs/.eslintrc.js +0 -13
  71. package/template/configs/.phpcs.xml.dist +0 -87
  72. package/template/configs/.prettierignore +0 -49
  73. package/template/configs/.prettierrc.js +0 -3
  74. package/template/configs/.stylelintrc +0 -44
  75. package/template/configs/composer.json +0 -51
  76. package/template/configs/gitattributes +0 -34
  77. package/template/configs/gitignore +0 -43
  78. package/template/configs/package.json +0 -66
  79. package/template/configs/postcss.config.js +0 -6
  80. package/template/configs/tailwind.config.js +0 -8
  81. package/template/configs/webpack.mix.js +0 -65
  82. package/template/configs/webpack.mix.local.js +0 -3
  83. package/template/includes/index.php +0 -2
  84. package/template/index.js +0 -0
  85. package/template/index.php +0 -4
  86. package/template/plugin/assets/scss/app.scss +0 -0
  87. package/template/plugin/assets/src/app.js +0 -0
  88. package/template/tools/laravel-mix/wp-pot.js +0 -57
  89. package/template/tools/wp-glotpress.js +0 -162
@@ -1,87 +0,0 @@
1
- <?xml version="1.0"?>
2
- <ruleset name="{{company.name}}">
3
- <description>{{company.name}} Coding Standards.</description>
4
-
5
- <!-- PHPCS arguments: -->
6
- <arg value="ps" />
7
- <arg name="colors"/>
8
- <arg name="parallel" value="20" />
9
- <arg name="extensions" value="php"/>
10
-
11
- <!-- Set files and paths: -->
12
- <file>.</file>
13
-
14
- <!-- Exclude paths -->
15
- <exclude-pattern>*/languages/*</exclude-pattern>
16
- <exclude-pattern>*/lib/*</exclude-pattern>
17
- <exclude-pattern>*/node_modules/*</exclude-pattern>
18
- <exclude-pattern>*/packages/*</exclude-pattern>
19
- <exclude-pattern>*/tests/*</exclude-pattern>
20
- <exclude-pattern>*/vendor/*</exclude-pattern>
21
- <exclude-pattern>*/index.php</exclude-pattern>
22
-
23
- <!-- PHPCompatibility configs: -->
24
- <config name="testVersion" value="7.2-" />
25
- <config name="minimum_supported_wp_version" value="4.9" />
26
- <config name="minimum_wp_version" value="4.9" />
27
-
28
- <rule ref="PHPCompatibility">
29
- <include-pattern>*\.php$</include-pattern>
30
- <exclude-pattern>tests/</exclude-pattern>
31
- </rule>
32
-
33
- <!-- Rules: -->
34
- <rule ref="WordPress"/>
35
-
36
- <rule ref="WordPress.WP.I18n">
37
- <properties>
38
- <property name="text_domain" type="array" value="{{wp.textDomain}}" />
39
- </properties>
40
- </rule>
41
-
42
- <rule ref="WordPress.NamingConventions">
43
- <exclude name="WordPress.NamingConventions.PrefixAllGlobals" />
44
- </rule>
45
-
46
- <rule ref="WordPress.NamingConventions.ValidHookName">
47
- <properties>
48
- <property name="additionalWordDelimiters" value="-"/>
49
- </properties>
50
- </rule>
51
-
52
- <rule ref="WordPress.Files.FileName.InvalidClassFileName">
53
- <exclude-pattern>includes/**/abstract-*.php</exclude-pattern>
54
- <exclude-pattern>includes/**/interface-*.php</exclude-pattern>
55
- </rule>
56
-
57
- <!-- Disable disallow short arrays and enforce them: -->
58
- <rule ref="WordPress-Extra">
59
- <exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
60
- </rule>
61
-
62
- <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
63
-
64
- <!-- Elevate these rules to an error, so it gets printed on commit -->
65
- <rule ref="Generic.Formatting.MultipleStatementAlignment">
66
- <type>error</type>
67
- </rule>
68
-
69
- <rule ref="Generic.CodeAnalysis.AssignmentInCondition">
70
- <type>error</type>
71
- </rule>
72
-
73
- <rule ref="Universal.Operators.StrictComparisons">
74
- <type>error</type>
75
- </rule>
76
-
77
- <rule ref="WordPress.PHP.StrictInArray">
78
- <type>error</type>
79
- </rule>
80
-
81
- <!-- 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. -->
82
- <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
83
- <type>error</type>
84
- <message>Method name "%s" must not be prefixed with an underscore to indicate visibility</message>
85
- </rule>
86
-
87
- </ruleset>
@@ -1,49 +0,0 @@
1
- # Wordpress - ignore core, configuration, examples, uploads and logs.
2
- # https://github.com/github/gitignore/blob/main/WordPress.gitignore
3
-
4
- # Operating System files
5
- .DS_Store
6
- Thumbs.db
7
-
8
- # IDE files
9
- .vscode/*
10
- project.xml
11
- project.properties
12
- .project
13
- .settings*
14
- *.sublime-project
15
- *.sublime-workspace
16
- .sublimelinterrc
17
-
18
- # Eslint Cache
19
- .eslintcache
20
-
21
- # Environment files
22
- wp-cli.local.yml
23
- .wp-env.override.json
24
- npm-debug.log
25
- .pnpm-debug.log
26
-
27
- # Node Package Dependencies
28
- node_modules/
29
-
30
- # Composer
31
- vendor/
32
- packages/
33
- bin/composer/**/vendor/
34
- composer.json
35
- composer.lock
36
-
37
- # Config files
38
- .*
39
- *-lock*
40
- webpack.mix.js
41
- tailwind.config.js
42
-
43
- # Support .gitkeep Files
44
- !.gitkeep
45
-
46
- # Project files
47
- assets/css
48
- assets/js
49
- tools/
@@ -1,3 +0,0 @@
1
- // Import the default config file and expose it in the project root.
2
- // Useful for editor integrations.
3
- module.exports = require( '@wordpress/prettier-config' );
@@ -1,44 +0,0 @@
1
- {
2
- "extends": "@wordpress/stylelint-config/scss",
3
- "ignoreFiles": [
4
- "**/*.js",
5
- "assets/css/*.min.css",
6
- "node_modules/**/*.css",
7
- "vendor/**/*.css"
8
- ],
9
- "rules": {
10
- "scss/at-rule-no-unknown": [
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",
25
- {
26
- "ignoreAtRules": [
27
- "tailwind",
28
- "apply",
29
- "variants",
30
- "responsive",
31
- "screen",
32
- "import"
33
- ]
34
- }
35
- ],
36
- "rule-empty-line-before": [
37
- "always",
38
- {
39
- "ignore": ["first-nested" ]
40
- }
41
- ],
42
- "no-descending-specificity": null
43
- }
44
- }
@@ -1,51 +0,0 @@
1
- {
2
- "name": "{{package.vendor}}/{{package.name}}",
3
- "description": "{{wp.description}}",
4
- "homepage": "{{company.url}}",
5
- "version": "{{wp.version}}",
6
- "type": "wordpress-plugin",
7
- "license": "GPL-3.0-or-later",
8
- "prefer-stable": true,
9
- "minimum-stability": "dev",
10
- "authors": [
11
- {
12
- "name": "{{author.name}}",
13
- "email": "{{author.email}}",
14
- "homepage": "{{author.url}}"
15
- }
16
- ],
17
- "require": {
18
- "php": ">=7.2",
19
- "advanced-ads/framework": "dev-main"
20
- },
21
- "require-dev": {
22
- "phpcompatibility/phpcompatibility-wp": "*",
23
- "wp-coding-standards/wpcs": "^3.0.0"
24
- },
25
- "config": {
26
- "optimize-autoloader": true,
27
- "sort-packages": true,
28
- "platform": {
29
- "php": "7.2"
30
- },
31
- "allow-plugins": {
32
- "dealerdirect/phpcodesniffer-composer-installer": true
33
- }
34
- },
35
- "autoload": {
36
- "classmap": [
37
- "includes/"
38
- ]
39
- },
40
- "scripts": {
41
- "post-install-cmd": [
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"
49
- ]
50
- }
51
- }
@@ -1,34 +0,0 @@
1
- # Set the default behavior, in case people don't have `core.autocrlf` set.
2
- * text=auto
3
-
4
- # Declare files that will always have LF line endings on checkout.
5
- *.php text eol=lf
6
-
7
- # Denote all files that are truly binary and should not be modified.
8
- *.aar binary
9
- *.gif binary
10
- *.jar binary
11
- *.jpg binary
12
- *.png binary
13
- *.ttf binary
14
- *.webp binary
15
-
16
- # Remove files for archives generated using `git archive`.
17
- /.* export-ignore
18
- changelog.txt export-ignore
19
- composer.* export-ignore
20
- package*.json export-ignore
21
- phpcs.* export-ignore
22
- phpunit.* export-ignore
23
- README.md export-ignore
24
-
25
- # Remove folders for archives generated using `git archive`.
26
- assets/admin/scss export-ignore
27
- assets/admin/src export-ignore
28
- assets/frontend/scss export-ignore
29
- assets/frontend/src export-ignore
30
- bin/ export-ignore
31
- .changelog/ export-ignore
32
- tests/ export-ignore
33
- tools/ export-ignore
34
- adv-ads-scaffolding export-ignore
@@ -1,43 +0,0 @@
1
- # Wordpress - ignore core, configuration, examples, uploads and logs.
2
- # https://github.com/github/gitignore/blob/main/WordPress.gitignore
3
-
4
- # Operating System files
5
- .DS_Store
6
- Thumbs.db
7
-
8
- # IDE files
9
- .vscode/*
10
- project.xml
11
- project.properties
12
- .project
13
- .settings*
14
- *.sublime-project
15
- *.sublime-workspace
16
- .sublimelinterrc
17
-
18
- # Caches
19
- .eslintcache
20
- .stylelintcache
21
-
22
- # Environment files
23
- wp-cli.local.yml
24
- .wp-env.override.json
25
- npm-debug.log
26
- .pnpm-debug.log
27
-
28
- # Node Package Dependencies
29
- node_modules/
30
-
31
- # Composer
32
- packages/**/tests/
33
- vendor/
34
- bin/composer/**/vendor/
35
-
36
- # Support .gitkeep Files
37
- !.gitkeep
38
- webpack.mix.local.js
39
- mix-manifest.json
40
-
41
- # WP Browser Files
42
- tests/_output
43
- tests/.env
@@ -1,66 +0,0 @@
1
- {
2
- "name": "{{package.name}}",
3
- "title": "{{wp.name}}",
4
- "description": "{{wp.description}}",
5
- "homepage": "{{company.url}}",
6
- "private": true,
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/advanced-ads/{{package.name}}.git"
10
- },
11
- "author": "{{author.name}}",
12
- "license": "GPL-3.0-or-later",
13
- "bugs": {
14
- "url": "https://github.com/advanced-ads/{{package.name}}/issues"
15
- },
16
- "scripts": {
17
- "prepare": "husky install",
18
- "dev": "mix",
19
- "watch": "mix watch",
20
- "watch-poll": "mix watch -- --watch-options-poll=1000",
21
- "hot": "mix watch --hot",
22
- "build": "mix --production",
23
- "lint": "lint-staged",
24
- "lint:css": "stylelint \"**/*.css\" --cache",
25
- "lint:scss": "stylelint \"**/*.scss\" --cache",
26
- "lint:js": "eslint . --cache",
27
- "lint:p": "prettier -c .",
28
- "lint:pw": "prettier -w .",
29
- "lint:php": "vendor/bin/phpcs",
30
- "translations": "node ./tools/wp-glotpress.js"
31
- },
32
- "devDependencies": {
33
- },
34
- "browserslist": [
35
- "> 1%",
36
- "last 1 Android versions",
37
- "last 1 ChromeAndroid versions",
38
- "last 2 Chrome versions",
39
- "last 2 Firefox versions",
40
- "last 2 Safari versions",
41
- "last 2 iOS versions",
42
- "last 2 Edge versions",
43
- "last 2 Opera versions"
44
- ],
45
- "lint-staged": {
46
- "*.js": [
47
- "prettier -c",
48
- "eslint --cache"
49
- ],
50
- "*.(sa|sc|c)ss": [
51
- "prettier -c",
52
- "stylelint --cache"
53
- ],
54
- "*.php": "vendor/bin/phpcs",
55
- "*.md": "prettier -c"
56
- },
57
- "glotpress": {
58
- "project": "{{package.name}}",
59
- "destination": "./languages/"
60
- },
61
- "wpPot": {
62
- "output": "/languages/",
63
- "file": "{{wp.textDomain}}.pot",
64
- "domain": "{{wp.textDomain}}"
65
- }
66
- }
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- };
@@ -1,8 +0,0 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
- content: ['./includes/**/*.php', './views/**/*.php'],
4
- theme: {
5
- extend: {},
6
- },
7
- plugins: [],
8
- };
@@ -1,65 +0,0 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- // webpack.mix.js
3
-
4
- const mix = require('laravel-mix');
5
- const { join } = require('path');
6
- const packageData = require('./package.json');
7
- require('./tools/laravel-mix/wp-pot');
8
-
9
- // Local config.
10
- let localConfig = {};
11
-
12
- try {
13
- localConfig = require('./webpack.mix.local');
14
- } catch {}
15
-
16
- // Webpack Config.
17
- mix.webpackConfig({
18
- externals: {
19
- jquery: 'jQuery',
20
- lodash: 'lodash',
21
- moment: 'moment',
22
- },
23
- });
24
-
25
- // Aliasing Paths.
26
- mix.alias({
27
- '@root': join(__dirname, 'assets/src'),
28
- });
29
-
30
- // Browsersync
31
- if (undefined !== localConfig.wpUrl && '' !== localConfig.wpUrl) {
32
- mix.browserSync({
33
- proxy: localConfig.wpUrl,
34
- ghostMode: false,
35
- notify: false,
36
- ui: false,
37
- open: true,
38
- online: false,
39
- files: ['assets/css/*.min.css', 'assets/js/*.js', '**/*.php'],
40
- });
41
- }
42
-
43
- /**
44
- * CSS Files
45
- */
46
- mix.sass('assets/scss/app.scss', 'assets/css/app.min.css', {
47
- sassOptions: {
48
- outputStyle: 'compressed',
49
- },
50
- });
51
-
52
- /**
53
- * JavaScript Files
54
- */
55
- mix.js('assets/src/app.js', 'assets/js/app.js');
56
-
57
- /**
58
- * WordPress translation
59
- */
60
- mix.wpPot({
61
- output: packageData.wpPot.output,
62
- file: packageData.wpPot.file,
63
- skipJS: true,
64
- domain: packageData.wpPot.domain,
65
- });
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- wpUrl: '{{wp.proxy}}',
3
- };
@@ -1,2 +0,0 @@
1
- <?php
2
- // Silence is golden.
package/template/index.js DELETED
File without changes
@@ -1,4 +0,0 @@
1
- <?php
2
- /**
3
- * Silence is golden.
4
- */
File without changes
File without changes
@@ -1,57 +0,0 @@
1
- const mix = require('laravel-mix');
2
-
3
- class WordPressPot {
4
- name() {
5
- return 'wpPot';
6
- }
7
-
8
- dependencies() {
9
- this.requiresReload = `Dependencies have been installed. Please run again.`;
10
-
11
- return ['shelljs'];
12
- }
13
-
14
- register(config) {
15
- this.config = config;
16
- }
17
-
18
- boot() {
19
- const sh = require('shelljs');
20
- const {
21
- output,
22
- file,
23
- domain,
24
- skipJS = false,
25
- exclude = [],
26
- headers = {
27
- 'Last-Translator': 'Thomas Maier <post@webzunft.de>',
28
- 'Language-Team': 'webgilde <support@wpadvancedads.com>',
29
- },
30
- } = this.config;
31
-
32
- exclude.push('.github');
33
- exclude.push('.husky');
34
- exclude.push('.wordpress-org');
35
- exclude.push('node_modules');
36
- exclude.push('packages');
37
- exclude.push('tools');
38
- exclude.push('vendor');
39
-
40
- const rootPath = process.cwd();
41
- const command = [
42
- 'wp i18n make-pot',
43
- rootPath,
44
- rootPath + output + file,
45
- `--domain=${domain}`,
46
- `--exclude=${exclude.join(',')}`,
47
- `--headers='${JSON.stringify(headers)}'`,
48
- ];
49
-
50
- sh.exec(command.join(' '));
51
- if (false !== skipJS) {
52
- sh.exec(`wp i18n make-json ${rootPath}${output}`, { silent: true });
53
- }
54
- }
55
- }
56
-
57
- mix.extend('wpPot', new WordPressPot());