plugship 1.0.0 → 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 -100
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,172 +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. Get [plugship-receiver](https://github.com/plugship/plugship-receiver) and copy `plugship-receiver.php` to your site's `wp-content/plugins/` directory
24
- 2. Activate **PlugShip Receiver** from the WordPress admin Plugins page
21
+ 1. Go to **Plugins > Add New > Upload Plugin** in WordPress admin
22
+ 2. Upload the ZIP file
23
+ 3. Activate **PlugShip Receiver**
25
24
 
26
- ### 2. Create an Application Password
27
-
28
- 1. Go to **Users > Profile** in WordPress admin
29
- 2. Scroll to **Application Passwords**
30
- 3. Enter a name (e.g. "plugship") and click **Add New Application Password**
31
- 4. Copy the generated password
32
-
33
- ### 3. Configure a Site
25
+ ### 3. Configure Your Site
34
26
 
35
27
  ```bash
36
28
  plugship init
37
29
  ```
38
30
 
39
- You will be prompted for:
40
-
41
- - **Site alias** — a short name for this site (e.g. "staging")
42
- - **Site URL** — your WordPress site URL (e.g. `https://example.com`)
43
- - **Username** your WordPress admin username
44
- - **Application password** — the password from step 2
45
-
46
- 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)
47
36
 
48
- ## Usage
37
+ ### 4. Deploy
49
38
 
50
- ### Deploy a Plugin
51
-
52
- Navigate to your WordPress plugin directory and run:
39
+ Navigate to your plugin directory and run:
53
40
 
54
41
  ```bash
55
42
  plugship deploy
56
43
  ```
57
44
 
58
- This will:
45
+ Done! Your plugin is deployed and activated.
46
+
47
+ ---
59
48
 
60
- 1. Detect the plugin from PHP file headers
61
- 2. Create a ZIP archive in the `build/` directory
62
- 3. Upload and install the plugin on the remote site
63
- 4. Activate the plugin
49
+ ## Commands
64
50
 
65
- If you have multiple sites configured, you will be prompted to select one.
51
+ ### `plugship deploy`
66
52
 
67
- #### Options
53
+ Deploy the plugin from the current directory.
68
54
 
69
55
  ```bash
70
- plugship deploy --site <name> # Deploy to a specific site
71
- plugship deploy --no-activate # Deploy without activating the plugin
72
- 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
73
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
74
61
  ```
75
62
 
76
- ### Check Site Status
63
+ ### `plugship init`
77
64
 
78
- Verify connection, credentials, and receiver plugin before deploying:
65
+ Add a new WordPress site.
79
66
 
80
67
  ```bash
81
- plugship status # Check default or select a site
82
- plugship status --site <name> # Check a specific site
68
+ plugship init
83
69
  ```
84
70
 
85
- ### Manage Sites
71
+ ### `plugship status`
72
+
73
+ Check if a site is ready for deployment.
86
74
 
87
75
  ```bash
88
- plugship sites list # List all saved sites
89
- plugship sites remove <name> # Remove a saved site
90
- plugship sites set-default <name> # Set the default site
76
+ plugship status # Check default site
77
+ plugship status --site staging # Check specific site
91
78
  ```
92
79
 
93
- ## Commands
80
+ ### `plugship sites`
94
81
 
95
- | Command | Description |
96
- | --- | --- |
97
- | `plugship init` | Configure a new WordPress site |
98
- | `plugship deploy` | Deploy the plugin from the current directory |
99
- | `plugship deploy --dry-run` | Preview deploy without uploading |
100
- | `plugship deploy --all` | Deploy to all configured sites |
101
- | `plugship status` | Check site connection and receiver status |
102
- | `plugship sites list` | List all saved sites |
103
- | `plugship sites remove <name>` | Remove a saved site |
104
- | `plugship sites set-default <name>` | Set the default site |
105
- | `plugship ignore` | Create `.plugshipignore` with default template |
106
- | `plugship ignore <patterns...>` | Add patterns to `.plugshipignore` |
107
- | `plugship --help` | Show help |
108
- | `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
+ ```
109
89
 
110
- ## Plugin Detection
90
+ ### `plugship ignore`
111
91
 
112
- The CLI detects your plugin by scanning `.php` files in the current directory for a standard WordPress plugin header:
92
+ Exclude files from deployment.
113
93
 
114
- ```php
115
- <?php
116
- /**
117
- * Plugin Name: My Plugin
118
- * Version: 1.0.0
119
- * Text Domain: my-plugin
120
- */
94
+ ```bash
95
+ plugship ignore # Create .plugshipignore template
96
+ plugship ignore "src/**" "*.map" # Add patterns
121
97
  ```
122
98
 
123
- The `Text Domain` is used as the plugin slug. If not provided, the slug is derived from the plugin name.
99
+ ---
124
100
 
125
101
  ## Ignoring Files
126
102
 
127
- Use the `ignore` command to create a `.plugshipignore` file with a default template:
103
+ Create a `.plugshipignore` file to exclude files from deployment:
128
104
 
129
105
  ```bash
130
106
  plugship ignore
131
107
  ```
132
108
 
133
- Or add specific patterns directly:
134
-
135
- ```bash
136
- plugship ignore "src/**" "*.map" composer.json
137
- ```
138
-
139
- 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:
140
110
 
141
111
  ```
142
112
  # .plugshipignore
143
113
  src/**
144
- assets/scss/**
145
- webpack.config.js
114
+ *.map
146
115
  package.json
147
- package-lock.json
148
116
  composer.json
149
- composer.lock
150
- *.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
151
143
  ```
152
144
 
153
- - One pattern per line
154
- - Lines starting with `#` are comments
155
- - Blank lines are ignored
156
- - 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
+ ---
157
172
 
158
- The following are always excluded by default:
173
+ ## Security
159
174
 
160
- `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
+ ---
161
181
 
162
182
  ## Configuration
163
183
 
164
- Site credentials are stored in `~/.plugship/config.json` with `0600` file permissions. The config file looks like:
184
+ Config file: `~/.plugship/config.json`
165
185
 
166
186
  ```json
167
187
  {
168
- "defaultSite": "staging",
188
+ "defaultSite": "production",
169
189
  "sites": {
190
+ "production": {
191
+ "url": "https://example.com",
192
+ "username": "admin",
193
+ "appPassword": "xxxx xxxx xxxx xxxx"
194
+ },
170
195
  "staging": {
171
196
  "url": "https://staging.example.com",
172
197
  "username": "admin",
@@ -176,14 +201,42 @@ Site credentials are stored in `~/.plugship/config.json` with `0600` file permis
176
201
  }
177
202
  ```
178
203
 
179
- ## 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
+ ---
180
232
 
181
- The WordPress REST API does not support direct ZIP upload for plugin installation. The `plugship-receiver` companion plugin adds two custom endpoints:
233
+ ## Links
182
234
 
183
- - `GET /wp-json/plugship/v1/status` — Health check
184
- - `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)
185
238
 
186
- If the plugin already exists on the site, it is replaced with the uploaded version.
239
+ ---
187
240
 
188
241
  ## License
189
242
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugship",
3
- "version": "1.0.0",
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": {