@orderly.network/npm-release 0.0.2 → 0.0.3-alpha.0
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 +3 -12
- package/index.mjs +10 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,10 +19,7 @@ pnpm add -D @orderly.network/npm-release
|
|
|
19
19
|
```json
|
|
20
20
|
{
|
|
21
21
|
"scripts": {
|
|
22
|
-
"release": "orderly-npm-release"
|
|
23
|
-
"release:patch": "RELEASE_VERSION_TYPE=patch orderly-npm-release",
|
|
24
|
-
"release:minor": "RELEASE_VERSION_TYPE=minor orderly-npm-release",
|
|
25
|
-
"release:major": "RELEASE_VERSION_TYPE=major orderly-npm-release"
|
|
22
|
+
"release": "orderly-npm-release"
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
```
|
|
@@ -37,12 +34,6 @@ pnpm add -D @orderly.network/npm-release
|
|
|
37
34
|
| `GIT_USERNAME` | Git username (used with token for authenticated remote URL) |
|
|
38
35
|
| `GIT_NAME` | Git `user.name` for commits |
|
|
39
36
|
| `GIT_EMAIL` | Git `user.email` for commits |
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `CUSTOM_PRE_TAG` | Pre-release identifier (e.g. `alpha`, `beta`); enables `--preRelease` and `--npm.tag` |
|
|
37
|
+
| `RELEASE_VERSION_TYPE` | Bump type: `patch`, `minor`, or `major` |
|
|
38
|
+
| `PRERELEASE_TAG` | Pre-release identifier (e.g. `alpha`, `beta`); enables `--preRelease` and `--npm.tag` |
|
|
43
39
|
| `SLACK_WEBHOOK_URL` | Webhook URL for success/failure Slack notifications |
|
|
44
|
-
|
|
45
|
-
## Prerequisites
|
|
46
|
-
|
|
47
|
-
- Your project must have a `package.json` with a valid `version`.
|
|
48
|
-
- For publishing to npm, configure `.release-it.json` in your project (or rely on defaults). This package ships a default [.release-it.json](.release-it.json) you can copy or merge.
|
package/index.mjs
CHANGED
|
@@ -12,16 +12,15 @@ const npm = {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const git = {
|
|
15
|
-
token: process.env.GIT_TOKEN,
|
|
16
|
-
username: process.env.GIT_USERNAME,
|
|
17
15
|
name: process.env.GIT_NAME,
|
|
18
16
|
email: process.env.GIT_EMAIL,
|
|
19
|
-
|
|
17
|
+
username: process.env.GIT_USERNAME,
|
|
18
|
+
token: process.env.GIT_TOKEN,
|
|
20
19
|
};
|
|
21
20
|
|
|
22
|
-
const
|
|
21
|
+
const preReleaseTag = process.env.PRERELEASE_TAG;
|
|
23
22
|
|
|
24
|
-
// Custom release version type (
|
|
23
|
+
// Custom release version type (patch, minor, major)
|
|
25
24
|
const releaseVersionType = process.env.RELEASE_VERSION_TYPE;
|
|
26
25
|
|
|
27
26
|
/** Inlined config (formerly .release-it.json) */
|
|
@@ -197,7 +196,7 @@ async function authNPM() {
|
|
|
197
196
|
}
|
|
198
197
|
|
|
199
198
|
/**
|
|
200
|
-
* When current version is already a pre-release (e.g. 1.0.0-alpha.0) and
|
|
199
|
+
* When current version is already a pre-release (e.g. 1.0.0-alpha.0) and PRERELEASE_TAG
|
|
201
200
|
* matches the same preId (e.g. "alpha"), use increment "prerelease" so release-it bumps
|
|
202
201
|
* to 1.0.0-alpha.1. Otherwise use RELEASE_VERSION_TYPE (patch/minor/major).
|
|
203
202
|
* Returns options for release-it programmatic API (merged with RELEASE_IT_CONFIG).
|
|
@@ -205,10 +204,10 @@ async function authNPM() {
|
|
|
205
204
|
async function getReleaseItOptions() {
|
|
206
205
|
let increment = releaseVersionType;
|
|
207
206
|
|
|
208
|
-
if (
|
|
207
|
+
if (preReleaseTag) {
|
|
209
208
|
const currentVersion = readPackageVersion();
|
|
210
209
|
const { isPrerelease, preId } = parseVersion(currentVersion);
|
|
211
|
-
const normalizedPreTag = sanitizePreId(
|
|
210
|
+
const normalizedPreTag = sanitizePreId(preReleaseTag);
|
|
212
211
|
// Continue pre-release: alpha.0 -> alpha.1 (same preId)
|
|
213
212
|
if (isPrerelease && preId === normalizedPreTag) {
|
|
214
213
|
increment = "prerelease";
|
|
@@ -220,9 +219,9 @@ async function getReleaseItOptions() {
|
|
|
220
219
|
increment,
|
|
221
220
|
};
|
|
222
221
|
|
|
223
|
-
if (
|
|
224
|
-
options.preRelease =
|
|
225
|
-
options.npm.tag =
|
|
222
|
+
if (preReleaseTag) {
|
|
223
|
+
options.preRelease = preReleaseTag;
|
|
224
|
+
options.npm.tag = preReleaseTag;
|
|
226
225
|
}
|
|
227
226
|
|
|
228
227
|
return options;
|