@lishugupta652/dokploy 0.1.4 → 0.1.6
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/.githooks/commit-msg +9 -0
- package/.githooks/pre-commit +2 -7
- package/CHANGELOG.md +44 -0
- package/README.md +244 -35
- package/package.json +6 -2
- package/scripts/commit-msg.mjs +185 -0
- package/scripts/ensure-publish-version.mjs +162 -0
- package/scripts/generate-changelog.mjs +169 -0
- package/scripts/publish.sh +34 -1
package/.githooks/pre-commit
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
set -e
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
PACKAGE_DIR="."
|
|
7
|
-
fi
|
|
8
|
-
|
|
9
|
-
node "$PACKAGE_DIR/scripts/bump-version-on-commit.mjs"
|
|
10
|
-
git add "$PACKAGE_DIR/package.json" "$PACKAGE_DIR/package-lock.json"
|
|
4
|
+
# Commit message validation and semver bumping happen in commit-msg.
|
|
5
|
+
exit 0
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.6 - 2026-04-13
|
|
4
|
+
|
|
5
|
+
_Initial changelog generated from repository history._
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
- scripts (691cf33)
|
|
10
|
+
- scripts (2930c10)
|
|
11
|
+
|
|
12
|
+
### Other Changes
|
|
13
|
+
|
|
14
|
+
- test (9ab9e57)
|
|
15
|
+
- add script for deployment (c511505)
|
|
16
|
+
- first commit (3f5e457)
|
|
17
|
+
|
|
18
|
+
## 0.1.5 - 2026-04-13
|
|
19
|
+
|
|
20
|
+
_Initial changelog generated from repository history._
|
|
21
|
+
|
|
22
|
+
### Fixes
|
|
23
|
+
|
|
24
|
+
- scripts (2930c10)
|
|
25
|
+
|
|
26
|
+
### Other Changes
|
|
27
|
+
|
|
28
|
+
- test (9ab9e57)
|
|
29
|
+
- add script for deployment (c511505)
|
|
30
|
+
- first commit (3f5e457)
|
|
31
|
+
|
|
32
|
+
## 0.1.4 - 2026-04-13
|
|
33
|
+
|
|
34
|
+
_Initial changelog generated from repository history._
|
|
35
|
+
|
|
36
|
+
### Fixes
|
|
37
|
+
|
|
38
|
+
- scripts (2930c10)
|
|
39
|
+
|
|
40
|
+
### Other Changes
|
|
41
|
+
|
|
42
|
+
- add script for deployment (c511505)
|
|
43
|
+
- first commit (3f5e457)
|
|
44
|
+
|
package/README.md
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
|
-
# Dokploy
|
|
1
|
+
# Dokploy CLI
|
|
2
2
|
|
|
3
|
-
YAML-driven CLI for
|
|
3
|
+
YAML-driven CLI for managing Dokploy projects through the Dokploy API.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Use it locally or in CI to inspect projects, create/update applications, attach domains, deploy compose stacks, provision databases, and trigger redeploys without relying on the Terraform provider.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
npm install
|
|
9
|
-
npm run build
|
|
10
|
-
```
|
|
7
|
+
## Features
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
- Inspect all Dokploy projects with `project.all`.
|
|
10
|
+
- Apply a declarative YAML config.
|
|
11
|
+
- Manage projects, environments, applications, compose stacks, databases, domains, backups, and volume backups.
|
|
12
|
+
- Trigger app or compose redeploys.
|
|
13
|
+
- Keep a small local `dokploy-state.json` file for resource IDs.
|
|
14
|
+
- Use colored terminal output with a raw JSON option for scripts.
|
|
15
|
+
- Accept either a Dokploy root URL or `/api` URL.
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- Node.js 18 or newer
|
|
20
|
+
- A running Dokploy instance
|
|
21
|
+
- A Dokploy API key
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
The API key is read only from `DOKPLOY_API_KEY`. Do not put it in YAML config.
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
Global install:
|
|
21
28
|
|
|
22
29
|
```bash
|
|
23
30
|
npm install -g @lishugupta652/dokploy
|
|
24
31
|
dokploy --help
|
|
25
32
|
```
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
One-off use with npm:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx @lishugupta652/dokploy --help
|
|
38
|
+
npx @lishugupta652/dokploy projects --host https://your-dokploy.example.com
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Local project install:
|
|
28
42
|
|
|
29
43
|
```bash
|
|
30
44
|
npm install @lishugupta652/dokploy
|
|
@@ -32,66 +46,261 @@ npx dokploy --help
|
|
|
32
46
|
npm exec dokploy -- --help
|
|
33
47
|
```
|
|
34
48
|
|
|
35
|
-
##
|
|
49
|
+
## Authentication
|
|
36
50
|
|
|
37
51
|
```bash
|
|
38
52
|
export DOKPLOY_API_KEY=your-api-key
|
|
39
|
-
export DOKPLOY_HOST=https://your-dokploy.example.com
|
|
53
|
+
export DOKPLOY_HOST=https://your-dokploy.example.com
|
|
40
54
|
```
|
|
41
55
|
|
|
42
|
-
`DOKPLOY_HOST` is optional when `host` is set in
|
|
56
|
+
`DOKPLOY_HOST` is optional when `host` is set in `dokploy.yaml`.
|
|
57
|
+
|
|
58
|
+
Both forms work:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
https://your-dokploy.example.com
|
|
62
|
+
https://your-dokploy.example.com/api
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The CLI normalizes root hosts to `/api`.
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
1. Check your API connection:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
dokploy projects --host https://your-dokploy.example.com --summary
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
2. Create a starter config:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
dokploy init
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. Edit `dokploy.yaml`.
|
|
82
|
+
|
|
83
|
+
4. Preview the changes:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
dokploy apply -f dokploy.yaml --dry-run
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
5. Apply the config:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
dokploy apply -f dokploy.yaml
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
6. Check status:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
dokploy status -f dokploy.yaml
|
|
99
|
+
```
|
|
43
100
|
|
|
44
101
|
## Commands
|
|
45
102
|
|
|
46
103
|
```bash
|
|
47
|
-
dokploy projects --host https://your-dokploy.example.com/api
|
|
48
|
-
dokploy projects --summary --host https://your-dokploy.example.com/api
|
|
49
|
-
dokploy projects --json --host https://your-dokploy.example.com/api
|
|
50
104
|
dokploy projects --host https://your-dokploy.example.com
|
|
105
|
+
dokploy projects --summary --host https://your-dokploy.example.com
|
|
106
|
+
dokploy projects --json --host https://your-dokploy.example.com
|
|
107
|
+
|
|
108
|
+
dokploy init
|
|
109
|
+
dokploy init --output dokploy.yaml --force
|
|
110
|
+
|
|
51
111
|
dokploy apply -f dokploy.yaml
|
|
52
112
|
dokploy apply -f dokploy.yaml --dry-run
|
|
113
|
+
dokploy apply -f dokploy.yaml --state .dokploy-state.json
|
|
114
|
+
|
|
53
115
|
dokploy deploy frontend -f dokploy.yaml
|
|
54
116
|
dokploy status -f dokploy.yaml
|
|
117
|
+
|
|
55
118
|
dokploy destroy frontend -f dokploy.yaml
|
|
56
119
|
dokploy destroy -f dokploy.yaml
|
|
57
|
-
dokploy
|
|
120
|
+
dokploy destroy -f dokploy.yaml --delete-volumes
|
|
58
121
|
```
|
|
59
122
|
|
|
60
|
-
|
|
123
|
+
## Example Config
|
|
61
124
|
|
|
62
|
-
|
|
125
|
+
```yaml
|
|
126
|
+
host: https://your-dokploy.example.com
|
|
127
|
+
|
|
128
|
+
project:
|
|
129
|
+
name: My App
|
|
130
|
+
description: Deployed via dokploy
|
|
131
|
+
|
|
132
|
+
environment:
|
|
133
|
+
name: production
|
|
134
|
+
|
|
135
|
+
applications:
|
|
136
|
+
- name: frontend
|
|
137
|
+
source: github
|
|
138
|
+
github:
|
|
139
|
+
id: your-github-provider-id
|
|
140
|
+
owner: your-org
|
|
141
|
+
repository: your-repo
|
|
142
|
+
branch: main
|
|
143
|
+
buildPath: /
|
|
144
|
+
triggerType: push
|
|
145
|
+
build:
|
|
146
|
+
type: dockerfile
|
|
147
|
+
dockerfile: Dockerfile
|
|
148
|
+
contextPath: .
|
|
149
|
+
env:
|
|
150
|
+
NODE_ENV: production
|
|
151
|
+
VITE_BACKEND_URL: https://api.example.com
|
|
152
|
+
domains:
|
|
153
|
+
- host: app.example.com
|
|
154
|
+
port: 80
|
|
155
|
+
path: /
|
|
156
|
+
https: true
|
|
157
|
+
certificate: letsencrypt
|
|
158
|
+
deploy: true
|
|
159
|
+
|
|
160
|
+
databases:
|
|
161
|
+
- name: app-db
|
|
162
|
+
type: postgres
|
|
163
|
+
version: "16"
|
|
164
|
+
databaseName: app
|
|
165
|
+
databaseUser: app
|
|
166
|
+
password: change-me
|
|
167
|
+
deploy: true
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
More examples are in [`examples/`](examples/).
|
|
171
|
+
|
|
172
|
+
## Config Notes
|
|
173
|
+
|
|
174
|
+
- `host` can be the Dokploy root URL or `/api` URL.
|
|
175
|
+
- `environment` is optional. If omitted, the CLI uses the first environment returned by Dokploy for the project.
|
|
176
|
+
- `applications[].deploy: true` triggers a deploy after configuration.
|
|
177
|
+
- `buildArgs`, `buildSecrets`, and `createEnvFile` are supported for applications.
|
|
178
|
+
- Database creation requires a password because the Dokploy API requires one.
|
|
179
|
+
- State is written next to the config as `dokploy-state.json` unless `stateFile` or `--state` is provided.
|
|
63
180
|
|
|
64
|
-
|
|
181
|
+
## Project Inspection
|
|
182
|
+
|
|
183
|
+
Human-readable output:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
dokploy projects --host https://your-dokploy.example.com
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Short table only:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
dokploy projects --summary --host https://your-dokploy.example.com
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Raw JSON for scripts:
|
|
65
196
|
|
|
66
197
|
```bash
|
|
67
|
-
|
|
198
|
+
dokploy projects --json --host https://your-dokploy.example.com
|
|
68
199
|
```
|
|
69
200
|
|
|
70
|
-
|
|
201
|
+
## Troubleshooting
|
|
202
|
+
|
|
203
|
+
`zsh: command not found: dokploy`
|
|
204
|
+
|
|
205
|
+
You probably installed the package locally. Use:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
npx dokploy --help
|
|
209
|
+
```
|
|
71
210
|
|
|
72
|
-
|
|
211
|
+
or install globally:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npm install -g @lishugupta652/dokploy
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`Dokploy API /project.all failed with HTTP 404` and the response is HTML
|
|
218
|
+
|
|
219
|
+
The request hit the Dokploy web UI instead of the API. Use a recent package version and pass either:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
dokploy projects --host https://your-dokploy.example.com
|
|
223
|
+
dokploy projects --host https://your-dokploy.example.com/api
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
`DOKPLOY_API_KEY is required`
|
|
227
|
+
|
|
228
|
+
Set the API key before running commands:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
export DOKPLOY_API_KEY=your-api-key
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Development
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npm install
|
|
238
|
+
npm run check
|
|
239
|
+
npm run build
|
|
240
|
+
npm run dev -- projects --host https://your-dokploy.example.com --summary
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Using pnpm is fine if you switch the lockfile:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
rm package-lock.json
|
|
247
|
+
pnpm install
|
|
248
|
+
pnpm run check
|
|
249
|
+
pnpm run build
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Publishing
|
|
253
|
+
|
|
254
|
+
The package name is `@lishugupta652/dokploy`; the binary is `dokploy`.
|
|
255
|
+
|
|
256
|
+
Safe dry-run:
|
|
73
257
|
|
|
74
258
|
```bash
|
|
75
259
|
./scripts/publish.sh npm
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Publish:
|
|
263
|
+
|
|
264
|
+
```bash
|
|
76
265
|
./scripts/publish.sh npm --publish
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
If the current package version is already on npm, the publish script bumps `patch` automatically before publishing. Override the bump when needed:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
./scripts/publish.sh npm --publish --bump patch
|
|
272
|
+
./scripts/publish.sh npm --publish --bump minor
|
|
273
|
+
./scripts/publish.sh npm --publish --bump major
|
|
274
|
+
./scripts/publish.sh npm --publish --bump none
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
pnpm flow:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
77
280
|
./scripts/publish.sh pnpm
|
|
78
281
|
./scripts/publish.sh pnpm --publish
|
|
79
282
|
```
|
|
80
283
|
|
|
81
|
-
|
|
284
|
+
Publishing generates `CHANGELOG.md` from git commits since the latest tag. Conventional Commit messages are grouped into sections such as Features, Fixes, Breaking Changes, and Chores.
|
|
285
|
+
|
|
286
|
+
Direct `npm publish --access public` is also protected by `prepublishOnly`: it checks whether the current version already exists on npm and bumps `patch` when needed before building and generating the changelog.
|
|
82
287
|
|
|
83
|
-
## Commit
|
|
288
|
+
## Commit Messages And Versioning
|
|
84
289
|
|
|
85
|
-
Install
|
|
290
|
+
Install hooks:
|
|
86
291
|
|
|
87
292
|
```bash
|
|
88
293
|
npm run hooks:install
|
|
89
294
|
```
|
|
90
295
|
|
|
91
|
-
The
|
|
296
|
+
The `commit-msg` hook enforces Conventional Commits and bumps `package.json` plus `package-lock.json` from the commit message:
|
|
92
297
|
|
|
93
|
-
|
|
298
|
+
```text
|
|
299
|
+
feat: add project listing # minor
|
|
300
|
+
fix(projects): normalize host # patch
|
|
301
|
+
perf: improve status lookup # patch
|
|
302
|
+
feat!: change config schema # major
|
|
303
|
+
docs: update usage # no version bump
|
|
304
|
+
```
|
|
94
305
|
|
|
95
|
-
|
|
96
|
-
- Applications are configured in Dokploy's required order: create, source provider, build type, environment, domains, deploy.
|
|
97
|
-
- Database creation requires a password because the Dokploy API requires one on create.
|
|
306
|
+
Use `SKIP_DOKPLOY_VERSION_BUMP=1` to keep commit validation but skip version changes. Use `SKIP_DOKPLOY_COMMIT_CHECK=1` only when you intentionally need to bypass the hook.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lishugupta652/dokploy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "A YAML-driven CLI for applying Dokploy projects through the Dokploy API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,15 +11,19 @@
|
|
|
11
11
|
"examples",
|
|
12
12
|
"scripts",
|
|
13
13
|
".githooks",
|
|
14
|
+
"CHANGELOG.md",
|
|
14
15
|
"README.md"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "tsc -p tsconfig.json",
|
|
19
|
+
"changelog": "node scripts/generate-changelog.mjs",
|
|
18
20
|
"check": "tsc -p tsconfig.json --noEmit",
|
|
19
21
|
"dev": "tsx src/index.ts",
|
|
22
|
+
"commit-msg": "node scripts/commit-msg.mjs",
|
|
20
23
|
"hooks:install": "node scripts/install-git-hooks.mjs",
|
|
21
24
|
"prepack": "npm run build",
|
|
22
|
-
"prepublishOnly": "npm run check && npm run build",
|
|
25
|
+
"prepublishOnly": "npm run version:publish && npm run check && npm run build && npm run changelog",
|
|
26
|
+
"version:publish": "node scripts/ensure-publish-version.mjs",
|
|
23
27
|
"version:commit": "node scripts/bump-version-on-commit.mjs"
|
|
24
28
|
},
|
|
25
29
|
"publishConfig": {
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const allowedTypes = new Set([
|
|
8
|
+
"feat",
|
|
9
|
+
"fix",
|
|
10
|
+
"perf",
|
|
11
|
+
"refactor",
|
|
12
|
+
"docs",
|
|
13
|
+
"test",
|
|
14
|
+
"build",
|
|
15
|
+
"ci",
|
|
16
|
+
"chore",
|
|
17
|
+
"style",
|
|
18
|
+
"revert",
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const bumpByType = new Map([
|
|
22
|
+
["feat", "minor"],
|
|
23
|
+
["fix", "patch"],
|
|
24
|
+
["perf", "patch"],
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
const messagePath = process.argv[2];
|
|
28
|
+
if (!messagePath) {
|
|
29
|
+
console.error("Missing commit message file path.");
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const message = readFileSync(messagePath, "utf8");
|
|
34
|
+
const header = firstCommitMessageLine(message);
|
|
35
|
+
|
|
36
|
+
if (!header) {
|
|
37
|
+
fail("Commit message is empty.");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (process.env.SKIP_DOKPLOY_COMMIT_CHECK === "1") {
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (isGeneratedCommit(header)) {
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const parsed = parseConventionalCommit(header);
|
|
49
|
+
if (!parsed) {
|
|
50
|
+
fail(`Invalid commit message: ${header}`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!allowedTypes.has(parsed.type)) {
|
|
54
|
+
fail(`Unsupported commit type "${parsed.type}".`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (parsed.subject.trim().length === 0) {
|
|
58
|
+
fail("Commit subject cannot be empty.");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const bump = resolveBump(parsed, message);
|
|
62
|
+
if (!bump) {
|
|
63
|
+
console.log(`Commit type "${parsed.type}" does not change the package version.`);
|
|
64
|
+
process.exit(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (process.env.SKIP_DOKPLOY_VERSION_BUMP === "1") {
|
|
68
|
+
console.log(`Skipping ${bump} version bump because SKIP_DOKPLOY_VERSION_BUMP=1.`);
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const packageDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
73
|
+
const packageJsonPath = path.join(packageDir, "package.json");
|
|
74
|
+
const packageLockPath = path.join(packageDir, "package-lock.json");
|
|
75
|
+
|
|
76
|
+
const packageJson = readJson(packageJsonPath);
|
|
77
|
+
const nextVersion = bumpVersion(packageJson.version, bump);
|
|
78
|
+
|
|
79
|
+
if (process.env.DOKPLOY_VERSION_DRY_RUN === "1") {
|
|
80
|
+
console.log(`${parsed.type} commit will create ${bump} version: ${packageJson.version} -> ${nextVersion}`);
|
|
81
|
+
process.exit(0);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
packageJson.version = nextVersion;
|
|
85
|
+
writeJson(packageJsonPath, packageJson);
|
|
86
|
+
|
|
87
|
+
const packageLock = readJson(packageLockPath);
|
|
88
|
+
packageLock.name = packageJson.name;
|
|
89
|
+
packageLock.version = nextVersion;
|
|
90
|
+
if (packageLock.packages?.[""]) {
|
|
91
|
+
packageLock.packages[""].name = packageJson.name;
|
|
92
|
+
packageLock.packages[""].version = nextVersion;
|
|
93
|
+
packageLock.packages[""].bin = packageJson.bin;
|
|
94
|
+
}
|
|
95
|
+
writeJson(packageLockPath, packageLock);
|
|
96
|
+
|
|
97
|
+
execFileSync("git", ["-C", packageDir, "add", packageJsonPath, packageLockPath], {
|
|
98
|
+
stdio: "inherit",
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
console.log(`${parsed.type} commit created ${bump} version: ${packageJson.name}@${nextVersion}`);
|
|
102
|
+
|
|
103
|
+
function firstCommitMessageLine(rawMessage) {
|
|
104
|
+
return rawMessage
|
|
105
|
+
.split(/\r?\n/)
|
|
106
|
+
.map((line) => line.trim())
|
|
107
|
+
.find((line) => line.length > 0 && !line.startsWith("#"));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function isGeneratedCommit(headerLine) {
|
|
111
|
+
return (
|
|
112
|
+
headerLine.startsWith("Merge ") ||
|
|
113
|
+
headerLine.startsWith("Revert ") ||
|
|
114
|
+
headerLine.startsWith("fixup!") ||
|
|
115
|
+
headerLine.startsWith("squash!")
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function parseConventionalCommit(headerLine) {
|
|
120
|
+
const match = headerLine.match(/^([a-z]+)(\([a-z0-9._/-]+\))?(!)?: (.+)$/);
|
|
121
|
+
if (!match) return undefined;
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
type: match[1],
|
|
125
|
+
breaking: Boolean(match[3]),
|
|
126
|
+
subject: match[4],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function resolveBump(parsedCommit, rawMessage) {
|
|
131
|
+
if (parsedCommit.breaking || /\nBREAKING[ -]CHANGE:/m.test(rawMessage)) {
|
|
132
|
+
return "major";
|
|
133
|
+
}
|
|
134
|
+
return bumpByType.get(parsedCommit.type);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function bumpVersion(version, bump) {
|
|
138
|
+
if (typeof version !== "string") {
|
|
139
|
+
throw new Error("package.json version must be a string");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const match = version.match(/^(\d+)\.(\d+)\.(\d+)(-.+)?$/);
|
|
143
|
+
if (!match) {
|
|
144
|
+
throw new Error(`Unsupported semver version: ${version}`);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const major = Number(match[1]);
|
|
148
|
+
const minor = Number(match[2]);
|
|
149
|
+
const patch = Number(match[3]);
|
|
150
|
+
|
|
151
|
+
switch (bump) {
|
|
152
|
+
case "major":
|
|
153
|
+
return `${major + 1}.0.0`;
|
|
154
|
+
case "minor":
|
|
155
|
+
return `${major}.${minor + 1}.0`;
|
|
156
|
+
case "patch":
|
|
157
|
+
return `${major}.${minor}.${patch + 1}`;
|
|
158
|
+
default:
|
|
159
|
+
throw new Error(`Unsupported bump type: ${bump}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function readJson(filePath) {
|
|
164
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function writeJson(filePath, value) {
|
|
168
|
+
writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function fail(messageText) {
|
|
172
|
+
console.error(messageText);
|
|
173
|
+
console.error("");
|
|
174
|
+
console.error("Use Conventional Commits:");
|
|
175
|
+
console.error(" feat: add project listing");
|
|
176
|
+
console.error(" fix(projects): normalize Dokploy host");
|
|
177
|
+
console.error(" feat!: change config schema");
|
|
178
|
+
console.error("");
|
|
179
|
+
console.error("Version bump rules:");
|
|
180
|
+
console.error(" feat or feat(scope) -> minor");
|
|
181
|
+
console.error(" fix/perf -> patch");
|
|
182
|
+
console.error(" ! or BREAKING CHANGE -> major");
|
|
183
|
+
console.error(" docs/chore/etc. -> no version bump");
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const packageDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const packageJsonPath = path.join(packageDir, "package.json");
|
|
9
|
+
const packageLockPath = path.join(packageDir, "package-lock.json");
|
|
10
|
+
const options = parseArgs(process.argv.slice(2));
|
|
11
|
+
|
|
12
|
+
const packageJson = readJson(packageJsonPath);
|
|
13
|
+
const packageName = stringValue(packageJson.name, "");
|
|
14
|
+
let version = stringValue(packageJson.version, "");
|
|
15
|
+
|
|
16
|
+
if (!packageName || !version) {
|
|
17
|
+
throw new Error("package.json must contain name and version.");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let attempts = 0;
|
|
21
|
+
while (isVersionPublished(options.packageManager, packageName, version)) {
|
|
22
|
+
if (options.bump === "none") {
|
|
23
|
+
console.error(`${packageName}@${version} is already published.`);
|
|
24
|
+
console.error("Pass --bump patch|minor|major or update package.json before publishing.");
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const nextVersion = bumpVersion(version, options.bump);
|
|
29
|
+
console.log(`${packageName}@${version} is already published. Bumping ${options.bump}: ${nextVersion}`);
|
|
30
|
+
version = nextVersion;
|
|
31
|
+
attempts += 1;
|
|
32
|
+
|
|
33
|
+
if (attempts > 20) {
|
|
34
|
+
throw new Error("Stopped after 20 version bump attempts.");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (version === packageJson.version) {
|
|
39
|
+
console.log(`${packageName}@${version} is not published yet.`);
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (options.dryRun) {
|
|
44
|
+
console.log(`Dry run: would update ${packageName} to ${version}.`);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
packageJson.version = version;
|
|
49
|
+
writeJson(packageJsonPath, packageJson);
|
|
50
|
+
|
|
51
|
+
if (existsSync(packageLockPath)) {
|
|
52
|
+
const packageLock = readJson(packageLockPath);
|
|
53
|
+
packageLock.name = packageJson.name;
|
|
54
|
+
packageLock.version = version;
|
|
55
|
+
if (packageLock.packages?.[""]) {
|
|
56
|
+
packageLock.packages[""].name = packageJson.name;
|
|
57
|
+
packageLock.packages[""].version = version;
|
|
58
|
+
packageLock.packages[""].bin = packageJson.bin;
|
|
59
|
+
}
|
|
60
|
+
writeJson(packageLockPath, packageLock);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log(`Updated package version to ${packageName}@${version}.`);
|
|
64
|
+
|
|
65
|
+
function parseArgs(args) {
|
|
66
|
+
const parsed = {
|
|
67
|
+
bump: "patch",
|
|
68
|
+
packageManager: "npm",
|
|
69
|
+
dryRun: false,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
73
|
+
const arg = args[index];
|
|
74
|
+
switch (arg) {
|
|
75
|
+
case "--bump":
|
|
76
|
+
parsed.bump = stringArg(args, index);
|
|
77
|
+
index += 1;
|
|
78
|
+
break;
|
|
79
|
+
case "--package-manager":
|
|
80
|
+
parsed.packageManager = stringArg(args, index);
|
|
81
|
+
index += 1;
|
|
82
|
+
break;
|
|
83
|
+
case "--dry-run":
|
|
84
|
+
parsed.dryRun = true;
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
throw new Error(`Unknown argument: ${arg}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (!["patch", "minor", "major", "none"].includes(parsed.bump)) {
|
|
92
|
+
throw new Error("--bump must be patch, minor, major, or none.");
|
|
93
|
+
}
|
|
94
|
+
if (!["npm", "pnpm"].includes(parsed.packageManager)) {
|
|
95
|
+
throw new Error("--package-manager must be npm or pnpm.");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return parsed;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function stringArg(args, index) {
|
|
102
|
+
const value = args[index + 1];
|
|
103
|
+
if (!value) {
|
|
104
|
+
throw new Error(`Missing value for ${args[index]}.`);
|
|
105
|
+
}
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function isVersionPublished(packageManager, packageName, version) {
|
|
110
|
+
try {
|
|
111
|
+
const output = execFileSync(
|
|
112
|
+
packageManager,
|
|
113
|
+
["view", `${packageName}@${version}`, "version", "--json"],
|
|
114
|
+
{
|
|
115
|
+
encoding: "utf8",
|
|
116
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
117
|
+
},
|
|
118
|
+
).trim();
|
|
119
|
+
|
|
120
|
+
return output.length > 0 && output !== "null";
|
|
121
|
+
} catch (error) {
|
|
122
|
+
const stderr = String(error.stderr ?? "");
|
|
123
|
+
if (stderr.includes("E404") || stderr.includes("404 Not Found")) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function bumpVersion(version, bump) {
|
|
131
|
+
const match = version.match(/^(\d+)\.(\d+)\.(\d+)(-.+)?$/);
|
|
132
|
+
if (!match) {
|
|
133
|
+
throw new Error(`Unsupported semver version: ${version}`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const major = Number(match[1]);
|
|
137
|
+
const minor = Number(match[2]);
|
|
138
|
+
const patch = Number(match[3]);
|
|
139
|
+
|
|
140
|
+
switch (bump) {
|
|
141
|
+
case "major":
|
|
142
|
+
return `${major + 1}.0.0`;
|
|
143
|
+
case "minor":
|
|
144
|
+
return `${major}.${minor + 1}.0`;
|
|
145
|
+
case "patch":
|
|
146
|
+
return `${major}.${minor}.${patch + 1}`;
|
|
147
|
+
default:
|
|
148
|
+
throw new Error(`Unsupported bump type: ${bump}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function readJson(filePath) {
|
|
153
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function writeJson(filePath, value) {
|
|
157
|
+
writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function stringValue(value, fallback) {
|
|
161
|
+
return typeof value === "string" ? value : fallback;
|
|
162
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const packageDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const packageJsonPath = path.join(packageDir, "package.json");
|
|
9
|
+
const changelogPath = path.join(packageDir, "CHANGELOG.md");
|
|
10
|
+
const args = new Set(process.argv.slice(2));
|
|
11
|
+
const dryRun = args.has("--dry-run");
|
|
12
|
+
|
|
13
|
+
const packageJson = readJson(packageJsonPath);
|
|
14
|
+
const version = stringValue(packageJson.version, "0.0.0");
|
|
15
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
16
|
+
const lastTag = getLastTag();
|
|
17
|
+
const commits = getCommits(lastTag);
|
|
18
|
+
const section = renderVersionSection(version, today, lastTag, commits);
|
|
19
|
+
|
|
20
|
+
if (dryRun) {
|
|
21
|
+
console.log(section.trimEnd());
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const currentChangelog = readChangelog();
|
|
26
|
+
const nextChangelog = upsertVersionSection(currentChangelog, version, section);
|
|
27
|
+
writeFileSync(changelogPath, nextChangelog, "utf8");
|
|
28
|
+
|
|
29
|
+
console.log(`Updated CHANGELOG.md for ${packageJson.name}@${version}`);
|
|
30
|
+
|
|
31
|
+
function getLastTag() {
|
|
32
|
+
try {
|
|
33
|
+
return execFileSync("git", ["-C", packageDir, "describe", "--tags", "--abbrev=0"], {
|
|
34
|
+
encoding: "utf8",
|
|
35
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
36
|
+
}).trim();
|
|
37
|
+
} catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getCommits(tag) {
|
|
43
|
+
const range = tag ? [`${tag}..HEAD`] : [];
|
|
44
|
+
const output = execFileSync(
|
|
45
|
+
"git",
|
|
46
|
+
[
|
|
47
|
+
"-C",
|
|
48
|
+
packageDir,
|
|
49
|
+
"log",
|
|
50
|
+
"--date=short",
|
|
51
|
+
"--pretty=format:%H%x1f%ad%x1f%s%x1f%b%x1e",
|
|
52
|
+
...range,
|
|
53
|
+
],
|
|
54
|
+
{ encoding: "utf8" },
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return output
|
|
58
|
+
.split("\x1e")
|
|
59
|
+
.map((record) => record.trim())
|
|
60
|
+
.filter(Boolean)
|
|
61
|
+
.map(parseCommit);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function parseCommit(record) {
|
|
65
|
+
const [hash = "", date = "", subject = "", body = ""] = record.split("\x1f");
|
|
66
|
+
const conventional = subject.match(/^([a-z]+)(\([a-z0-9._/-]+\))?(!)?: (.+)$/);
|
|
67
|
+
|
|
68
|
+
if (!conventional) {
|
|
69
|
+
return {
|
|
70
|
+
hash,
|
|
71
|
+
date,
|
|
72
|
+
type: "other",
|
|
73
|
+
breaking: /\nBREAKING[ -]CHANGE:/m.test(body),
|
|
74
|
+
subject,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
hash,
|
|
80
|
+
date,
|
|
81
|
+
type: conventional[1],
|
|
82
|
+
breaking: Boolean(conventional[3]) || /\nBREAKING[ -]CHANGE:/m.test(body),
|
|
83
|
+
subject: conventional[4],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function renderVersionSection(nextVersion, date, tag, commits) {
|
|
88
|
+
const lines = [`## ${nextVersion} - ${date}`, ""];
|
|
89
|
+
lines.push(tag ? `_Changes since ${tag}._` : "_Initial changelog generated from repository history._");
|
|
90
|
+
lines.push("");
|
|
91
|
+
|
|
92
|
+
if (commits.length === 0) {
|
|
93
|
+
lines.push("- No commits found since the last tag.", "");
|
|
94
|
+
return `${lines.join("\n")}\n`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const breaking = commits.filter((commit) => commit.breaking);
|
|
98
|
+
appendGroup(lines, "Breaking Changes", breaking);
|
|
99
|
+
|
|
100
|
+
const grouped = [
|
|
101
|
+
["Features", ["feat"]],
|
|
102
|
+
["Fixes", ["fix"]],
|
|
103
|
+
["Performance", ["perf"]],
|
|
104
|
+
["Refactoring", ["refactor"]],
|
|
105
|
+
["Documentation", ["docs"]],
|
|
106
|
+
["Tests", ["test"]],
|
|
107
|
+
["Build", ["build"]],
|
|
108
|
+
["CI", ["ci"]],
|
|
109
|
+
["Chores", ["chore"]],
|
|
110
|
+
["Styles", ["style"]],
|
|
111
|
+
["Reverts", ["revert"]],
|
|
112
|
+
["Other Changes", ["other"]],
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
for (const [title, types] of grouped) {
|
|
116
|
+
appendGroup(
|
|
117
|
+
lines,
|
|
118
|
+
title,
|
|
119
|
+
commits.filter((commit) => types.includes(commit.type) && !commit.breaking),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return `${lines.join("\n").trimEnd()}\n\n`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function appendGroup(lines, title, commits) {
|
|
127
|
+
if (commits.length === 0) return;
|
|
128
|
+
|
|
129
|
+
lines.push(`### ${title}`, "");
|
|
130
|
+
for (const commit of commits) {
|
|
131
|
+
lines.push(`- ${commit.subject} (${commit.hash.slice(0, 7)})`);
|
|
132
|
+
}
|
|
133
|
+
lines.push("");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function upsertVersionSection(currentChangelog, nextVersion, section) {
|
|
137
|
+
const header = "# Changelog\n\n";
|
|
138
|
+
const body = currentChangelog.startsWith("# Changelog\n")
|
|
139
|
+
? currentChangelog.slice(header.length)
|
|
140
|
+
: currentChangelog.trimStart();
|
|
141
|
+
const versionHeader = `## ${nextVersion} - `;
|
|
142
|
+
const start = body.indexOf(versionHeader);
|
|
143
|
+
|
|
144
|
+
if (start === -1) {
|
|
145
|
+
return `${header}${section}${body.trimStart()}`;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const nextSectionStart = body.indexOf("\n## ", start + 1);
|
|
149
|
+
const before = body.slice(0, start);
|
|
150
|
+
const after = nextSectionStart === -1 ? "" : body.slice(nextSectionStart + 1);
|
|
151
|
+
|
|
152
|
+
return `${header}${before}${section}${after}`.replace(/\n{3,}/g, "\n\n");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function readChangelog() {
|
|
156
|
+
try {
|
|
157
|
+
return readFileSync(changelogPath, "utf8");
|
|
158
|
+
} catch {
|
|
159
|
+
return "# Changelog\n\n";
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function readJson(filePath) {
|
|
164
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function stringValue(value, fallback) {
|
|
168
|
+
return typeof value === "string" ? value : fallback;
|
|
169
|
+
}
|
package/scripts/publish.sh
CHANGED
|
@@ -4,20 +4,23 @@ set -eu
|
|
|
4
4
|
PACKAGE_MANAGER="npm"
|
|
5
5
|
PUBLISH="0"
|
|
6
6
|
ACCESS="public"
|
|
7
|
+
BUMP="patch"
|
|
7
8
|
|
|
8
9
|
usage() {
|
|
9
10
|
cat <<'EOF'
|
|
10
11
|
Usage:
|
|
11
|
-
./scripts/publish.sh [npm|pnpm] [--publish] [--access public|restricted]
|
|
12
|
+
./scripts/publish.sh [npm|pnpm] [--publish] [--access public|restricted] [--bump patch|minor|major|none]
|
|
12
13
|
|
|
13
14
|
Examples:
|
|
14
15
|
./scripts/publish.sh npm
|
|
15
16
|
./scripts/publish.sh npm --publish
|
|
17
|
+
./scripts/publish.sh npm --publish --bump minor
|
|
16
18
|
./scripts/publish.sh pnpm
|
|
17
19
|
./scripts/publish.sh pnpm --publish
|
|
18
20
|
|
|
19
21
|
Default mode is safe: it runs checks and pack dry-run only.
|
|
20
22
|
Pass --publish to publish @lishugupta652/dokploy to npm.
|
|
23
|
+
In publish mode, if the current version already exists on npm, the script bumps patch by default.
|
|
21
24
|
EOF
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -43,6 +46,22 @@ while [ "$#" -gt 0 ]; do
|
|
|
43
46
|
ACCESS="$2"
|
|
44
47
|
shift 2
|
|
45
48
|
;;
|
|
49
|
+
--bump)
|
|
50
|
+
if [ "$#" -lt 2 ]; then
|
|
51
|
+
echo "Missing value for --bump" >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
case "$2" in
|
|
55
|
+
patch|minor|major|none)
|
|
56
|
+
BUMP="$2"
|
|
57
|
+
;;
|
|
58
|
+
*)
|
|
59
|
+
echo "--bump must be patch, minor, major, or none" >&2
|
|
60
|
+
exit 1
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
63
|
+
shift 2
|
|
64
|
+
;;
|
|
46
65
|
-h|--help)
|
|
47
66
|
usage
|
|
48
67
|
exit 0
|
|
@@ -79,6 +98,7 @@ fi
|
|
|
79
98
|
echo "Package manager: $PACKAGE_MANAGER"
|
|
80
99
|
echo "Publish mode: $PUBLISH"
|
|
81
100
|
echo "Access: $ACCESS"
|
|
101
|
+
echo "Version bump: $BUMP"
|
|
82
102
|
echo ""
|
|
83
103
|
|
|
84
104
|
if [ "$PUBLISH" = "1" ]; then
|
|
@@ -88,6 +108,10 @@ if [ "$PUBLISH" = "1" ]; then
|
|
|
88
108
|
fi
|
|
89
109
|
echo "Logged in as: $("$PACKAGE_MANAGER" whoami)"
|
|
90
110
|
echo ""
|
|
111
|
+
|
|
112
|
+
echo "Checking npm version availability..."
|
|
113
|
+
node scripts/ensure-publish-version.mjs --package-manager "$PACKAGE_MANAGER" --bump "$BUMP"
|
|
114
|
+
echo ""
|
|
91
115
|
fi
|
|
92
116
|
|
|
93
117
|
echo "Checking package..."
|
|
@@ -102,6 +126,15 @@ echo "CLI smoke test..."
|
|
|
102
126
|
node dist/index.js --version
|
|
103
127
|
node dist/index.js --help >/dev/null
|
|
104
128
|
|
|
129
|
+
echo ""
|
|
130
|
+
if [ "$PUBLISH" = "1" ]; then
|
|
131
|
+
echo "Generating changelog..."
|
|
132
|
+
"$PACKAGE_MANAGER" run changelog
|
|
133
|
+
else
|
|
134
|
+
echo "Changelog dry-run..."
|
|
135
|
+
"$PACKAGE_MANAGER" run changelog -- --dry-run
|
|
136
|
+
fi
|
|
137
|
+
|
|
105
138
|
echo ""
|
|
106
139
|
echo "Pack dry-run..."
|
|
107
140
|
"$PACKAGE_MANAGER" pack --dry-run
|