@vc-shell/release-config 1.1.0-alpha.9 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ # [1.1.0](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.0-alpha.2...v1.1.0) (2025-04-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * redesign alpha4 wip ([ac48f52](https://github.com/VirtoCommerce/vc-shell/commit/ac48f526f61e85518a238e1e6b49047ff3fcc786))
7
+ * redesign alpha5 ([ac430b8](https://github.com/VirtoCommerce/vc-shell/commit/ac430b80f684d3b920c35778a83c33ec387b2484))
8
+
9
+
10
+
11
+ # [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)
12
+
13
+
14
+ ### Features
15
+
16
+ * redesign alpha4 wip ([ac48f52](https://github.com/VirtoCommerce/vc-shell/commit/ac48f526f61e85518a238e1e6b49047ff3fcc786))
17
+ * redesign alpha5 ([ac430b8](https://github.com/VirtoCommerce/vc-shell/commit/ac430b80f684d3b920c35778a83c33ec387b2484))
18
+
19
+
20
+
1
21
  ## [v1.1.0-alpha.2](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.340...vv1.1.0-alpha.2) (2025-02-25)
2
22
 
3
23
 
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,111 +1,154 @@
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 T } from "semver";
3
+ import { readFileSync as V } from "node:fs";
4
+ import w from "node:path";
5
+ import o from "chalk";
6
+ import I from "mri";
7
+ import { argv as R } from "node:process";
8
+ import { sync as U } from "cross-spawn";
9
+ const a = I(R.slice(2)), b = !!a.dry;
10
+ b && (console.log(o.inverse(o.yellow(" DRY RUN "))), console.log());
11
+ function y(n) {
12
+ const s = w.resolve(n), l = w.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 k(n, s, l) {
16
+ return U(n, s, { stdio: "inherit", ...l });
17
17
  }
18
- async function j(e, t, a) {
19
- return console.log(r.blue(`[dryrun] ${e} ${t.join(" ")}`), a || "");
18
+ async function D(n, s, l) {
19
+ return console.log(o.blue(`[dryrun] ${n} ${s.join(" ")}`), l || "");
20
20
  }
21
- const l = $ ? j : k;
22
- function p(e) {
23
- return console.log(r.cyan(e));
21
+ const p = b ? D : k;
22
+ function f(n) {
23
+ return console.log(o.cyan(n));
24
24
  }
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}`;
25
+ function S(n) {
26
+ function s(r, t) {
27
+ if (r === "prerelease" && t === "alpha") {
28
+ if (n.includes("-alpha")) {
29
+ const [u, m] = n.split("-alpha."), $ = parseInt(m) + 1;
30
+ return `${u}-alpha.${$}`;
31
31
  }
32
- return `${y(e, "patch")}-alpha.0`;
32
+ return `${v(n, "patch")}-alpha.0`;
33
33
  }
34
- return y(e, o);
34
+ return v(n, r);
35
35
  }
36
36
  return [
37
37
  {
38
38
  title: "next",
39
- value: t("patch")
39
+ value: s("patch")
40
40
  },
41
41
  {
42
42
  title: "alpha",
43
- value: t("prerelease", "alpha")
43
+ value: s("prerelease", "alpha")
44
44
  },
45
45
  {
46
46
  title: "minor",
47
- value: t("minor")
47
+ value: s("minor")
48
48
  },
49
49
  {
50
50
  title: "major",
51
- value: t("major")
51
+ value: s("major")
52
52
  },
53
53
  {
54
54
  value: "custom",
55
55
  title: "custom"
56
56
  }
57
- ].map((o) => (o.title = `${o.title} (${o.value})`, o));
57
+ ].map((r) => (r.title = `${r.title} (${r.value})`, r));
58
58
  }
59
59
  const H = async ({
60
- packages: e,
61
- bumpVersion: t,
62
- generateChangelog: a,
63
- toTag: o
60
+ packages: n,
61
+ bumpVersion: s,
62
+ generateChangelog: l,
63
+ toTag: r
64
64
  }) => {
65
- let n;
66
- if (e.length === 0)
65
+ let t;
66
+ if (n.length === 0)
67
67
  throw new Error("No packages to release");
68
- const { pkg: m } = w(e[0]);
69
- if (!n) {
70
- const { release: s } = await v({
68
+ const { pkg: h } = y(n[0]);
69
+ if (!t) {
70
+ const { release: e } = await c({
71
71
  type: "select",
72
72
  name: "release",
73
73
  message: "Select release type",
74
- choices: D(m.version)
74
+ choices: S(h.version)
75
75
  });
76
- s === "custom" ? n = (await v({
76
+ e === "custom" ? t = (await c({
77
77
  type: "text",
78
78
  name: "version",
79
79
  message: "Input custom version",
80
- initial: m.version
81
- })).version : n = s;
80
+ initial: h.version
81
+ })).version : t = e;
82
82
  }
83
- if (!b(n))
84
- 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({
83
+ if (!C(t))
84
+ throw new Error(`invalid target version: ${t}`);
85
+ const u = t.match(/-([a-zA-Z]+)(?:\.(\d+))?$/);
86
+ if (u && !a.tag && (a.tag = u[1]), !a.tag) {
87
+ const { npmTag: e } = await c({
88
+ type: "select",
89
+ name: "npmTag",
90
+ message: "Select npm distribution tag",
91
+ choices: [
92
+ { title: "latest (default)", value: "latest" },
93
+ { title: "next", value: "next" },
94
+ { title: "beta", value: "beta" },
95
+ { title: "alpha", value: "alpha" },
96
+ { title: "custom", value: "custom" }
97
+ ]
98
+ });
99
+ if (e === "custom") {
100
+ const g = await c({
101
+ type: "text",
102
+ name: "customTag",
103
+ message: "Input custom npm tag",
104
+ initial: "latest"
105
+ });
106
+ a.tag = g.customTag;
107
+ } else e !== "latest" && (a.tag = e);
108
+ }
109
+ if (a.tag && a.tag !== "latest") {
110
+ const e = T(t);
111
+ if (e && !t.includes(`-${a.tag}`)) {
112
+ let i, d = 0;
113
+ e.prerelease.length > 0 ? (e.prerelease.length > 1 && typeof e.prerelease[1] == "number" && (d = e.prerelease[1]), i = `${`${e.major}.${e.minor}.${e.patch}`}-${a.tag}`) : i = `${v(t, "minor")}-${a.tag}`;
114
+ const { usePreNum: x } = await c({
115
+ type: "confirm",
116
+ name: "usePreNum",
117
+ message: `Add prerelease number to version? (e.g. ${i}.${d})`,
118
+ initial: !0
119
+ });
120
+ x && (i = `${i}.${d}`);
121
+ const { confirmVersionChange: P } = await c({
122
+ type: "confirm",
123
+ name: "confirmVersionChange",
124
+ message: `Update version from ${o.yellow(t)} to ${o.green(i)} to match ${o.blue(a.tag)} tag?`
125
+ });
126
+ P && (t = i, console.log(`Version updated to ${o.green(t)}`));
127
+ }
128
+ }
129
+ const m = r(t), { yes: $ } = await c({
88
130
  type: "confirm",
89
131
  name: "yes",
90
- message: `Releasing ${r.yellow(i)} Confirm?`
132
+ message: `Releasing ${o.yellow(m)}${a.tag && a.tag !== "latest" ? ` with npm tag ${o.blue(a.tag)}` : ""} Confirm?`
91
133
  });
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);
134
+ if (!$) return;
135
+ for (let e = 0; e < n.length; e++) {
136
+ const g = n[e], { pkg: i } = y(g);
137
+ f(`
138
+ Updating ${o.green(i.name)} package version to ${o.green(t)}...`), await s(i.name, t), f(`
139
+ Generating ${o.green(i.name)} changelog...`), await l(i.name, t, g);
98
140
  }
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]);
141
+ const { stdout: N } = await k("git", ["diff"], { stdio: "pipe" });
142
+ if (N)
143
+ f(`
144
+ Committing changes...`), await p("git", ["add", "-A"]), await p("git", ["commit", "-m", `release: ${m}`, "--no-verify"]), await p("git", ["tag", m]);
103
145
  else {
104
146
  console.log("No changes to commit.");
105
147
  return;
106
148
  }
107
- p(`
108
- Pushing to GitHub...`), await l("git", ["push", "origin", `refs/tags/${i}`]), await l("git", ["push"]), console.log();
149
+ f(`
150
+ Pushing to GitHub...`), await p("git", ["push", "origin", `refs/tags/${m}`]), await p("git", ["push"]), a.tag && a.tag !== "latest" && console.log(`
151
+ NOTE: This release will be published to npm with tag ${o.blue(a.tag)}`), console.log();
109
152
  };
110
153
  export {
111
154
  H as release
@@ -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,kBAuKA,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,MA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a;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.0",
4
4
  "type": "module",
5
5
  "main": "dist/release-config.js",
6
6
  "types": "./dist/index.d.ts",
@@ -16,19 +16,18 @@
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.0",
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
- },
33
- "stableVersion": "1.0.340"
32
+ }
34
33
  }