@wyxos/zephyr 0.2.20 → 0.2.22
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/README.md +144 -144
- package/bin/zephyr.mjs +29 -29
- package/package.json +58 -58
- package/src/config/project.mjs +118 -118
- package/src/config/servers.mjs +57 -57
- package/src/dependency-scanner.mjs +412 -453
- package/src/deploy/local-repo.mjs +215 -215
- package/src/deploy/locks.mjs +171 -171
- package/src/deploy/preflight.mjs +117 -117
- package/src/deploy/remote-exec.mjs +99 -99
- package/src/deploy/snapshots.mjs +35 -35
- package/src/index.mjs +91 -91
- package/src/main.mjs +677 -652
- package/src/project/bootstrap.mjs +147 -147
- package/src/release-node.mjs +24 -6
- package/src/runtime/local-command.mjs +18 -18
- package/src/runtime/prompt.mjs +14 -14
- package/src/runtime/ssh-client.mjs +14 -14
- package/src/ssh/index.mjs +8 -8
- package/src/ssh/keys.mjs +146 -146
- package/src/ssh/ssh.mjs +134 -134
- package/src/utils/command.mjs +92 -92
- package/src/utils/config-flow.mjs +284 -284
- package/src/utils/git.mjs +91 -91
- package/src/utils/id.mjs +6 -6
- package/src/utils/log-file.mjs +76 -76
- package/src/utils/output.mjs +29 -29
- package/src/utils/paths.mjs +28 -28
- package/src/utils/php-version.mjs +137 -0
- package/src/utils/remote-path.mjs +23 -23
- package/src/utils/task-planner.mjs +99 -96
- package/src/version-checker.mjs +162 -162
package/README.md
CHANGED
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
# @wyxos/zephyr
|
|
2
|
-
|
|
3
|
-
A streamlined deployment tool for web applications with intelligent Laravel project detection.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g @wyxos/zephyr
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Or run directly with npx:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npx @wyxos/zephyr
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
Navigate to your project directory and run:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
zephyr
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
See all flags:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
zephyr --help
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Common flags:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# Run a release workflow
|
|
35
|
-
zephyr --type node
|
|
36
|
-
|
|
37
|
-
# Skip the best-effort update check for this run
|
|
38
|
-
zephyr --skip-version-check
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Follow the interactive prompts to configure your deployment target:
|
|
42
|
-
- Server name and IP address
|
|
43
|
-
- Project path on the remote server
|
|
44
|
-
- Git branch to deploy
|
|
45
|
-
- SSH user and private key
|
|
46
|
-
|
|
47
|
-
Configuration is saved automatically for future deployments.
|
|
48
|
-
|
|
49
|
-
## Update Checks
|
|
50
|
-
|
|
51
|
-
When run via `npx`, Zephyr can prompt to re-run itself using the latest published version.
|
|
52
|
-
|
|
53
|
-
- **Skip update check**:
|
|
54
|
-
- Set `ZEPHYR_SKIP_VERSION_CHECK=1`, or
|
|
55
|
-
- Use `zephyr --skip-version-check`
|
|
56
|
-
|
|
57
|
-
## Features
|
|
58
|
-
|
|
59
|
-
- Automated Git operations (branch switching, commits, pushes)
|
|
60
|
-
- SSH-based deployment to remote servers
|
|
61
|
-
- Laravel project detection with smart task execution
|
|
62
|
-
- Intelligent dependency management (Composer, npm)
|
|
63
|
-
- Database migrations when detected
|
|
64
|
-
- Frontend asset compilation
|
|
65
|
-
- Cache clearing and queue worker management
|
|
66
|
-
- SSH key validation and management
|
|
67
|
-
- Deployment locking to prevent concurrent runs
|
|
68
|
-
- Task snapshots for resuming failed deployments
|
|
69
|
-
- Comprehensive logging of all remote operations
|
|
70
|
-
|
|
71
|
-
## Smart Task Execution
|
|
72
|
-
|
|
73
|
-
Zephyr analyzes changed files and runs appropriate tasks:
|
|
74
|
-
|
|
75
|
-
- **Always**: `git pull origin <branch>`
|
|
76
|
-
- **Composer files changed** (`composer.json` / `composer.lock`): `composer update --no-dev --no-interaction --prefer-dist`
|
|
77
|
-
- **Migrations changed** (`database/migrations/*.php`): `php artisan migrate --force`
|
|
78
|
-
- **Node dependency files changed** (`package.json` / `package-lock.json`, including nested): `npm install`
|
|
79
|
-
- **Frontend files changed** (`.vue/.js/.ts/.tsx/.css/.scss/.less`): `npm run build`
|
|
80
|
-
- Note: `npm run build` is also scheduled when `npm install` is scheduled.
|
|
81
|
-
- **PHP files changed**: clear caches + restart queue workers (Horizon if configured)
|
|
82
|
-
|
|
83
|
-
## Configuration
|
|
84
|
-
|
|
85
|
-
### Global Server Configuration
|
|
86
|
-
|
|
87
|
-
Servers are stored globally at `~/.config/zephyr/servers.json`:
|
|
88
|
-
|
|
89
|
-
```json
|
|
90
|
-
[
|
|
91
|
-
{
|
|
92
|
-
"id": "server_abc123",
|
|
93
|
-
"serverName": "production",
|
|
94
|
-
"serverIp": "192.168.1.100"
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Project Configuration
|
|
100
|
-
|
|
101
|
-
Deployment targets are stored per-project at `.zephyr/config.json`:
|
|
102
|
-
|
|
103
|
-
```json
|
|
104
|
-
{
|
|
105
|
-
"presets": [
|
|
106
|
-
{
|
|
107
|
-
"name": "prod-main",
|
|
108
|
-
"appId": "app_def456",
|
|
109
|
-
"branch": "main"
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
"apps": [
|
|
113
|
-
{
|
|
114
|
-
"id": "app_def456",
|
|
115
|
-
"serverId": "server_abc123",
|
|
116
|
-
"serverName": "production",
|
|
117
|
-
"projectPath": "~/webapps/myapp",
|
|
118
|
-
"branch": "main",
|
|
119
|
-
"sshUser": "forge",
|
|
120
|
-
"sshKey": "~/.ssh/id_rsa"
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Project Directory Structure
|
|
127
|
-
|
|
128
|
-
Zephyr creates a `.zephyr/` directory in your project with:
|
|
129
|
-
- `config.json` - Project deployment configuration
|
|
130
|
-
- `deploy.lock` - Lock file to prevent concurrent deployments
|
|
131
|
-
- `pending-tasks.json` - Task snapshot for resuming failed deployments
|
|
132
|
-
- `{timestamp}.log` - Log files for each deployment run
|
|
133
|
-
|
|
134
|
-
The `.zephyr/` directory is automatically added to `.gitignore`.
|
|
135
|
-
|
|
136
|
-
## Notes
|
|
137
|
-
|
|
138
|
-
- If Zephyr reports **"No upstream file changes detected"**, it means the remote repository already matches `origin/<branch>` after `git fetch`. In that case, Zephyr will only run `git pull` and skip all conditional maintenance tasks.
|
|
139
|
-
- If Zephyr prompts to update local file dependencies (path-based deps outside the repo), it may also prompt to commit those updates before continuing.
|
|
140
|
-
|
|
141
|
-
## Requirements
|
|
142
|
-
|
|
143
|
-
- Node.js 16+
|
|
144
|
-
- Git
|
|
1
|
+
# @wyxos/zephyr
|
|
2
|
+
|
|
3
|
+
A streamlined deployment tool for web applications with intelligent Laravel project detection.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @wyxos/zephyr
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @wyxos/zephyr
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Navigate to your project directory and run:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
zephyr
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
See all flags:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
zephyr --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Common flags:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Run a release workflow
|
|
35
|
+
zephyr --type node
|
|
36
|
+
|
|
37
|
+
# Skip the best-effort update check for this run
|
|
38
|
+
zephyr --skip-version-check
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Follow the interactive prompts to configure your deployment target:
|
|
42
|
+
- Server name and IP address
|
|
43
|
+
- Project path on the remote server
|
|
44
|
+
- Git branch to deploy
|
|
45
|
+
- SSH user and private key
|
|
46
|
+
|
|
47
|
+
Configuration is saved automatically for future deployments.
|
|
48
|
+
|
|
49
|
+
## Update Checks
|
|
50
|
+
|
|
51
|
+
When run via `npx`, Zephyr can prompt to re-run itself using the latest published version.
|
|
52
|
+
|
|
53
|
+
- **Skip update check**:
|
|
54
|
+
- Set `ZEPHYR_SKIP_VERSION_CHECK=1`, or
|
|
55
|
+
- Use `zephyr --skip-version-check`
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- Automated Git operations (branch switching, commits, pushes)
|
|
60
|
+
- SSH-based deployment to remote servers
|
|
61
|
+
- Laravel project detection with smart task execution
|
|
62
|
+
- Intelligent dependency management (Composer, npm)
|
|
63
|
+
- Database migrations when detected
|
|
64
|
+
- Frontend asset compilation
|
|
65
|
+
- Cache clearing and queue worker management
|
|
66
|
+
- SSH key validation and management
|
|
67
|
+
- Deployment locking to prevent concurrent runs
|
|
68
|
+
- Task snapshots for resuming failed deployments
|
|
69
|
+
- Comprehensive logging of all remote operations
|
|
70
|
+
|
|
71
|
+
## Smart Task Execution
|
|
72
|
+
|
|
73
|
+
Zephyr analyzes changed files and runs appropriate tasks:
|
|
74
|
+
|
|
75
|
+
- **Always**: `git pull origin <branch>`
|
|
76
|
+
- **Composer files changed** (`composer.json` / `composer.lock`): `composer update --no-dev --no-interaction --prefer-dist`
|
|
77
|
+
- **Migrations changed** (`database/migrations/*.php`): `php artisan migrate --force`
|
|
78
|
+
- **Node dependency files changed** (`package.json` / `package-lock.json`, including nested): `npm install`
|
|
79
|
+
- **Frontend files changed** (`.vue/.js/.ts/.tsx/.css/.scss/.less`): `npm run build`
|
|
80
|
+
- Note: `npm run build` is also scheduled when `npm install` is scheduled.
|
|
81
|
+
- **PHP files changed**: clear caches + restart queue workers (Horizon if configured)
|
|
82
|
+
|
|
83
|
+
## Configuration
|
|
84
|
+
|
|
85
|
+
### Global Server Configuration
|
|
86
|
+
|
|
87
|
+
Servers are stored globally at `~/.config/zephyr/servers.json`:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
[
|
|
91
|
+
{
|
|
92
|
+
"id": "server_abc123",
|
|
93
|
+
"serverName": "production",
|
|
94
|
+
"serverIp": "192.168.1.100"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Project Configuration
|
|
100
|
+
|
|
101
|
+
Deployment targets are stored per-project at `.zephyr/config.json`:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"presets": [
|
|
106
|
+
{
|
|
107
|
+
"name": "prod-main",
|
|
108
|
+
"appId": "app_def456",
|
|
109
|
+
"branch": "main"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"apps": [
|
|
113
|
+
{
|
|
114
|
+
"id": "app_def456",
|
|
115
|
+
"serverId": "server_abc123",
|
|
116
|
+
"serverName": "production",
|
|
117
|
+
"projectPath": "~/webapps/myapp",
|
|
118
|
+
"branch": "main",
|
|
119
|
+
"sshUser": "forge",
|
|
120
|
+
"sshKey": "~/.ssh/id_rsa"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Project Directory Structure
|
|
127
|
+
|
|
128
|
+
Zephyr creates a `.zephyr/` directory in your project with:
|
|
129
|
+
- `config.json` - Project deployment configuration
|
|
130
|
+
- `deploy.lock` - Lock file to prevent concurrent deployments
|
|
131
|
+
- `pending-tasks.json` - Task snapshot for resuming failed deployments
|
|
132
|
+
- `{timestamp}.log` - Log files for each deployment run
|
|
133
|
+
|
|
134
|
+
The `.zephyr/` directory is automatically added to `.gitignore`.
|
|
135
|
+
|
|
136
|
+
## Notes
|
|
137
|
+
|
|
138
|
+
- If Zephyr reports **"No upstream file changes detected"**, it means the remote repository already matches `origin/<branch>` after `git fetch`. In that case, Zephyr will only run `git pull` and skip all conditional maintenance tasks.
|
|
139
|
+
- If Zephyr prompts to update local file dependencies (path-based deps outside the repo), it may also prompt to commit those updates before continuing.
|
|
140
|
+
|
|
141
|
+
## Requirements
|
|
142
|
+
|
|
143
|
+
- Node.js 16+
|
|
144
|
+
- Git
|
|
145
145
|
- SSH access to target servers
|
package/bin/zephyr.mjs
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import { Command } from 'commander'
|
|
4
|
-
import chalk from 'chalk'
|
|
5
|
-
import { main } from '../src/main.mjs'
|
|
6
|
-
import { createChalkLogger } from '../src/utils/output.mjs'
|
|
7
|
-
|
|
8
|
-
const { logError } = createChalkLogger(chalk)
|
|
9
|
-
|
|
10
|
-
const program = new Command()
|
|
11
|
-
|
|
12
|
-
program
|
|
13
|
-
.name('zephyr')
|
|
14
|
-
.description('A streamlined deployment tool for web applications with intelligent Laravel project detection')
|
|
15
|
-
.option('--type <type>', 'Release type (node|vue|packagist)')
|
|
16
|
-
.option('--skip-version-check', 'Skip the version check for this run')
|
|
17
|
-
|
|
18
|
-
program.parse(process.argv)
|
|
19
|
-
const options = program.opts()
|
|
20
|
-
|
|
21
|
-
if (options.skipVersionCheck) {
|
|
22
|
-
process.env.ZEPHYR_SKIP_VERSION_CHECK = '1'
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
await main(options.type ?? null)
|
|
27
|
-
} catch (error) {
|
|
28
|
-
logError(error?.message || String(error))
|
|
29
|
-
process.exitCode = 1
|
|
30
|
-
}
|
|
2
|
+
import process from 'node:process'
|
|
3
|
+
import { Command } from 'commander'
|
|
4
|
+
import chalk from 'chalk'
|
|
5
|
+
import { main } from '../src/main.mjs'
|
|
6
|
+
import { createChalkLogger } from '../src/utils/output.mjs'
|
|
7
|
+
|
|
8
|
+
const { logError } = createChalkLogger(chalk)
|
|
9
|
+
|
|
10
|
+
const program = new Command()
|
|
11
|
+
|
|
12
|
+
program
|
|
13
|
+
.name('zephyr')
|
|
14
|
+
.description('A streamlined deployment tool for web applications with intelligent Laravel project detection')
|
|
15
|
+
.option('--type <type>', 'Release type (node|vue|packagist)')
|
|
16
|
+
.option('--skip-version-check', 'Skip the version check for this run')
|
|
17
|
+
|
|
18
|
+
program.parse(process.argv)
|
|
19
|
+
const options = program.opts()
|
|
20
|
+
|
|
21
|
+
if (options.skipVersionCheck) {
|
|
22
|
+
process.env.ZEPHYR_SKIP_VERSION_CHECK = '1'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
await main(options.type ?? null)
|
|
27
|
+
} catch (error) {
|
|
28
|
+
logError(error?.message || String(error))
|
|
29
|
+
process.exitCode = 1
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@wyxos/zephyr",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "A streamlined deployment tool for web applications with intelligent Laravel project detection",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./src/index.mjs",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./src/index.mjs",
|
|
9
|
-
"./ssh": "./src/ssh/index.mjs"
|
|
10
|
-
},
|
|
11
|
-
"bin": {
|
|
12
|
-
"zephyr": "bin/zephyr.mjs"
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"test": "vitest run",
|
|
16
|
-
"lint": "eslint .",
|
|
17
|
-
"release": "node bin/zephyr.mjs --type=node"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"deployment",
|
|
21
|
-
"laravel",
|
|
22
|
-
"ssh",
|
|
23
|
-
"automation",
|
|
24
|
-
"devops",
|
|
25
|
-
"git"
|
|
26
|
-
],
|
|
27
|
-
"author": "wyxos",
|
|
28
|
-
"license": "MIT",
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/wyxos/zephyr.git"
|
|
32
|
-
},
|
|
33
|
-
"bugs": {
|
|
34
|
-
"url": "https://github.com/wyxos/zephyr/issues"
|
|
35
|
-
},
|
|
36
|
-
"homepage": "https://github.com/wyxos/zephyr#readme",
|
|
37
|
-
"engines": {
|
|
38
|
-
"node": ">=16.0.0"
|
|
39
|
-
},
|
|
40
|
-
"files": [
|
|
41
|
-
"bin/",
|
|
42
|
-
"src/",
|
|
43
|
-
"README.md"
|
|
44
|
-
],
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"chalk": "5.3.0",
|
|
47
|
-
"commander": "11.1.0",
|
|
48
|
-
"inquirer": "^9.2.12",
|
|
49
|
-
"node-ssh": "^13.1.0",
|
|
50
|
-
"semver": "^7.6.3"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@eslint/js": "^9.39.2",
|
|
54
|
-
"eslint": "^9.39.2",
|
|
55
|
-
"globals": "^17.0.0",
|
|
56
|
-
"vitest": "^2.1.8"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@wyxos/zephyr",
|
|
3
|
+
"version": "0.2.22",
|
|
4
|
+
"description": "A streamlined deployment tool for web applications with intelligent Laravel project detection",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.mjs",
|
|
9
|
+
"./ssh": "./src/ssh/index.mjs"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"zephyr": "bin/zephyr.mjs"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "vitest run",
|
|
16
|
+
"lint": "eslint .",
|
|
17
|
+
"release": "node bin/zephyr.mjs --type=node"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"deployment",
|
|
21
|
+
"laravel",
|
|
22
|
+
"ssh",
|
|
23
|
+
"automation",
|
|
24
|
+
"devops",
|
|
25
|
+
"git"
|
|
26
|
+
],
|
|
27
|
+
"author": "wyxos",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/wyxos/zephyr.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/wyxos/zephyr/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/wyxos/zephyr#readme",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=16.0.0"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"bin/",
|
|
42
|
+
"src/",
|
|
43
|
+
"README.md"
|
|
44
|
+
],
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"chalk": "5.3.0",
|
|
47
|
+
"commander": "11.1.0",
|
|
48
|
+
"inquirer": "^9.2.12",
|
|
49
|
+
"node-ssh": "^13.1.0",
|
|
50
|
+
"semver": "^7.6.3"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@eslint/js": "^9.39.2",
|
|
54
|
+
"eslint": "^9.39.2",
|
|
55
|
+
"globals": "^17.0.0",
|
|
56
|
+
"vitest": "^2.1.8"
|
|
57
|
+
}
|
|
58
|
+
}
|