plugship 1.0.1 → 1.0.2

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 +153 -101
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,173 +1,197 @@
1
1
  # plugship
2
2
 
3
- A CLI tool to deploy local WordPress plugins to remote WordPress sites.
3
+ > Deploy WordPress plugins from your terminal to any WordPress site instantly.
4
4
 
5
- ## Prerequisites
5
+ A simple CLI tool to deploy local WordPress plugins to remote WordPress sites. No FTP, no cPanel — just `plugship deploy`.
6
6
 
7
- - Node.js 18+
8
- - A WordPress site with REST API enabled
9
- - An Administrator account with an [Application Password](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/)
7
+ ## Quick Start
10
8
 
11
- ## Installation
9
+ ### 1. Install
12
10
 
13
11
  ```bash
14
12
  npm install -g plugship
15
13
  ```
16
14
 
17
- ## Setup
15
+ ### 2. Install Receiver Plugin
18
16
 
19
- ### 1. Install the Receiver Plugin
17
+ Download and install the companion plugin on your WordPress site:
20
18
 
21
- The `plugship-receiver` companion plugin must be installed on your WordPress site. It adds a REST endpoint that accepts plugin ZIP uploads.
19
+ **[Download plugship-receiver.zip](https://github.com/shamim0902/plugship-receiver/releases/latest/download/plugship-receiver.zip)**
22
20
 
23
- 1. Download [plugship-receiver.zip](https://github.com/shamim0902/plugship-receiver/releases/latest/download/plugship-receiver.zip) or get it from the [repo](https://github.com/shamim0902/plugship-receiver)
24
- 2. Go to **Plugins > Add New > Upload Plugin** in WordPress admin
25
- 3. Upload the ZIP and activate **PlugShip Receiver**
21
+ 1. Go to **Plugins > Add New > Upload Plugin** in WordPress admin
22
+ 2. Upload the ZIP file
23
+ 3. Activate **PlugShip Receiver**
26
24
 
27
- ### 2. Create an Application Password
28
-
29
- 1. Go to **Users > Profile** in WordPress admin
30
- 2. Scroll to **Application Passwords**
31
- 3. Enter a name (e.g. "plugship") and click **Add New Application Password**
32
- 4. Copy the generated password
33
-
34
- ### 3. Configure a Site
25
+ ### 3. Configure Your Site
35
26
 
36
27
  ```bash
37
28
  plugship init
38
29
  ```
39
30
 
40
- You will be prompted for:
41
-
42
- - **Site alias** — a short name for this site (e.g. "staging")
43
- - **Site URL** — your WordPress site URL (e.g. `https://example.com`)
44
- - **Username** your WordPress admin username
45
- - **Application password** — the password from step 2
46
-
47
- The command will verify the connection, credentials, and receiver plugin status.
31
+ You'll be prompted for:
32
+ - Site alias (e.g., "production")
33
+ - WordPress site URL
34
+ - Admin username
35
+ - [Application Password](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/) (create one in Users > Profile)
48
36
 
49
- ## Usage
37
+ ### 4. Deploy
50
38
 
51
- ### Deploy a Plugin
52
-
53
- Navigate to your WordPress plugin directory and run:
39
+ Navigate to your plugin directory and run:
54
40
 
55
41
  ```bash
56
42
  plugship deploy
57
43
  ```
58
44
 
59
- This will:
45
+ Done! Your plugin is deployed and activated.
46
+
47
+ ---
60
48
 
61
- 1. Detect the plugin from PHP file headers
62
- 2. Create a ZIP archive in the `build/` directory
63
- 3. Upload and install the plugin on the remote site
64
- 4. Activate the plugin
49
+ ## Commands
65
50
 
66
- If you have multiple sites configured, you will be prompted to select one.
51
+ ### `plugship deploy`
67
52
 
68
- #### Options
53
+ Deploy the plugin from the current directory.
69
54
 
70
55
  ```bash
71
- plugship deploy --site <name> # Deploy to a specific site
72
- plugship deploy --no-activate # Deploy without activating the plugin
73
- plugship deploy --dry-run # Preview what would be deployed without uploading
56
+ plugship deploy # Deploy to default site
57
+ plugship deploy --site staging # Deploy to specific site
74
58
  plugship deploy --all # Deploy to all configured sites
59
+ plugship deploy --dry-run # Preview without uploading
60
+ plugship deploy --no-activate # Deploy without activating
75
61
  ```
76
62
 
77
- ### Check Site Status
63
+ ### `plugship init`
78
64
 
79
- Verify connection, credentials, and receiver plugin before deploying:
65
+ Add a new WordPress site.
80
66
 
81
67
  ```bash
82
- plugship status # Check default or select a site
83
- plugship status --site <name> # Check a specific site
68
+ plugship init
84
69
  ```
85
70
 
86
- ### Manage Sites
71
+ ### `plugship status`
72
+
73
+ Check if a site is ready for deployment.
87
74
 
88
75
  ```bash
89
- plugship sites list # List all saved sites
90
- plugship sites remove <name> # Remove a saved site
91
- plugship sites set-default <name> # Set the default site
76
+ plugship status # Check default site
77
+ plugship status --site staging # Check specific site
92
78
  ```
93
79
 
94
- ## Commands
80
+ ### `plugship sites`
95
81
 
96
- | Command | Description |
97
- | --- | --- |
98
- | `plugship init` | Configure a new WordPress site |
99
- | `plugship deploy` | Deploy the plugin from the current directory |
100
- | `plugship deploy --dry-run` | Preview deploy without uploading |
101
- | `plugship deploy --all` | Deploy to all configured sites |
102
- | `plugship status` | Check site connection and receiver status |
103
- | `plugship sites list` | List all saved sites |
104
- | `plugship sites remove <name>` | Remove a saved site |
105
- | `plugship sites set-default <name>` | Set the default site |
106
- | `plugship ignore` | Create `.plugshipignore` with default template |
107
- | `plugship ignore <patterns...>` | Add patterns to `.plugshipignore` |
108
- | `plugship --help` | Show help |
109
- | `plugship --version` | Show version |
82
+ Manage your saved sites.
83
+
84
+ ```bash
85
+ plugship sites list # List all sites
86
+ plugship sites set-default staging # Set default site
87
+ plugship sites remove staging # Remove a site
88
+ ```
110
89
 
111
- ## Plugin Detection
90
+ ### `plugship ignore`
112
91
 
113
- The CLI detects your plugin by scanning `.php` files in the current directory for a standard WordPress plugin header:
92
+ Exclude files from deployment.
114
93
 
115
- ```php
116
- <?php
117
- /**
118
- * Plugin Name: My Plugin
119
- * Version: 1.0.0
120
- * Text Domain: my-plugin
121
- */
94
+ ```bash
95
+ plugship ignore # Create .plugshipignore template
96
+ plugship ignore "src/**" "*.map" # Add patterns
122
97
  ```
123
98
 
124
- The `Text Domain` is used as the plugin slug. If not provided, the slug is derived from the plugin name.
99
+ ---
125
100
 
126
101
  ## Ignoring Files
127
102
 
128
- Use the `ignore` command to create a `.plugshipignore` file with a default template:
103
+ Create a `.plugshipignore` file to exclude files from deployment:
129
104
 
130
105
  ```bash
131
106
  plugship ignore
132
107
  ```
133
108
 
134
- Or add specific patterns directly:
135
-
136
- ```bash
137
- plugship ignore "src/**" "*.map" composer.json
138
- ```
139
-
140
- You can also manually create or edit `.plugshipignore` in your plugin directory to exclude files and folders from the deployment ZIP:
109
+ This creates a template with common exclusions. Edit it to add your own:
141
110
 
142
111
  ```
143
112
  # .plugshipignore
144
113
  src/**
145
- assets/scss/**
146
- webpack.config.js
114
+ *.map
147
115
  package.json
148
- package-lock.json
149
116
  composer.json
150
- composer.lock
151
- *.map
117
+ webpack.config.js
118
+ ```
119
+
120
+ **Already excluded by default:**
121
+ `node_modules`, `.git`, `.env`, `*.log`, `.vscode`, `.idea`, `tests`, `.github`, `build`
122
+
123
+ ---
124
+
125
+ ## How It Works
126
+
127
+ 1. **Detects your plugin** from the WordPress plugin header in your PHP files
128
+ 2. **Creates a ZIP** with only the files you need (excludes dev files)
129
+ 3. **Uploads via REST API** to the WordPress site using the receiver plugin
130
+ 4. **Installs and activates** the plugin automatically
131
+
132
+ The [plugship-receiver](https://github.com/shamim0902/plugship-receiver) plugin adds secure REST endpoints to accept the upload. Only admin users with Application Passwords can deploy.
133
+
134
+ ---
135
+
136
+ ## Examples
137
+
138
+ ### Deploy to Staging
139
+
140
+ ```bash
141
+ cd my-plugin/
142
+ plugship deploy --site staging
152
143
  ```
153
144
 
154
- - One pattern per line
155
- - Lines starting with `#` are comments
156
- - Blank lines are ignored
157
- - Supports `dir/**` (directory and contents), `*.ext` (extension match), and exact names
145
+ ### Deploy to All Sites
146
+
147
+ ```bash
148
+ plugship deploy --all
149
+ ```
150
+
151
+ ### Preview What Would Be Deployed
152
+
153
+ ```bash
154
+ plugship deploy --dry-run
155
+ ```
156
+
157
+ ### Check Connection Before Deploying
158
+
159
+ ```bash
160
+ plugship status
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Requirements
166
+
167
+ - **Node.js** 18 or higher
168
+ - **WordPress** 5.8 or higher
169
+ - **Admin account** with Application Passwords enabled
170
+
171
+ ---
158
172
 
159
- The following are always excluded by default:
173
+ ## Security
160
174
 
161
- `node_modules`, `.git`, `.DS_Store`, `.env`, `*.log`, `.vscode`, `.idea`, `tests`, `phpunit.xml`, `.phpunit.result.cache`, `.github`, `build`
175
+ - All credentials are stored locally in `~/.plugship/config.json` with `0600` permissions
176
+ - Uses WordPress Application Passwords (not your main password)
177
+ - Only users with `install_plugins` capability can deploy
178
+ - All uploads are authenticated via WordPress REST API
179
+
180
+ ---
162
181
 
163
182
  ## Configuration
164
183
 
165
- Site credentials are stored in `~/.plugship/config.json` with `0600` file permissions. The config file looks like:
184
+ Config file: `~/.plugship/config.json`
166
185
 
167
186
  ```json
168
187
  {
169
- "defaultSite": "staging",
188
+ "defaultSite": "production",
170
189
  "sites": {
190
+ "production": {
191
+ "url": "https://example.com",
192
+ "username": "admin",
193
+ "appPassword": "xxxx xxxx xxxx xxxx"
194
+ },
171
195
  "staging": {
172
196
  "url": "https://staging.example.com",
173
197
  "username": "admin",
@@ -177,14 +201,42 @@ Site credentials are stored in `~/.plugship/config.json` with `0600` file permis
177
201
  }
178
202
  ```
179
203
 
180
- ## How It Works
204
+ ---
205
+
206
+ ## Troubleshooting
207
+
208
+ ### "Receiver plugin not found"
209
+
210
+ The plugship-receiver plugin isn't active on your WordPress site.
211
+
212
+ 1. Download: https://github.com/shamim0902/plugship-receiver/releases/latest/download/plugship-receiver.zip
213
+ 2. Upload and activate in WordPress admin
214
+
215
+ ### "Authentication failed"
216
+
217
+ Your Application Password is incorrect.
218
+
219
+ 1. Go to **Users > Profile** in WordPress admin
220
+ 2. Generate a new Application Password
221
+ 3. Run `plugship init` again
222
+
223
+ ### "Cannot reach REST API"
224
+
225
+ Your WordPress REST API isn't accessible.
226
+
227
+ - Check that `https://yoursite.com/wp-json/` loads
228
+ - Disable security plugins temporarily to test
229
+ - Check for firewall/hosting restrictions
230
+
231
+ ---
181
232
 
182
- The WordPress REST API does not support direct ZIP upload for plugin installation. The `plugship-receiver` companion plugin adds two custom endpoints:
233
+ ## Links
183
234
 
184
- - `GET /wp-json/plugship/v1/status` — Health check
185
- - `POST /wp-json/plugship/v1/deploy` — Accepts a ZIP file and installs it using WordPress's built-in `Plugin_Upgrader` with `overwrite_package => true`
235
+ - [npm package](https://www.npmjs.com/package/plugship)
236
+ - [Receiver plugin](https://github.com/shamim0902/plugship-receiver)
237
+ - [Report issues](https://github.com/shamim0902/plugship/issues)
186
238
 
187
- If the plugin already exists on the site, it is replaced with the uploaded version.
239
+ ---
188
240
 
189
241
  ## License
190
242
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugship",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Deploy local WordPress plugins to remote sites from the command line",
5
5
  "type": "module",
6
6
  "bin": {