@ucdjs/release-scripts 0.1.0-beta.5 → 0.1.0-beta.50

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.
@@ -1,7 +1,7 @@
1
- import * as fs from "node:fs";
2
1
  import * as path from "node:path";
2
+ import * as fs from "node:fs";
3
3
 
4
- //#region node_modules/.pnpm/eta@4.0.1/node_modules/eta/dist/index.js
4
+ //#region node_modules/.pnpm/eta@4.5.1/node_modules/eta/dist/index.mjs
5
5
  var EtaError = class extends Error {
6
6
  constructor(message) {
7
7
  super(message);
@@ -53,6 +53,7 @@ function RuntimeErr(originalError, str, lineNo, path$1) {
53
53
  }).join("\n");
54
54
  const err = new EtaRuntimeError((filename ? filename + ":" + lineNo + "\n" : "line " + lineNo + "\n") + context + "\n\n" + originalError.message);
55
55
  err.name = originalError.name;
56
+ err.cause = originalError;
56
57
  throw err;
57
58
  }
58
59
  function readFile(path$1) {
@@ -121,8 +122,8 @@ function compileToString(str, options) {
121
122
  const compileBody$1 = this.compileBody;
122
123
  const buffer = this.parse.call(this, str);
123
124
  let res = `${config.functionHeader}
124
- let include = (template, data) => this.render(template, data, options);
125
- let includeAsync = (template, data) => this.renderAsync(template, data, options);
125
+ let include = (__eta_t, __eta_d) => this.render(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);
126
+ let includeAsync = (__eta_t, __eta_d) => this.renderAsync(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);
126
127
 
127
128
  let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${config.debug ? ", line: 1, templateStr: \"" + str.replace(/\\|"/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n") + "\"" : ""}};
128
129
 
@@ -131,6 +132,8 @@ function layout(path, data) {
131
132
  __eta.layoutData = data;
132
133
  }${config.debug ? "try {" : ""}${config.useWith ? "with(" + config.varName + "||{}){" : ""}
133
134
 
135
+ function ${config.outputFunctionName}(s){__eta.res+=s;}
136
+
134
137
  ${compileBody$1.call(this, buffer)}
135
138
  if (__eta.layout) {
136
139
  __eta.res = ${isAsync ? "await includeAsync" : "include"} (__eta.layout, {...${config.varName}, body: __eta.res, ...__eta.layoutData});
@@ -162,18 +165,18 @@ function compileBody(buff) {
162
165
  let returnStr = "";
163
166
  for (; i < buffLength; i++) {
164
167
  const currentBlock = buff[i];
165
- if (typeof currentBlock === "string") returnStr += "__eta.res+='" + currentBlock + "'\n";
168
+ if (typeof currentBlock === "string") returnStr += "__eta.res+='" + currentBlock + "';\n";
166
169
  else {
167
170
  const type = currentBlock.t;
168
171
  let content = currentBlock.val || "";
169
172
  if (config.debug) returnStr += "__eta.line=" + currentBlock.lineNo + "\n";
170
173
  if (type === "r") {
171
174
  if (config.autoFilter) content = "__eta.f(" + content + ")";
172
- returnStr += "__eta.res+=" + content + "\n";
175
+ returnStr += "__eta.res+=" + content + ";\n";
173
176
  } else if (type === "i") {
174
177
  if (config.autoFilter) content = "__eta.f(" + content + ")";
175
178
  if (config.autoEscape) content = "__eta.e(" + content + ")";
176
- returnStr += "__eta.res+=" + content + "\n";
179
+ returnStr += "__eta.res+=" + content + ";\n";
177
180
  } else if (type === "e") returnStr += content + "\n";
178
181
  }
179
182
  }
@@ -233,6 +236,7 @@ const defaultConfig = {
233
236
  debug: false,
234
237
  escapeFunction: XMLEscape,
235
238
  filterFunction: (val) => String(val),
239
+ outputFunctionName: "output",
236
240
  functionHeader: "",
237
241
  parse: {
238
242
  exec: "",
package/dist/index.d.mts CHANGED
@@ -1,4 +1,43 @@
1
- //#region src/workspace.d.ts
1
+ //#region src/options.d.ts
2
+ interface FindWorkspacePackagesOptions {
3
+ exclude?: string[];
4
+ include?: string[];
5
+ excludePrivate?: boolean;
6
+ }
7
+ interface ReleaseScriptsOptionsInput {
8
+ dryRun?: boolean;
9
+ repo: `${string}/${string}`;
10
+ workspaceRoot?: string;
11
+ packages?: true | FindWorkspacePackagesOptions | string[];
12
+ githubToken: string;
13
+ safeguards?: boolean;
14
+ branch?: {
15
+ release?: string;
16
+ default?: string;
17
+ };
18
+ globalCommitMode?: "dependencies" | "all" | "none";
19
+ pullRequest?: {
20
+ title?: string;
21
+ body?: string;
22
+ };
23
+ types?: Record<string, CommitTypeRule>;
24
+ changelog?: {
25
+ enabled?: boolean;
26
+ template?: string;
27
+ emojis?: boolean;
28
+ };
29
+ npm?: {
30
+ otp?: string;
31
+ provenance?: boolean;
32
+ access?: "public" | "restricted";
33
+ };
34
+ prompts?: {
35
+ versions?: boolean;
36
+ packages?: boolean;
37
+ };
38
+ }
39
+ //#endregion
40
+ //#region src/core/workspace.d.ts
2
41
  interface WorkspacePackage {
3
42
  name: string;
4
43
  version: string;
@@ -8,8 +47,18 @@ interface WorkspacePackage {
8
47
  workspaceDevDependencies: string[];
9
48
  }
10
49
  //#endregion
11
- //#region src/types.d.ts
50
+ //#region src/shared/types.d.ts
12
51
  type BumpKind = "none" | "patch" | "minor" | "major";
52
+ interface CommitTypeRule {
53
+ /**
54
+ * Display title (e.g., "Features", "Bug Fixes")
55
+ */
56
+ title: string;
57
+ /**
58
+ * Commit types to include in this group (defaults to the map key)
59
+ */
60
+ types?: string[];
61
+ }
13
62
  interface PackageJson {
14
63
  name: string;
15
64
  version: string;
@@ -19,21 +68,7 @@ interface PackageJson {
19
68
  private?: boolean;
20
69
  [key: string]: unknown;
21
70
  }
22
- interface FindWorkspacePackagesOptions {
23
- /**
24
- * Package names to exclude
25
- */
26
- excluded?: string[];
27
- /**
28
- * Only include these packages (if specified, all others are excluded)
29
- */
30
- included?: string[];
31
- /**
32
- * Whether to exclude private packages (default: false)
33
- */
34
- excludePrivate?: boolean;
35
- }
36
- interface VersionUpdate {
71
+ interface PackageRelease {
37
72
  /**
38
73
  * The package being updated
39
74
  */
@@ -54,75 +89,18 @@ interface VersionUpdate {
54
89
  * Whether this package has direct changes (vs being updated due to dependency changes)
55
90
  */
56
91
  hasDirectChanges: boolean;
57
- }
58
- interface ReleaseOptions {
59
- /**
60
- * Repository identifier (e.g., "owner/repo")
61
- */
62
- repo: string;
63
- /**
64
- * Root directory of the workspace (defaults to process.cwd())
65
- */
66
- workspaceRoot?: string;
67
- /**
68
- * Specific packages to prepare for release.
69
- * - true: discover all packages
70
- * - FindWorkspacePackagesOptions: discover with filters
71
- * - string[]: specific package names
72
- */
73
- packages?: true | FindWorkspacePackagesOptions | string[];
74
- /**
75
- * Branch name for the release PR (defaults to "release/next")
76
- */
77
- releaseBranch?: string;
78
- /**
79
- * Interactive prompt configuration
80
- */
81
- prompts?: {
82
- /**
83
- * Enable package selection prompt (defaults to true when not in CI)
84
- */
85
- packages?: boolean;
86
- /**
87
- * Enable version override prompt (defaults to true when not in CI)
88
- */
89
- versions?: boolean;
90
- };
91
- /**
92
- * Whether to perform a dry run (no changes pushed or PR created)
93
- * @default false
94
- */
95
- dryRun?: boolean;
96
92
  /**
97
- * Whether to enable safety safeguards (e.g., checking for clean working directory)
98
- * @default true
93
+ * Why/how this release entry exists.
99
94
  */
100
- safeguards?: boolean;
101
- /**
102
- * GitHub token for authentication
103
- */
104
- githubToken: string;
105
- pullRequest?: {
106
- /**
107
- * Title for the release pull request
108
- */
109
- title?: string;
110
- /**
111
- * Body for the release pull request
112
- *
113
- * If not provided, a default body will be generated.
114
- *
115
- * NOTE:
116
- * You can use custom template expressions, see [h3js/rendu](https://github.com/h3js/rendu)
117
- */
118
- body?: string;
119
- };
95
+ changeKind: "auto" | "manual" | "as-is" | "dependent";
120
96
  }
97
+ //#endregion
98
+ //#region src/types.d.ts
121
99
  interface ReleaseResult {
122
100
  /**
123
101
  * Packages that will be updated
124
102
  */
125
- updates: VersionUpdate[];
103
+ updates: PackageRelease[];
126
104
  /**
127
105
  * URL of the created or updated PR
128
106
  */
@@ -133,7 +111,16 @@ interface ReleaseResult {
133
111
  created: boolean;
134
112
  }
135
113
  //#endregion
136
- //#region src/release.d.ts
137
- declare function release(options: ReleaseOptions): Promise<ReleaseResult | null>;
114
+ //#region src/index.d.ts
115
+ interface ReleaseScripts {
116
+ verify: () => Promise<void>;
117
+ prepare: () => Promise<ReleaseResult | null>;
118
+ publish: () => Promise<void>;
119
+ packages: {
120
+ list: () => Promise<WorkspacePackage[]>;
121
+ get: (packageName: string) => Promise<WorkspacePackage | undefined>;
122
+ };
123
+ }
124
+ declare function createReleaseScripts(options: ReleaseScriptsOptionsInput): Promise<ReleaseScripts>;
138
125
  //#endregion
139
- export { release };
126
+ export { ReleaseScripts, createReleaseScripts };