wp-advads 1.0.34 → 1.0.35

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 (2) hide show
  1. package/README.md +82 -63
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,139 +1,158 @@
1
- # wp-advads Scaffolding Tool
2
-
3
-
4
-
1
+ # wp-advads
5
2
 
6
3
  [![npm version](https://img.shields.io/npm/v/wp-advads.svg)](https://www.npmjs.com/package/wp-advads)
7
4
  [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](LICENSE)
8
5
 
9
- <p align="center">
10
- <img src="https://img.icons8.com/nolan/256/wordpress.png"/>
11
- </p>
6
+ CLI scaffolding for an **existing** Advanced Ads WordPress plugin. It writes `wp.advads` and file stubs (`class`, `view`, `updates`, `js`, `css`). It does not generate a plugin from scratch.
12
7
 
13
- ## 📃 Introduction
8
+ Requires **Node.js 18+**. Created by [Shakeeb Ahmed](https://github.com/meshakeeb).
14
9
 
15
- CLI tools to streamline development tasks for the Advanced Ads WordPress plugin.
16
- Created by [Shakeeb Ahmed](https://github.com/meshakeeb)
10
+ ## Installation
17
11
 
18
- ## 📦 Installation
19
- Use via npx:
20
12
  ```bash
21
13
  npx wp-advads
22
14
  ```
23
15
 
24
- ## 🚀 Usage
25
- Run the CLI using:
26
16
  ```bash
27
17
  npx wp-advads <command> [options]
28
18
  ```
29
19
 
30
- ## 🔧 Commands
20
+ ## Config
21
+
22
+ Commands (except `init`) need a `wp.advads` file. The CLI uses the nearest ancestor that already has one. `init` writes `wp.advads` in the current directory.
23
+
24
+ If the file is missing, the CLI exits and tells you to run `wp-advads init`. It does not prompt.
25
+
26
+ ## Commands
31
27
 
32
28
  #### `init`
33
- Initializes a new project configuration file.
29
+
30
+ Creates `wp.advads` in the current directory.
31
+
34
32
  ```bash
35
33
  npx wp-advads init
36
34
  ```
37
35
 
38
- `wp.advads` lives in the nearest ancestor directory that already has that file. `init` creates it in the current directory.
36
+ #### `build`
37
+
38
+ Installs PHP dependencies into `packages/` (`COMPOSER_VENDOR_DIR=packages`), dumps the autoloader, runs `npm run build` when `package.json` has a `scripts.build`, then generates a `.pot`.
39
+
40
+ ```bash
41
+ npx wp-advads build
42
+ ```
43
+
44
+ Standalone `build` does not touch release git messages. During `release`, commit bullets are passed in explicitly.
39
45
 
40
46
  #### `release`
41
- Creates a new release for the plugin.
47
+
48
+ Bumps the version, changelog, translations, build, and git (explicit file list, hooks run). Stops on the first failed step.
49
+
42
50
  ```bash
43
51
  npx wp-advads release
44
52
  ```
45
53
 
46
-
47
54
  #### `class <classname> [options]`
48
- Creates a new PHP class file with optional templates.
55
+
56
+ Writes a PHP class under `paths.php`. Combine `--heading` with a template flag (`-i` / `-g` / `-r` / `-s`).
57
+
49
58
  ```bash
50
59
  npx wp-advads class MyClass --heading "Class Heading" --description "Description" -s
51
60
  ```
52
61
 
53
- ##### Required Argument:
54
- - `<classname>` – The name of the class.
55
-
56
- ##### Optional Argument:
62
+ - `<classname>` – Class name (namespaces with `\`, e.g. `Foo\Bar`)
57
63
  - `--heading <heading>` – File heading
58
64
  - `--description <description>` – File description
59
- - `-i` – Initializer interface
60
- - `-g` – Integration interface
61
- - `-r` – REST interface
62
- - `-s` – Singleton class
63
-
65
+ - `-i` – Initializer
66
+ - `-g` – Integration
67
+ - `-r` – REST
68
+ - `-s` – Singleton (`__construct` is private)
69
+ - `--force` – Overwrite if the file exists
64
70
 
65
71
  #### `view <viewname> [heading]`
66
- Creates a new view file (e.g. template partial).
72
+
73
+ Writes a PHP view under `paths.views`. Nested names accept `/` or `\`.
74
+
67
75
  ```bash
68
76
  npx wp-advads view sidebar "Sidebar View"
77
+ npx wp-advads view admin/settings
69
78
  ```
70
79
 
71
- ##### Required Argument:
72
- - `<viewname>` – Name of the view file.
80
+ - `<viewname>` – View file name
81
+ - `[heading]` – Heading comment
82
+ - `--force` – Overwrite if the file exists
73
83
 
74
- ##### Optional Argument:
75
- - `[heading]` – A heading comment added to the view file.
84
+ #### `updates <version>`
76
85
 
86
+ Writes an upgrade file under `paths.updates`. `misc.prefix` from `wp.advads` is required (empty prefix is an error).
77
87
 
78
- #### `updates <version>`
79
- Creates update logic for the given plugin version.
80
88
  ```bash
81
89
  npx wp-advads updates 1.2.3
82
90
  ```
83
91
 
84
- ##### Required Argument:
85
- - `<version>` – Target version number (e.g. `1.2.0`)
92
+ - `<version>` – Target version (e.g. `1.2.3`)
93
+ - `--force` – Overwrite if the file exists
86
94
 
87
95
  #### `js <filename> [options]`
88
- Creates a new JavaScript file.
96
+
97
+ Writes a JavaScript file under `paths.javascript`. Nested names accept `/` or `\`.
98
+
89
99
  ```bash
90
100
  npx wp-advads js script -h "Main JS" -d "Handles the frontend logic"
91
101
  ```
92
102
 
93
- ##### Required Argument:
94
- - `<filename>` – Name of the JavaScript file (without extension).
103
+ - `<filename>` – Name without extension
104
+ - `-h <heading>` – Heading comment
105
+ - `-d <description>` – Description comment
106
+ - `--force` – Overwrite if the file exists
95
107
 
96
- ##### Optional Argument:
97
- - `-h <heading>` – Heading comment for the file.
98
- - `-d <description>` – Description comment for the file.
108
+ #### `css <filename> [options]`
99
109
 
110
+ Writes a CSS file under `paths.css`. Nested names accept `/` or `\`.
100
111
 
101
- #### `css <filename> [options]`
102
- Creates a new CSS file.
103
112
  ```bash
104
113
  npx wp-advads css styles -h "Main CSS" -d "Plugin styles"
105
114
  ```
106
115
 
107
- ##### Required Argument:
108
- - `<filename>` – Name of the CSS file (without extension).
109
-
110
- ##### Optional Argument:
111
- - `-h <heading>` – Heading comment for the file.
112
- - `-d <description>` – Description comment for the file.
116
+ - `<filename>` – Name without extension
117
+ - `-h <heading>` – Heading comment
118
+ - `-d <description>` – Description comment
119
+ - `--force` – Overwrite if the file exists
113
120
 
114
121
  #### `pot`
115
- Generates a `.pot` translation template.
122
+
123
+ Creates a `.pot` translation template (`wp i18n make-pot`).
124
+
116
125
  ```bash
117
126
  npx wp-advads pot
118
127
  ```
119
128
 
129
+ POT headers (`Last-Translator`, `Language-Team`) use `author.name` and `author.email` from `wp.advads`.
130
+
120
131
  #### `translations`
121
- Downloads translation files from GlotPress.
132
+
133
+ Downloads `.po` / `.mo` files from GlotPress into `glotpress.destination` (default `./languages/`). Locale ids must be `[a-zA-Z0-9_]+`; non-OK HTTP responses are skipped.
134
+
122
135
  ```bash
123
136
  npx wp-advads translations
124
137
  ```
125
138
 
126
- ### ⚠️ Notes
127
- A config file is required for all commands **except** init.
139
+ ## Notes
140
+
141
+ `class`, `view`, `updates`, `js`, and `css` will not overwrite an existing file unless you pass `--force`. Writes cannot escape the project root.
142
+
143
+ ## Tests
144
+
145
+ ```bash
146
+ npm test
147
+ ```
128
148
 
129
- If one is missing, you'll be prompted to create it with `wp-advads init`.
149
+ That runs `node --experimental-test-module-mocks --test`. Node 18+ is required (`engines.node`).
130
150
 
131
- `class`, `view`, `updates`, `js`, and `css` will not overwrite an existing file unless you pass `--force`.
151
+ ## Author
132
152
 
133
- ### 👤 Author
134
- Shakeeb Ahmed
135
- GitHub: [@meshakeeb](http://github.com/meshakeeb)
153
+ Shakeeb Ahmed
154
+ GitHub: [@meshakeeb](https://github.com/meshakeeb)
136
155
 
137
- ### 📖 Changelog
156
+ ## Changelog
138
157
 
139
- [See the changelog file](./CHANGELOG.md)
158
+ [CHANGELOG.md](./CHANGELOG.md)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "wp-advads",
4
- "version": "1.0.34",
4
+ "version": "1.0.35",
5
5
  "description": "Create an Advanced Ads WordPress plugin ecosystem.",
6
6
  "author": {
7
7
  "name": "Shakeeb Ahmed",