versionary 0.1.0 → 0.3.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.
Files changed (70) hide show
  1. package/README.md +217 -8
  2. package/dist/app/release/pr.d.ts +18 -0
  3. package/dist/app/release/pr.js +209 -0
  4. package/dist/app/release/recovery.d.ts +17 -0
  5. package/dist/app/release/recovery.js +101 -0
  6. package/dist/app/release/release.d.ts +1 -0
  7. package/dist/app/release/release.js +90 -0
  8. package/dist/app/release/state.d.ts +10 -0
  9. package/dist/app/release/state.js +59 -0
  10. package/dist/app/release/verify.d.ts +2 -0
  11. package/dist/app/release/verify.js +5 -0
  12. package/dist/cli/index.js +51 -8
  13. package/dist/config/load-config.js +8 -12
  14. package/dist/config/schema.d.ts +25 -85
  15. package/dist/config/schema.js +20 -81
  16. package/dist/domain/release/changelog.d.ts +12 -0
  17. package/dist/domain/release/changelog.js +123 -0
  18. package/dist/domain/release/plan.d.ts +21 -0
  19. package/dist/domain/release/plan.js +114 -0
  20. package/dist/domain/release/semver.d.ts +15 -0
  21. package/dist/domain/release/semver.js +111 -0
  22. package/dist/domain/strategy/node.d.ts +2 -0
  23. package/dist/domain/strategy/node.js +37 -0
  24. package/dist/domain/strategy/resolve.d.ts +3 -0
  25. package/dist/domain/strategy/resolve.js +11 -0
  26. package/dist/domain/strategy/simple.d.ts +2 -0
  27. package/dist/domain/strategy/simple.js +28 -0
  28. package/dist/domain/strategy/types.d.ts +7 -0
  29. package/dist/domain/strategy/types.js +2 -0
  30. package/dist/index.d.ts +6 -1
  31. package/dist/index.js +10 -1
  32. package/dist/infra/git/commits.d.ts +65 -0
  33. package/dist/infra/git/commits.js +436 -0
  34. package/dist/infra/git/repo-url.d.ts +1 -0
  35. package/dist/infra/git/repo-url.js +27 -0
  36. package/dist/infra/scm/github/plugin.d.ts +1 -0
  37. package/dist/infra/scm/github/plugin.js +5 -0
  38. package/dist/infra/scm/runtime.d.ts +2 -0
  39. package/dist/infra/scm/runtime.js +24 -0
  40. package/dist/infra/scm/types.d.ts +1 -0
  41. package/dist/infra/scm/types.js +2 -0
  42. package/dist/plugins/capabilities.d.ts +3 -0
  43. package/dist/plugins/capabilities.js +10 -0
  44. package/dist/plugins/runtime.d.ts +1 -0
  45. package/dist/plugins/runtime.js +5 -0
  46. package/dist/scm/github-plugin.d.ts +2 -0
  47. package/dist/scm/github-plugin.js +207 -0
  48. package/dist/strategies/node.d.ts +1 -0
  49. package/dist/strategies/node.js +5 -0
  50. package/dist/strategies/resolve.d.ts +1 -0
  51. package/dist/strategies/resolve.js +5 -0
  52. package/dist/strategies/simple.d.ts +1 -0
  53. package/dist/strategies/simple.js +5 -0
  54. package/dist/strategies/types.d.ts +1 -0
  55. package/dist/strategies/types.js +2 -0
  56. package/dist/types/config.d.ts +20 -66
  57. package/dist/types/plugins.d.ts +37 -0
  58. package/dist/types/plugins.js +2 -0
  59. package/dist/verify/verify-project.js +13 -13
  60. package/package.json +15 -14
  61. package/dist/simple/changelog.d.ts +0 -3
  62. package/dist/simple/changelog.js +0 -32
  63. package/dist/simple/git.d.ts +0 -7
  64. package/dist/simple/git.js +0 -61
  65. package/dist/simple/plan.d.ts +0 -12
  66. package/dist/simple/plan.js +0 -37
  67. package/dist/simple/pr.d.ts +0 -5
  68. package/dist/simple/pr.js +0 -45
  69. package/dist/simple/semver.d.ts +0 -8
  70. package/dist/simple/semver.js +0 -25
