@ucdjs/release-scripts 0.1.0-beta.6 → 0.1.0-beta.60

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,44 @@
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
+ combinePrereleaseIntoFirstStable?: boolean;
29
+ };
30
+ npm?: {
31
+ otp?: string;
32
+ provenance?: boolean;
33
+ access?: "public" | "restricted";
34
+ };
35
+ prompts?: {
36
+ versions?: boolean;
37
+ packages?: boolean;
38
+ };
39
+ }
40
+ //#endregion
41
+ //#region src/core/workspace.d.ts
2
42
  interface WorkspacePackage {
3
43
  name: string;
4
44
  version: string;
@@ -8,46 +48,17 @@ interface WorkspacePackage {
8
48
  workspaceDevDependencies: string[];
9
49
  }
10
50
  //#endregion
11
- //#region src/types.d.ts
51
+ //#region src/shared/types.d.ts
12
52
  type BumpKind = "none" | "patch" | "minor" | "major";
13
- interface SharedOptions {
14
- /**
15
- * Repository identifier (e.g., "owner/repo")
16
- */
17
- repo: string;
53
+ interface CommitTypeRule {
18
54
  /**
19
- * Root directory of the workspace (defaults to process.cwd())
55
+ * Display title (e.g., "Features", "Bug Fixes")
20
56
  */
21
- workspaceRoot?: string;
22
- /**
23
- * Specific packages to prepare for release.
24
- * - true: discover all packages
25
- * - FindWorkspacePackagesOptions: discover with filters
26
- * - string[]: specific package names
27
- */
28
- packages?: true | FindWorkspacePackagesOptions | string[];
29
- /**
30
- * Whether to enable verbose logging
31
- * @default false
32
- */
33
- verbose?: boolean;
34
- /**
35
- * GitHub token for authentication
36
- */
37
- githubToken: string;
57
+ title: string;
38
58
  /**
39
- * Interactive prompt configuration
59
+ * Commit types to include in this group (defaults to the map key)
40
60
  */
41
- prompts?: {
42
- /**
43
- * Enable package selection prompt (defaults to true when not in CI)
44
- */
45
- packages?: boolean;
46
- /**
47
- * Enable version override prompt (defaults to true when not in CI)
48
- */
49
- versions?: boolean;
50
- };
61
+ types?: string[];
51
62
  }
52
63
  interface PackageJson {
53
64
  name: string;
@@ -58,21 +69,7 @@ interface PackageJson {
58
69
  private?: boolean;
59
70
  [key: string]: unknown;
60
71
  }
61
- interface FindWorkspacePackagesOptions {
62
- /**
63
- * Package names to exclude
64
- */
65
- exclude?: string[];
66
- /**
67
- * Only include these packages (if specified, all others are excluded)
68
- */
69
- include?: string[];
70
- /**
71
- * Whether to exclude private packages (default: false)
72
- */
73
- excludePrivate?: boolean;
74
- }
75
- interface VersionUpdate {
72
+ interface PackageRelease {
76
73
  /**
77
74
  * The package being updated
78
75
  */
@@ -93,52 +90,18 @@ interface VersionUpdate {
93
90
  * Whether this package has direct changes (vs being updated due to dependency changes)
94
91
  */
95
92
  hasDirectChanges: boolean;
96
- }
97
- //#endregion
98
- //#region src/publish.d.ts
99
- interface PublishOptions extends SharedOptions {}
100
- declare function publish(_options: PublishOptions): void;
101
- //#endregion
102
- //#region src/release.d.ts
103
- interface ReleaseOptions extends SharedOptions {
104
93
  /**
105
- * Branch name for the release PR (defaults to "release/next")
94
+ * Why/how this release entry exists.
106
95
  */
107
- releaseBranch?: string;
108
- /**
109
- * Whether to perform a dry run (no changes pushed or PR created)
110
- * @default false
111
- */
112
- dryRun?: boolean;
113
- /**
114
- * Whether to enable safety safeguards (e.g., checking for clean working directory)
115
- * @default true
116
- */
117
- safeguards?: boolean;
118
- /**
119
- * Pull request configuration
120
- */
121
- pullRequest?: {
122
- /**
123
- * Title for the release pull request
124
- */
125
- title?: string;
126
- /**
127
- * Body for the release pull request
128
- *
129
- * If not provided, a default body will be generated.
130
- *
131
- * NOTE:
132
- * You can use custom template expressions, see [h3js/rendu](https://github.com/h3js/rendu)
133
- */
134
- body?: string;
135
- };
96
+ changeKind: "auto" | "manual" | "as-is" | "dependent";
136
97
  }
98
+ //#endregion
99
+ //#region src/types.d.ts
137
100
  interface ReleaseResult {
138
101
  /**
139
102
  * Packages that will be updated
140
103
  */
141
- updates: VersionUpdate[];
104
+ updates: PackageRelease[];
142
105
  /**
143
106
  * URL of the created or updated PR
144
107
  */
@@ -148,6 +111,17 @@ interface ReleaseResult {
148
111
  */
149
112
  created: boolean;
150
113
  }
151
- declare function release(options: ReleaseOptions): Promise<ReleaseResult | null>;
152
114
  //#endregion
153
- export { type PublishOptions, type ReleaseOptions, type ReleaseResult, publish, release };
115
+ //#region src/index.d.ts
116
+ interface ReleaseScripts {
117
+ verify: () => Promise<void>;
118
+ prepare: () => Promise<ReleaseResult | null>;
119
+ publish: () => Promise<void>;
120
+ packages: {
121
+ list: () => Promise<WorkspacePackage[]>;
122
+ get: (packageName: string) => Promise<WorkspacePackage | undefined>;
123
+ };
124
+ }
125
+ declare function createReleaseScripts(options: ReleaseScriptsOptionsInput): Promise<ReleaseScripts>;
126
+ //#endregion
127
+ export { ReleaseScripts, createReleaseScripts };