@vc-shell/release-config 1.1.0-alpha.9 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [1.1.1](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.0...v1.1.1) (2025-04-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * enhance release process with npm tag detection and commit message generation ([fbc92b6](https://github.com/VirtoCommerce/vc-shell/commit/fbc92b62922a5ba118a87507293334fa5138b9f1))
7
+
8
+
9
+
10
+ # [1.1.0](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.0-alpha.2...v1.1.0) (2025-04-29)
11
+
12
+
13
+ ### Features
14
+
15
+ * redesign alpha4 wip ([ac48f52](https://github.com/VirtoCommerce/vc-shell/commit/ac48f526f61e85518a238e1e6b49047ff3fcc786))
16
+ * redesign alpha5 ([ac430b8](https://github.com/VirtoCommerce/vc-shell/commit/ac430b80f684d3b920c35778a83c33ec387b2484))
17
+
18
+
19
+
20
+ # [1.1.0-alpha.11](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.0-alpha.2...v1.1.0-alpha.11) (2025-04-29)
21
+
22
+
23
+ ### Features
24
+
25
+ * redesign alpha4 wip ([ac48f52](https://github.com/VirtoCommerce/vc-shell/commit/ac48f526f61e85518a238e1e6b49047ff3fcc786))
26
+ * redesign alpha5 ([ac430b8](https://github.com/VirtoCommerce/vc-shell/commit/ac430b80f684d3b920c35778a83c33ec387b2484))
27
+
28
+
29
+
1
30
  ## [v1.1.0-alpha.2](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.340...vv1.1.0-alpha.2) (2025-02-25)
2
31
 
3
32
 
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @vc-shell/release-config
2
+
3
+ A utility package for managing releases in VC-Shell projects.
4
+
5
+ ## Features
6
+
7
+ - Versioning with [semver](https://semver.org/) support
8
+ - Changelog generation with [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog)
9
+ - Git tagging and commits
10
+ - Support for npm distribution tags (`latest`, `next`, `beta`, `alpha`, etc.)
11
+
12
+ ## Usage
13
+
14
+ The release-config package provides a streamlined workflow for versioning and publishing packages:
15
+
16
+ ```ts
17
+ import { release } from "@vc-shell/release-config";
18
+
19
+ release({
20
+ packages: [
21
+ ".", // root
22
+ "packages/a",
23
+ "packages/b",
24
+ ],
25
+ toTag: (version) => `v${version}`,
26
+ bumpVersion: async (pkgName, pkgVersion) => {
27
+ // Your version bump implementation
28
+ },
29
+ generateChangelog: async (pkgName, pkgVersion, workspaceName) => {
30
+ // Your changelog generation implementation
31
+ },
32
+ });
33
+ ```
34
+
35
+ ## NPM Distribution Tags
36
+
37
+ Release-config now supports setting npm distribution tags during the release process. When running a release, you will be prompted to select a distribution tag:
38
+
39
+ - `latest` (default) - The default distribution tag for stable releases
40
+ - `next` - For upcoming features that are ready for testing
41
+ - `beta` - For beta releases (automatically selected for versions containing "beta")
42
+ - `alpha` - For alpha releases (automatically selected for versions containing "alpha")
43
+ - `custom` - Allows specifying a custom distribution tag
44
+
45
+ After selecting a tag, you'll receive instructions on how to publish the packages with the selected tag:
46
+
47
+ ```bash
48
+ # Using npm directly
49
+ npm publish --tag next
50
+
51
+ # Using yarn workspaces script
52
+ yarn publish:tag --tag next
53
+ ```
54
+
55
+ ## Configuration
56
+
57
+ You can also provide the tag via command line arguments:
58
+
59
+ ```bash
60
+ yarn release --tag next
61
+ ```
62
+
63
+ ## License
64
+
65
+ MIT
@@ -1,112 +1,170 @@
1
- import v from "prompts";
2
- import { inc as y, valid as b } from "semver";
3
- import { readFileSync as x } from "node:fs";
4
- import d from "node:path";
5
- import r from "chalk";
6
- import C from "mri";
7
- import { argv as N } from "node:process";
8
- import { sync as R } from "cross-spawn";
9
- const c = C(N.slice(2)), $ = !!c.dry;
10
- $ && (console.log(r.inverse(r.yellow(" DRY RUN "))), console.log());
11
- function w(e) {
12
- const t = d.resolve(e), a = d.resolve(t, "package.json");
13
- return { pkg: JSON.parse(x(a, "utf-8")), pkgDir: t, pkgPath: a };
1
+ import c from "prompts";
2
+ import { inc as v, valid as C, parse as S } from "semver";
3
+ import { readFileSync as V, writeFileSync as I } from "node:fs";
4
+ import k from "node:path";
5
+ import o from "chalk";
6
+ import R from "mri";
7
+ import { argv as U } from "node:process";
8
+ import { sync as A } from "cross-spawn";
9
+ const e = R(U.slice(2)), b = !!e.dry;
10
+ b && (console.log(o.inverse(o.yellow(" DRY RUN "))), console.log());
11
+ function y(t) {
12
+ const s = k.resolve(t), l = k.resolve(s, "package.json");
13
+ return { pkg: JSON.parse(V(l, "utf-8")), pkgDir: s, pkgPath: l };
14
14
  }
15
- async function k(e, t, a) {
16
- return R(e, t, { stdio: "inherit", ...a });
15
+ async function D(t, s) {
16
+ if (b) {
17
+ console.log(o.blue(`[dryrun] Writing package.json to ${t}`));
18
+ return;
19
+ }
20
+ I(t, JSON.stringify(s, null, 2) + `
21
+ `, "utf-8");
22
+ }
23
+ async function N(t, s, l) {
24
+ return A(t, s, { stdio: "inherit", ...l });
17
25
  }
18
- async function j(e, t, a) {
19
- return console.log(r.blue(`[dryrun] ${e} ${t.join(" ")}`), a || "");
26
+ async function M(t, s, l) {
27
+ return console.log(o.blue(`[dryrun] ${t} ${s.join(" ")}`), l || "");
20
28
  }
21
- const l = $ ? j : k;
22
- function p(e) {
23
- return console.log(r.cyan(e));
29
+ const u = b ? M : N;
30
+ function $(t) {
31
+ return console.log(o.cyan(t));
24
32
  }
25
- function D(e) {
26
- function t(o, n) {
27
- if (o === "prerelease" && n === "alpha") {
28
- if (e.includes("-alpha")) {
29
- const [i, u] = e.split("-alpha."), f = parseInt(u) + 1;
30
- return `${i}-alpha.${f}`;
33
+ function E(t) {
34
+ function s(r, n) {
35
+ if (r === "prerelease" && n === "alpha") {
36
+ if (t.includes("-alpha")) {
37
+ const [f, m] = t.split("-alpha."), h = parseInt(m) + 1;
38
+ return `${f}-alpha.${h}`;
31
39
  }
32
- return `${y(e, "patch")}-alpha.0`;
40
+ return `${v(t, "patch")}-alpha.0`;
33
41
  }
34
- return y(e, o);
42
+ return v(t, r);
35
43
  }
36
44
  return [
37
45
  {
38
46
  title: "next",
39
- value: t("patch")
47
+ value: s("patch")
40
48
  },
41
49
  {
42
50
  title: "alpha",
43
- value: t("prerelease", "alpha")
51
+ value: s("prerelease", "alpha")
44
52
  },
45
53
  {
46
54
  title: "minor",
47
- value: t("minor")
55
+ value: s("minor")
48
56
  },
49
57
  {
50
58
  title: "major",
51
- value: t("major")
59
+ value: s("major")
52
60
  },
53
61
  {
54
62
  value: "custom",
55
63
  title: "custom"
56
64
  }
57
- ].map((o) => (o.title = `${o.title} (${o.value})`, o));
65
+ ].map((r) => (r.title = `${r.title} (${r.value})`, r));
58
66
  }
59
- const H = async ({
60
- packages: e,
61
- bumpVersion: t,
62
- generateChangelog: a,
63
- toTag: o
67
+ const Y = async ({
68
+ packages: t,
69
+ bumpVersion: s,
70
+ generateChangelog: l,
71
+ toTag: r
64
72
  }) => {
65
73
  let n;
66
- if (e.length === 0)
74
+ if (t.length === 0)
67
75
  throw new Error("No packages to release");
68
- const { pkg: m } = w(e[0]);
76
+ const { pkg: d } = y(t[0]);
69
77
  if (!n) {
70
- const { release: s } = await v({
78
+ const { release: a } = await c({
71
79
  type: "select",
72
80
  name: "release",
73
81
  message: "Select release type",
74
- choices: D(m.version)
82
+ choices: E(d.version)
75
83
  });
76
- s === "custom" ? n = (await v({
84
+ a === "custom" ? n = (await c({
77
85
  type: "text",
78
86
  name: "version",
79
87
  message: "Input custom version",
80
- initial: m.version
81
- })).version : n = s;
88
+ initial: d.version
89
+ })).version : n = a;
82
90
  }
83
- if (!b(n))
91
+ if (!C(n))
84
92
  throw new Error(`invalid target version: ${n}`);
85
- const i = o(n);
86
- n.includes("beta") && !c.tag && (c.tag = "beta"), n.includes("alpha") && !c.tag && (c.tag = "alpha");
87
- const { yes: u } = await v({
93
+ const f = n.match(/-([a-zA-Z]+)(?:\.(\d+))?$/);
94
+ if (f && !e.tag && (e.tag = f[1]), !e.tag) {
95
+ const { npmTag: a } = await c({
96
+ type: "select",
97
+ name: "npmTag",
98
+ message: "Select npm distribution tag",
99
+ choices: [
100
+ { title: "latest (default)", value: "latest" },
101
+ { title: "next", value: "next" },
102
+ { title: "beta", value: "beta" },
103
+ { title: "alpha", value: "alpha" },
104
+ { title: "custom", value: "custom" }
105
+ ]
106
+ });
107
+ if (a === "custom") {
108
+ const g = await c({
109
+ type: "text",
110
+ name: "customTag",
111
+ message: "Input custom npm tag",
112
+ initial: "latest"
113
+ });
114
+ e.tag = g.customTag;
115
+ } else a !== "latest" && (e.tag = a);
116
+ }
117
+ if (e.tag && e.tag !== "latest") {
118
+ const a = S(n);
119
+ if (a && !n.includes(`-${e.tag}`)) {
120
+ let i, p = 0;
121
+ a.prerelease.length > 0 ? (a.prerelease.length > 1 && typeof a.prerelease[1] == "number" && (p = a.prerelease[1]), i = `${`${a.major}.${a.minor}.${a.patch}`}-${e.tag}`) : i = `${v(n, "minor")}-${e.tag}`;
122
+ const { usePreNum: w } = await c({
123
+ type: "confirm",
124
+ name: "usePreNum",
125
+ message: `Add prerelease number to version? (e.g. ${i}.${p})`,
126
+ initial: !0
127
+ });
128
+ w && (i = `${i}.${p}`);
129
+ const { confirmVersionChange: j } = await c({
130
+ type: "confirm",
131
+ name: "confirmVersionChange",
132
+ message: `Update version from ${o.yellow(n)} to ${o.green(i)} to match ${o.blue(e.tag)} tag?`
133
+ });
134
+ j && (n = i, console.log(`Version updated to ${o.green(n)}`));
135
+ }
136
+ }
137
+ const m = r(n);
138
+ let h = `release: ${m}`;
139
+ e.tag && e.tag !== "latest" && (h += ` with npm tag ${e.tag}`);
140
+ const { yes: P } = await c({
88
141
  type: "confirm",
89
142
  name: "yes",
90
- message: `Releasing ${r.yellow(i)} Confirm?`
143
+ message: `Releasing ${o.yellow(m)}${e.tag && e.tag !== "latest" ? ` with npm tag ${o.blue(e.tag)}` : ""} Confirm?`
91
144
  });
92
- if (!u) return;
93
- for (let s = 0; s < e.length; s++) {
94
- const h = e[s], { pkg: g } = w(h);
95
- p(`
96
- Updating ${r.green(g.name)} package version to ${r.green(n)}...`), await t(g.name, n), p(`
97
- Generating ${r.green(g.name)} changelog...`), await a(g.name, n, h);
145
+ if (!P) return;
146
+ for (let a = 0; a < t.length; a++) {
147
+ const g = t[a], { pkg: i } = y(g);
148
+ if ($(`
149
+ Updating ${o.green(i.name)} package version to ${o.green(n)}...`), await s(i.name, n), e.tag && e.tag !== "latest") {
150
+ const p = y(g), w = { ...p.pkg, npmTag: e.tag };
151
+ await D(p.pkgPath, w), console.log(`Added npmTag: ${o.blue(e.tag)} to ${o.green(i.name)}`);
152
+ }
153
+ $(`
154
+ Generating ${o.green(i.name)} changelog...`), await l(i.name, n, g);
98
155
  }
99
- const { stdout: f } = await k("git", ["diff"], { stdio: "pipe" });
100
- if (f)
101
- p(`
102
- Committing changes...`), await l("git", ["add", "-A"]), await l("git", ["commit", "-m", `release: ${i}`, "--no-verify"]), await l("git", ["tag", i]);
156
+ const { stdout: T } = await N("git", ["diff"], { stdio: "pipe" });
157
+ if (T)
158
+ $(`
159
+ Committing changes...`), await u("git", ["add", "-A"]), await u("git", ["commit", "-m", h, "--no-verify"]), await u("git", ["tag", m]);
103
160
  else {
104
161
  console.log("No changes to commit.");
105
162
  return;
106
163
  }
107
- p(`
108
- Pushing to GitHub...`), await l("git", ["push", "origin", `refs/tags/${i}`]), await l("git", ["push"]), console.log();
164
+ $(`
165
+ Pushing to GitHub...`), await u("git", ["push", "origin", `refs/tags/${m}`]), await u("git", ["push"]), e.tag && e.tag !== "latest" && console.log(`
166
+ NOTE: This release will be published to npm with tag ${o.blue(e.tag)}`), console.log();
109
167
  };
110
168
  export {
111
- H as release
169
+ Y as release
112
170
  };
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO;cAMR,MAAM,EAAE;2BACK,MAAM,WAAW,MAAM,KAAK,IAAI,GAAG,QAAQ,IAAI,CAAC;iCAC1C,MAAM,WAAW,MAAM,kBAAkB,MAAM,KAAK,IAAI,GAAG,QAAQ,IAAI,CAAC;qBACpF,MAAM,KAAK,MAAM;mBAgFnC,CAAC"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../src/release.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAU,sDAK3B;IACD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtG,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACpC,kBAqLA,CAAC"}
package/dist/utils.d.ts CHANGED
@@ -9,11 +9,13 @@ export declare function getPackageInfo(pkgName: string): {
9
9
  pkg: {
10
10
  name: string;
11
11
  version: string;
12
+ stableVersion?: string;
12
13
  };
13
14
  pkgDir: string;
14
15
  pkgPath: string;
15
16
  };
16
- export declare function run(bin: string, args: string[], opts?: Partial<SpawnSyncOptionsWithStringEncoding>): Promise<import('child_process').SpawnSyncReturns<string | Buffer>>;
17
+ export declare function writePackageJson(pkgPath: string, pkg: any): Promise<void>;
18
+ export declare function run(bin: string, args: string[], opts?: Partial<SpawnSyncOptionsWithStringEncoding>): Promise<import('child_process').SpawnSyncReturns<string | Buffer<ArrayBufferLike>>>;
17
19
  export declare function dryRun(bin: string, args: string[], opts?: Partial<SpawnSyncOptionsWithStringEncoding>): Promise<void>;
18
20
  export declare const runIfNotDry: typeof dryRun | typeof run;
19
21
  export declare function step(msg: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAGA,OAAO,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,IAAI;;EAAqB,CAAC;AAEvC,eAAO,MAAM,QAAQ,SAAa,CAAC;AAOnC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM;;cAIpC,MAAM;iBACH,MAAM;;;;EAIlB;AAED,wBAAsB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,kCAAkC,CAAC,sEAExG;AAED,wBAAsB,MAAM,CAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,CAAC,EAAE,OAAO,CAAC,kCAAkC,CAAC,GACjD,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,eAAO,MAAM,WAAW,4BAA0B,CAAC;AAEnD,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCzE"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kCAAkC,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,GAAG,MAAM,KAAK,CAAC;AAItB,eAAO,MAAM,IAAI;;EAAqB,CAAC;AAEvC,eAAO,MAAM,QAAQ,SAAa,CAAC;AAOnC,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM;;cAIpC,MAAM;iBACH,MAAM;wBACC,MAAM;;;;EAIzB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/E;AAED,wBAAsB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,kCAAkC,CAAC,uFAExG;AAED,wBAAsB,MAAM,CAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,CAAC,EAAE,OAAO,CAAC,kCAAkC,CAAC,GACjD,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,eAAO,MAAM,WAAW,4BAA0B,CAAC;AAEnD,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCzE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/release-config",
3
- "version": "1.1.0-alpha.9",
3
+ "version": "1.1.1",
4
4
  "type": "module",
5
5
  "main": "dist/release-config.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,19 +16,19 @@
16
16
  "mri": "^1.2.0",
17
17
  "prompts": "^2.4.2",
18
18
  "semver": "^7.5.4",
19
- "vite": "5.3.6"
19
+ "vite": "^6.3.3"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/cross-spawn": "^6.0.6",
23
23
  "@types/prompts": "^2.4.7",
24
24
  "@types/semver": "^7.5.4",
25
- "@vc-shell/ts-config": "^1.1.0-alpha.9",
26
- "typescript": "~5.3.3",
25
+ "@vc-shell/ts-config": "^1.1.1",
26
+ "typescript": "^5.8.3",
27
27
  "vite-plugin-dts": "^3.6.4"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public",
31
31
  "registry": "https://registry.npmjs.org/"
32
32
  },
33
- "stableVersion": "1.0.340"
33
+ "npmTag": "next"
34
34
  }