@ucdjs/release-scripts 0.1.0-beta.23 → 0.1.0-beta.25
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/dist/{eta-j5TFRbI4.mjs → eta-BV8TCRDW.mjs} +17 -13
- package/dist/index.d.mts +48 -170
- package/dist/index.mjs +1391 -1653
- package/package.json +15 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as path from "node:path";
|
|
2
1
|
import * as fs from "node:fs";
|
|
2
|
+
import * as path$2 from "node:path";
|
|
3
3
|
|
|
4
|
-
//#region node_modules/.pnpm/eta@4.
|
|
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) {
|
|
@@ -76,22 +77,22 @@ function resolvePath(templatePath, options) {
|
|
|
76
77
|
path: templatePath,
|
|
77
78
|
views: this.config.views
|
|
78
79
|
});
|
|
79
|
-
templatePath += path.extname(templatePath) ? "" : defaultExtension;
|
|
80
|
+
templatePath += path$2.extname(templatePath) ? "" : defaultExtension;
|
|
80
81
|
if (baseFilePath) {
|
|
81
82
|
if (this.config.cacheFilepaths && this.filepathCache[cacheIndex]) return this.filepathCache[cacheIndex];
|
|
82
83
|
if (absolutePathRegExp.exec(templatePath)?.length) {
|
|
83
84
|
const formattedPath = templatePath.replace(/^\/*|^\\*/, "");
|
|
84
|
-
resolvedFilePath = path.join(views, formattedPath);
|
|
85
|
-
} else resolvedFilePath = path.join(path.dirname(baseFilePath), templatePath);
|
|
86
|
-
} else resolvedFilePath = path.join(views, templatePath);
|
|
85
|
+
resolvedFilePath = path$2.join(views, formattedPath);
|
|
86
|
+
} else resolvedFilePath = path$2.join(path$2.dirname(baseFilePath), templatePath);
|
|
87
|
+
} else resolvedFilePath = path$2.join(views, templatePath);
|
|
87
88
|
if (dirIsChild(views, resolvedFilePath)) {
|
|
88
89
|
if (baseFilePath && this.config.cacheFilepaths) this.filepathCache[cacheIndex] = resolvedFilePath;
|
|
89
90
|
return resolvedFilePath;
|
|
90
91
|
} else throw new EtaFileResolutionError(`Template '${templatePath}' is not in the views directory`);
|
|
91
92
|
}
|
|
92
93
|
function dirIsChild(parent, dir) {
|
|
93
|
-
const relative
|
|
94
|
-
return relative
|
|
94
|
+
const relative = path$2.relative(parent, dir);
|
|
95
|
+
return relative && !relative.startsWith("..") && !path$2.isAbsolute(relative);
|
|
95
96
|
}
|
|
96
97
|
const absolutePathRegExp = /^\\|^\//;
|
|
97
98
|
/* istanbul ignore next */
|
|
@@ -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 = (
|
|
125
|
-
let includeAsync = (
|
|
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 + "'
|
|
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 + "
|
|
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 + "
|
|
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,192 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
path: string;
|
|
6
|
-
packageJson: PackageJson;
|
|
7
|
-
workspaceDependencies: string[];
|
|
8
|
-
workspaceDevDependencies: string[];
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/shared/types.d.ts
|
|
12
|
-
type BumpKind = "none" | "patch" | "minor" | "major";
|
|
13
|
-
type GlobalCommitMode = false | "dependencies" | "all";
|
|
14
|
-
interface CommitGroup {
|
|
15
|
-
/**
|
|
16
|
-
* Unique identifier for the group
|
|
17
|
-
*/
|
|
18
|
-
name: string;
|
|
19
|
-
/**
|
|
20
|
-
* Display title (e.g., "Features", "Bug Fixes")
|
|
21
|
-
*/
|
|
22
|
-
title: string;
|
|
23
|
-
/**
|
|
24
|
-
* Conventional commit types to include in this group
|
|
25
|
-
*/
|
|
26
|
-
types: string[];
|
|
27
|
-
}
|
|
28
|
-
interface SharedOptions {
|
|
29
|
-
/**
|
|
30
|
-
* Repository identifier (e.g., "owner/repo")
|
|
31
|
-
*/
|
|
32
|
-
repo: `${string}/${string}`;
|
|
33
|
-
/**
|
|
34
|
-
* Root directory of the workspace (defaults to process.cwd())
|
|
35
|
-
*/
|
|
36
|
-
workspaceRoot?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Specific packages to prepare for release.
|
|
39
|
-
* - true: discover all packages
|
|
40
|
-
* - FindWorkspacePackagesOptions: discover with filters
|
|
41
|
-
* - string[]: specific package names
|
|
42
|
-
*/
|
|
43
|
-
packages?: true | FindWorkspacePackagesOptions | string[];
|
|
44
|
-
/**
|
|
45
|
-
* GitHub token for authentication
|
|
46
|
-
*/
|
|
47
|
-
githubToken: string;
|
|
48
|
-
/**
|
|
49
|
-
* Interactive prompt configuration
|
|
50
|
-
*/
|
|
51
|
-
prompts?: {
|
|
52
|
-
/**
|
|
53
|
-
* Enable package selection prompt (defaults to true when not in CI)
|
|
54
|
-
*/
|
|
55
|
-
packages?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Enable version override prompt (defaults to true when not in CI)
|
|
58
|
-
*/
|
|
59
|
-
versions?: boolean;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Commit grouping configuration
|
|
63
|
-
* Used for changelog generation and commit display
|
|
64
|
-
* @default DEFAULT_COMMIT_GROUPS
|
|
65
|
-
*/
|
|
66
|
-
groups?: CommitGroup[];
|
|
67
|
-
}
|
|
68
|
-
interface PackageJson {
|
|
69
|
-
name: string;
|
|
70
|
-
version: string;
|
|
71
|
-
dependencies?: Record<string, string>;
|
|
72
|
-
devDependencies?: Record<string, string>;
|
|
73
|
-
peerDependencies?: Record<string, string>;
|
|
74
|
-
private?: boolean;
|
|
75
|
-
[key: string]: unknown;
|
|
76
|
-
}
|
|
1
|
+
import { Context, Effect, Schema } from "effect";
|
|
2
|
+
import { CommandExecutor } from "@effect/platform";
|
|
3
|
+
|
|
4
|
+
//#region src/options.d.ts
|
|
77
5
|
interface FindWorkspacePackagesOptions {
|
|
78
|
-
/**
|
|
79
|
-
* Package names to exclude
|
|
80
|
-
*/
|
|
81
6
|
exclude?: string[];
|
|
82
|
-
/**
|
|
83
|
-
* Only include these packages (if specified, all others are excluded)
|
|
84
|
-
*/
|
|
85
7
|
include?: string[];
|
|
86
|
-
/**
|
|
87
|
-
* Whether to exclude private packages (default: false)
|
|
88
|
-
*/
|
|
89
8
|
excludePrivate?: boolean;
|
|
90
9
|
}
|
|
91
|
-
interface
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
* Current version
|
|
98
|
-
*/
|
|
99
|
-
currentVersion: string;
|
|
100
|
-
/**
|
|
101
|
-
* New version to release
|
|
102
|
-
*/
|
|
103
|
-
newVersion: string;
|
|
104
|
-
/**
|
|
105
|
-
* Type of version bump
|
|
106
|
-
*/
|
|
107
|
-
bumpType: BumpKind;
|
|
108
|
-
/**
|
|
109
|
-
* Whether this package has direct changes (vs being updated due to dependency changes)
|
|
110
|
-
*/
|
|
111
|
-
hasDirectChanges: boolean;
|
|
112
|
-
}
|
|
113
|
-
//#endregion
|
|
114
|
-
//#region src/publish.d.ts
|
|
115
|
-
interface PublishOptions extends SharedOptions {}
|
|
116
|
-
declare function publish(_options: PublishOptions): void;
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/release.d.ts
|
|
119
|
-
interface ReleaseOptions extends SharedOptions {
|
|
10
|
+
interface ReleaseScriptsOptionsInput {
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
repo: `${string}/${string}`;
|
|
13
|
+
workspaceRoot?: string;
|
|
14
|
+
packages?: true | FindWorkspacePackagesOptions | string[];
|
|
15
|
+
githubToken: string;
|
|
120
16
|
branch?: {
|
|
121
|
-
/**
|
|
122
|
-
* Branch name for the release PR (defaults to "release/next")
|
|
123
|
-
*/
|
|
124
17
|
release?: string;
|
|
125
|
-
/**
|
|
126
|
-
* Default branch name (e.g., "main")
|
|
127
|
-
*/
|
|
128
18
|
default?: string;
|
|
129
19
|
};
|
|
130
|
-
|
|
131
|
-
* Whether to enable safety safeguards (e.g., checking for clean working directory)
|
|
132
|
-
* @default true
|
|
133
|
-
*/
|
|
134
|
-
safeguards?: boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Pull request configuration
|
|
137
|
-
*/
|
|
20
|
+
globalCommitMode?: "dependencies" | "all" | "none";
|
|
138
21
|
pullRequest?: {
|
|
139
|
-
/**
|
|
140
|
-
* Title for the release pull request
|
|
141
|
-
*/
|
|
142
22
|
title?: string;
|
|
143
|
-
/**
|
|
144
|
-
* Body for the release pull request
|
|
145
|
-
*
|
|
146
|
-
* If not provided, a default body will be generated.
|
|
147
|
-
*
|
|
148
|
-
* NOTE:
|
|
149
|
-
* You can use custom template expressions, see [h3js/rendu](https://github.com/h3js/rendu)
|
|
150
|
-
*/
|
|
151
23
|
body?: string;
|
|
152
24
|
};
|
|
25
|
+
types?: Record<string, {
|
|
26
|
+
title: string;
|
|
27
|
+
color?: string;
|
|
28
|
+
}>;
|
|
153
29
|
changelog?: {
|
|
154
|
-
/**
|
|
155
|
-
* Whether to generate or update changelogs
|
|
156
|
-
* @default true
|
|
157
|
-
*/
|
|
158
30
|
enabled?: boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Custom changelog entry template (ETA format)
|
|
161
|
-
*/
|
|
162
31
|
template?: string;
|
|
32
|
+
emojis?: boolean;
|
|
33
|
+
};
|
|
34
|
+
npm?: {
|
|
35
|
+
otp?: string;
|
|
36
|
+
provenance?: boolean;
|
|
163
37
|
};
|
|
164
|
-
globalCommitMode?: GlobalCommitMode;
|
|
165
|
-
}
|
|
166
|
-
interface ReleaseResult {
|
|
167
|
-
/**
|
|
168
|
-
* Packages that will be updated
|
|
169
|
-
*/
|
|
170
|
-
updates: PackageRelease[];
|
|
171
|
-
/**
|
|
172
|
-
* URL of the created or updated PR
|
|
173
|
-
*/
|
|
174
|
-
prUrl?: string;
|
|
175
|
-
/**
|
|
176
|
-
* Whether a new PR was created (vs updating existing)
|
|
177
|
-
*/
|
|
178
|
-
created: boolean;
|
|
179
38
|
}
|
|
180
|
-
declare function release(options: ReleaseOptions): Promise<ReleaseResult | null>;
|
|
181
39
|
//#endregion
|
|
182
|
-
//#region src/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
40
|
+
//#region src/services/workspace.service.d.ts
|
|
41
|
+
declare const WorkspacePackageSchema: Schema.Struct<{
|
|
42
|
+
name: typeof Schema.String;
|
|
43
|
+
version: typeof Schema.String;
|
|
44
|
+
path: typeof Schema.String;
|
|
45
|
+
packageJson: Schema.Struct<{
|
|
46
|
+
name: typeof Schema.String;
|
|
47
|
+
private: Schema.optional<typeof Schema.Boolean>;
|
|
48
|
+
version: Schema.optional<typeof Schema.String>;
|
|
49
|
+
dependencies: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
50
|
+
devDependencies: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
51
|
+
peerDependencies: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
52
|
+
}>;
|
|
53
|
+
workspaceDependencies: Schema.Array$<typeof Schema.String>;
|
|
54
|
+
workspaceDevDependencies: Schema.Array$<typeof Schema.String>;
|
|
55
|
+
}>;
|
|
56
|
+
type WorkspacePackage = Schema.Schema.Type<typeof WorkspacePackageSchema>;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/index.d.ts
|
|
59
|
+
interface ReleaseScripts {
|
|
60
|
+
verify: () => Promise<void>;
|
|
61
|
+
prepare: () => Promise<void>;
|
|
62
|
+
publish: () => Promise<void>;
|
|
63
|
+
packages: {
|
|
64
|
+
list: () => Promise<readonly WorkspacePackage[]>;
|
|
65
|
+
get: (packageName: string) => Promise<WorkspacePackage | null>;
|
|
187
66
|
};
|
|
188
|
-
safeguards?: boolean;
|
|
189
67
|
}
|
|
190
|
-
declare function
|
|
68
|
+
declare function createReleaseScripts(options: ReleaseScriptsOptionsInput): Promise<ReleaseScripts>;
|
|
191
69
|
//#endregion
|
|
192
|
-
export {
|
|
70
|
+
export { ReleaseScripts, createReleaseScripts };
|