package/dist/simple/pr.js DELETED
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.prepareSimpleReleasePr = prepareSimpleReleasePr;
7
- const node_fs_1 = __importDefault(require("node:fs"));
8
- const node_path_1 = __importDefault(require("node:path"));
9
- const node_child_process_1 = require("node:child_process");
10
- const plan_js_1 = require("./plan.js");
11
- const changelog_js_1 = require("./changelog.js");
12
- function ensureCleanWorktree(cwd) {
13
- const status = (0, node_child_process_1.execFileSync)("git", ["status", "--porcelain"], {
14
- cwd,
15
- encoding: "utf8",
16
- stdio: ["ignore", "pipe", "ignore"],
17
- }).trim();
18
- if (status.length > 0) {
19
- throw new Error("Working tree is not clean. Commit or stash changes before `versionary pr`.");
20
- }
21
- }
22
- function prepareSimpleReleasePr(cwd = process.cwd()) {
23
- const plan = (0, plan_js_1.createSimplePlan)(cwd);
24
- if (!plan.nextVersion) {
25
- throw new Error("No releasable commits found. Nothing to open a release PR for.");
26
- }
27
- ensureCleanWorktree(cwd);
28
- const versionPath = node_path_1.default.join(cwd, plan.versionFile);
29
- node_fs_1.default.writeFileSync(versionPath, `${plan.nextVersion}\n`, "utf8");
30
- const section = (0, changelog_js_1.renderSimpleChangelog)(plan);
31
- (0, changelog_js_1.prependChangelog)(cwd, plan.changelogFile, section);
32
- const branch = `versionary/release-v${plan.nextVersion}`;
33
- const title = `chore(release): v${plan.nextVersion}`;
34
- (0, node_child_process_1.execFileSync)("git", ["checkout", "-B", branch], { cwd, stdio: ["ignore", "pipe", "ignore"] });
35
- (0, node_child_process_1.execFileSync)("git", ["add", plan.versionFile, plan.changelogFile], {
36
- cwd,
37
- stdio: ["ignore", "pipe", "ignore"],
38
- });
39
- (0, node_child_process_1.execFileSync)("git", ["commit", "-m", title], { cwd, stdio: ["ignore", "pipe", "ignore"] });
40
- return {
41
- branch,
42
- title,
43
- version: plan.nextVersion,
44
- };
45
- }
@@ -1,8 +0,0 @@
1
- export type ReleaseType = "major" | "minor" | "patch" | null;
2
- export interface ParsedVersion {
3
- major: number;
4
- minor: number;
5
- patch: number;
6
- }
7
- export declare function parseVersion(version: string): ParsedVersion;
8
- export declare function bumpVersion(current: string, releaseType: Exclude<ReleaseType, null>): string;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseVersion = parseVersion;
4
- exports.bumpVersion = bumpVersion;
5
- function parseVersion(version) {
6
- const match = version.trim().match(/^(\d+)\.(\d+)\.(\d+)$/);
7
- if (!match) {
8
- throw new Error(`Invalid version in version file: "${version}". Expected x.y.z`);
9
- }
10
- return {
11
- major: Number(match[1]),
12
- minor: Number(match[2]),
13
- patch: Number(match[3]),
14
- };
15
- }
16
- function bumpVersion(current, releaseType) {
17
- const parsed = parseVersion(current);
18
- if (releaseType === "major") {
19
- return `${parsed.major + 1}.0.0`;
20
- }
21
- if (releaseType === "minor") {
22
- return `${parsed.major}.${parsed.minor + 1}.0`;
23
- }
24
- return `${parsed.major}.${parsed.minor}.${parsed.patch + 1}`;
25
- }