@qlover/fe-release 2.3.5 → 3.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/dist/cli.cjs +2666 -1005
- package/dist/cli.js +2673 -1007
- package/dist/index.cjs +3072 -1403
- package/dist/index.d.ts +2354 -161
- package/dist/index.js +3078 -1404
- package/package.json +5 -4
package/dist/cli.cjs
CHANGED
|
@@ -2878,116 +2878,65 @@ var require_set = __commonJS({
|
|
|
2878
2878
|
}
|
|
2879
2879
|
});
|
|
2880
2880
|
|
|
2881
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2882
|
-
var
|
|
2883
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2884
|
-
"use strict";
|
|
2885
|
-
var ListCache = require_ListCache();
|
|
2886
|
-
function stackClear() {
|
|
2887
|
-
this.__data__ = new ListCache();
|
|
2888
|
-
this.size = 0;
|
|
2889
|
-
}
|
|
2890
|
-
module2.exports = stackClear;
|
|
2891
|
-
}
|
|
2892
|
-
});
|
|
2893
|
-
|
|
2894
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js
|
|
2895
|
-
var require_stackDelete = __commonJS({
|
|
2896
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js"(exports2, module2) {
|
|
2897
|
-
"use strict";
|
|
2898
|
-
function stackDelete(key) {
|
|
2899
|
-
var data = this.__data__, result = data["delete"](key);
|
|
2900
|
-
this.size = data.size;
|
|
2901
|
-
return result;
|
|
2902
|
-
}
|
|
2903
|
-
module2.exports = stackDelete;
|
|
2904
|
-
}
|
|
2905
|
-
});
|
|
2906
|
-
|
|
2907
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js
|
|
2908
|
-
var require_stackGet = __commonJS({
|
|
2909
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js"(exports2, module2) {
|
|
2910
|
-
"use strict";
|
|
2911
|
-
function stackGet(key) {
|
|
2912
|
-
return this.__data__.get(key);
|
|
2913
|
-
}
|
|
2914
|
-
module2.exports = stackGet;
|
|
2915
|
-
}
|
|
2916
|
-
});
|
|
2917
|
-
|
|
2918
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js
|
|
2919
|
-
var require_stackHas = __commonJS({
|
|
2920
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js"(exports2, module2) {
|
|
2881
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js
|
|
2882
|
+
var require_baseGet = __commonJS({
|
|
2883
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"(exports2, module2) {
|
|
2921
2884
|
"use strict";
|
|
2922
|
-
|
|
2923
|
-
|
|
2885
|
+
var castPath = require_castPath();
|
|
2886
|
+
var toKey = require_toKey();
|
|
2887
|
+
function baseGet(object, path) {
|
|
2888
|
+
path = castPath(path, object);
|
|
2889
|
+
var index = 0, length = path.length;
|
|
2890
|
+
while (object != null && index < length) {
|
|
2891
|
+
object = object[toKey(path[index++])];
|
|
2892
|
+
}
|
|
2893
|
+
return index && index == length ? object : void 0;
|
|
2924
2894
|
}
|
|
2925
|
-
module2.exports =
|
|
2895
|
+
module2.exports = baseGet;
|
|
2926
2896
|
}
|
|
2927
2897
|
});
|
|
2928
2898
|
|
|
2929
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2930
|
-
var
|
|
2931
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2899
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js
|
|
2900
|
+
var require_get = __commonJS({
|
|
2901
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js"(exports2, module2) {
|
|
2932
2902
|
"use strict";
|
|
2933
|
-
var
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
function stackSet(key, value) {
|
|
2938
|
-
var data = this.__data__;
|
|
2939
|
-
if (data instanceof ListCache) {
|
|
2940
|
-
var pairs = data.__data__;
|
|
2941
|
-
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
2942
|
-
pairs.push([key, value]);
|
|
2943
|
-
this.size = ++data.size;
|
|
2944
|
-
return this;
|
|
2945
|
-
}
|
|
2946
|
-
data = this.__data__ = new MapCache(pairs);
|
|
2947
|
-
}
|
|
2948
|
-
data.set(key, value);
|
|
2949
|
-
this.size = data.size;
|
|
2950
|
-
return this;
|
|
2903
|
+
var baseGet = require_baseGet();
|
|
2904
|
+
function get2(object, path, defaultValue) {
|
|
2905
|
+
var result = object == null ? void 0 : baseGet(object, path);
|
|
2906
|
+
return result === void 0 ? defaultValue : result;
|
|
2951
2907
|
}
|
|
2952
|
-
module2.exports =
|
|
2908
|
+
module2.exports = get2;
|
|
2953
2909
|
}
|
|
2954
2910
|
});
|
|
2955
2911
|
|
|
2956
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2957
|
-
var
|
|
2958
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2912
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isString.js
|
|
2913
|
+
var require_isString = __commonJS({
|
|
2914
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isString.js"(exports2, module2) {
|
|
2959
2915
|
"use strict";
|
|
2960
|
-
var
|
|
2961
|
-
var
|
|
2962
|
-
var
|
|
2963
|
-
var
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
function Stack(entries) {
|
|
2967
|
-
var data = this.__data__ = new ListCache(entries);
|
|
2968
|
-
this.size = data.size;
|
|
2916
|
+
var baseGetTag = require_baseGetTag();
|
|
2917
|
+
var isArray = require_isArray();
|
|
2918
|
+
var isObjectLike = require_isObjectLike();
|
|
2919
|
+
var stringTag = "[object String]";
|
|
2920
|
+
function isString2(value) {
|
|
2921
|
+
return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
|
|
2969
2922
|
}
|
|
2970
|
-
|
|
2971
|
-
Stack.prototype["delete"] = stackDelete;
|
|
2972
|
-
Stack.prototype.get = stackGet;
|
|
2973
|
-
Stack.prototype.has = stackHas;
|
|
2974
|
-
Stack.prototype.set = stackSet;
|
|
2975
|
-
module2.exports = Stack;
|
|
2923
|
+
module2.exports = isString2;
|
|
2976
2924
|
}
|
|
2977
2925
|
});
|
|
2978
2926
|
|
|
2979
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2980
|
-
var
|
|
2981
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2927
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayAggregator.js
|
|
2928
|
+
var require_arrayAggregator = __commonJS({
|
|
2929
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayAggregator.js"(exports2, module2) {
|
|
2982
2930
|
"use strict";
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2931
|
+
function arrayAggregator(array, setter, iteratee, accumulator) {
|
|
2932
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
2933
|
+
while (++index < length) {
|
|
2934
|
+
var value = array[index];
|
|
2935
|
+
setter(accumulator, value, iteratee(value), array);
|
|
2988
2936
|
}
|
|
2937
|
+
return accumulator;
|
|
2989
2938
|
}
|
|
2990
|
-
module2.exports =
|
|
2939
|
+
module2.exports = arrayAggregator;
|
|
2991
2940
|
}
|
|
2992
2941
|
});
|
|
2993
2942
|
|
|
@@ -3021,154 +2970,18 @@ var require_baseFor = __commonJS({
|
|
|
3021
2970
|
}
|
|
3022
2971
|
});
|
|
3023
2972
|
|
|
3024
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
3025
|
-
var
|
|
3026
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
2973
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js
|
|
2974
|
+
var require_baseTimes = __commonJS({
|
|
2975
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js"(exports2, module2) {
|
|
3027
2976
|
"use strict";
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
var Buffer2 = moduleExports ? root.Buffer : void 0;
|
|
3033
|
-
var allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
|
|
3034
|
-
function cloneBuffer(buffer, isDeep) {
|
|
3035
|
-
if (isDeep) {
|
|
3036
|
-
return buffer.slice();
|
|
2977
|
+
function baseTimes(n, iteratee) {
|
|
2978
|
+
var index = -1, result = Array(n);
|
|
2979
|
+
while (++index < n) {
|
|
2980
|
+
result[index] = iteratee(index);
|
|
3037
2981
|
}
|
|
3038
|
-
var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
3039
|
-
buffer.copy(result);
|
|
3040
2982
|
return result;
|
|
3041
2983
|
}
|
|
3042
|
-
module2.exports =
|
|
3043
|
-
}
|
|
3044
|
-
});
|
|
3045
|
-
|
|
3046
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js
|
|
3047
|
-
var require_Uint8Array = __commonJS({
|
|
3048
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js"(exports2, module2) {
|
|
3049
|
-
"use strict";
|
|
3050
|
-
var root = require_root();
|
|
3051
|
-
var Uint8Array2 = root.Uint8Array;
|
|
3052
|
-
module2.exports = Uint8Array2;
|
|
3053
|
-
}
|
|
3054
|
-
});
|
|
3055
|
-
|
|
3056
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneArrayBuffer.js
|
|
3057
|
-
var require_cloneArrayBuffer = __commonJS({
|
|
3058
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneArrayBuffer.js"(exports2, module2) {
|
|
3059
|
-
"use strict";
|
|
3060
|
-
var Uint8Array2 = require_Uint8Array();
|
|
3061
|
-
function cloneArrayBuffer(arrayBuffer) {
|
|
3062
|
-
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
3063
|
-
new Uint8Array2(result).set(new Uint8Array2(arrayBuffer));
|
|
3064
|
-
return result;
|
|
3065
|
-
}
|
|
3066
|
-
module2.exports = cloneArrayBuffer;
|
|
3067
|
-
}
|
|
3068
|
-
});
|
|
3069
|
-
|
|
3070
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneTypedArray.js
|
|
3071
|
-
var require_cloneTypedArray = __commonJS({
|
|
3072
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_cloneTypedArray.js"(exports2, module2) {
|
|
3073
|
-
"use strict";
|
|
3074
|
-
var cloneArrayBuffer = require_cloneArrayBuffer();
|
|
3075
|
-
function cloneTypedArray(typedArray, isDeep) {
|
|
3076
|
-
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
|
3077
|
-
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
3078
|
-
}
|
|
3079
|
-
module2.exports = cloneTypedArray;
|
|
3080
|
-
}
|
|
3081
|
-
});
|
|
3082
|
-
|
|
3083
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyArray.js
|
|
3084
|
-
var require_copyArray = __commonJS({
|
|
3085
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyArray.js"(exports2, module2) {
|
|
3086
|
-
"use strict";
|
|
3087
|
-
function copyArray(source, array) {
|
|
3088
|
-
var index = -1, length = source.length;
|
|
3089
|
-
array || (array = Array(length));
|
|
3090
|
-
while (++index < length) {
|
|
3091
|
-
array[index] = source[index];
|
|
3092
|
-
}
|
|
3093
|
-
return array;
|
|
3094
|
-
}
|
|
3095
|
-
module2.exports = copyArray;
|
|
3096
|
-
}
|
|
3097
|
-
});
|
|
3098
|
-
|
|
3099
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseCreate.js
|
|
3100
|
-
var require_baseCreate = __commonJS({
|
|
3101
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseCreate.js"(exports2, module2) {
|
|
3102
|
-
"use strict";
|
|
3103
|
-
var isObject = require_isObject();
|
|
3104
|
-
var objectCreate = Object.create;
|
|
3105
|
-
var baseCreate = /* @__PURE__ */ function() {
|
|
3106
|
-
function object() {
|
|
3107
|
-
}
|
|
3108
|
-
return function(proto) {
|
|
3109
|
-
if (!isObject(proto)) {
|
|
3110
|
-
return {};
|
|
3111
|
-
}
|
|
3112
|
-
if (objectCreate) {
|
|
3113
|
-
return objectCreate(proto);
|
|
3114
|
-
}
|
|
3115
|
-
object.prototype = proto;
|
|
3116
|
-
var result = new object();
|
|
3117
|
-
object.prototype = void 0;
|
|
3118
|
-
return result;
|
|
3119
|
-
};
|
|
3120
|
-
}();
|
|
3121
|
-
module2.exports = baseCreate;
|
|
3122
|
-
}
|
|
3123
|
-
});
|
|
3124
|
-
|
|
3125
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js
|
|
3126
|
-
var require_overArg = __commonJS({
|
|
3127
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js"(exports2, module2) {
|
|
3128
|
-
"use strict";
|
|
3129
|
-
function overArg(func, transform) {
|
|
3130
|
-
return function(arg) {
|
|
3131
|
-
return func(transform(arg));
|
|
3132
|
-
};
|
|
3133
|
-
}
|
|
3134
|
-
module2.exports = overArg;
|
|
3135
|
-
}
|
|
3136
|
-
});
|
|
3137
|
-
|
|
3138
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getPrototype.js
|
|
3139
|
-
var require_getPrototype = __commonJS({
|
|
3140
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getPrototype.js"(exports2, module2) {
|
|
3141
|
-
"use strict";
|
|
3142
|
-
var overArg = require_overArg();
|
|
3143
|
-
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
3144
|
-
module2.exports = getPrototype;
|
|
3145
|
-
}
|
|
3146
|
-
});
|
|
3147
|
-
|
|
3148
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js
|
|
3149
|
-
var require_isPrototype = __commonJS({
|
|
3150
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js"(exports2, module2) {
|
|
3151
|
-
"use strict";
|
|
3152
|
-
var objectProto = Object.prototype;
|
|
3153
|
-
function isPrototype(value) {
|
|
3154
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
3155
|
-
return value === proto;
|
|
3156
|
-
}
|
|
3157
|
-
module2.exports = isPrototype;
|
|
3158
|
-
}
|
|
3159
|
-
});
|
|
3160
|
-
|
|
3161
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_initCloneObject.js
|
|
3162
|
-
var require_initCloneObject = __commonJS({
|
|
3163
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_initCloneObject.js"(exports2, module2) {
|
|
3164
|
-
"use strict";
|
|
3165
|
-
var baseCreate = require_baseCreate();
|
|
3166
|
-
var getPrototype = require_getPrototype();
|
|
3167
|
-
var isPrototype = require_isPrototype();
|
|
3168
|
-
function initCloneObject(object) {
|
|
3169
|
-
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
|
3170
|
-
}
|
|
3171
|
-
module2.exports = initCloneObject;
|
|
2984
|
+
module2.exports = baseTimes;
|
|
3172
2985
|
}
|
|
3173
2986
|
});
|
|
3174
2987
|
|
|
@@ -3204,44 +3017,6 @@ var require_isArguments = __commonJS({
|
|
|
3204
3017
|
}
|
|
3205
3018
|
});
|
|
3206
3019
|
|
|
3207
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js
|
|
3208
|
-
var require_isLength = __commonJS({
|
|
3209
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js"(exports2, module2) {
|
|
3210
|
-
"use strict";
|
|
3211
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
3212
|
-
function isLength(value) {
|
|
3213
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
3214
|
-
}
|
|
3215
|
-
module2.exports = isLength;
|
|
3216
|
-
}
|
|
3217
|
-
});
|
|
3218
|
-
|
|
3219
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js
|
|
3220
|
-
var require_isArrayLike = __commonJS({
|
|
3221
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js"(exports2, module2) {
|
|
3222
|
-
"use strict";
|
|
3223
|
-
var isFunction = require_isFunction();
|
|
3224
|
-
var isLength = require_isLength();
|
|
3225
|
-
function isArrayLike(value) {
|
|
3226
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
3227
|
-
}
|
|
3228
|
-
module2.exports = isArrayLike;
|
|
3229
|
-
}
|
|
3230
|
-
});
|
|
3231
|
-
|
|
3232
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLikeObject.js
|
|
3233
|
-
var require_isArrayLikeObject = __commonJS({
|
|
3234
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLikeObject.js"(exports2, module2) {
|
|
3235
|
-
"use strict";
|
|
3236
|
-
var isArrayLike = require_isArrayLike();
|
|
3237
|
-
var isObjectLike = require_isObjectLike();
|
|
3238
|
-
function isArrayLikeObject(value) {
|
|
3239
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
3240
|
-
}
|
|
3241
|
-
module2.exports = isArrayLikeObject;
|
|
3242
|
-
}
|
|
3243
|
-
});
|
|
3244
|
-
|
|
3245
3020
|
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js
|
|
3246
3021
|
var require_stubFalse = __commonJS({
|
|
3247
3022
|
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/stubFalse.js"(exports2, module2) {
|
|
@@ -3269,31 +3044,15 @@ var require_isBuffer = __commonJS({
|
|
|
3269
3044
|
}
|
|
3270
3045
|
});
|
|
3271
3046
|
|
|
3272
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
3273
|
-
var
|
|
3274
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
3047
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js
|
|
3048
|
+
var require_isLength = __commonJS({
|
|
3049
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js"(exports2, module2) {
|
|
3275
3050
|
"use strict";
|
|
3276
|
-
var
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
var objectTag = "[object Object]";
|
|
3280
|
-
var funcProto = Function.prototype;
|
|
3281
|
-
var objectProto = Object.prototype;
|
|
3282
|
-
var funcToString = funcProto.toString;
|
|
3283
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
3284
|
-
var objectCtorString = funcToString.call(Object);
|
|
3285
|
-
function isPlainObject(value) {
|
|
3286
|
-
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
|
3287
|
-
return false;
|
|
3288
|
-
}
|
|
3289
|
-
var proto = getPrototype(value);
|
|
3290
|
-
if (proto === null) {
|
|
3291
|
-
return true;
|
|
3292
|
-
}
|
|
3293
|
-
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
3294
|
-
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
|
3051
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
3052
|
+
function isLength(value) {
|
|
3053
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
3295
3054
|
}
|
|
3296
|
-
module2.exports =
|
|
3055
|
+
module2.exports = isLength;
|
|
3297
3056
|
}
|
|
3298
3057
|
});
|
|
3299
3058
|
|
|
@@ -3387,66 +3146,6 @@ var require_isTypedArray = __commonJS({
|
|
|
3387
3146
|
}
|
|
3388
3147
|
});
|
|
3389
3148
|
|
|
3390
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_safeGet.js
|
|
3391
|
-
var require_safeGet = __commonJS({
|
|
3392
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_safeGet.js"(exports2, module2) {
|
|
3393
|
-
"use strict";
|
|
3394
|
-
function safeGet(object, key) {
|
|
3395
|
-
if (key === "constructor" && typeof object[key] === "function") {
|
|
3396
|
-
return;
|
|
3397
|
-
}
|
|
3398
|
-
if (key == "__proto__") {
|
|
3399
|
-
return;
|
|
3400
|
-
}
|
|
3401
|
-
return object[key];
|
|
3402
|
-
}
|
|
3403
|
-
module2.exports = safeGet;
|
|
3404
|
-
}
|
|
3405
|
-
});
|
|
3406
|
-
|
|
3407
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyObject.js
|
|
3408
|
-
var require_copyObject = __commonJS({
|
|
3409
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_copyObject.js"(exports2, module2) {
|
|
3410
|
-
"use strict";
|
|
3411
|
-
var assignValue = require_assignValue();
|
|
3412
|
-
var baseAssignValue = require_baseAssignValue();
|
|
3413
|
-
function copyObject(source, props, object, customizer) {
|
|
3414
|
-
var isNew = !object;
|
|
3415
|
-
object || (object = {});
|
|
3416
|
-
var index = -1, length = props.length;
|
|
3417
|
-
while (++index < length) {
|
|
3418
|
-
var key = props[index];
|
|
3419
|
-
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
|
3420
|
-
if (newValue === void 0) {
|
|
3421
|
-
newValue = source[key];
|
|
3422
|
-
}
|
|
3423
|
-
if (isNew) {
|
|
3424
|
-
baseAssignValue(object, key, newValue);
|
|
3425
|
-
} else {
|
|
3426
|
-
assignValue(object, key, newValue);
|
|
3427
|
-
}
|
|
3428
|
-
}
|
|
3429
|
-
return object;
|
|
3430
|
-
}
|
|
3431
|
-
module2.exports = copyObject;
|
|
3432
|
-
}
|
|
3433
|
-
});
|
|
3434
|
-
|
|
3435
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js
|
|
3436
|
-
var require_baseTimes = __commonJS({
|
|
3437
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTimes.js"(exports2, module2) {
|
|
3438
|
-
"use strict";
|
|
3439
|
-
function baseTimes(n, iteratee) {
|
|
3440
|
-
var index = -1, result = Array(n);
|
|
3441
|
-
while (++index < n) {
|
|
3442
|
-
result[index] = iteratee(index);
|
|
3443
|
-
}
|
|
3444
|
-
return result;
|
|
3445
|
-
}
|
|
3446
|
-
module2.exports = baseTimes;
|
|
3447
|
-
}
|
|
3448
|
-
});
|
|
3449
|
-
|
|
3450
3149
|
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js
|
|
3451
3150
|
var require_arrayLikeKeys = __commonJS({
|
|
3452
3151
|
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayLikeKeys.js"(exports2, module2) {
|
|
@@ -3465,447 +3164,40 @@ var require_arrayLikeKeys = __commonJS({
|
|
|
3465
3164
|
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
3466
3165
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
3467
3166
|
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
3468
|
-
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
3469
|
-
isIndex(key, length)))) {
|
|
3470
|
-
result.push(key);
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
return result;
|
|
3474
|
-
}
|
|
3475
|
-
module2.exports = arrayLikeKeys;
|
|
3476
|
-
}
|
|
3477
|
-
});
|
|
3478
|
-
|
|
3479
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeysIn.js
|
|
3480
|
-
var require_nativeKeysIn = __commonJS({
|
|
3481
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeKeysIn.js"(exports2, module2) {
|
|
3482
|
-
"use strict";
|
|
3483
|
-
function nativeKeysIn(object) {
|
|
3484
|
-
var result = [];
|
|
3485
|
-
if (object != null) {
|
|
3486
|
-
for (var key in Object(object)) {
|
|
3487
|
-
result.push(key);
|
|
3488
|
-
}
|
|
3489
|
-
}
|
|
3490
|
-
return result;
|
|
3491
|
-
}
|
|
3492
|
-
module2.exports = nativeKeysIn;
|
|
3493
|
-
}
|
|
3494
|
-
});
|
|
3495
|
-
|
|
3496
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeysIn.js
|
|
3497
|
-
var require_baseKeysIn = __commonJS({
|
|
3498
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseKeysIn.js"(exports2, module2) {
|
|
3499
|
-
"use strict";
|
|
3500
|
-
var isObject = require_isObject();
|
|
3501
|
-
var isPrototype = require_isPrototype();
|
|
3502
|
-
var nativeKeysIn = require_nativeKeysIn();
|
|
3503
|
-
var objectProto = Object.prototype;
|
|
3504
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
3505
|
-
function baseKeysIn(object) {
|
|
3506
|
-
if (!isObject(object)) {
|
|
3507
|
-
return nativeKeysIn(object);
|
|
3508
|
-
}
|
|
3509
|
-
var isProto = isPrototype(object), result = [];
|
|
3510
|
-
for (var key in object) {
|
|
3511
|
-
if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
|
|
3512
|
-
result.push(key);
|
|
3513
|
-
}
|
|
3514
|
-
}
|
|
3515
|
-
return result;
|
|
3516
|
-
}
|
|
3517
|
-
module2.exports = baseKeysIn;
|
|
3518
|
-
}
|
|
3519
|
-
});
|
|
3520
|
-
|
|
3521
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keysIn.js
|
|
3522
|
-
var require_keysIn = __commonJS({
|
|
3523
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keysIn.js"(exports2, module2) {
|
|
3524
|
-
"use strict";
|
|
3525
|
-
var arrayLikeKeys = require_arrayLikeKeys();
|
|
3526
|
-
var baseKeysIn = require_baseKeysIn();
|
|
3527
|
-
var isArrayLike = require_isArrayLike();
|
|
3528
|
-
function keysIn(object) {
|
|
3529
|
-
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
3530
|
-
}
|
|
3531
|
-
module2.exports = keysIn;
|
|
3532
|
-
}
|
|
3533
|
-
});
|
|
3534
|
-
|
|
3535
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toPlainObject.js
|
|
3536
|
-
var require_toPlainObject = __commonJS({
|
|
3537
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toPlainObject.js"(exports2, module2) {
|
|
3538
|
-
"use strict";
|
|
3539
|
-
var copyObject = require_copyObject();
|
|
3540
|
-
var keysIn = require_keysIn();
|
|
3541
|
-
function toPlainObject(value) {
|
|
3542
|
-
return copyObject(value, keysIn(value));
|
|
3543
|
-
}
|
|
3544
|
-
module2.exports = toPlainObject;
|
|
3545
|
-
}
|
|
3546
|
-
});
|
|
3547
|
-
|
|
3548
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMergeDeep.js
|
|
3549
|
-
var require_baseMergeDeep = __commonJS({
|
|
3550
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMergeDeep.js"(exports2, module2) {
|
|
3551
|
-
"use strict";
|
|
3552
|
-
var assignMergeValue = require_assignMergeValue();
|
|
3553
|
-
var cloneBuffer = require_cloneBuffer();
|
|
3554
|
-
var cloneTypedArray = require_cloneTypedArray();
|
|
3555
|
-
var copyArray = require_copyArray();
|
|
3556
|
-
var initCloneObject = require_initCloneObject();
|
|
3557
|
-
var isArguments = require_isArguments();
|
|
3558
|
-
var isArray = require_isArray();
|
|
3559
|
-
var isArrayLikeObject = require_isArrayLikeObject();
|
|
3560
|
-
var isBuffer = require_isBuffer();
|
|
3561
|
-
var isFunction = require_isFunction();
|
|
3562
|
-
var isObject = require_isObject();
|
|
3563
|
-
var isPlainObject = require_isPlainObject();
|
|
3564
|
-
var isTypedArray = require_isTypedArray();
|
|
3565
|
-
var safeGet = require_safeGet();
|
|
3566
|
-
var toPlainObject = require_toPlainObject();
|
|
3567
|
-
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
|
3568
|
-
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
|
|
3569
|
-
if (stacked) {
|
|
3570
|
-
assignMergeValue(object, key, stacked);
|
|
3571
|
-
return;
|
|
3572
|
-
}
|
|
3573
|
-
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
|
|
3574
|
-
var isCommon = newValue === void 0;
|
|
3575
|
-
if (isCommon) {
|
|
3576
|
-
var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
|
3577
|
-
newValue = srcValue;
|
|
3578
|
-
if (isArr || isBuff || isTyped) {
|
|
3579
|
-
if (isArray(objValue)) {
|
|
3580
|
-
newValue = objValue;
|
|
3581
|
-
} else if (isArrayLikeObject(objValue)) {
|
|
3582
|
-
newValue = copyArray(objValue);
|
|
3583
|
-
} else if (isBuff) {
|
|
3584
|
-
isCommon = false;
|
|
3585
|
-
newValue = cloneBuffer(srcValue, true);
|
|
3586
|
-
} else if (isTyped) {
|
|
3587
|
-
isCommon = false;
|
|
3588
|
-
newValue = cloneTypedArray(srcValue, true);
|
|
3589
|
-
} else {
|
|
3590
|
-
newValue = [];
|
|
3591
|
-
}
|
|
3592
|
-
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
|
3593
|
-
newValue = objValue;
|
|
3594
|
-
if (isArguments(objValue)) {
|
|
3595
|
-
newValue = toPlainObject(objValue);
|
|
3596
|
-
} else if (!isObject(objValue) || isFunction(objValue)) {
|
|
3597
|
-
newValue = initCloneObject(srcValue);
|
|
3598
|
-
}
|
|
3599
|
-
} else {
|
|
3600
|
-
isCommon = false;
|
|
3601
|
-
}
|
|
3602
|
-
}
|
|
3603
|
-
if (isCommon) {
|
|
3604
|
-
stack.set(srcValue, newValue);
|
|
3605
|
-
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
|
3606
|
-
stack["delete"](srcValue);
|
|
3607
|
-
}
|
|
3608
|
-
assignMergeValue(object, key, newValue);
|
|
3609
|
-
}
|
|
3610
|
-
module2.exports = baseMergeDeep;
|
|
3611
|
-
}
|
|
3612
|
-
});
|
|
3613
|
-
|
|
3614
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMerge.js
|
|
3615
|
-
var require_baseMerge = __commonJS({
|
|
3616
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMerge.js"(exports2, module2) {
|
|
3617
|
-
"use strict";
|
|
3618
|
-
var Stack = require_Stack();
|
|
3619
|
-
var assignMergeValue = require_assignMergeValue();
|
|
3620
|
-
var baseFor = require_baseFor();
|
|
3621
|
-
var baseMergeDeep = require_baseMergeDeep();
|
|
3622
|
-
var isObject = require_isObject();
|
|
3623
|
-
var keysIn = require_keysIn();
|
|
3624
|
-
var safeGet = require_safeGet();
|
|
3625
|
-
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
3626
|
-
if (object === source) {
|
|
3627
|
-
return;
|
|
3628
|
-
}
|
|
3629
|
-
baseFor(source, function(srcValue, key) {
|
|
3630
|
-
stack || (stack = new Stack());
|
|
3631
|
-
if (isObject(srcValue)) {
|
|
3632
|
-
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
|
3633
|
-
} else {
|
|
3634
|
-
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
|
3635
|
-
if (newValue === void 0) {
|
|
3636
|
-
newValue = srcValue;
|
|
3637
|
-
}
|
|
3638
|
-
assignMergeValue(object, key, newValue);
|
|
3639
|
-
}
|
|
3640
|
-
}, keysIn);
|
|
3641
|
-
}
|
|
3642
|
-
module2.exports = baseMerge;
|
|
3643
|
-
}
|
|
3644
|
-
});
|
|
3645
|
-
|
|
3646
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js
|
|
3647
|
-
var require_identity = __commonJS({
|
|
3648
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js"(exports2, module2) {
|
|
3649
|
-
"use strict";
|
|
3650
|
-
function identity(value) {
|
|
3651
|
-
return value;
|
|
3652
|
-
}
|
|
3653
|
-
module2.exports = identity;
|
|
3654
|
-
}
|
|
3655
|
-
});
|
|
3656
|
-
|
|
3657
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js
|
|
3658
|
-
var require_apply = __commonJS({
|
|
3659
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js"(exports2, module2) {
|
|
3660
|
-
"use strict";
|
|
3661
|
-
function apply(func, thisArg, args) {
|
|
3662
|
-
switch (args.length) {
|
|
3663
|
-
case 0:
|
|
3664
|
-
return func.call(thisArg);
|
|
3665
|
-
case 1:
|
|
3666
|
-
return func.call(thisArg, args[0]);
|
|
3667
|
-
case 2:
|
|
3668
|
-
return func.call(thisArg, args[0], args[1]);
|
|
3669
|
-
case 3:
|
|
3670
|
-
return func.call(thisArg, args[0], args[1], args[2]);
|
|
3671
|
-
}
|
|
3672
|
-
return func.apply(thisArg, args);
|
|
3673
|
-
}
|
|
3674
|
-
module2.exports = apply;
|
|
3675
|
-
}
|
|
3676
|
-
});
|
|
3677
|
-
|
|
3678
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js
|
|
3679
|
-
var require_overRest = __commonJS({
|
|
3680
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js"(exports2, module2) {
|
|
3681
|
-
"use strict";
|
|
3682
|
-
var apply = require_apply();
|
|
3683
|
-
var nativeMax = Math.max;
|
|
3684
|
-
function overRest(func, start, transform) {
|
|
3685
|
-
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
|
3686
|
-
return function() {
|
|
3687
|
-
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
|
|
3688
|
-
while (++index < length) {
|
|
3689
|
-
array[index] = args[start + index];
|
|
3690
|
-
}
|
|
3691
|
-
index = -1;
|
|
3692
|
-
var otherArgs = Array(start + 1);
|
|
3693
|
-
while (++index < start) {
|
|
3694
|
-
otherArgs[index] = args[index];
|
|
3695
|
-
}
|
|
3696
|
-
otherArgs[start] = transform(array);
|
|
3697
|
-
return apply(func, this, otherArgs);
|
|
3698
|
-
};
|
|
3699
|
-
}
|
|
3700
|
-
module2.exports = overRest;
|
|
3701
|
-
}
|
|
3702
|
-
});
|
|
3703
|
-
|
|
3704
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/constant.js
|
|
3705
|
-
var require_constant = __commonJS({
|
|
3706
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/constant.js"(exports2, module2) {
|
|
3707
|
-
"use strict";
|
|
3708
|
-
function constant(value) {
|
|
3709
|
-
return function() {
|
|
3710
|
-
return value;
|
|
3711
|
-
};
|
|
3712
|
-
}
|
|
3713
|
-
module2.exports = constant;
|
|
3714
|
-
}
|
|
3715
|
-
});
|
|
3716
|
-
|
|
3717
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSetToString.js
|
|
3718
|
-
var require_baseSetToString = __commonJS({
|
|
3719
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSetToString.js"(exports2, module2) {
|
|
3720
|
-
"use strict";
|
|
3721
|
-
var constant = require_constant();
|
|
3722
|
-
var defineProperty = require_defineProperty();
|
|
3723
|
-
var identity = require_identity();
|
|
3724
|
-
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
|
3725
|
-
return defineProperty(func, "toString", {
|
|
3726
|
-
"configurable": true,
|
|
3727
|
-
"enumerable": false,
|
|
3728
|
-
"value": constant(string),
|
|
3729
|
-
"writable": true
|
|
3730
|
-
});
|
|
3731
|
-
};
|
|
3732
|
-
module2.exports = baseSetToString;
|
|
3733
|
-
}
|
|
3734
|
-
});
|
|
3735
|
-
|
|
3736
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_shortOut.js
|
|
3737
|
-
var require_shortOut = __commonJS({
|
|
3738
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_shortOut.js"(exports2, module2) {
|
|
3739
|
-
"use strict";
|
|
3740
|
-
var HOT_COUNT = 800;
|
|
3741
|
-
var HOT_SPAN = 16;
|
|
3742
|
-
var nativeNow = Date.now;
|
|
3743
|
-
function shortOut(func) {
|
|
3744
|
-
var count = 0, lastCalled = 0;
|
|
3745
|
-
return function() {
|
|
3746
|
-
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
|
3747
|
-
lastCalled = stamp;
|
|
3748
|
-
if (remaining > 0) {
|
|
3749
|
-
if (++count >= HOT_COUNT) {
|
|
3750
|
-
return arguments[0];
|
|
3751
|
-
}
|
|
3752
|
-
} else {
|
|
3753
|
-
count = 0;
|
|
3754
|
-
}
|
|
3755
|
-
return func.apply(void 0, arguments);
|
|
3756
|
-
};
|
|
3757
|
-
}
|
|
3758
|
-
module2.exports = shortOut;
|
|
3759
|
-
}
|
|
3760
|
-
});
|
|
3761
|
-
|
|
3762
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js
|
|
3763
|
-
var require_setToString = __commonJS({
|
|
3764
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js"(exports2, module2) {
|
|
3765
|
-
"use strict";
|
|
3766
|
-
var baseSetToString = require_baseSetToString();
|
|
3767
|
-
var shortOut = require_shortOut();
|
|
3768
|
-
var setToString = shortOut(baseSetToString);
|
|
3769
|
-
module2.exports = setToString;
|
|
3770
|
-
}
|
|
3771
|
-
});
|
|
3772
|
-
|
|
3773
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseRest.js
|
|
3774
|
-
var require_baseRest = __commonJS({
|
|
3775
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseRest.js"(exports2, module2) {
|
|
3776
|
-
"use strict";
|
|
3777
|
-
var identity = require_identity();
|
|
3778
|
-
var overRest = require_overRest();
|
|
3779
|
-
var setToString = require_setToString();
|
|
3780
|
-
function baseRest(func, start) {
|
|
3781
|
-
return setToString(overRest(func, start, identity), func + "");
|
|
3782
|
-
}
|
|
3783
|
-
module2.exports = baseRest;
|
|
3784
|
-
}
|
|
3785
|
-
});
|
|
3786
|
-
|
|
3787
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIterateeCall.js
|
|
3788
|
-
var require_isIterateeCall = __commonJS({
|
|
3789
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIterateeCall.js"(exports2, module2) {
|
|
3790
|
-
"use strict";
|
|
3791
|
-
var eq = require_eq2();
|
|
3792
|
-
var isArrayLike = require_isArrayLike();
|
|
3793
|
-
var isIndex = require_isIndex();
|
|
3794
|
-
var isObject = require_isObject();
|
|
3795
|
-
function isIterateeCall(value, index, object) {
|
|
3796
|
-
if (!isObject(object)) {
|
|
3797
|
-
return false;
|
|
3798
|
-
}
|
|
3799
|
-
var type = typeof index;
|
|
3800
|
-
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
|
|
3801
|
-
return eq(object[index], value);
|
|
3802
|
-
}
|
|
3803
|
-
return false;
|
|
3804
|
-
}
|
|
3805
|
-
module2.exports = isIterateeCall;
|
|
3806
|
-
}
|
|
3807
|
-
});
|
|
3808
|
-
|
|
3809
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createAssigner.js
|
|
3810
|
-
var require_createAssigner = __commonJS({
|
|
3811
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createAssigner.js"(exports2, module2) {
|
|
3812
|
-
"use strict";
|
|
3813
|
-
var baseRest = require_baseRest();
|
|
3814
|
-
var isIterateeCall = require_isIterateeCall();
|
|
3815
|
-
function createAssigner(assigner) {
|
|
3816
|
-
return baseRest(function(object, sources) {
|
|
3817
|
-
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
|
|
3818
|
-
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
|
|
3819
|
-
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
3820
|
-
customizer = length < 3 ? void 0 : customizer;
|
|
3821
|
-
length = 1;
|
|
3822
|
-
}
|
|
3823
|
-
object = Object(object);
|
|
3824
|
-
while (++index < length) {
|
|
3825
|
-
var source = sources[index];
|
|
3826
|
-
if (source) {
|
|
3827
|
-
assigner(object, source, index, customizer);
|
|
3828
|
-
}
|
|
3829
|
-
}
|
|
3830
|
-
return object;
|
|
3831
|
-
});
|
|
3832
|
-
}
|
|
3833
|
-
module2.exports = createAssigner;
|
|
3834
|
-
}
|
|
3835
|
-
});
|
|
3836
|
-
|
|
3837
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/merge.js
|
|
3838
|
-
var require_merge = __commonJS({
|
|
3839
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/merge.js"(exports2, module2) {
|
|
3840
|
-
"use strict";
|
|
3841
|
-
var baseMerge = require_baseMerge();
|
|
3842
|
-
var createAssigner = require_createAssigner();
|
|
3843
|
-
var merge3 = createAssigner(function(object, source, srcIndex) {
|
|
3844
|
-
baseMerge(object, source, srcIndex);
|
|
3845
|
-
});
|
|
3846
|
-
module2.exports = merge3;
|
|
3847
|
-
}
|
|
3848
|
-
});
|
|
3849
|
-
|
|
3850
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js
|
|
3851
|
-
var require_baseGet = __commonJS({
|
|
3852
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js"(exports2, module2) {
|
|
3853
|
-
"use strict";
|
|
3854
|
-
var castPath = require_castPath();
|
|
3855
|
-
var toKey = require_toKey();
|
|
3856
|
-
function baseGet(object, path) {
|
|
3857
|
-
path = castPath(path, object);
|
|
3858
|
-
var index = 0, length = path.length;
|
|
3859
|
-
while (object != null && index < length) {
|
|
3860
|
-
object = object[toKey(path[index++])];
|
|
3167
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
3168
|
+
isIndex(key, length)))) {
|
|
3169
|
+
result.push(key);
|
|
3170
|
+
}
|
|
3861
3171
|
}
|
|
3862
|
-
return
|
|
3863
|
-
}
|
|
3864
|
-
module2.exports = baseGet;
|
|
3865
|
-
}
|
|
3866
|
-
});
|
|
3867
|
-
|
|
3868
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js
|
|
3869
|
-
var require_get = __commonJS({
|
|
3870
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js"(exports2, module2) {
|
|
3871
|
-
"use strict";
|
|
3872
|
-
var baseGet = require_baseGet();
|
|
3873
|
-
function get3(object, path, defaultValue) {
|
|
3874
|
-
var result = object == null ? void 0 : baseGet(object, path);
|
|
3875
|
-
return result === void 0 ? defaultValue : result;
|
|
3172
|
+
return result;
|
|
3876
3173
|
}
|
|
3877
|
-
module2.exports =
|
|
3174
|
+
module2.exports = arrayLikeKeys;
|
|
3878
3175
|
}
|
|
3879
3176
|
});
|
|
3880
3177
|
|
|
3881
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
3882
|
-
var
|
|
3883
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
3178
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js
|
|
3179
|
+
var require_isPrototype = __commonJS({
|
|
3180
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isPrototype.js"(exports2, module2) {
|
|
3884
3181
|
"use strict";
|
|
3885
|
-
var
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
function isString2(value) {
|
|
3890
|
-
return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
|
|
3182
|
+
var objectProto = Object.prototype;
|
|
3183
|
+
function isPrototype(value) {
|
|
3184
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
3185
|
+
return value === proto;
|
|
3891
3186
|
}
|
|
3892
|
-
module2.exports =
|
|
3187
|
+
module2.exports = isPrototype;
|
|
3893
3188
|
}
|
|
3894
3189
|
});
|
|
3895
3190
|
|
|
3896
|
-
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
3897
|
-
var
|
|
3898
|
-
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
3191
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js
|
|
3192
|
+
var require_overArg = __commonJS({
|
|
3193
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overArg.js"(exports2, module2) {
|
|
3899
3194
|
"use strict";
|
|
3900
|
-
function
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
setter(accumulator, value, iteratee(value), array);
|
|
3905
|
-
}
|
|
3906
|
-
return accumulator;
|
|
3195
|
+
function overArg(func, transform) {
|
|
3196
|
+
return function(arg) {
|
|
3197
|
+
return func(transform(arg));
|
|
3198
|
+
};
|
|
3907
3199
|
}
|
|
3908
|
-
module2.exports =
|
|
3200
|
+
module2.exports = overArg;
|
|
3909
3201
|
}
|
|
3910
3202
|
});
|
|
3911
3203
|
|
|
@@ -3943,6 +3235,19 @@ var require_baseKeys = __commonJS({
|
|
|
3943
3235
|
}
|
|
3944
3236
|
});
|
|
3945
3237
|
|
|
3238
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js
|
|
3239
|
+
var require_isArrayLike = __commonJS({
|
|
3240
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArrayLike.js"(exports2, module2) {
|
|
3241
|
+
"use strict";
|
|
3242
|
+
var isFunction = require_isFunction();
|
|
3243
|
+
var isLength = require_isLength();
|
|
3244
|
+
function isArrayLike(value) {
|
|
3245
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
3246
|
+
}
|
|
3247
|
+
module2.exports = isArrayLike;
|
|
3248
|
+
}
|
|
3249
|
+
});
|
|
3250
|
+
|
|
3946
3251
|
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keys.js
|
|
3947
3252
|
var require_keys = __commonJS({
|
|
3948
3253
|
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/keys.js"(exports2, module2) {
|
|
@@ -4022,6 +3327,104 @@ var require_baseAggregator = __commonJS({
|
|
|
4022
3327
|
}
|
|
4023
3328
|
});
|
|
4024
3329
|
|
|
3330
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js
|
|
3331
|
+
var require_stackClear = __commonJS({
|
|
3332
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackClear.js"(exports2, module2) {
|
|
3333
|
+
"use strict";
|
|
3334
|
+
var ListCache = require_ListCache();
|
|
3335
|
+
function stackClear() {
|
|
3336
|
+
this.__data__ = new ListCache();
|
|
3337
|
+
this.size = 0;
|
|
3338
|
+
}
|
|
3339
|
+
module2.exports = stackClear;
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3342
|
+
|
|
3343
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js
|
|
3344
|
+
var require_stackDelete = __commonJS({
|
|
3345
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackDelete.js"(exports2, module2) {
|
|
3346
|
+
"use strict";
|
|
3347
|
+
function stackDelete(key) {
|
|
3348
|
+
var data = this.__data__, result = data["delete"](key);
|
|
3349
|
+
this.size = data.size;
|
|
3350
|
+
return result;
|
|
3351
|
+
}
|
|
3352
|
+
module2.exports = stackDelete;
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3355
|
+
|
|
3356
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js
|
|
3357
|
+
var require_stackGet = __commonJS({
|
|
3358
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackGet.js"(exports2, module2) {
|
|
3359
|
+
"use strict";
|
|
3360
|
+
function stackGet(key) {
|
|
3361
|
+
return this.__data__.get(key);
|
|
3362
|
+
}
|
|
3363
|
+
module2.exports = stackGet;
|
|
3364
|
+
}
|
|
3365
|
+
});
|
|
3366
|
+
|
|
3367
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js
|
|
3368
|
+
var require_stackHas = __commonJS({
|
|
3369
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackHas.js"(exports2, module2) {
|
|
3370
|
+
"use strict";
|
|
3371
|
+
function stackHas(key) {
|
|
3372
|
+
return this.__data__.has(key);
|
|
3373
|
+
}
|
|
3374
|
+
module2.exports = stackHas;
|
|
3375
|
+
}
|
|
3376
|
+
});
|
|
3377
|
+
|
|
3378
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js
|
|
3379
|
+
var require_stackSet = __commonJS({
|
|
3380
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stackSet.js"(exports2, module2) {
|
|
3381
|
+
"use strict";
|
|
3382
|
+
var ListCache = require_ListCache();
|
|
3383
|
+
var Map2 = require_Map();
|
|
3384
|
+
var MapCache = require_MapCache();
|
|
3385
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
3386
|
+
function stackSet(key, value) {
|
|
3387
|
+
var data = this.__data__;
|
|
3388
|
+
if (data instanceof ListCache) {
|
|
3389
|
+
var pairs = data.__data__;
|
|
3390
|
+
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
3391
|
+
pairs.push([key, value]);
|
|
3392
|
+
this.size = ++data.size;
|
|
3393
|
+
return this;
|
|
3394
|
+
}
|
|
3395
|
+
data = this.__data__ = new MapCache(pairs);
|
|
3396
|
+
}
|
|
3397
|
+
data.set(key, value);
|
|
3398
|
+
this.size = data.size;
|
|
3399
|
+
return this;
|
|
3400
|
+
}
|
|
3401
|
+
module2.exports = stackSet;
|
|
3402
|
+
}
|
|
3403
|
+
});
|
|
3404
|
+
|
|
3405
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js
|
|
3406
|
+
var require_Stack = __commonJS({
|
|
3407
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Stack.js"(exports2, module2) {
|
|
3408
|
+
"use strict";
|
|
3409
|
+
var ListCache = require_ListCache();
|
|
3410
|
+
var stackClear = require_stackClear();
|
|
3411
|
+
var stackDelete = require_stackDelete();
|
|
3412
|
+
var stackGet = require_stackGet();
|
|
3413
|
+
var stackHas = require_stackHas();
|
|
3414
|
+
var stackSet = require_stackSet();
|
|
3415
|
+
function Stack(entries) {
|
|
3416
|
+
var data = this.__data__ = new ListCache(entries);
|
|
3417
|
+
this.size = data.size;
|
|
3418
|
+
}
|
|
3419
|
+
Stack.prototype.clear = stackClear;
|
|
3420
|
+
Stack.prototype["delete"] = stackDelete;
|
|
3421
|
+
Stack.prototype.get = stackGet;
|
|
3422
|
+
Stack.prototype.has = stackHas;
|
|
3423
|
+
Stack.prototype.set = stackSet;
|
|
3424
|
+
module2.exports = Stack;
|
|
3425
|
+
}
|
|
3426
|
+
});
|
|
3427
|
+
|
|
4025
3428
|
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheAdd.js
|
|
4026
3429
|
var require_setCacheAdd = __commonJS({
|
|
4027
3430
|
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setCacheAdd.js"(exports2, module2) {
|
|
@@ -4150,6 +3553,16 @@ var require_equalArrays = __commonJS({
|
|
|
4150
3553
|
}
|
|
4151
3554
|
});
|
|
4152
3555
|
|
|
3556
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js
|
|
3557
|
+
var require_Uint8Array = __commonJS({
|
|
3558
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Uint8Array.js"(exports2, module2) {
|
|
3559
|
+
"use strict";
|
|
3560
|
+
var root = require_root();
|
|
3561
|
+
var Uint8Array2 = root.Uint8Array;
|
|
3562
|
+
module2.exports = Uint8Array2;
|
|
3563
|
+
}
|
|
3564
|
+
});
|
|
3565
|
+
|
|
4153
3566
|
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapToArray.js
|
|
4154
3567
|
var require_mapToArray = __commonJS({
|
|
4155
3568
|
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapToArray.js"(exports2, module2) {
|
|
@@ -4734,7 +4147,7 @@ var require_baseMatchesProperty = __commonJS({
|
|
|
4734
4147
|
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseMatchesProperty.js"(exports2, module2) {
|
|
4735
4148
|
"use strict";
|
|
4736
4149
|
var baseIsEqual = require_baseIsEqual();
|
|
4737
|
-
var
|
|
4150
|
+
var get2 = require_get();
|
|
4738
4151
|
var hasIn = require_hasIn();
|
|
4739
4152
|
var isKey = require_isKey();
|
|
4740
4153
|
var isStrictComparable = require_isStrictComparable();
|
|
@@ -4747,7 +4160,7 @@ var require_baseMatchesProperty = __commonJS({
|
|
|
4747
4160
|
return matchesStrictComparable(toKey(path), srcValue);
|
|
4748
4161
|
}
|
|
4749
4162
|
return function(object) {
|
|
4750
|
-
var objValue =
|
|
4163
|
+
var objValue = get2(object, path);
|
|
4751
4164
|
return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
4752
4165
|
};
|
|
4753
4166
|
}
|
|
@@ -4755,6 +4168,17 @@ var require_baseMatchesProperty = __commonJS({
|
|
|
4755
4168
|
}
|
|
4756
4169
|
});
|
|
4757
4170
|
|
|
4171
|
+
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js
|
|
4172
|
+
var require_identity = __commonJS({
|
|
4173
|
+
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js"(exports2, module2) {
|
|
4174
|
+
"use strict";
|
|
4175
|
+
function identity(value) {
|
|
4176
|
+
return value;
|
|
4177
|
+
}
|
|
4178
|
+
module2.exports = identity;
|
|
4179
|
+
}
|
|
4180
|
+
});
|
|
4181
|
+
|
|
4758
4182
|
// ../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js
|
|
4759
4183
|
var require_baseProperty = __commonJS({
|
|
4760
4184
|
"../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseProperty.js"(exports2, module2) {
|
|
@@ -4864,7 +4288,7 @@ var import_commander = require("commander");
|
|
|
4864
4288
|
|
|
4865
4289
|
// package.json
|
|
4866
4290
|
var description = "A tool for releasing front-end projects, supporting multiple release modes and configurations, simplifying the release process and improving efficiency.";
|
|
4867
|
-
var version = "
|
|
4291
|
+
var version = "3.1.0";
|
|
4868
4292
|
|
|
4869
4293
|
// src/cli.ts
|
|
4870
4294
|
var import_semver = __toESM(require_semver2(), 1);
|
|
@@ -4891,10 +4315,7 @@ function tuple(plugin, ...args) {
|
|
|
4891
4315
|
var import_fe_corekit = require("@qlover/fe-corekit");
|
|
4892
4316
|
|
|
4893
4317
|
// src/implments/ReleaseContext.ts
|
|
4894
|
-
var import_scripts_context = require("@qlover/scripts-context");
|
|
4895
|
-
var import_merge = __toESM(require_merge(), 1);
|
|
4896
4318
|
var import_get = __toESM(require_get(), 1);
|
|
4897
|
-
var import_env_loader = require("@qlover/env-loader");
|
|
4898
4319
|
|
|
4899
4320
|
// src/defaults.ts
|
|
4900
4321
|
var DEFAULT_SOURCE_BRANCH = "master";
|
|
@@ -4908,68 +4329,167 @@ var WORKSPACE_VERSION_SEPARATOR = "@";
|
|
|
4908
4329
|
var BATCH_PR_BODY = "\n## ${name} ${version}\n${changelog}\n";
|
|
4909
4330
|
|
|
4910
4331
|
// src/implments/ReleaseContext.ts
|
|
4911
|
-
var
|
|
4912
|
-
var ReleaseContext = class extends import_scripts_context.
|
|
4913
|
-
_env;
|
|
4332
|
+
var import_scripts_context = require("@qlover/scripts-context");
|
|
4333
|
+
var ReleaseContext = class extends import_scripts_context.ScriptContext {
|
|
4914
4334
|
/**
|
|
4915
|
-
*
|
|
4335
|
+
* Creates a new ReleaseContext instance
|
|
4336
|
+
*
|
|
4337
|
+
* Initializes the context with provided options and sets up
|
|
4338
|
+
* default values for required configuration:
|
|
4339
|
+
* - rootPath: Defaults to current working directory
|
|
4340
|
+
* - sourceBranch: Uses environment variables or default
|
|
4341
|
+
* - releaseEnv: Uses environment variables or 'development'
|
|
4342
|
+
*
|
|
4343
|
+
* Environment Variable Priority:
|
|
4344
|
+
* - sourceBranch: FE_RELEASE_BRANCH > FE_RELEASE_SOURCE_BRANCH > DEFAULT_SOURCE_BRANCH
|
|
4345
|
+
* - releaseEnv: FE_RELEASE_ENV > NODE_ENV > 'development'
|
|
4346
|
+
*
|
|
4347
|
+
* @param name - Unique identifier for this release context
|
|
4348
|
+
* @param options - Configuration options
|
|
4349
|
+
*
|
|
4350
|
+
* @example
|
|
4351
|
+
* ```typescript
|
|
4352
|
+
* const context = new ReleaseContext('web-app', {
|
|
4353
|
+
* rootPath: '/projects/web-app',
|
|
4354
|
+
* sourceBranch: 'main',
|
|
4355
|
+
* releaseEnv: 'production'
|
|
4356
|
+
* });
|
|
4357
|
+
* ```
|
|
4916
4358
|
*/
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
this.
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
return {
|
|
4933
|
-
rootPath: process.cwd(),
|
|
4934
|
-
// use currentBranch by default
|
|
4935
|
-
sourceBranch: this._env.get("FE_RELEASE_BRANCH") || this._env.get("FE_RELEASE_SOURCE_BRANCH") || DEFAULT_SOURCE_BRANCH,
|
|
4936
|
-
releaseEnv: this._env.get("FE_RELEASE_ENV") || this._env.get("NODE_ENV") || "development",
|
|
4937
|
-
...props
|
|
4938
|
-
};
|
|
4359
|
+
constructor(name, options) {
|
|
4360
|
+
super(name, options);
|
|
4361
|
+
if (!this.options.rootPath) {
|
|
4362
|
+
this.setOptions({ rootPath: process.cwd() });
|
|
4363
|
+
}
|
|
4364
|
+
if (!this.options.sourceBranch) {
|
|
4365
|
+
this.setOptions({
|
|
4366
|
+
sourceBranch: this.env.get("FE_RELEASE_BRANCH") || this.env.get("FE_RELEASE_SOURCE_BRANCH") || DEFAULT_SOURCE_BRANCH
|
|
4367
|
+
});
|
|
4368
|
+
}
|
|
4369
|
+
if (!this.options.releaseEnv) {
|
|
4370
|
+
this.setOptions({
|
|
4371
|
+
releaseEnv: this.env.get("FE_RELEASE_ENV") || this.env.get("NODE_ENV") || "development"
|
|
4372
|
+
});
|
|
4373
|
+
}
|
|
4939
4374
|
}
|
|
4375
|
+
/**
|
|
4376
|
+
* Gets the root path of the project
|
|
4377
|
+
*
|
|
4378
|
+
* @returns Absolute path to project root
|
|
4379
|
+
*
|
|
4380
|
+
* @example
|
|
4381
|
+
* ```typescript
|
|
4382
|
+
* const root = context.rootPath;
|
|
4383
|
+
* // '/path/to/project'
|
|
4384
|
+
* ```
|
|
4385
|
+
*/
|
|
4940
4386
|
get rootPath() {
|
|
4941
|
-
return this.
|
|
4387
|
+
return this.getOptions("rootPath");
|
|
4942
4388
|
}
|
|
4389
|
+
/**
|
|
4390
|
+
* Gets the source branch for the release
|
|
4391
|
+
*
|
|
4392
|
+
* @returns Branch name to use as source
|
|
4393
|
+
*
|
|
4394
|
+
* @example
|
|
4395
|
+
* ```typescript
|
|
4396
|
+
* const branch = context.sourceBranch;
|
|
4397
|
+
* // 'main' or custom branch name
|
|
4398
|
+
* ```
|
|
4399
|
+
*/
|
|
4943
4400
|
get sourceBranch() {
|
|
4944
|
-
return this.
|
|
4401
|
+
return this.getOptions("sourceBranch");
|
|
4945
4402
|
}
|
|
4403
|
+
/**
|
|
4404
|
+
* Gets the release environment
|
|
4405
|
+
*
|
|
4406
|
+
* @returns Environment name (e.g., 'development', 'production')
|
|
4407
|
+
*
|
|
4408
|
+
* @example
|
|
4409
|
+
* ```typescript
|
|
4410
|
+
* const env = context.releaseEnv;
|
|
4411
|
+
* // 'development' or custom environment
|
|
4412
|
+
* ```
|
|
4413
|
+
*/
|
|
4946
4414
|
get releaseEnv() {
|
|
4947
|
-
return this.
|
|
4948
|
-
}
|
|
4949
|
-
get env() {
|
|
4950
|
-
return this._env;
|
|
4415
|
+
return this.getOptions("releaseEnv");
|
|
4951
4416
|
}
|
|
4417
|
+
/**
|
|
4418
|
+
* Gets all configured workspaces
|
|
4419
|
+
*
|
|
4420
|
+
* @returns Array of workspace configurations or undefined
|
|
4421
|
+
*
|
|
4422
|
+
* @example
|
|
4423
|
+
* ```typescript
|
|
4424
|
+
* const allWorkspaces = context.workspaces;
|
|
4425
|
+
* // [{ name: 'pkg-a', version: '1.0.0', ... }]
|
|
4426
|
+
* ```
|
|
4427
|
+
*/
|
|
4952
4428
|
get workspaces() {
|
|
4953
|
-
return this.
|
|
4429
|
+
return this.getOptions("workspaces.workspaces");
|
|
4954
4430
|
}
|
|
4431
|
+
/**
|
|
4432
|
+
* Gets the current active workspace
|
|
4433
|
+
*
|
|
4434
|
+
* @returns Current workspace configuration or undefined
|
|
4435
|
+
*
|
|
4436
|
+
* @example
|
|
4437
|
+
* ```typescript
|
|
4438
|
+
* const current = context.workspace;
|
|
4439
|
+
* // { name: 'pkg-a', version: '1.0.0', ... }
|
|
4440
|
+
* ```
|
|
4441
|
+
*/
|
|
4955
4442
|
get workspace() {
|
|
4956
|
-
return this.
|
|
4443
|
+
return this.getOptions("workspaces.workspace");
|
|
4957
4444
|
}
|
|
4445
|
+
/**
|
|
4446
|
+
* Sets the workspace configurations
|
|
4447
|
+
*
|
|
4448
|
+
* Updates the workspace list while preserving other workspace settings
|
|
4449
|
+
*
|
|
4450
|
+
* @param workspaces - Array of workspace configurations
|
|
4451
|
+
*
|
|
4452
|
+
* @example
|
|
4453
|
+
* ```typescript
|
|
4454
|
+
* context.setWorkspaces([{
|
|
4455
|
+
* name: 'pkg-a',
|
|
4456
|
+
* version: '1.0.0',
|
|
4457
|
+
* path: 'packages/a'
|
|
4458
|
+
* }]);
|
|
4459
|
+
* ```
|
|
4460
|
+
*/
|
|
4958
4461
|
setWorkspaces(workspaces) {
|
|
4959
4462
|
this.options.workspaces = {
|
|
4960
4463
|
...this.options.workspaces,
|
|
4961
4464
|
workspaces
|
|
4962
4465
|
};
|
|
4963
4466
|
}
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4467
|
+
/**
|
|
4468
|
+
* Gets package.json data for the current workspace
|
|
4469
|
+
*
|
|
4470
|
+
* Provides type-safe access to package.json fields with optional
|
|
4471
|
+
* path and default value support.
|
|
4472
|
+
*
|
|
4473
|
+
* @param key - Optional dot-notation path to specific field
|
|
4474
|
+
* @param defaultValue - Default value if field not found
|
|
4475
|
+
* @returns Package data of type T
|
|
4476
|
+
* @throws Error if package.json not found
|
|
4477
|
+
*
|
|
4478
|
+
* @example Basic usage
|
|
4479
|
+
* ```typescript
|
|
4480
|
+
* // Get entire package.json
|
|
4481
|
+
* const pkg = context.getPkg();
|
|
4482
|
+
*
|
|
4483
|
+
* // Get specific field
|
|
4484
|
+
* const version = context.getPkg<string>('version');
|
|
4485
|
+
*
|
|
4486
|
+
* // Get nested field with default
|
|
4487
|
+
* const script = context.getPkg<string>(
|
|
4488
|
+
* 'scripts.build',
|
|
4489
|
+
* 'echo "No build script"'
|
|
4490
|
+
* );
|
|
4491
|
+
* ```
|
|
4492
|
+
*/
|
|
4973
4493
|
getPkg(key, defaultValue) {
|
|
4974
4494
|
const packageJson = this.workspace?.packageJson;
|
|
4975
4495
|
if (!packageJson) {
|
|
@@ -4980,9 +4500,31 @@ var ReleaseContext = class extends import_scripts_context.FeScriptContext {
|
|
|
4980
4500
|
}
|
|
4981
4501
|
return (0, import_get.default)(packageJson, key, defaultValue);
|
|
4982
4502
|
}
|
|
4503
|
+
/**
|
|
4504
|
+
* Generates template context for string interpolation
|
|
4505
|
+
*
|
|
4506
|
+
* Combines context options, workspace data, and specific paths
|
|
4507
|
+
* for use in template processing. Includes deprecated fields
|
|
4508
|
+
* for backward compatibility.
|
|
4509
|
+
*
|
|
4510
|
+
* @returns Combined template context
|
|
4511
|
+
*
|
|
4512
|
+
* @example
|
|
4513
|
+
* ```typescript
|
|
4514
|
+
* const context = releaseContext.getTemplateContext();
|
|
4515
|
+
* // {
|
|
4516
|
+
* // publishPath: 'packages/my-pkg',
|
|
4517
|
+
* // env: 'production', // deprecated
|
|
4518
|
+
* // branch: 'main', // deprecated
|
|
4519
|
+
* // releaseEnv: 'production', // use this instead
|
|
4520
|
+
* // sourceBranch: 'main', // use this instead
|
|
4521
|
+
* // ...other options
|
|
4522
|
+
* // }
|
|
4523
|
+
* ```
|
|
4524
|
+
*/
|
|
4983
4525
|
getTemplateContext() {
|
|
4984
4526
|
return {
|
|
4985
|
-
...this.
|
|
4527
|
+
...this.getOptions(),
|
|
4986
4528
|
...this.workspace,
|
|
4987
4529
|
publishPath: this.workspace?.path || "",
|
|
4988
4530
|
// deprecated
|
|
@@ -4990,6 +4532,28 @@ var ReleaseContext = class extends import_scripts_context.FeScriptContext {
|
|
|
4990
4532
|
branch: this.sourceBranch
|
|
4991
4533
|
};
|
|
4992
4534
|
}
|
|
4535
|
+
/**
|
|
4536
|
+
* Executes changeset CLI commands
|
|
4537
|
+
*
|
|
4538
|
+
* Automatically detects and uses appropriate package manager
|
|
4539
|
+
* (pnpm or npx) to run changeset commands.
|
|
4540
|
+
*
|
|
4541
|
+
* @param name - Changeset command name
|
|
4542
|
+
* @param args - Optional command arguments
|
|
4543
|
+
* @returns Command output
|
|
4544
|
+
*
|
|
4545
|
+
* @example Version bump
|
|
4546
|
+
* ```typescript
|
|
4547
|
+
* // Bump version with snapshot
|
|
4548
|
+
* await context.runChangesetsCli('version', ['--snapshot', 'alpha']);
|
|
4549
|
+
*
|
|
4550
|
+
* // Create new changeset
|
|
4551
|
+
* await context.runChangesetsCli('add');
|
|
4552
|
+
*
|
|
4553
|
+
* // Status check
|
|
4554
|
+
* await context.runChangesetsCli('status');
|
|
4555
|
+
* ```
|
|
4556
|
+
*/
|
|
4993
4557
|
async runChangesetsCli(name, args) {
|
|
4994
4558
|
let packageManager = "pnpm";
|
|
4995
4559
|
try {
|
|
@@ -5007,6 +4571,7 @@ var ReleaseContext = class extends import_scripts_context.FeScriptContext {
|
|
|
5007
4571
|
};
|
|
5008
4572
|
|
|
5009
4573
|
// src/implments/ReleaseParams.ts
|
|
4574
|
+
var import_scripts_context2 = require("@qlover/scripts-context");
|
|
5010
4575
|
var DEFAULT_RELEASE_CONFIG = {
|
|
5011
4576
|
maxWorkspace: MAX_WORKSPACE,
|
|
5012
4577
|
multiWorkspaceSeparator: MULTI_WORKSPACE_SEPARATOR,
|
|
@@ -5015,22 +4580,85 @@ var DEFAULT_RELEASE_CONFIG = {
|
|
|
5015
4580
|
batchTagName: "batch-${length}-packages-${timestamp}"
|
|
5016
4581
|
};
|
|
5017
4582
|
var ReleaseParams = class {
|
|
5018
|
-
|
|
5019
|
-
|
|
4583
|
+
/**
|
|
4584
|
+
* Creates a new ReleaseParams instance
|
|
4585
|
+
*
|
|
4586
|
+
* Initializes with logger for debug output and optional configuration
|
|
4587
|
+
* overrides. Uses default configuration values for any unspecified options.
|
|
4588
|
+
*
|
|
4589
|
+
* @param logger - Logger instance for debug output
|
|
4590
|
+
* @param config - Optional configuration overrides
|
|
4591
|
+
*
|
|
4592
|
+
* @example
|
|
4593
|
+
* ```typescript
|
|
4594
|
+
* // Basic initialization
|
|
4595
|
+
* const params = new ReleaseParams(logger);
|
|
4596
|
+
*
|
|
4597
|
+
* // With custom configuration
|
|
4598
|
+
* const params = new ReleaseParams(logger, {
|
|
4599
|
+
* maxWorkspace: 5,
|
|
4600
|
+
* multiWorkspaceSeparator: '-',
|
|
4601
|
+
* workspaceVersionSeparator: '#'
|
|
4602
|
+
* });
|
|
4603
|
+
* ```
|
|
4604
|
+
*/
|
|
4605
|
+
constructor(logger, config = {}) {
|
|
5020
4606
|
this.logger = logger;
|
|
5021
4607
|
this.config = {
|
|
5022
4608
|
...DEFAULT_RELEASE_CONFIG,
|
|
5023
4609
|
...config
|
|
5024
4610
|
};
|
|
5025
4611
|
}
|
|
4612
|
+
/**
|
|
4613
|
+
* Current configuration
|
|
4614
|
+
* @private
|
|
4615
|
+
*/
|
|
5026
4616
|
config;
|
|
4617
|
+
/**
|
|
4618
|
+
* Generates a release branch name for a single package
|
|
4619
|
+
*
|
|
4620
|
+
* Uses the branch name template from shared configuration or
|
|
4621
|
+
* falls back to the default template 'release-${tagName}'.
|
|
4622
|
+
* Supports variable interpolation in the template.
|
|
4623
|
+
*
|
|
4624
|
+
* Template Variables:
|
|
4625
|
+
* - ${pkgName}: Package name
|
|
4626
|
+
* - ${releaseName}: Release name (same as pkgName)
|
|
4627
|
+
* - ${tagName}: Release tag
|
|
4628
|
+
* - All shared config properties
|
|
4629
|
+
*
|
|
4630
|
+
* @param releaseName - Name of the package being released
|
|
4631
|
+
* @param tagName - Version tag for the release
|
|
4632
|
+
* @param shared - Shared configuration with branch template
|
|
4633
|
+
* @returns Formatted branch name
|
|
4634
|
+
* @throws Error if branch name template is not a string
|
|
4635
|
+
*
|
|
4636
|
+
* @example
|
|
4637
|
+
* ```typescript
|
|
4638
|
+
* // With default template
|
|
4639
|
+
* const branch = params.getReleaseBranchName(
|
|
4640
|
+
* 'my-pkg',
|
|
4641
|
+
* 'v1.0.0',
|
|
4642
|
+
* {}
|
|
4643
|
+
* );
|
|
4644
|
+
* // 'release-v1.0.0'
|
|
4645
|
+
*
|
|
4646
|
+
* // With custom template
|
|
4647
|
+
* const branch = params.getReleaseBranchName(
|
|
4648
|
+
* 'my-pkg',
|
|
4649
|
+
* 'v1.0.0',
|
|
4650
|
+
* { branchName: '${pkgName}-release-${tagName}' }
|
|
4651
|
+
* );
|
|
4652
|
+
* // 'my-pkg-release-v1.0.0'
|
|
4653
|
+
* ```
|
|
4654
|
+
*/
|
|
5027
4655
|
getReleaseBranchName(releaseName, tagName, shared) {
|
|
5028
4656
|
const branchNameTpl = shared.branchName || "release-${tagName}";
|
|
5029
4657
|
if (typeof branchNameTpl !== "string") {
|
|
5030
4658
|
throw new Error("Branch name template is not a string");
|
|
5031
4659
|
}
|
|
5032
4660
|
this.logger.debug("Release Branch template is:", branchNameTpl);
|
|
5033
|
-
return
|
|
4661
|
+
return import_scripts_context2.Shell.format(branchNameTpl, {
|
|
5034
4662
|
pkgName: releaseName,
|
|
5035
4663
|
releaseName,
|
|
5036
4664
|
tagName,
|
|
@@ -5038,13 +4666,56 @@ var ReleaseParams = class {
|
|
|
5038
4666
|
...shared
|
|
5039
4667
|
});
|
|
5040
4668
|
}
|
|
4669
|
+
/**
|
|
4670
|
+
* Generates a release branch name for multiple packages
|
|
4671
|
+
*
|
|
4672
|
+
* Uses the batch branch name template from configuration.
|
|
4673
|
+
* Supports variable interpolation with additional batch-specific
|
|
4674
|
+
* variables.
|
|
4675
|
+
*
|
|
4676
|
+
* Template Variables:
|
|
4677
|
+
* - ${pkgName}: Package name
|
|
4678
|
+
* - ${releaseName}: Combined release name
|
|
4679
|
+
* - ${tagName}: Combined tag name
|
|
4680
|
+
* - ${length}: Number of packages
|
|
4681
|
+
* - ${timestamp}: Current timestamp
|
|
4682
|
+
* - All shared config properties
|
|
4683
|
+
*
|
|
4684
|
+
* @param releaseName - Combined name of packages
|
|
4685
|
+
* @param tagName - Combined version tag
|
|
4686
|
+
* @param shared - Shared configuration
|
|
4687
|
+
* @param length - Number of packages in batch
|
|
4688
|
+
* @returns Formatted batch branch name
|
|
4689
|
+
* @throws Error if branch name template is not a string
|
|
4690
|
+
*
|
|
4691
|
+
* @example
|
|
4692
|
+
* ```typescript
|
|
4693
|
+
* // With default template
|
|
4694
|
+
* const branch = params.getBatchReleaseBranchName(
|
|
4695
|
+
* 'pkg-a@1.0.0_pkg-b@2.0.0',
|
|
4696
|
+
* 'batch-2-packages-1234567890',
|
|
4697
|
+
* {},
|
|
4698
|
+
* 2
|
|
4699
|
+
* );
|
|
4700
|
+
* // 'batch-pkg-a@1.0.0_pkg-b@2.0.0-2-packages-1234567890'
|
|
4701
|
+
*
|
|
4702
|
+
* // With custom template
|
|
4703
|
+
* const branch = params.getBatchReleaseBranchName(
|
|
4704
|
+
* 'pkg-a@1.0.0_pkg-b@2.0.0',
|
|
4705
|
+
* 'v1.0.0',
|
|
4706
|
+
* {},
|
|
4707
|
+
* 2,
|
|
4708
|
+
* );
|
|
4709
|
+
* // Custom formatted branch name
|
|
4710
|
+
* ```
|
|
4711
|
+
*/
|
|
5041
4712
|
getBatchReleaseBranchName(releaseName, tagName, shared, length) {
|
|
5042
4713
|
const branchNameTpl = this.config.batchBranchName;
|
|
5043
4714
|
if (typeof branchNameTpl !== "string") {
|
|
5044
4715
|
throw new Error("Branch name template is not a string");
|
|
5045
4716
|
}
|
|
5046
4717
|
this.logger.debug("Release Batch Branch template is:", branchNameTpl);
|
|
5047
|
-
return
|
|
4718
|
+
return import_scripts_context2.Shell.format(branchNameTpl, {
|
|
5048
4719
|
pkgName: releaseName,
|
|
5049
4720
|
releaseName,
|
|
5050
4721
|
tagName,
|
|
@@ -5054,6 +4725,45 @@ var ReleaseParams = class {
|
|
|
5054
4725
|
timestamp: Date.now()
|
|
5055
4726
|
});
|
|
5056
4727
|
}
|
|
4728
|
+
/**
|
|
4729
|
+
* Generates a release name from workspace configurations
|
|
4730
|
+
*
|
|
4731
|
+
* For single packages, returns the package name.
|
|
4732
|
+
* For multiple packages, combines names and versions up to
|
|
4733
|
+
* the configured maximum number of workspaces.
|
|
4734
|
+
*
|
|
4735
|
+
* Format:
|
|
4736
|
+
* - Single: packageName
|
|
4737
|
+
* - Multiple: pkg1@1.0.0_pkg2@2.0.0_pkg3@3.0.0
|
|
4738
|
+
*
|
|
4739
|
+
* @param composeWorkspaces - Array of workspace configurations
|
|
4740
|
+
* @returns Formatted release name
|
|
4741
|
+
*
|
|
4742
|
+
* @example
|
|
4743
|
+
* ```typescript
|
|
4744
|
+
* // Single package
|
|
4745
|
+
* const name = params.getReleaseName([
|
|
4746
|
+
* { name: 'pkg-a', version: '1.0.0' }
|
|
4747
|
+
* ]);
|
|
4748
|
+
* // 'pkg-a'
|
|
4749
|
+
*
|
|
4750
|
+
* // Multiple packages
|
|
4751
|
+
* const name = params.getReleaseName([
|
|
4752
|
+
* { name: 'pkg-a', version: '1.0.0' },
|
|
4753
|
+
* { name: 'pkg-b', version: '2.0.0' }
|
|
4754
|
+
* ]);
|
|
4755
|
+
* // 'pkg-a@1.0.0_pkg-b@2.0.0'
|
|
4756
|
+
*
|
|
4757
|
+
* // With max limit
|
|
4758
|
+
* const name = params.getReleaseName([
|
|
4759
|
+
* { name: 'pkg-a', version: '1.0.0' },
|
|
4760
|
+
* { name: 'pkg-b', version: '2.0.0' },
|
|
4761
|
+
* { name: 'pkg-c', version: '3.0.0' },
|
|
4762
|
+
* { name: 'pkg-d', version: '4.0.0' }
|
|
4763
|
+
* ]);
|
|
4764
|
+
* // Only first 3: 'pkg-a@1.0.0_pkg-b@2.0.0_pkg-c@3.0.0'
|
|
4765
|
+
* ```
|
|
4766
|
+
*/
|
|
5057
4767
|
getReleaseName(composeWorkspaces) {
|
|
5058
4768
|
if (composeWorkspaces.length === 1) {
|
|
5059
4769
|
return composeWorkspaces[0].name;
|
|
@@ -5063,16 +4773,84 @@ var ReleaseParams = class {
|
|
|
5063
4773
|
({ name, version: version2 }) => `${name}${workspaceVersionSeparator}${version2}`
|
|
5064
4774
|
).join(multiWorkspaceSeparator);
|
|
5065
4775
|
}
|
|
4776
|
+
/**
|
|
4777
|
+
* Generates a tag name for the release
|
|
4778
|
+
*
|
|
4779
|
+
* For single packages, uses the package version.
|
|
4780
|
+
* For multiple packages, generates a batch tag name using
|
|
4781
|
+
* the configured template.
|
|
4782
|
+
*
|
|
4783
|
+
* Format:
|
|
4784
|
+
* - Single: version
|
|
4785
|
+
* - Multiple: batch-${length}-packages-${timestamp}
|
|
4786
|
+
*
|
|
4787
|
+
* @param composeWorkspaces - Array of workspace configurations
|
|
4788
|
+
* @returns Formatted tag name
|
|
4789
|
+
*
|
|
4790
|
+
* @example
|
|
4791
|
+
* ```typescript
|
|
4792
|
+
* // Single package
|
|
4793
|
+
* const tag = params.getReleaseTagName([
|
|
4794
|
+
* { name: 'pkg-a', version: '1.0.0' }
|
|
4795
|
+
* ]);
|
|
4796
|
+
* // '1.0.0'
|
|
4797
|
+
*
|
|
4798
|
+
* // Multiple packages
|
|
4799
|
+
* const tag = params.getReleaseTagName([
|
|
4800
|
+
* { name: 'pkg-a', version: '1.0.0' },
|
|
4801
|
+
* { name: 'pkg-b', version: '2.0.0' }
|
|
4802
|
+
* ]);
|
|
4803
|
+
* // 'batch-2-packages-1234567890'
|
|
4804
|
+
* ```
|
|
4805
|
+
*/
|
|
5066
4806
|
getReleaseTagName(composeWorkspaces) {
|
|
5067
4807
|
if (composeWorkspaces.length === 1) {
|
|
5068
4808
|
return composeWorkspaces[0].version;
|
|
5069
4809
|
}
|
|
5070
4810
|
const { batchTagName } = this.config;
|
|
5071
|
-
return
|
|
4811
|
+
return import_scripts_context2.Shell.format(batchTagName, {
|
|
5072
4812
|
length: composeWorkspaces.length,
|
|
5073
4813
|
timestamp: Date.now()
|
|
5074
4814
|
});
|
|
5075
4815
|
}
|
|
4816
|
+
/**
|
|
4817
|
+
* Generates branch and tag parameters for the release
|
|
4818
|
+
*
|
|
4819
|
+
* Combines the generation of branch name and tag name into
|
|
4820
|
+
* a single operation. Handles both single and multi-package
|
|
4821
|
+
* releases appropriately.
|
|
4822
|
+
*
|
|
4823
|
+
* @param composeWorkspaces - Array of workspace configurations
|
|
4824
|
+
* @param shared - Shared configuration
|
|
4825
|
+
* @returns Object containing tag name and branch name
|
|
4826
|
+
*
|
|
4827
|
+
* @example Single package
|
|
4828
|
+
* ```typescript
|
|
4829
|
+
* const params = releaseParams.getReleaseBranchParams(
|
|
4830
|
+
* [{ name: 'pkg-a', version: '1.0.0' }],
|
|
4831
|
+
* { branchName: 'release-${tagName}' }
|
|
4832
|
+
* );
|
|
4833
|
+
* // {
|
|
4834
|
+
* // tagName: '1.0.0',
|
|
4835
|
+
* // releaseBranch: 'release-1.0.0'
|
|
4836
|
+
* // }
|
|
4837
|
+
* ```
|
|
4838
|
+
*
|
|
4839
|
+
* @example Multiple packages
|
|
4840
|
+
* ```typescript
|
|
4841
|
+
* const params = releaseParams.getReleaseBranchParams(
|
|
4842
|
+
* [
|
|
4843
|
+
* { name: 'pkg-a', version: '1.0.0' },
|
|
4844
|
+
* { name: 'pkg-b', version: '2.0.0' }
|
|
4845
|
+
* ],
|
|
4846
|
+
* {}
|
|
4847
|
+
* );
|
|
4848
|
+
* // {
|
|
4849
|
+
* // tagName: 'batch-2-packages-1234567890',
|
|
4850
|
+
* // releaseBranch: 'batch-pkg-a@1.0.0_pkg-b@2.0.0-2-packages-1234567890'
|
|
4851
|
+
* // }
|
|
4852
|
+
* ```
|
|
4853
|
+
*/
|
|
5076
4854
|
getReleaseBranchParams(composeWorkspaces, shared) {
|
|
5077
4855
|
const releaseTagName = this.getReleaseTagName(composeWorkspaces);
|
|
5078
4856
|
const releaseName = this.getReleaseName(composeWorkspaces);
|
|
@@ -5087,24 +4865,125 @@ var ReleaseParams = class {
|
|
|
5087
4865
|
releaseBranch: releaseBranchName
|
|
5088
4866
|
};
|
|
5089
4867
|
}
|
|
4868
|
+
/**
|
|
4869
|
+
* Generates a title for the release pull request
|
|
4870
|
+
*
|
|
4871
|
+
* Uses the configured PR title template or falls back to the default.
|
|
4872
|
+
* Supports variable interpolation with release parameters and context.
|
|
4873
|
+
*
|
|
4874
|
+
* Template Variables:
|
|
4875
|
+
* - ${tagName}: Release tag name
|
|
4876
|
+
* - ${pkgName}: Package/branch name
|
|
4877
|
+
* - All template context properties
|
|
4878
|
+
*
|
|
4879
|
+
* @param releaseBranchParams - Release branch parameters
|
|
4880
|
+
* @param context - Template context for variable interpolation
|
|
4881
|
+
* @returns Formatted PR title
|
|
4882
|
+
*
|
|
4883
|
+
* @example
|
|
4884
|
+
* ```typescript
|
|
4885
|
+
* // With default template
|
|
4886
|
+
* const title = params.getPRTitle(
|
|
4887
|
+
* {
|
|
4888
|
+
* tagName: '1.0.0',
|
|
4889
|
+
* releaseBranch: 'release-1.0.0'
|
|
4890
|
+
* },
|
|
4891
|
+
* {
|
|
4892
|
+
* env: 'production',
|
|
4893
|
+
* pkgName: 'my-package'
|
|
4894
|
+
* }
|
|
4895
|
+
* );
|
|
4896
|
+
* // 'Release production my-package 1.0.0'
|
|
4897
|
+
*
|
|
4898
|
+
* // With custom template
|
|
4899
|
+
* const title = params.getPRTitle(
|
|
4900
|
+
* {
|
|
4901
|
+
* tagName: '1.0.0',
|
|
4902
|
+
* releaseBranch: 'release-1.0.0'
|
|
4903
|
+
* },
|
|
4904
|
+
* {
|
|
4905
|
+
* env: 'staging',
|
|
4906
|
+
* pkgName: 'my-package'
|
|
4907
|
+
* }
|
|
4908
|
+
* );
|
|
4909
|
+
* // Custom formatted title
|
|
4910
|
+
* ```
|
|
4911
|
+
*/
|
|
5090
4912
|
getPRTitle(releaseBranchParams, context) {
|
|
5091
4913
|
const prTitleTpl = this.config.PRTitle || DEFAULT_PR_TITLE;
|
|
5092
|
-
return
|
|
4914
|
+
return import_scripts_context2.Shell.format(prTitleTpl, {
|
|
5093
4915
|
...context,
|
|
5094
4916
|
tagName: releaseBranchParams.tagName,
|
|
5095
4917
|
pkgName: releaseBranchParams.releaseBranch
|
|
5096
4918
|
});
|
|
5097
4919
|
}
|
|
5098
4920
|
/**
|
|
5099
|
-
*
|
|
4921
|
+
* Generates the body content for the release pull request
|
|
4922
|
+
*
|
|
4923
|
+
* Handles both single and multi-package releases, combining
|
|
4924
|
+
* changelogs appropriately. For batch releases, formats each
|
|
4925
|
+
* package's changelog according to the batch template.
|
|
5100
4926
|
*
|
|
5101
|
-
*
|
|
5102
|
-
*
|
|
4927
|
+
* Template Variables:
|
|
4928
|
+
* - ${tagName}: Release tag or combined workspace versions
|
|
4929
|
+
* - ${changelog}: Single changelog or combined batch changelogs
|
|
4930
|
+
* - All template context properties
|
|
4931
|
+
*
|
|
4932
|
+
* @param composeWorkspaces - Array of workspace configurations
|
|
4933
|
+
* @param releaseBranchParams - Release branch parameters
|
|
4934
|
+
* @param context - Template context for variable interpolation
|
|
4935
|
+
* @returns Formatted PR body content
|
|
4936
|
+
*
|
|
4937
|
+
* @example Single package
|
|
4938
|
+
* ```typescript
|
|
4939
|
+
* const body = params.getPRBody(
|
|
4940
|
+
* [{
|
|
4941
|
+
* name: 'pkg-a',
|
|
4942
|
+
* version: '1.0.0',
|
|
4943
|
+
* changelog: '- Feature: New functionality\n- Fix: Bug fix'
|
|
4944
|
+
* }],
|
|
4945
|
+
* {
|
|
4946
|
+
* tagName: '1.0.0',
|
|
4947
|
+
* releaseBranch: 'release-1.0.0'
|
|
4948
|
+
* },
|
|
4949
|
+
* context
|
|
4950
|
+
* );
|
|
4951
|
+
* // Custom formatted body with single changelog
|
|
4952
|
+
* ```
|
|
4953
|
+
*
|
|
4954
|
+
* @example Multiple packages
|
|
4955
|
+
* ```typescript
|
|
4956
|
+
* const body = params.getPRBody(
|
|
4957
|
+
* [
|
|
4958
|
+
* {
|
|
4959
|
+
* name: 'pkg-a',
|
|
4960
|
+
* version: '1.0.0',
|
|
4961
|
+
* changelog: '- Feature: Package A changes'
|
|
4962
|
+
* },
|
|
4963
|
+
* {
|
|
4964
|
+
* name: 'pkg-b',
|
|
4965
|
+
* version: '2.0.0',
|
|
4966
|
+
* changelog: '- Feature: Package B changes'
|
|
4967
|
+
* }
|
|
4968
|
+
* ],
|
|
4969
|
+
* {
|
|
4970
|
+
* tagName: 'batch-2-packages-1234567890',
|
|
4971
|
+
* releaseBranch: 'batch-release'
|
|
4972
|
+
* },
|
|
4973
|
+
* context
|
|
4974
|
+
* );
|
|
4975
|
+
* // Formatted body with combined changelogs:
|
|
4976
|
+
* // ## pkg-a 1.0.0
|
|
4977
|
+
* // - Feature: Package A changes
|
|
4978
|
+
* //
|
|
4979
|
+
* // ## pkg-b 2.0.0
|
|
4980
|
+
* // - Feature: Package B changes
|
|
4981
|
+
* ```
|
|
5103
4982
|
*/
|
|
5104
4983
|
getPRBody(composeWorkspaces, releaseBranchParams, context) {
|
|
5105
4984
|
const PRBodyTpl = this.config.PRBody;
|
|
5106
4985
|
const changelog = composeWorkspaces.length > 1 ? composeWorkspaces.map((workspace) => {
|
|
5107
|
-
return
|
|
4986
|
+
return import_scripts_context2.Shell.format(
|
|
5108
4987
|
BATCH_PR_BODY,
|
|
5109
4988
|
workspace
|
|
5110
4989
|
);
|
|
@@ -5113,7 +4992,7 @@ var ReleaseParams = class {
|
|
|
5113
4992
|
const tagName = composeWorkspaces.length === 1 ? releaseBranchParams.tagName : composeWorkspaces.map(
|
|
5114
4993
|
(workspace) => `${workspace.name}${workspaceVersionSeparator}${workspace.version}`
|
|
5115
4994
|
).join(" ");
|
|
5116
|
-
return
|
|
4995
|
+
return import_scripts_context2.Shell.format(PRBodyTpl, {
|
|
5117
4996
|
...context,
|
|
5118
4997
|
tagName,
|
|
5119
4998
|
changelog
|
|
@@ -5122,14 +5001,41 @@ var ReleaseParams = class {
|
|
|
5122
5001
|
};
|
|
5123
5002
|
|
|
5124
5003
|
// src/plugins/githubPR/GithubManager.ts
|
|
5004
|
+
var import_scripts_context3 = require("@qlover/scripts-context");
|
|
5125
5005
|
var import_rest = require("@octokit/rest");
|
|
5126
5006
|
var GithubManager = class {
|
|
5007
|
+
/**
|
|
5008
|
+
* Creates a new GithubManager instance
|
|
5009
|
+
*
|
|
5010
|
+
* @param context - Release context containing configuration
|
|
5011
|
+
*
|
|
5012
|
+
* @example
|
|
5013
|
+
* ```typescript
|
|
5014
|
+
* const manager = new GithubManager(context);
|
|
5015
|
+
* ```
|
|
5016
|
+
*/
|
|
5127
5017
|
constructor(context) {
|
|
5128
5018
|
this.context = context;
|
|
5129
5019
|
}
|
|
5020
|
+
/** Lazy-loaded Octokit instance */
|
|
5130
5021
|
_octokit = null;
|
|
5022
|
+
/**
|
|
5023
|
+
* Gets GitHub repository information
|
|
5024
|
+
*
|
|
5025
|
+
* Retrieves the owner and repository name from the context.
|
|
5026
|
+
* This information is required for most GitHub API operations.
|
|
5027
|
+
*
|
|
5028
|
+
* @returns Repository owner and name
|
|
5029
|
+
* @throws Error if owner or repo name is not set
|
|
5030
|
+
*
|
|
5031
|
+
* @example
|
|
5032
|
+
* ```typescript
|
|
5033
|
+
* const info = manager.getGitHubUserInfo();
|
|
5034
|
+
* // { owner: 'org-name', repo: 'repo-name' }
|
|
5035
|
+
* ```
|
|
5036
|
+
*/
|
|
5131
5037
|
getGitHubUserInfo() {
|
|
5132
|
-
const { authorName, repoName } = this.context.
|
|
5038
|
+
const { authorName, repoName } = this.context.getOptions();
|
|
5133
5039
|
if (!authorName || !repoName) {
|
|
5134
5040
|
throw new Error("Author name or repo name is not set");
|
|
5135
5041
|
}
|
|
@@ -5138,8 +5044,30 @@ var GithubManager = class {
|
|
|
5138
5044
|
repo: repoName
|
|
5139
5045
|
};
|
|
5140
5046
|
}
|
|
5047
|
+
/**
|
|
5048
|
+
* Gets GitHub API token
|
|
5049
|
+
*
|
|
5050
|
+
* Retrieves the GitHub API token from environment variables.
|
|
5051
|
+
* The token name can be configured via the tokenRef option.
|
|
5052
|
+
*
|
|
5053
|
+
* @returns GitHub API token
|
|
5054
|
+
* @throws Error if token is not set
|
|
5055
|
+
*
|
|
5056
|
+
* @example Default token
|
|
5057
|
+
* ```typescript
|
|
5058
|
+
* const token = manager.getToken();
|
|
5059
|
+
* // Uses GITHUB_TOKEN env var
|
|
5060
|
+
* ```
|
|
5061
|
+
*
|
|
5062
|
+
* @example Custom token
|
|
5063
|
+
* ```typescript
|
|
5064
|
+
* context.options.githubPR.tokenRef = 'CUSTOM_TOKEN';
|
|
5065
|
+
* const token = manager.getToken();
|
|
5066
|
+
* // Uses CUSTOM_TOKEN env var
|
|
5067
|
+
* ```
|
|
5068
|
+
*/
|
|
5141
5069
|
getToken() {
|
|
5142
|
-
const { tokenRef = "GITHUB_TOKEN" } = this.context.
|
|
5070
|
+
const { tokenRef = "GITHUB_TOKEN" } = this.context.getOptions("githubPR");
|
|
5143
5071
|
const token = this.context.env.get(tokenRef);
|
|
5144
5072
|
if (!token) {
|
|
5145
5073
|
throw new Error(
|
|
@@ -5148,11 +5076,29 @@ var GithubManager = class {
|
|
|
5148
5076
|
}
|
|
5149
5077
|
return token;
|
|
5150
5078
|
}
|
|
5079
|
+
/**
|
|
5080
|
+
* Gets Octokit instance
|
|
5081
|
+
*
|
|
5082
|
+
* Lazily initializes and returns an Octokit instance configured
|
|
5083
|
+
* with the GitHub token and timeout settings.
|
|
5084
|
+
*
|
|
5085
|
+
* @returns Configured Octokit instance
|
|
5086
|
+
* @throws Error if token retrieval fails
|
|
5087
|
+
*
|
|
5088
|
+
* @example
|
|
5089
|
+
* ```typescript
|
|
5090
|
+
* const octokit = manager.octokit;
|
|
5091
|
+
* await octokit.rest.issues.create({
|
|
5092
|
+
* ...manager.getGitHubUserInfo(),
|
|
5093
|
+
* title: 'Issue title'
|
|
5094
|
+
* });
|
|
5095
|
+
* ```
|
|
5096
|
+
*/
|
|
5151
5097
|
get octokit() {
|
|
5152
5098
|
if (this._octokit) {
|
|
5153
5099
|
return this._octokit;
|
|
5154
5100
|
}
|
|
5155
|
-
const { timeout } = this.context.
|
|
5101
|
+
const { timeout } = this.context.getOptions("githubPR");
|
|
5156
5102
|
const options = {
|
|
5157
5103
|
auth: this.getToken(),
|
|
5158
5104
|
request: {
|
|
@@ -5162,9 +5108,37 @@ var GithubManager = class {
|
|
|
5162
5108
|
this._octokit = new import_rest.Octokit(options);
|
|
5163
5109
|
return this._octokit;
|
|
5164
5110
|
}
|
|
5111
|
+
/**
|
|
5112
|
+
* Gets logger instance
|
|
5113
|
+
*
|
|
5114
|
+
* Provides access to the context's logger for consistent
|
|
5115
|
+
* logging across the manager.
|
|
5116
|
+
*
|
|
5117
|
+
* @returns Logger instance
|
|
5118
|
+
*
|
|
5119
|
+
* @example
|
|
5120
|
+
* ```typescript
|
|
5121
|
+
* manager.logger.info('Creating release...');
|
|
5122
|
+
* manager.logger.debug('API response:', response);
|
|
5123
|
+
* ```
|
|
5124
|
+
*/
|
|
5165
5125
|
get logger() {
|
|
5166
5126
|
return this.context.logger;
|
|
5167
5127
|
}
|
|
5128
|
+
/**
|
|
5129
|
+
* Gets shell interface
|
|
5130
|
+
*
|
|
5131
|
+
* Provides access to the context's shell interface for
|
|
5132
|
+
* executing Git commands and other shell operations.
|
|
5133
|
+
*
|
|
5134
|
+
* @returns Shell interface
|
|
5135
|
+
*
|
|
5136
|
+
* @example
|
|
5137
|
+
* ```typescript
|
|
5138
|
+
* await manager.shell.exec('git fetch origin');
|
|
5139
|
+
* await manager.shell.exec(['git', 'push', 'origin', 'main']);
|
|
5140
|
+
* ```
|
|
5141
|
+
*/
|
|
5168
5142
|
get shell() {
|
|
5169
5143
|
return this.context.shell;
|
|
5170
5144
|
}
|
|
@@ -5173,24 +5147,77 @@ var GithubManager = class {
|
|
|
5173
5147
|
*
|
|
5174
5148
|
* @default `squash`
|
|
5175
5149
|
*/
|
|
5150
|
+
/**
|
|
5151
|
+
* Gets auto-merge type for pull requests
|
|
5152
|
+
*
|
|
5153
|
+
* Determines how pull requests should be merged when
|
|
5154
|
+
* auto-merge is enabled. Defaults to 'squash'.
|
|
5155
|
+
*
|
|
5156
|
+
* @returns Auto-merge type ('merge', 'squash', or 'rebase')
|
|
5157
|
+
*
|
|
5158
|
+
* @example
|
|
5159
|
+
* ```typescript
|
|
5160
|
+
* const mergeType = manager.autoMergeType;
|
|
5161
|
+
* // 'squash' (default)
|
|
5162
|
+
*
|
|
5163
|
+
* context.options.autoMergeType = 'rebase';
|
|
5164
|
+
* manager.autoMergeType; // 'rebase'
|
|
5165
|
+
* ```
|
|
5166
|
+
*/
|
|
5176
5167
|
get autoMergeType() {
|
|
5177
|
-
return this.context.
|
|
5168
|
+
return this.context.getOptions().autoMergeType || DEFAULT_AUTO_MERGE_TYPE;
|
|
5178
5169
|
}
|
|
5179
5170
|
/**
|
|
5180
5171
|
* Dry run PR number
|
|
5181
5172
|
*
|
|
5182
5173
|
* @default `999999`
|
|
5183
5174
|
*/
|
|
5175
|
+
/**
|
|
5176
|
+
* Gets pull request number for dry runs
|
|
5177
|
+
*
|
|
5178
|
+
* Returns a placeholder PR number when running in dry-run mode.
|
|
5179
|
+
* This allows testing PR-related functionality without creating
|
|
5180
|
+
* actual pull requests.
|
|
5181
|
+
*
|
|
5182
|
+
* @returns Dry run PR number (default: '999999')
|
|
5183
|
+
*
|
|
5184
|
+
* @example
|
|
5185
|
+
* ```typescript
|
|
5186
|
+
* context.dryRun = true;
|
|
5187
|
+
* const prNumber = manager.dryRunPRNumber;
|
|
5188
|
+
* // '999999'
|
|
5189
|
+
*
|
|
5190
|
+
* context.options.githubPR.dryRunPRNumber = '123456';
|
|
5191
|
+
* manager.dryRunPRNumber; // '123456'
|
|
5192
|
+
* ```
|
|
5193
|
+
*/
|
|
5184
5194
|
get dryRunPRNumber() {
|
|
5185
|
-
return this.context.
|
|
5195
|
+
return this.context.getOptions("githubPR.dryRunPRNumber", "999999");
|
|
5186
5196
|
}
|
|
5187
5197
|
/**
|
|
5188
5198
|
* Auto merge release PR
|
|
5189
5199
|
*
|
|
5190
5200
|
* @default `false`
|
|
5191
5201
|
*/
|
|
5202
|
+
/**
|
|
5203
|
+
* Gets auto-merge setting for release PRs
|
|
5204
|
+
*
|
|
5205
|
+
* Determines whether release pull requests should be
|
|
5206
|
+
* automatically merged after creation. Defaults to false.
|
|
5207
|
+
*
|
|
5208
|
+
* @returns True if auto-merge is enabled
|
|
5209
|
+
*
|
|
5210
|
+
* @example
|
|
5211
|
+
* ```typescript
|
|
5212
|
+
* const autoMerge = manager.autoMergeReleasePR;
|
|
5213
|
+
* // false (default)
|
|
5214
|
+
*
|
|
5215
|
+
* context.options.autoMergeReleasePR = true;
|
|
5216
|
+
* manager.autoMergeReleasePR; // true
|
|
5217
|
+
* ```
|
|
5218
|
+
*/
|
|
5192
5219
|
get autoMergeReleasePR() {
|
|
5193
|
-
return this.context.
|
|
5220
|
+
return this.context.getOptions("autoMergeReleasePR") || DEFAULT_AUTO_MERGE_RELEASE_PR;
|
|
5194
5221
|
}
|
|
5195
5222
|
/**
|
|
5196
5223
|
* Automatically merges a pull request.
|
|
@@ -5198,6 +5225,30 @@ var GithubManager = class {
|
|
|
5198
5225
|
* @param prNumber - The pull request number to merge.
|
|
5199
5226
|
* @param releaseBranch - The branch to merge into.
|
|
5200
5227
|
*/
|
|
5228
|
+
/**
|
|
5229
|
+
* Merges a pull request
|
|
5230
|
+
*
|
|
5231
|
+
* Merges the specified pull request using the configured
|
|
5232
|
+
* merge method. In dry-run mode, logs the merge action
|
|
5233
|
+
* without performing it.
|
|
5234
|
+
*
|
|
5235
|
+
* @param prNumber - Pull request number
|
|
5236
|
+
* @param releaseBranch - Branch to merge
|
|
5237
|
+
* @throws Error if merge fails
|
|
5238
|
+
*
|
|
5239
|
+
* @example Basic merge
|
|
5240
|
+
* ```typescript
|
|
5241
|
+
* await manager.mergePR('123', 'release-1.0.0');
|
|
5242
|
+
* // Merges PR #123 using configured merge method
|
|
5243
|
+
* ```
|
|
5244
|
+
*
|
|
5245
|
+
* @example Dry run
|
|
5246
|
+
* ```typescript
|
|
5247
|
+
* context.dryRun = true;
|
|
5248
|
+
* await manager.mergePR('123', 'release-1.0.0');
|
|
5249
|
+
* // Logs merge action without performing it
|
|
5250
|
+
* ```
|
|
5251
|
+
*/
|
|
5201
5252
|
async mergePR(prNumber, releaseBranch) {
|
|
5202
5253
|
if (!prNumber) {
|
|
5203
5254
|
this.logger.error("Failed to create Pull Request.", prNumber);
|
|
@@ -5205,7 +5256,7 @@ var GithubManager = class {
|
|
|
5205
5256
|
}
|
|
5206
5257
|
const mergeMethod = this.autoMergeType;
|
|
5207
5258
|
if (this.context.dryRun) {
|
|
5208
|
-
const { repoName, authorName } = this.context.
|
|
5259
|
+
const { repoName, authorName } = this.context.getOptions();
|
|
5209
5260
|
this.logger.info(
|
|
5210
5261
|
`[DRY RUN] Would merge PR #${prNumber} with method '${mergeMethod}' in repo ${authorName}/${repoName}, branch ${releaseBranch}`
|
|
5211
5262
|
);
|
|
@@ -5217,6 +5268,24 @@ var GithubManager = class {
|
|
|
5217
5268
|
merge_method: mergeMethod
|
|
5218
5269
|
});
|
|
5219
5270
|
}
|
|
5271
|
+
/**
|
|
5272
|
+
* Gets commits from a pull request
|
|
5273
|
+
*
|
|
5274
|
+
* Retrieves all commits associated with the specified pull request.
|
|
5275
|
+
* Useful for generating changelogs or analyzing changes.
|
|
5276
|
+
*
|
|
5277
|
+
* @param prNumber - Pull request number
|
|
5278
|
+
* @returns Promise resolving to array of commit information
|
|
5279
|
+
* @throws Error if request fails
|
|
5280
|
+
*
|
|
5281
|
+
* @example
|
|
5282
|
+
* ```typescript
|
|
5283
|
+
* const commits = await manager.getPullRequestCommits(123);
|
|
5284
|
+
* commits.forEach(commit => {
|
|
5285
|
+
* console.log(commit.sha, commit.commit.message);
|
|
5286
|
+
* });
|
|
5287
|
+
* ```
|
|
5288
|
+
*/
|
|
5220
5289
|
async getPullRequestCommits(prNumber) {
|
|
5221
5290
|
const pr = await this.octokit.rest.pulls.listCommits({
|
|
5222
5291
|
...this.getGitHubUserInfo(),
|
|
@@ -5224,6 +5293,23 @@ var GithubManager = class {
|
|
|
5224
5293
|
});
|
|
5225
5294
|
return pr.data;
|
|
5226
5295
|
}
|
|
5296
|
+
/**
|
|
5297
|
+
* Gets detailed information about a commit
|
|
5298
|
+
*
|
|
5299
|
+
* Retrieves detailed information about a specific commit,
|
|
5300
|
+
* including files changed, author details, and commit message.
|
|
5301
|
+
*
|
|
5302
|
+
* @param commitSha - Commit SHA
|
|
5303
|
+
* @returns Promise resolving to commit information
|
|
5304
|
+
* @throws Error if request fails
|
|
5305
|
+
*
|
|
5306
|
+
* @example
|
|
5307
|
+
* ```typescript
|
|
5308
|
+
* const info = await manager.getCommitInfo('abc123');
|
|
5309
|
+
* console.log(info.commit.message);
|
|
5310
|
+
* console.log(info.files.map(f => f.filename));
|
|
5311
|
+
* ```
|
|
5312
|
+
*/
|
|
5227
5313
|
async getCommitInfo(commitSha) {
|
|
5228
5314
|
const pr = await this.octokit.rest.repos.getCommit({
|
|
5229
5315
|
...this.getGitHubUserInfo(),
|
|
@@ -5231,6 +5317,24 @@ var GithubManager = class {
|
|
|
5231
5317
|
});
|
|
5232
5318
|
return pr.data;
|
|
5233
5319
|
}
|
|
5320
|
+
/**
|
|
5321
|
+
* Gets pull request information
|
|
5322
|
+
*
|
|
5323
|
+
* Retrieves detailed information about a pull request,
|
|
5324
|
+
* including title, body, labels, and review status.
|
|
5325
|
+
*
|
|
5326
|
+
* @param prNumber - Pull request number
|
|
5327
|
+
* @returns Promise resolving to pull request information
|
|
5328
|
+
* @throws Error if request fails
|
|
5329
|
+
*
|
|
5330
|
+
* @example
|
|
5331
|
+
* ```typescript
|
|
5332
|
+
* const pr = await manager.getPullRequest(123);
|
|
5333
|
+
* console.log(pr.title);
|
|
5334
|
+
* console.log(pr.labels.map(l => l.name));
|
|
5335
|
+
* console.log(pr.mergeable_state);
|
|
5336
|
+
* ```
|
|
5337
|
+
*/
|
|
5234
5338
|
async getPullRequest(prNumber) {
|
|
5235
5339
|
const pr = await this.octokit.rest.pulls.get({
|
|
5236
5340
|
...this.getGitHubUserInfo(),
|
|
@@ -5244,6 +5348,27 @@ var GithubManager = class {
|
|
|
5244
5348
|
* @param prNumber - The pull request number to check.
|
|
5245
5349
|
* @param releaseBranch - The branch to check against.
|
|
5246
5350
|
*/
|
|
5351
|
+
/**
|
|
5352
|
+
* Checks pull request status and cleans up
|
|
5353
|
+
*
|
|
5354
|
+
* Verifies pull request status and deletes the release branch
|
|
5355
|
+
* if the PR has been merged. Used for post-merge cleanup.
|
|
5356
|
+
*
|
|
5357
|
+
* Process:
|
|
5358
|
+
* 1. Verify PR exists and status
|
|
5359
|
+
* 2. Delete release branch if PR merged
|
|
5360
|
+
* 3. Log cleanup results
|
|
5361
|
+
*
|
|
5362
|
+
* @param prNumber - Pull request number
|
|
5363
|
+
* @param releaseBranch - Branch to clean up
|
|
5364
|
+
* @throws Error if verification or cleanup fails
|
|
5365
|
+
*
|
|
5366
|
+
* @example
|
|
5367
|
+
* ```typescript
|
|
5368
|
+
* await manager.checkedPR('123', 'release-1.0.0');
|
|
5369
|
+
* // Verifies PR #123 and deletes release-1.0.0 if merged
|
|
5370
|
+
* ```
|
|
5371
|
+
*/
|
|
5247
5372
|
async checkedPR(prNumber, releaseBranch) {
|
|
5248
5373
|
try {
|
|
5249
5374
|
await this.getPullRequest(Number(prNumber));
|
|
@@ -5270,7 +5395,7 @@ var GithubManager = class {
|
|
|
5270
5395
|
* @throws If the label is not valid or if the creation fails.
|
|
5271
5396
|
*/
|
|
5272
5397
|
async createReleasePRLabel() {
|
|
5273
|
-
const label = this.context.
|
|
5398
|
+
const label = this.context.getOptions().label;
|
|
5274
5399
|
if (!label || !label.name || !label.description || !label.color) {
|
|
5275
5400
|
throw new Error("Label is not valid, skipping creation");
|
|
5276
5401
|
}
|
|
@@ -5305,7 +5430,7 @@ var GithubManager = class {
|
|
|
5305
5430
|
* @throws If the creation fails or if the pull request already exists.
|
|
5306
5431
|
*/
|
|
5307
5432
|
async createReleasePR(options) {
|
|
5308
|
-
const dryRunCreatePR = this.context.
|
|
5433
|
+
const dryRunCreatePR = this.context.getOptions("githubPR.dryRunCreatePR");
|
|
5309
5434
|
if (dryRunCreatePR || this.context.dryRun) {
|
|
5310
5435
|
this.logger.info(`[DRY RUN] Would create PR with:`, {
|
|
5311
5436
|
...options,
|
|
@@ -5344,10 +5469,55 @@ var GithubManager = class {
|
|
|
5344
5469
|
throw error;
|
|
5345
5470
|
}
|
|
5346
5471
|
}
|
|
5472
|
+
/**
|
|
5473
|
+
* Truncates long PR/release body text
|
|
5474
|
+
*
|
|
5475
|
+
* GitHub has a limit on PR and release body length.
|
|
5476
|
+
* This method ensures the text stays within limits by
|
|
5477
|
+
* truncating if necessary.
|
|
5478
|
+
*
|
|
5479
|
+
* @param body - Body text to truncate
|
|
5480
|
+
* @returns Truncated text (if > 124000 chars)
|
|
5481
|
+
*
|
|
5482
|
+
* @example
|
|
5483
|
+
* ```typescript
|
|
5484
|
+
* const body = manager.truncateBody(veryLongText);
|
|
5485
|
+
* // Returns truncated text if > 124000 chars
|
|
5486
|
+
* // Adds '...' to indicate truncation
|
|
5487
|
+
* ```
|
|
5488
|
+
* @private
|
|
5489
|
+
*/
|
|
5347
5490
|
truncateBody(body) {
|
|
5348
5491
|
if (body && body.length >= 124e3) return body.substring(0, 124e3) + "...";
|
|
5349
5492
|
return body;
|
|
5350
5493
|
}
|
|
5494
|
+
/**
|
|
5495
|
+
* Builds GitHub release options
|
|
5496
|
+
*
|
|
5497
|
+
* Combines default release options with provided overrides
|
|
5498
|
+
* and context configuration. Handles formatting of release
|
|
5499
|
+
* name, body, and other settings.
|
|
5500
|
+
*
|
|
5501
|
+
* @param options - Override options for release
|
|
5502
|
+
* @returns Complete release options
|
|
5503
|
+
*
|
|
5504
|
+
* @example
|
|
5505
|
+
* ```typescript
|
|
5506
|
+
* const opts = manager.getOctokitReleaseOptions({
|
|
5507
|
+
* tag_name: 'v1.0.0',
|
|
5508
|
+
* body: 'Release notes...'
|
|
5509
|
+
* });
|
|
5510
|
+
* // Returns merged options with defaults:
|
|
5511
|
+
* // {
|
|
5512
|
+
* // name: 'Release v1.0.0',
|
|
5513
|
+
* // body: 'Release notes...',
|
|
5514
|
+
* // draft: false,
|
|
5515
|
+
* // prerelease: false,
|
|
5516
|
+
* // ...
|
|
5517
|
+
* // }
|
|
5518
|
+
* ```
|
|
5519
|
+
* @private
|
|
5520
|
+
*/
|
|
5351
5521
|
getOctokitReleaseOptions(options) {
|
|
5352
5522
|
const {
|
|
5353
5523
|
releaseName,
|
|
@@ -5357,7 +5527,7 @@ var GithubManager = class {
|
|
|
5357
5527
|
makeLatest = true,
|
|
5358
5528
|
releaseNotes,
|
|
5359
5529
|
discussionCategoryName = void 0
|
|
5360
|
-
} = this.context.
|
|
5530
|
+
} = this.context.getOptions("githubPR");
|
|
5361
5531
|
const name = releaseName;
|
|
5362
5532
|
const body = autoGenerate ? "" : this.truncateBody(String(releaseNotes));
|
|
5363
5533
|
return {
|
|
@@ -5373,12 +5543,43 @@ var GithubManager = class {
|
|
|
5373
5543
|
...this.getGitHubUserInfo()
|
|
5374
5544
|
};
|
|
5375
5545
|
}
|
|
5546
|
+
/**
|
|
5547
|
+
* Creates a GitHub release
|
|
5548
|
+
*
|
|
5549
|
+
* Creates a new GitHub release for a workspace with:
|
|
5550
|
+
* - Formatted release name
|
|
5551
|
+
* - Changelog as release notes
|
|
5552
|
+
* - Proper tag
|
|
5553
|
+
* - Configurable settings (draft, prerelease, etc.)
|
|
5554
|
+
*
|
|
5555
|
+
* Handles dry run mode and error cases gracefully.
|
|
5556
|
+
*
|
|
5557
|
+
* @param workspace - Workspace to create release for
|
|
5558
|
+
* @throws Error if tag name is missing or creation fails
|
|
5559
|
+
*
|
|
5560
|
+
* @example Basic release
|
|
5561
|
+
* ```typescript
|
|
5562
|
+
* await manager.createRelease({
|
|
5563
|
+
* name: 'pkg-a',
|
|
5564
|
+
* version: '1.0.0',
|
|
5565
|
+
* tagName: 'v1.0.0',
|
|
5566
|
+
* changelog: '...'
|
|
5567
|
+
* });
|
|
5568
|
+
* ```
|
|
5569
|
+
*
|
|
5570
|
+
* @example Dry run
|
|
5571
|
+
* ```typescript
|
|
5572
|
+
* context.dryRun = true;
|
|
5573
|
+
* await manager.createRelease(workspace);
|
|
5574
|
+
* // Logs release info without creating
|
|
5575
|
+
* ```
|
|
5576
|
+
*/
|
|
5376
5577
|
async createRelease(workspace) {
|
|
5377
5578
|
const meragedOptions = this.getOctokitReleaseOptions({
|
|
5378
5579
|
tag_name: workspace.tagName,
|
|
5379
5580
|
body: workspace.changelog
|
|
5380
5581
|
});
|
|
5381
|
-
meragedOptions.name =
|
|
5582
|
+
meragedOptions.name = import_scripts_context3.Shell.format(
|
|
5382
5583
|
meragedOptions.name,
|
|
5383
5584
|
workspace
|
|
5384
5585
|
);
|
|
@@ -5392,110 +5593,56 @@ var GithubManager = class {
|
|
|
5392
5593
|
throw new Error("TagName is undefined");
|
|
5393
5594
|
}
|
|
5394
5595
|
if (this.context.dryRun) {
|
|
5395
|
-
return;
|
|
5396
|
-
}
|
|
5397
|
-
try {
|
|
5398
|
-
const response = await this.octokit.repos.createRelease(meragedOptions);
|
|
5399
|
-
this.logger.debug(
|
|
5400
|
-
`[DONE] octokit repos.createRelease "${meragedOptions.name}" (${meragedOptions.tag_name}) (${response.headers.location})`
|
|
5401
|
-
);
|
|
5402
|
-
} catch (error) {
|
|
5403
|
-
this.logger.error(
|
|
5404
|
-
`[FAILED] octokit repos.createRelease "${meragedOptions.name}" (${meragedOptions.tag_name})`,
|
|
5405
|
-
error
|
|
5406
|
-
);
|
|
5407
|
-
}
|
|
5408
|
-
}
|
|
5409
|
-
};
|
|
5410
|
-
|
|
5411
|
-
// src/plugins/GitBase.ts
|
|
5412
|
-
var import_isString = __toESM(require_isString(), 1);
|
|
5413
|
-
|
|
5414
|
-
// src/plugins/Plugin.ts
|
|
5415
|
-
var import_merge2 = __toESM(require_merge(), 1);
|
|
5416
|
-
var import_get2 = __toESM(require_get(), 1);
|
|
5417
|
-
var Plugin = class {
|
|
5418
|
-
constructor(context, pluginName, props = {}) {
|
|
5419
|
-
this.context = context;
|
|
5420
|
-
this.pluginName = pluginName;
|
|
5421
|
-
this.props = props;
|
|
5422
|
-
this.setConfig(this.getInitialProps(props));
|
|
5423
|
-
}
|
|
5424
|
-
onlyOne = true;
|
|
5425
|
-
getInitialProps(props) {
|
|
5426
|
-
const pluginConfig = this.context.options[this.pluginName];
|
|
5427
|
-
const fileConfig = (0, import_get2.default)(this.context.shared, this.pluginName);
|
|
5428
|
-
return pluginConfig || props ? (0, import_merge2.default)({}, fileConfig, props, pluginConfig) : {};
|
|
5429
|
-
}
|
|
5430
|
-
get logger() {
|
|
5431
|
-
return this.context.logger;
|
|
5432
|
-
}
|
|
5433
|
-
get shell() {
|
|
5434
|
-
return this.context.shell;
|
|
5435
|
-
}
|
|
5436
|
-
get options() {
|
|
5437
|
-
return this.context.getConfig(this.pluginName, {});
|
|
5438
|
-
}
|
|
5439
|
-
getEnv(key, defaultValue) {
|
|
5440
|
-
return this.context.env.get(key) ?? defaultValue;
|
|
5441
|
-
}
|
|
5442
|
-
enabled(_name, _context) {
|
|
5443
|
-
return true;
|
|
5444
|
-
}
|
|
5445
|
-
getConfig(keys, defaultValue) {
|
|
5446
|
-
if (!keys) {
|
|
5447
|
-
return this.context.getConfig(this.pluginName, defaultValue);
|
|
5448
|
-
}
|
|
5449
|
-
return this.context.getConfig(
|
|
5450
|
-
[this.pluginName, ...Array.isArray(keys) ? keys : [keys]],
|
|
5451
|
-
defaultValue
|
|
5452
|
-
);
|
|
5453
|
-
}
|
|
5454
|
-
setConfig(config) {
|
|
5455
|
-
this.context.setConfig({
|
|
5456
|
-
[this.pluginName]: config
|
|
5457
|
-
});
|
|
5458
|
-
}
|
|
5459
|
-
onBefore(_context) {
|
|
5460
|
-
}
|
|
5461
|
-
onExec(_context) {
|
|
5462
|
-
}
|
|
5463
|
-
onSuccess(_context) {
|
|
5464
|
-
}
|
|
5465
|
-
onError(_context) {
|
|
5466
|
-
}
|
|
5467
|
-
/**
|
|
5468
|
-
* run a step
|
|
5469
|
-
*
|
|
5470
|
-
* this will log the step and return the result of the task
|
|
5471
|
-
*
|
|
5472
|
-
* @param label - the label of the step
|
|
5473
|
-
* @param task - the task to run
|
|
5474
|
-
* @returns the result of the task
|
|
5475
|
-
*/
|
|
5476
|
-
async step({ label, task }) {
|
|
5477
|
-
this.logger.log();
|
|
5478
|
-
this.logger.info(label);
|
|
5479
|
-
this.logger.log();
|
|
5596
|
+
return;
|
|
5597
|
+
}
|
|
5480
5598
|
try {
|
|
5481
|
-
const
|
|
5482
|
-
this.logger.
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5599
|
+
const response = await this.octokit.repos.createRelease(meragedOptions);
|
|
5600
|
+
this.logger.debug(
|
|
5601
|
+
`[DONE] octokit repos.createRelease "${meragedOptions.name}" (${meragedOptions.tag_name}) (${response.headers.location})`
|
|
5602
|
+
);
|
|
5603
|
+
} catch (error) {
|
|
5604
|
+
this.logger.error(
|
|
5605
|
+
`[FAILED] octokit repos.createRelease "${meragedOptions.name}" (${meragedOptions.tag_name})`,
|
|
5606
|
+
error
|
|
5607
|
+
);
|
|
5487
5608
|
}
|
|
5488
5609
|
}
|
|
5489
5610
|
};
|
|
5490
5611
|
|
|
5491
5612
|
// src/plugins/GitBase.ts
|
|
5492
|
-
var
|
|
5613
|
+
var import_isString = __toESM(require_isString(), 1);
|
|
5614
|
+
var import_scripts_context4 = require("@qlover/scripts-context");
|
|
5615
|
+
var GitBase = class extends import_scripts_context4.ScriptPlugin {
|
|
5616
|
+
/**
|
|
5617
|
+
* Plugin initialization hook
|
|
5618
|
+
*
|
|
5619
|
+
* Runs before plugin execution to set up repository context:
|
|
5620
|
+
* 1. Retrieves repository information
|
|
5621
|
+
* 2. Gets current branch
|
|
5622
|
+
* 3. Switches to current branch if needed
|
|
5623
|
+
* 4. Updates context with repository info
|
|
5624
|
+
*
|
|
5625
|
+
* @throws Error if repository information cannot be retrieved
|
|
5626
|
+
*
|
|
5627
|
+
* @example
|
|
5628
|
+
* ```typescript
|
|
5629
|
+
* class MyPlugin extends GitBase<GitBaseProps> {
|
|
5630
|
+
* async onExec() {
|
|
5631
|
+
* // onBefore has already:
|
|
5632
|
+
* // - Set up repository info
|
|
5633
|
+
* // - Switched to correct branch
|
|
5634
|
+
* // - Updated context
|
|
5635
|
+
* await this.doSomething();
|
|
5636
|
+
* }
|
|
5637
|
+
* }
|
|
5638
|
+
* ```
|
|
5639
|
+
*/
|
|
5493
5640
|
async onBefore() {
|
|
5494
5641
|
const repoInfo = await this.getUserInfo();
|
|
5495
5642
|
if (!repoInfo) {
|
|
5496
5643
|
throw new Error("Failed to get repoInfo");
|
|
5497
5644
|
}
|
|
5498
|
-
let currentBranch = this.context.
|
|
5645
|
+
let currentBranch = this.context.options.currentBranch;
|
|
5499
5646
|
if (!currentBranch) {
|
|
5500
5647
|
currentBranch = await this.getCurrentBranch();
|
|
5501
5648
|
}
|
|
@@ -5504,18 +5651,50 @@ var GitBase = class extends Plugin {
|
|
|
5504
5651
|
dryRun: false
|
|
5505
5652
|
});
|
|
5506
5653
|
}
|
|
5507
|
-
this.context.
|
|
5654
|
+
this.context.setOptions({
|
|
5508
5655
|
repoName: repoInfo.repoName,
|
|
5509
5656
|
authorName: repoInfo.authorName,
|
|
5510
5657
|
currentBranch
|
|
5511
5658
|
});
|
|
5512
5659
|
}
|
|
5660
|
+
/**
|
|
5661
|
+
* Gets the current Git branch name
|
|
5662
|
+
*
|
|
5663
|
+
* Retrieves the name of the currently checked out Git branch.
|
|
5664
|
+
* Includes a small delay to ensure Git's internal state is updated.
|
|
5665
|
+
*
|
|
5666
|
+
* @returns Promise resolving to branch name
|
|
5667
|
+
* @throws Error if branch name cannot be retrieved
|
|
5668
|
+
*
|
|
5669
|
+
* @example
|
|
5670
|
+
* ```typescript
|
|
5671
|
+
* const branch = await plugin.getCurrentBranch();
|
|
5672
|
+
* // 'main' or 'feature/new-feature'
|
|
5673
|
+
* ```
|
|
5674
|
+
*/
|
|
5513
5675
|
async getCurrentBranch() {
|
|
5514
5676
|
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
|
5515
5677
|
return this.context.shell.exec("git rev-parse --abbrev-ref HEAD", {
|
|
5516
5678
|
dryRun: false
|
|
5517
5679
|
});
|
|
5518
5680
|
}
|
|
5681
|
+
/**
|
|
5682
|
+
* Gets the Git remote URL
|
|
5683
|
+
*
|
|
5684
|
+
* Retrieves the URL of the 'origin' remote from Git configuration.
|
|
5685
|
+
* This URL is used to identify the GitHub repository.
|
|
5686
|
+
*
|
|
5687
|
+
* @returns Promise resolving to remote URL
|
|
5688
|
+
* @throws Error if remote URL cannot be retrieved
|
|
5689
|
+
*
|
|
5690
|
+
* @example
|
|
5691
|
+
* ```typescript
|
|
5692
|
+
* const url = await plugin.getRemoteUrl();
|
|
5693
|
+
* // 'https://github.com/org/repo.git'
|
|
5694
|
+
* // or
|
|
5695
|
+
* // 'git@github.com:org/repo.git'
|
|
5696
|
+
* ```
|
|
5697
|
+
*/
|
|
5519
5698
|
async getRemoteUrl() {
|
|
5520
5699
|
return (await this.context.shell.exec("git config --get remote.origin.url", {
|
|
5521
5700
|
dryRun: false
|
|
@@ -5569,9 +5748,53 @@ var GitBase = class extends Plugin {
|
|
|
5569
5748
|
* @param value - The value to check.
|
|
5570
5749
|
* @returns True if the value is a valid string, otherwise false.
|
|
5571
5750
|
*/
|
|
5751
|
+
/**
|
|
5752
|
+
* Type guard for valid string values
|
|
5753
|
+
*
|
|
5754
|
+
* Checks if a value is a non-empty string. Used for validating
|
|
5755
|
+
* repository information and other string inputs.
|
|
5756
|
+
*
|
|
5757
|
+
* @param value - Value to check
|
|
5758
|
+
* @returns True if value is a non-empty string
|
|
5759
|
+
*
|
|
5760
|
+
* @example
|
|
5761
|
+
* ```typescript
|
|
5762
|
+
* if (plugin.isValidString(value)) {
|
|
5763
|
+
* // value is definitely a non-empty string
|
|
5764
|
+
* console.log(value.toUpperCase());
|
|
5765
|
+
* }
|
|
5766
|
+
* ```
|
|
5767
|
+
*/
|
|
5572
5768
|
isValidString(value) {
|
|
5573
5769
|
return !!value && (0, import_isString.default)(value);
|
|
5574
5770
|
}
|
|
5771
|
+
/**
|
|
5772
|
+
* Creates a Git commit
|
|
5773
|
+
*
|
|
5774
|
+
* Creates a new Git commit with the specified message and optional
|
|
5775
|
+
* additional arguments. The message is automatically JSON-stringified
|
|
5776
|
+
* to handle special characters properly.
|
|
5777
|
+
*
|
|
5778
|
+
* @param message - Commit message
|
|
5779
|
+
* @param args - Additional Git commit arguments
|
|
5780
|
+
* @returns Promise resolving to command output
|
|
5781
|
+
*
|
|
5782
|
+
* @example Basic commit
|
|
5783
|
+
* ```typescript
|
|
5784
|
+
* await plugin.commit('feat: add new feature');
|
|
5785
|
+
* ```
|
|
5786
|
+
*
|
|
5787
|
+
* @example Commit with arguments
|
|
5788
|
+
* ```typescript
|
|
5789
|
+
* await plugin.commit('fix: update deps', ['--no-verify']);
|
|
5790
|
+
* ```
|
|
5791
|
+
*
|
|
5792
|
+
* @example Commit with special characters
|
|
5793
|
+
* ```typescript
|
|
5794
|
+
* await plugin.commit('fix: handle "quotes" & symbols');
|
|
5795
|
+
* // Message is automatically escaped
|
|
5796
|
+
* ```
|
|
5797
|
+
*/
|
|
5575
5798
|
commit(message, args = []) {
|
|
5576
5799
|
return this.context.shell.exec([
|
|
5577
5800
|
"git",
|
|
@@ -5606,24 +5829,60 @@ var CHANGELOG_ALL_FIELDS = [
|
|
|
5606
5829
|
"tag"
|
|
5607
5830
|
];
|
|
5608
5831
|
var GitChangelog = class {
|
|
5832
|
+
/**
|
|
5833
|
+
* Creates a new GitChangelog instance
|
|
5834
|
+
*
|
|
5835
|
+
* @param options - Configuration options including shell and logger
|
|
5836
|
+
*
|
|
5837
|
+
* @example
|
|
5838
|
+
* ```typescript
|
|
5839
|
+
* const changelog = new GitChangelog({
|
|
5840
|
+
* shell: new Shell(),
|
|
5841
|
+
* logger: new Logger(),
|
|
5842
|
+
* directory: 'packages/my-pkg',
|
|
5843
|
+
* noMerges: true
|
|
5844
|
+
* });
|
|
5845
|
+
* ```
|
|
5846
|
+
*/
|
|
5609
5847
|
constructor(options) {
|
|
5610
5848
|
this.options = options;
|
|
5611
5849
|
}
|
|
5612
5850
|
/**
|
|
5613
|
-
*
|
|
5851
|
+
* Retrieves Git commit history with specified options
|
|
5614
5852
|
*
|
|
5615
|
-
*
|
|
5616
|
-
*
|
|
5853
|
+
* Fetches commit information between specified tags or commits,
|
|
5854
|
+
* with support for filtering and field selection.
|
|
5855
|
+
*
|
|
5856
|
+
* @param options - Configuration options for Git log retrieval
|
|
5857
|
+
* @returns Array of commit objects with requested fields
|
|
5858
|
+
*
|
|
5859
|
+
* @example Basic usage
|
|
5860
|
+
* ```typescript
|
|
5861
|
+
* const commits = await changelog.getGitLog({
|
|
5862
|
+
* from: 'v1.0.0',
|
|
5863
|
+
* to: 'v2.0.0',
|
|
5864
|
+
* directory: 'packages/my-pkg',
|
|
5865
|
+
* noMerges: true
|
|
5866
|
+
* });
|
|
5867
|
+
* ```
|
|
5868
|
+
*
|
|
5869
|
+
* @example Custom fields
|
|
5870
|
+
* ```typescript
|
|
5871
|
+
* const commits = await changelog.getGitLog({
|
|
5872
|
+
* fields: ['hash', 'subject', 'authorName'],
|
|
5873
|
+
* directory: 'src'
|
|
5874
|
+
* });
|
|
5875
|
+
* ```
|
|
5617
5876
|
*/
|
|
5618
5877
|
async getGitLog(options = {}) {
|
|
5619
|
-
const { directory, noMerges = true,
|
|
5878
|
+
const { directory, noMerges = true, fields } = options;
|
|
5620
5879
|
const from = await this.resolveTag(options.from, "root");
|
|
5621
5880
|
const to = await this.resolveTag(options.to, "HEAD");
|
|
5622
5881
|
const range = from === to ? to : `${from}..${to}`;
|
|
5623
5882
|
const gitLogOptions = {
|
|
5624
5883
|
repo: ".",
|
|
5625
5884
|
number: 1e3,
|
|
5626
|
-
fields
|
|
5885
|
+
fields,
|
|
5627
5886
|
branch: range,
|
|
5628
5887
|
file: directory,
|
|
5629
5888
|
nameStatus: false,
|
|
@@ -5634,6 +5893,38 @@ var GitChangelog = class {
|
|
|
5634
5893
|
this.options.logger?.debug("GitChangelog commits", commits);
|
|
5635
5894
|
return commits;
|
|
5636
5895
|
}
|
|
5896
|
+
/**
|
|
5897
|
+
* Retrieves and parses Git commits with metadata
|
|
5898
|
+
*
|
|
5899
|
+
* Gets commit history and enhances it with parsed conventional
|
|
5900
|
+
* commit information and PR metadata.
|
|
5901
|
+
*
|
|
5902
|
+
* @param options - Configuration options for Git log retrieval
|
|
5903
|
+
* @returns Array of enhanced commit objects with parsed metadata
|
|
5904
|
+
*
|
|
5905
|
+
* @example Basic usage
|
|
5906
|
+
* ```typescript
|
|
5907
|
+
* const commits = await changelog.getCommits({
|
|
5908
|
+
* from: 'v1.0.0',
|
|
5909
|
+
* to: 'v2.0.0'
|
|
5910
|
+
* });
|
|
5911
|
+
* // [
|
|
5912
|
+
* // {
|
|
5913
|
+
* // base: { hash: '...', subject: '...' },
|
|
5914
|
+
* // commitlint: { type: 'feat', scope: 'api', ... },
|
|
5915
|
+
* // commits: []
|
|
5916
|
+
* // }
|
|
5917
|
+
* // ]
|
|
5918
|
+
* ```
|
|
5919
|
+
*
|
|
5920
|
+
* @example Filtered commits
|
|
5921
|
+
* ```typescript
|
|
5922
|
+
* const commits = await changelog.getCommits({
|
|
5923
|
+
* directory: 'packages/my-pkg',
|
|
5924
|
+
* noMerges: true
|
|
5925
|
+
* });
|
|
5926
|
+
* ```
|
|
5927
|
+
*/
|
|
5637
5928
|
async getCommits(options) {
|
|
5638
5929
|
const gitCommits = await this.getGitLog(options);
|
|
5639
5930
|
return gitCommits.map((commit) => {
|
|
@@ -5646,6 +5937,28 @@ var GitChangelog = class {
|
|
|
5646
5937
|
};
|
|
5647
5938
|
});
|
|
5648
5939
|
}
|
|
5940
|
+
/**
|
|
5941
|
+
* Creates a base commit object from message and optional data
|
|
5942
|
+
*
|
|
5943
|
+
* Utility method to create a standardized commit object with
|
|
5944
|
+
* basic metadata. Used internally for commit value creation.
|
|
5945
|
+
*
|
|
5946
|
+
* @param message - Commit message
|
|
5947
|
+
* @param target - Optional additional commit data
|
|
5948
|
+
* @returns Base commit object
|
|
5949
|
+
* @protected
|
|
5950
|
+
*
|
|
5951
|
+
* @example
|
|
5952
|
+
* ```typescript
|
|
5953
|
+
* const commit = changelog.createBaseCommit(
|
|
5954
|
+
* 'feat: new feature',
|
|
5955
|
+
* {
|
|
5956
|
+
* hash: 'abc123',
|
|
5957
|
+
* authorName: 'John Doe'
|
|
5958
|
+
* }
|
|
5959
|
+
* );
|
|
5960
|
+
* ```
|
|
5961
|
+
*/
|
|
5649
5962
|
createBaseCommit(message, target) {
|
|
5650
5963
|
return {
|
|
5651
5964
|
subject: message,
|
|
@@ -5655,16 +5968,66 @@ var GitChangelog = class {
|
|
|
5655
5968
|
};
|
|
5656
5969
|
}
|
|
5657
5970
|
/**
|
|
5658
|
-
*
|
|
5971
|
+
* Indents each line of a text block
|
|
5972
|
+
*
|
|
5973
|
+
* Adds specified number of spaces to the start of each line
|
|
5974
|
+
* in a multi-line string. Used for formatting commit body text.
|
|
5659
5975
|
*
|
|
5660
5976
|
* @since 2.3.2
|
|
5661
|
-
* @param body
|
|
5662
|
-
* @param size
|
|
5663
|
-
* @returns
|
|
5977
|
+
* @param body - Text to indent
|
|
5978
|
+
* @param size - Number of spaces to add (default: 2)
|
|
5979
|
+
* @returns Indented text
|
|
5980
|
+
*
|
|
5981
|
+
* @example
|
|
5982
|
+
* ```typescript
|
|
5983
|
+
* const text = changelog.tabify(
|
|
5984
|
+
* 'Line 1\nLine 2\nLine 3',
|
|
5985
|
+
* 4
|
|
5986
|
+
* );
|
|
5987
|
+
* // ' Line 1\n Line 2\n Line 3'
|
|
5988
|
+
* ```
|
|
5664
5989
|
*/
|
|
5665
5990
|
tabify(body, size = 2) {
|
|
5666
5991
|
return body.split("\n").map((line) => " ".repeat(size) + line.trim()).join("\n");
|
|
5667
5992
|
}
|
|
5993
|
+
/**
|
|
5994
|
+
* Parses a commit message into conventional commit format
|
|
5995
|
+
*
|
|
5996
|
+
* Extracts type, scope, message, and body from a commit message
|
|
5997
|
+
* following the conventional commit specification.
|
|
5998
|
+
*
|
|
5999
|
+
* Format: type(scope): message
|
|
6000
|
+
*
|
|
6001
|
+
* @param subject - Commit subject line
|
|
6002
|
+
* @param rawBody - Full commit message body
|
|
6003
|
+
* @returns Parsed conventional commit data
|
|
6004
|
+
*
|
|
6005
|
+
* @example Basic commit
|
|
6006
|
+
* ```typescript
|
|
6007
|
+
* const commit = changelog.parseCommitlint(
|
|
6008
|
+
* 'feat(api): add new endpoint'
|
|
6009
|
+
* );
|
|
6010
|
+
* // {
|
|
6011
|
+
* // type: 'feat',
|
|
6012
|
+
* // scope: 'api',
|
|
6013
|
+
* // message: 'add new endpoint'
|
|
6014
|
+
* // }
|
|
6015
|
+
* ```
|
|
6016
|
+
*
|
|
6017
|
+
* @example With body
|
|
6018
|
+
* ```typescript
|
|
6019
|
+
* const commit = changelog.parseCommitlint(
|
|
6020
|
+
* 'fix(core): memory leak',
|
|
6021
|
+
* 'Fixed memory leak in core module\n\nBREAKING CHANGE: API changed'
|
|
6022
|
+
* );
|
|
6023
|
+
* // {
|
|
6024
|
+
* // type: 'fix',
|
|
6025
|
+
* // scope: 'core',
|
|
6026
|
+
* // message: 'memory leak',
|
|
6027
|
+
* // body: ' Fixed memory leak in core module\n\n BREAKING CHANGE: API changed'
|
|
6028
|
+
* // }
|
|
6029
|
+
* ```
|
|
6030
|
+
*/
|
|
5668
6031
|
parseCommitlint(subject, rawBody = "") {
|
|
5669
6032
|
const [title] = subject.trim().split("\n");
|
|
5670
6033
|
const bodyLines = rawBody.startsWith(title) ? rawBody.replace(title, "") : rawBody;
|
|
@@ -5683,6 +6046,51 @@ var GitChangelog = class {
|
|
|
5683
6046
|
body: bodyLines ? this.tabify(bodyLines) : void 0
|
|
5684
6047
|
};
|
|
5685
6048
|
}
|
|
6049
|
+
/**
|
|
6050
|
+
* Creates a complete commit value object from hash and message
|
|
6051
|
+
*
|
|
6052
|
+
* Combines commit hash, parsed conventional commit data, and
|
|
6053
|
+
* PR information into a single commit value object.
|
|
6054
|
+
*
|
|
6055
|
+
* @param hash - Commit hash
|
|
6056
|
+
* @param message - Full commit message
|
|
6057
|
+
* @returns Complete commit value object
|
|
6058
|
+
*
|
|
6059
|
+
* @example Basic commit
|
|
6060
|
+
* ```typescript
|
|
6061
|
+
* const commit = changelog.toCommitValue(
|
|
6062
|
+
* 'abc123',
|
|
6063
|
+
* 'feat(api): new endpoint'
|
|
6064
|
+
* );
|
|
6065
|
+
* // {
|
|
6066
|
+
* // base: {
|
|
6067
|
+
* // hash: 'abc123',
|
|
6068
|
+
* // abbrevHash: 'abc123',
|
|
6069
|
+
* // subject: 'feat(api): new endpoint'
|
|
6070
|
+
* // },
|
|
6071
|
+
* // commitlint: {
|
|
6072
|
+
* // type: 'feat',
|
|
6073
|
+
* // scope: 'api',
|
|
6074
|
+
* // message: 'new endpoint'
|
|
6075
|
+
* // },
|
|
6076
|
+
* // commits: []
|
|
6077
|
+
* // }
|
|
6078
|
+
* ```
|
|
6079
|
+
*
|
|
6080
|
+
* @example PR commit
|
|
6081
|
+
* ```typescript
|
|
6082
|
+
* const commit = changelog.toCommitValue(
|
|
6083
|
+
* 'def456',
|
|
6084
|
+
* 'fix(core): memory leak (#123)'
|
|
6085
|
+
* );
|
|
6086
|
+
* // {
|
|
6087
|
+
* // base: { hash: 'def456', ... },
|
|
6088
|
+
* // commitlint: { type: 'fix', ... },
|
|
6089
|
+
* // commits: [],
|
|
6090
|
+
* // prNumber: '123'
|
|
6091
|
+
* // }
|
|
6092
|
+
* ```
|
|
6093
|
+
*/
|
|
5686
6094
|
toCommitValue(hash, message) {
|
|
5687
6095
|
const [title] = message.trim().split("\n");
|
|
5688
6096
|
const prMatch = title.match(/\(#(\d+)\)/);
|
|
@@ -5700,6 +6108,33 @@ var GitChangelog = class {
|
|
|
5700
6108
|
prNumber: prMatch?.[1]
|
|
5701
6109
|
};
|
|
5702
6110
|
}
|
|
6111
|
+
/**
|
|
6112
|
+
* Resolves a Git tag or reference to a valid commit reference
|
|
6113
|
+
*
|
|
6114
|
+
* Attempts to resolve a tag name to a valid Git reference.
|
|
6115
|
+
* Falls back to root commit or HEAD if tag doesn't exist.
|
|
6116
|
+
*
|
|
6117
|
+
* @param tag - Tag name to resolve
|
|
6118
|
+
* @param fallback - Fallback value ('root' or 'HEAD')
|
|
6119
|
+
* @returns Resolved Git reference
|
|
6120
|
+
* @protected
|
|
6121
|
+
*
|
|
6122
|
+
* @example Basic tag resolution
|
|
6123
|
+
* ```typescript
|
|
6124
|
+
* const ref = await changelog.resolveTag('v1.0.0');
|
|
6125
|
+
* // 'v1.0.0' if tag exists
|
|
6126
|
+
* // 'HEAD' if tag doesn't exist
|
|
6127
|
+
* ```
|
|
6128
|
+
*
|
|
6129
|
+
* @example Root commit fallback
|
|
6130
|
+
* ```typescript
|
|
6131
|
+
* const ref = await changelog.resolveTag(
|
|
6132
|
+
* 'non-existent-tag',
|
|
6133
|
+
* 'root'
|
|
6134
|
+
* );
|
|
6135
|
+
* // First commit hash if tag doesn't exist
|
|
6136
|
+
* ```
|
|
6137
|
+
*/
|
|
5703
6138
|
async resolveTag(tag, fallback) {
|
|
5704
6139
|
if (tag) {
|
|
5705
6140
|
try {
|
|
@@ -5716,12 +6151,79 @@ var GitChangelog = class {
|
|
|
5716
6151
|
};
|
|
5717
6152
|
|
|
5718
6153
|
// src/implments/changelog/GitChangelogFormatter.ts
|
|
6154
|
+
var import_scripts_context5 = require("@qlover/scripts-context");
|
|
5719
6155
|
var import_groupBy = __toESM(require_groupBy(), 1);
|
|
5720
6156
|
var DEFAULT_TEMPLATE = "\n- ${scopeHeader} ${commitlint.message} ${commitLink} ${prLink}";
|
|
5721
6157
|
var GitChangelogFormatter = class {
|
|
6158
|
+
/**
|
|
6159
|
+
* Creates a new GitChangelogFormatter instance
|
|
6160
|
+
*
|
|
6161
|
+
* @param options - Configuration options including shell interface
|
|
6162
|
+
*
|
|
6163
|
+
* @example
|
|
6164
|
+
* ```typescript
|
|
6165
|
+
* const formatter = new GitChangelogFormatter({
|
|
6166
|
+
* shell: new Shell(),
|
|
6167
|
+
* repoUrl: 'https://github.com/org/repo',
|
|
6168
|
+
* types: [
|
|
6169
|
+
* { type: 'feat', section: '### Features' }
|
|
6170
|
+
* ],
|
|
6171
|
+
* formatTemplate: '- ${commitlint.message}'
|
|
6172
|
+
* });
|
|
6173
|
+
* ```
|
|
6174
|
+
*/
|
|
5722
6175
|
constructor(options) {
|
|
5723
6176
|
this.options = options;
|
|
5724
6177
|
}
|
|
6178
|
+
/**
|
|
6179
|
+
* Formats an array of commits into changelog entries
|
|
6180
|
+
*
|
|
6181
|
+
* Groups commits by type and formats them according to the
|
|
6182
|
+
* configured template and options. Supports commit body
|
|
6183
|
+
* inclusion and type-based sections.
|
|
6184
|
+
*
|
|
6185
|
+
* @param commits - Array of commit values to format
|
|
6186
|
+
* @param options - Optional formatting options
|
|
6187
|
+
* @returns Array of formatted changelog lines
|
|
6188
|
+
*
|
|
6189
|
+
* @example Basic formatting
|
|
6190
|
+
* ```typescript
|
|
6191
|
+
* const changelog = formatter.format([
|
|
6192
|
+
* {
|
|
6193
|
+
* base: { hash: 'abc123' },
|
|
6194
|
+
* commitlint: {
|
|
6195
|
+
* type: 'feat',
|
|
6196
|
+
* scope: 'api',
|
|
6197
|
+
* message: 'new endpoint'
|
|
6198
|
+
* }
|
|
6199
|
+
* }
|
|
6200
|
+
* ]);
|
|
6201
|
+
* // [
|
|
6202
|
+
* // '### Features',
|
|
6203
|
+
* // '- **api:** new endpoint ([abc123](...))'
|
|
6204
|
+
* // ]
|
|
6205
|
+
* ```
|
|
6206
|
+
*
|
|
6207
|
+
* @example With commit body
|
|
6208
|
+
* ```typescript
|
|
6209
|
+
* const changelog = formatter.format(
|
|
6210
|
+
* [{
|
|
6211
|
+
* commitlint: {
|
|
6212
|
+
* type: 'fix',
|
|
6213
|
+
* message: 'memory leak',
|
|
6214
|
+
* body: 'Fixed memory allocation\nAdded cleanup'
|
|
6215
|
+
* }
|
|
6216
|
+
* }],
|
|
6217
|
+
* { commitBody: true }
|
|
6218
|
+
* );
|
|
6219
|
+
* // [
|
|
6220
|
+
* // '### Bug Fixes',
|
|
6221
|
+
* // '- memory leak',
|
|
6222
|
+
* // ' Fixed memory allocation',
|
|
6223
|
+
* // ' Added cleanup'
|
|
6224
|
+
* // ]
|
|
6225
|
+
* ```
|
|
6226
|
+
*/
|
|
5725
6227
|
format(commits, options) {
|
|
5726
6228
|
const { types = [], commitBody = false } = { ...this.options, ...options };
|
|
5727
6229
|
const changelog = [];
|
|
@@ -5748,6 +6250,41 @@ var GitChangelogFormatter = class {
|
|
|
5748
6250
|
});
|
|
5749
6251
|
return changelog;
|
|
5750
6252
|
}
|
|
6253
|
+
/**
|
|
6254
|
+
* Formats a single commit into a changelog entry
|
|
6255
|
+
*
|
|
6256
|
+
* Applies the configured template to a commit, including
|
|
6257
|
+
* scope formatting, PR links, and commit hash links.
|
|
6258
|
+
*
|
|
6259
|
+
* @param commit - Commit value to format
|
|
6260
|
+
* @param options - Optional formatting options
|
|
6261
|
+
* @returns Formatted changelog entry
|
|
6262
|
+
*
|
|
6263
|
+
* @example Basic formatting
|
|
6264
|
+
* ```typescript
|
|
6265
|
+
* const entry = formatter.formatCommit({
|
|
6266
|
+
* base: { hash: 'abc123' },
|
|
6267
|
+
* commitlint: {
|
|
6268
|
+
* type: 'feat',
|
|
6269
|
+
* scope: 'api',
|
|
6270
|
+
* message: 'new endpoint'
|
|
6271
|
+
* }
|
|
6272
|
+
* });
|
|
6273
|
+
* // '- **api:** new endpoint ([abc123](...))'
|
|
6274
|
+
* ```
|
|
6275
|
+
*
|
|
6276
|
+
* @example With PR number
|
|
6277
|
+
* ```typescript
|
|
6278
|
+
* const entry = formatter.formatCommit({
|
|
6279
|
+
* base: { hash: 'def456' },
|
|
6280
|
+
* commitlint: {
|
|
6281
|
+
* message: 'fix bug'
|
|
6282
|
+
* },
|
|
6283
|
+
* prNumber: '123'
|
|
6284
|
+
* });
|
|
6285
|
+
* // '- fix bug ([def456](...)) (#123)'
|
|
6286
|
+
* ```
|
|
6287
|
+
*/
|
|
5751
6288
|
formatCommit(commit, options) {
|
|
5752
6289
|
const {
|
|
5753
6290
|
commitlint,
|
|
@@ -5767,19 +6304,72 @@ var GitChangelogFormatter = class {
|
|
|
5767
6304
|
hash.slice(0, 7),
|
|
5768
6305
|
repoUrl ? `${repoUrl}/commit/${hash}` : ""
|
|
5769
6306
|
) : "";
|
|
5770
|
-
return
|
|
6307
|
+
return import_scripts_context5.Shell.format(formatTemplate, {
|
|
5771
6308
|
...commit,
|
|
5772
6309
|
scopeHeader,
|
|
5773
6310
|
commitLink: hashLink,
|
|
5774
6311
|
prLink
|
|
5775
6312
|
});
|
|
5776
6313
|
}
|
|
6314
|
+
/**
|
|
6315
|
+
* Formats a target string as a Markdown link
|
|
6316
|
+
*
|
|
6317
|
+
* Creates a Markdown-formatted link with optional URL.
|
|
6318
|
+
* If no URL is provided, formats as a plain reference.
|
|
6319
|
+
*
|
|
6320
|
+
* @param target - Text to display
|
|
6321
|
+
* @param url - Optional URL for the link
|
|
6322
|
+
* @returns Formatted Markdown link
|
|
6323
|
+
*
|
|
6324
|
+
* @example With URL
|
|
6325
|
+
* ```typescript
|
|
6326
|
+
* const link = formatter.foramtLink('abc123', 'https://github.com/org/repo/commit/abc123');
|
|
6327
|
+
* // '([abc123](https://github.com/org/repo/commit/abc123))'
|
|
6328
|
+
* ```
|
|
6329
|
+
*
|
|
6330
|
+
* @example Without URL
|
|
6331
|
+
* ```typescript
|
|
6332
|
+
* const link = formatter.foramtLink('abc123');
|
|
6333
|
+
* // '(abc123)'
|
|
6334
|
+
* ```
|
|
6335
|
+
*/
|
|
5777
6336
|
foramtLink(target, url) {
|
|
5778
6337
|
return url ? `([${target}](${url}))` : `(${target})`;
|
|
5779
6338
|
}
|
|
6339
|
+
/**
|
|
6340
|
+
* Formats a commit hash as a Markdown link
|
|
6341
|
+
*
|
|
6342
|
+
* @deprecated Use foramtLink instead
|
|
6343
|
+
* @param target - Commit hash to display
|
|
6344
|
+
* @param url - Optional URL to the commit
|
|
6345
|
+
* @returns Formatted Markdown link
|
|
6346
|
+
*
|
|
6347
|
+
* @example
|
|
6348
|
+
* ```typescript
|
|
6349
|
+
* const link = formatter.formatCommitLink(
|
|
6350
|
+
* 'abc123',
|
|
6351
|
+
* 'https://github.com/org/repo/commit/abc123'
|
|
6352
|
+
* );
|
|
6353
|
+
* // '([abc123](https://github.com/org/repo/commit/abc123))'
|
|
6354
|
+
* ```
|
|
6355
|
+
*/
|
|
5780
6356
|
formatCommitLink(target, url) {
|
|
5781
6357
|
return url ? `([${target}](${url}))` : `(${target})`;
|
|
5782
6358
|
}
|
|
6359
|
+
/**
|
|
6360
|
+
* Formats a commit scope in Markdown
|
|
6361
|
+
*
|
|
6362
|
+
* Wraps the scope in bold syntax and adds a colon.
|
|
6363
|
+
*
|
|
6364
|
+
* @param scope - Scope to format
|
|
6365
|
+
* @returns Formatted scope in Markdown
|
|
6366
|
+
*
|
|
6367
|
+
* @example
|
|
6368
|
+
* ```typescript
|
|
6369
|
+
* const scope = formatter.formatScope('api');
|
|
6370
|
+
* // '**api:**'
|
|
6371
|
+
* ```
|
|
6372
|
+
*/
|
|
5783
6373
|
formatScope(scope) {
|
|
5784
6374
|
return `**${scope}:**`;
|
|
5785
6375
|
}
|
|
@@ -5833,7 +6423,30 @@ var Pather = class {
|
|
|
5833
6423
|
return child[boundaryIndex] === import_node_path.sep;
|
|
5834
6424
|
}
|
|
5835
6425
|
/**
|
|
5836
|
-
*
|
|
6426
|
+
* Normalized path prefix check
|
|
6427
|
+
*
|
|
6428
|
+
* Checks if sourcePath starts with targetPath after normalization.
|
|
6429
|
+
* Handles cross-platform path separators and trailing separators.
|
|
6430
|
+
*
|
|
6431
|
+
* @param sourcePath - Path to check
|
|
6432
|
+
* @param targetPath - Prefix path to match
|
|
6433
|
+
* @returns True if sourcePath starts with targetPath
|
|
6434
|
+
*
|
|
6435
|
+
* @example Basic usage
|
|
6436
|
+
* ```typescript
|
|
6437
|
+
* const pather = new Pather();
|
|
6438
|
+
*
|
|
6439
|
+
* pather.startsWith('src/utils/file.ts', 'src') // true
|
|
6440
|
+
* pather.startsWith('src\\utils\\file.ts', 'src') // true
|
|
6441
|
+
* pather.startsWith('lib/utils/file.ts', 'src') // false
|
|
6442
|
+
* ```
|
|
6443
|
+
*
|
|
6444
|
+
* @example Trailing separators
|
|
6445
|
+
* ```typescript
|
|
6446
|
+
* pather.startsWith('src/utils', 'src/') // true
|
|
6447
|
+
* pather.startsWith('src/utils/', 'src') // true
|
|
6448
|
+
* pather.startsWith('src2/utils', 'src') // false
|
|
6449
|
+
* ```
|
|
5837
6450
|
*/
|
|
5838
6451
|
startsWith(sourcePath, targetPath) {
|
|
5839
6452
|
let src = this.toLocalPath(sourcePath);
|
|
@@ -5847,7 +6460,44 @@ var Pather = class {
|
|
|
5847
6460
|
return src.startsWith(tgt);
|
|
5848
6461
|
}
|
|
5849
6462
|
/**
|
|
5850
|
-
* Segment-aware containment check
|
|
6463
|
+
* Segment-aware path containment check
|
|
6464
|
+
*
|
|
6465
|
+
* Checks if sourcePath contains targetPath as a complete path segment.
|
|
6466
|
+
* Unlike simple substring matching, this ensures proper path boundaries.
|
|
6467
|
+
* For example, 'src/abc' does not contain 'src/a' even though 'src/a'
|
|
6468
|
+
* is a substring.
|
|
6469
|
+
*
|
|
6470
|
+
* Features:
|
|
6471
|
+
* - Cross-platform path handling
|
|
6472
|
+
* - Proper segment boundary checking
|
|
6473
|
+
* - Trailing separator normalization
|
|
6474
|
+
* - Exact match support
|
|
6475
|
+
*
|
|
6476
|
+
* @param sourcePath - Path to search in
|
|
6477
|
+
* @param targetPath - Path to search for
|
|
6478
|
+
* @returns True if sourcePath contains targetPath as a segment
|
|
6479
|
+
*
|
|
6480
|
+
* @example Basic usage
|
|
6481
|
+
* ```typescript
|
|
6482
|
+
* const pather = new Pather();
|
|
6483
|
+
*
|
|
6484
|
+
* pather.containsPath('src/utils/file.ts', 'utils') // true
|
|
6485
|
+
* pather.containsPath('src/utils/file.ts', 'src/utils') // true
|
|
6486
|
+
* pather.containsPath('src/utils/file.ts', 'til') // false
|
|
6487
|
+
* ```
|
|
6488
|
+
*
|
|
6489
|
+
* @example Segment boundaries
|
|
6490
|
+
* ```typescript
|
|
6491
|
+
* pather.containsPath('src/abc/file.ts', 'src/a') // false
|
|
6492
|
+
* pather.containsPath('src/abc/file.ts', 'src/abc') // true
|
|
6493
|
+
* ```
|
|
6494
|
+
*
|
|
6495
|
+
* @example Trailing separators
|
|
6496
|
+
* ```typescript
|
|
6497
|
+
* pather.containsPath('src/utils/', 'utils') // true
|
|
6498
|
+
* pather.containsPath('src/utils', 'utils/') // true
|
|
6499
|
+
* pather.containsPath('src/utils/', 'utils/') // true
|
|
6500
|
+
* ```
|
|
5851
6501
|
*/
|
|
5852
6502
|
containsPath(sourcePath, targetPath) {
|
|
5853
6503
|
let src = this.toLocalPath(sourcePath);
|
|
@@ -5873,18 +6523,49 @@ var Pather = class {
|
|
|
5873
6523
|
// src/plugins/githubPR/GithubChangelog.ts
|
|
5874
6524
|
var DOMAIN = "https://github.com";
|
|
5875
6525
|
var GithubChangelog = class _GithubChangelog extends GitChangelog {
|
|
6526
|
+
/**
|
|
6527
|
+
* Creates a new GitHub changelog generator
|
|
6528
|
+
*
|
|
6529
|
+
* @param options - Changelog generation options
|
|
6530
|
+
* @param githubManager - GitHub API manager
|
|
6531
|
+
*
|
|
6532
|
+
* @example
|
|
6533
|
+
* ```typescript
|
|
6534
|
+
* const changelog = new GithubChangelog({
|
|
6535
|
+
* shell,
|
|
6536
|
+
* logger,
|
|
6537
|
+
* mergePRcommit: true,
|
|
6538
|
+
* githubRootPath: 'https://github.com/org/repo'
|
|
6539
|
+
* }, githubManager);
|
|
6540
|
+
* ```
|
|
6541
|
+
*/
|
|
5876
6542
|
constructor(options, githubManager) {
|
|
5877
6543
|
super(options);
|
|
5878
6544
|
this.options = options;
|
|
5879
6545
|
this.githubManager = githubManager;
|
|
5880
6546
|
}
|
|
6547
|
+
/** Path manipulation utility */
|
|
5881
6548
|
pather = new Pather();
|
|
5882
6549
|
/**
|
|
5883
|
-
*
|
|
5884
|
-
*
|
|
5885
|
-
*
|
|
5886
|
-
*
|
|
6550
|
+
* Filters commits by directory
|
|
6551
|
+
*
|
|
6552
|
+
* Filters commits based on whether they contain changes in
|
|
6553
|
+
* the specified directory. Uses GitHub API to get detailed
|
|
6554
|
+
* commit information.
|
|
6555
|
+
*
|
|
6556
|
+
* @param commits - Array of commits to filter
|
|
6557
|
+
* @param directory - Directory path to filter by
|
|
6558
|
+
* @returns Promise resolving to filtered commits
|
|
5887
6559
|
* @since 2.4.0
|
|
6560
|
+
*
|
|
6561
|
+
* @example
|
|
6562
|
+
* ```typescript
|
|
6563
|
+
* const commits = await changelog.filterCommitsByDirectory(
|
|
6564
|
+
* allCommits,
|
|
6565
|
+
* 'packages/pkg-a'
|
|
6566
|
+
* );
|
|
6567
|
+
* // Only commits that modified files in packages/pkg-a
|
|
6568
|
+
* ```
|
|
5888
6569
|
*/
|
|
5889
6570
|
async filterCommitsByDirectory(commits, directory) {
|
|
5890
6571
|
const result = [];
|
|
@@ -5902,6 +6583,41 @@ var GithubChangelog = class _GithubChangelog extends GitChangelog {
|
|
|
5902
6583
|
}
|
|
5903
6584
|
return result;
|
|
5904
6585
|
}
|
|
6586
|
+
/**
|
|
6587
|
+
* Gets complete commit information with PR details
|
|
6588
|
+
*
|
|
6589
|
+
* Retrieves commits and enhances them with pull request
|
|
6590
|
+
* information. For commits associated with PRs, includes
|
|
6591
|
+
* all PR commits and filters by directory.
|
|
6592
|
+
*
|
|
6593
|
+
* Process:
|
|
6594
|
+
* 1. Get base commits
|
|
6595
|
+
* 2. Extract PR numbers
|
|
6596
|
+
* 3. Fetch PR commits
|
|
6597
|
+
* 4. Filter by directory
|
|
6598
|
+
* 5. Flatten results
|
|
6599
|
+
*
|
|
6600
|
+
* @param options - Changelog options
|
|
6601
|
+
* @returns Promise resolving to enhanced commits
|
|
6602
|
+
*
|
|
6603
|
+
* @example Basic usage
|
|
6604
|
+
* ```typescript
|
|
6605
|
+
* const commits = await changelog.getFullCommit({
|
|
6606
|
+
* from: 'v1.0.0',
|
|
6607
|
+
* directory: 'packages/pkg-a'
|
|
6608
|
+
* });
|
|
6609
|
+
* // Returns commits with PR information
|
|
6610
|
+
* ```
|
|
6611
|
+
*
|
|
6612
|
+
* @example With PR merging
|
|
6613
|
+
* ```typescript
|
|
6614
|
+
* const commits = await changelog.getFullCommit({
|
|
6615
|
+
* mergePRcommit: true,
|
|
6616
|
+
* directory: 'packages/pkg-a'
|
|
6617
|
+
* });
|
|
6618
|
+
* // Includes all PR commits
|
|
6619
|
+
* ```
|
|
6620
|
+
*/
|
|
5905
6621
|
async getFullCommit(options) {
|
|
5906
6622
|
const _options = { ...this.options, ...options };
|
|
5907
6623
|
const allCommits = await this.getCommits(_options);
|
|
@@ -5929,14 +6645,49 @@ var GithubChangelog = class _GithubChangelog extends GitChangelog {
|
|
|
5929
6645
|
);
|
|
5930
6646
|
return newallCommits.flat();
|
|
5931
6647
|
}
|
|
6648
|
+
/**
|
|
6649
|
+
* Transforms workspaces with GitHub changelogs
|
|
6650
|
+
*
|
|
6651
|
+
* Processes each workspace to add GitHub-specific changelog
|
|
6652
|
+
* information. Includes:
|
|
6653
|
+
* - GitHub repository URL
|
|
6654
|
+
* - PR-aware commit history
|
|
6655
|
+
* - Formatted changelog with links
|
|
6656
|
+
*
|
|
6657
|
+
* Process:
|
|
6658
|
+
* 1. Build GitHub root path
|
|
6659
|
+
* 2. Configure changelog options
|
|
6660
|
+
* 3. Get commits for each workspace
|
|
6661
|
+
* 4. Format changelog with links
|
|
6662
|
+
* 5. Update workspace objects
|
|
6663
|
+
*
|
|
6664
|
+
* @param workspaces - Array of workspaces to process
|
|
6665
|
+
* @param context - Release context
|
|
6666
|
+
* @returns Promise resolving to updated workspaces
|
|
6667
|
+
*
|
|
6668
|
+
* @example
|
|
6669
|
+
* ```typescript
|
|
6670
|
+
* const workspaces = await changelog.transformWorkspace(
|
|
6671
|
+
* [
|
|
6672
|
+
* {
|
|
6673
|
+
* name: 'pkg-a',
|
|
6674
|
+
* path: 'packages/a',
|
|
6675
|
+
* lastTag: 'v1.0.0'
|
|
6676
|
+
* }
|
|
6677
|
+
* ],
|
|
6678
|
+
* context
|
|
6679
|
+
* );
|
|
6680
|
+
* // Returns workspaces with GitHub-formatted changelogs
|
|
6681
|
+
* ```
|
|
6682
|
+
*/
|
|
5932
6683
|
async transformWorkspace(workspaces, context) {
|
|
5933
6684
|
const githubRootPath = [
|
|
5934
6685
|
DOMAIN,
|
|
5935
|
-
context.
|
|
5936
|
-
context.
|
|
6686
|
+
context.getOptions("authorName"),
|
|
6687
|
+
context.getOptions("repoName")
|
|
5937
6688
|
].join("/");
|
|
5938
6689
|
const changelogProps = {
|
|
5939
|
-
...context.
|
|
6690
|
+
...context.getOptions("changelog"),
|
|
5940
6691
|
githubRootPath,
|
|
5941
6692
|
mergePRcommit: true,
|
|
5942
6693
|
shell: context.shell,
|
|
@@ -5952,7 +6703,7 @@ var GithubChangelog = class _GithubChangelog extends GitChangelog {
|
|
|
5952
6703
|
const changelog = await githubChangelog.getFullCommit({
|
|
5953
6704
|
from: workspace.lastTag ?? "",
|
|
5954
6705
|
directory: workspace.path,
|
|
5955
|
-
|
|
6706
|
+
fields: CHANGELOG_ALL_FIELDS
|
|
5956
6707
|
});
|
|
5957
6708
|
if (typeof changelog === "string") {
|
|
5958
6709
|
return {
|
|
@@ -5974,9 +6725,30 @@ var GithubChangelog = class _GithubChangelog extends GitChangelog {
|
|
|
5974
6725
|
};
|
|
5975
6726
|
|
|
5976
6727
|
// src/plugins/githubPR/GithubPR.ts
|
|
6728
|
+
var import_scripts_context6 = require("@qlover/scripts-context");
|
|
5977
6729
|
var DEFAULT_RELEASE_NAME = "Release ${name} v${version}";
|
|
5978
6730
|
var DEFAULT_COMMIT_MESSAGE = "chore(tag): ${name} v${version}";
|
|
5979
6731
|
var GithubPR = class extends GitBase {
|
|
6732
|
+
/**
|
|
6733
|
+
* Creates a new GithubPR plugin instance
|
|
6734
|
+
*
|
|
6735
|
+
* Initializes the plugin with GitHub-specific configuration and
|
|
6736
|
+
* sets up release parameters and GitHub manager.
|
|
6737
|
+
*
|
|
6738
|
+
* @param context - Release context
|
|
6739
|
+
* @param props - Plugin configuration
|
|
6740
|
+
*
|
|
6741
|
+
* @example
|
|
6742
|
+
* ```typescript
|
|
6743
|
+
* const plugin = new GithubPR(context, {
|
|
6744
|
+
* releasePR: true,
|
|
6745
|
+
* releaseName: 'Release v${version}',
|
|
6746
|
+
* commitMessage: 'chore: release v${version}',
|
|
6747
|
+
* draft: false,
|
|
6748
|
+
* preRelease: false
|
|
6749
|
+
* });
|
|
6750
|
+
* ```
|
|
6751
|
+
*/
|
|
5980
6752
|
constructor(context, props) {
|
|
5981
6753
|
super(context, "githubPR", {
|
|
5982
6754
|
releaseName: DEFAULT_RELEASE_NAME,
|
|
@@ -5984,23 +6756,75 @@ var GithubPR = class extends GitBase {
|
|
|
5984
6756
|
});
|
|
5985
6757
|
this.context = context;
|
|
5986
6758
|
this.githubManager = new GithubManager(this.context);
|
|
5987
|
-
this.releaseParams = new ReleaseParams(context.
|
|
5988
|
-
PRTitle: this.getConfig("PRTitle", this.context.
|
|
5989
|
-
PRBody: this.getConfig("PRBody", this.context.
|
|
6759
|
+
this.releaseParams = new ReleaseParams(context.logger, {
|
|
6760
|
+
PRTitle: this.getConfig("PRTitle", this.context.options.PRTitle),
|
|
6761
|
+
PRBody: this.getConfig("PRBody", this.context.options.PRBody),
|
|
5990
6762
|
...this.props
|
|
5991
6763
|
});
|
|
5992
6764
|
}
|
|
5993
6765
|
releaseParams;
|
|
5994
6766
|
githubManager;
|
|
6767
|
+
/**
|
|
6768
|
+
* Determines if the plugin should be enabled
|
|
6769
|
+
*
|
|
6770
|
+
* Plugin is enabled unless explicitly skipped via configuration.
|
|
6771
|
+
* This allows for conditional PR creation and release publishing.
|
|
6772
|
+
*
|
|
6773
|
+
* @param _name - Plugin name (unused)
|
|
6774
|
+
* @returns True if plugin should be enabled
|
|
6775
|
+
*
|
|
6776
|
+
* @example
|
|
6777
|
+
* ```typescript
|
|
6778
|
+
* const plugin = new GithubPR(context, { skip: true });
|
|
6779
|
+
* plugin.enabled(); // false
|
|
6780
|
+
*
|
|
6781
|
+
* const plugin2 = new GithubPR(context, {});
|
|
6782
|
+
* plugin2.enabled(); // true
|
|
6783
|
+
* ```
|
|
6784
|
+
*/
|
|
5995
6785
|
enabled(_name) {
|
|
5996
6786
|
if (this.getConfig("skip")) {
|
|
5997
6787
|
return false;
|
|
5998
6788
|
}
|
|
5999
6789
|
return true;
|
|
6000
6790
|
}
|
|
6791
|
+
/**
|
|
6792
|
+
* Determines if the plugin is in publish mode
|
|
6793
|
+
*
|
|
6794
|
+
* In publish mode, the plugin publishes releases directly.
|
|
6795
|
+
* In non-publish mode (releasePR=true), it creates pull requests.
|
|
6796
|
+
*
|
|
6797
|
+
* @returns True if in publish mode
|
|
6798
|
+
*
|
|
6799
|
+
* @example
|
|
6800
|
+
* ```typescript
|
|
6801
|
+
* const plugin = new GithubPR(context, { releasePR: true });
|
|
6802
|
+
* plugin.isPublish; // false (PR mode)
|
|
6803
|
+
*
|
|
6804
|
+
* const plugin2 = new GithubPR(context, { releasePR: false });
|
|
6805
|
+
* plugin2.isPublish; // true (publish mode)
|
|
6806
|
+
* ```
|
|
6807
|
+
*/
|
|
6001
6808
|
get isPublish() {
|
|
6002
6809
|
return !this.getConfig("releasePR");
|
|
6003
6810
|
}
|
|
6811
|
+
/**
|
|
6812
|
+
* Checks if the current repository is a GitHub repository
|
|
6813
|
+
*
|
|
6814
|
+
* Verifies that the remote URL contains 'github.com' to ensure
|
|
6815
|
+
* GitHub-specific features can be used.
|
|
6816
|
+
*
|
|
6817
|
+
* @returns Promise resolving to true if GitHub repository
|
|
6818
|
+
*
|
|
6819
|
+
* @example
|
|
6820
|
+
* ```typescript
|
|
6821
|
+
* const isGithub = await plugin.isGithubRepository();
|
|
6822
|
+
* if (isGithub) {
|
|
6823
|
+
* // Use GitHub-specific features
|
|
6824
|
+
* }
|
|
6825
|
+
* ```
|
|
6826
|
+
* @private
|
|
6827
|
+
*/
|
|
6004
6828
|
async isGithubRepository() {
|
|
6005
6829
|
try {
|
|
6006
6830
|
const remoteUrl = await this.getRemoteUrl();
|
|
@@ -6009,6 +6833,24 @@ var GithubPR = class extends GitBase {
|
|
|
6009
6833
|
return false;
|
|
6010
6834
|
}
|
|
6011
6835
|
}
|
|
6836
|
+
/**
|
|
6837
|
+
* Plugin initialization hook
|
|
6838
|
+
*
|
|
6839
|
+
* Performs pre-execution setup:
|
|
6840
|
+
* 1. Verifies repository is on GitHub
|
|
6841
|
+
* 2. Runs parent class initialization
|
|
6842
|
+
* 3. Sets up NPM token for publishing
|
|
6843
|
+
*
|
|
6844
|
+
* @throws Error if not a GitHub repository
|
|
6845
|
+
* @throws Error if NPM_TOKEN missing in publish mode
|
|
6846
|
+
*
|
|
6847
|
+
* @example
|
|
6848
|
+
* ```typescript
|
|
6849
|
+
* const plugin = new GithubPR(context, {});
|
|
6850
|
+
* await plugin.onBefore();
|
|
6851
|
+
* // Throws if not GitHub repo or missing NPM token
|
|
6852
|
+
* ```
|
|
6853
|
+
*/
|
|
6012
6854
|
async onBefore() {
|
|
6013
6855
|
this.logger.debug("GithubPR onBefore");
|
|
6014
6856
|
const isGithub = await this.isGithubRepository();
|
|
@@ -6019,7 +6861,7 @@ var GithubPR = class extends GitBase {
|
|
|
6019
6861
|
}
|
|
6020
6862
|
await super.onBefore();
|
|
6021
6863
|
if (this.isPublish) {
|
|
6022
|
-
const npmToken = this.getEnv("NPM_TOKEN");
|
|
6864
|
+
const npmToken = this.context.getEnv("NPM_TOKEN");
|
|
6023
6865
|
if (!npmToken) {
|
|
6024
6866
|
throw new Error("NPM_TOKEN is not set");
|
|
6025
6867
|
}
|
|
@@ -6028,10 +6870,28 @@ var GithubPR = class extends GitBase {
|
|
|
6028
6870
|
);
|
|
6029
6871
|
}
|
|
6030
6872
|
}
|
|
6873
|
+
/**
|
|
6874
|
+
* Main plugin execution hook
|
|
6875
|
+
*
|
|
6876
|
+
* Processes changelogs for all workspaces using GitHub-specific
|
|
6877
|
+
* formatting and updates the context with the results.
|
|
6878
|
+
*
|
|
6879
|
+
* Process:
|
|
6880
|
+
* 1. Initialize GitHub changelog processor
|
|
6881
|
+
* 2. Transform workspace changelogs
|
|
6882
|
+
* 3. Update context with new workspace info
|
|
6883
|
+
*
|
|
6884
|
+
* @example
|
|
6885
|
+
* ```typescript
|
|
6886
|
+
* const plugin = new GithubPR(context, {});
|
|
6887
|
+
* await plugin.onExec();
|
|
6888
|
+
* // Transforms changelogs with GitHub links
|
|
6889
|
+
* ```
|
|
6890
|
+
*/
|
|
6031
6891
|
async onExec() {
|
|
6032
6892
|
const workspaces = this.context.workspaces;
|
|
6033
6893
|
const githubChangelog = new GithubChangelog(
|
|
6034
|
-
this.context.
|
|
6894
|
+
this.context.getOptions("changelog"),
|
|
6035
6895
|
this.githubManager
|
|
6036
6896
|
);
|
|
6037
6897
|
const newWorkspaces = await this.step({
|
|
@@ -6040,6 +6900,27 @@ var GithubPR = class extends GitBase {
|
|
|
6040
6900
|
});
|
|
6041
6901
|
this.context.setWorkspaces(newWorkspaces);
|
|
6042
6902
|
}
|
|
6903
|
+
/**
|
|
6904
|
+
* Success hook after plugin execution
|
|
6905
|
+
*
|
|
6906
|
+
* Handles either PR creation or release publishing based on
|
|
6907
|
+
* configuration. In publish mode, publishes to NPM and creates
|
|
6908
|
+
* GitHub releases. In PR mode, creates release pull requests.
|
|
6909
|
+
*
|
|
6910
|
+
* @example PR mode
|
|
6911
|
+
* ```typescript
|
|
6912
|
+
* const plugin = new GithubPR(context, { releasePR: true });
|
|
6913
|
+
* await plugin.onSuccess();
|
|
6914
|
+
* // Creates release PR
|
|
6915
|
+
* ```
|
|
6916
|
+
*
|
|
6917
|
+
* @example Publish mode
|
|
6918
|
+
* ```typescript
|
|
6919
|
+
* const plugin = new GithubPR(context, { releasePR: false });
|
|
6920
|
+
* await plugin.onSuccess();
|
|
6921
|
+
* // Publishes to NPM and creates GitHub release
|
|
6922
|
+
* ```
|
|
6923
|
+
*/
|
|
6043
6924
|
async onSuccess() {
|
|
6044
6925
|
if (this.isPublish) {
|
|
6045
6926
|
await this.publishPR(this.context.workspaces);
|
|
@@ -6047,6 +6928,28 @@ var GithubPR = class extends GitBase {
|
|
|
6047
6928
|
}
|
|
6048
6929
|
await this.releasePR(this.context.workspaces);
|
|
6049
6930
|
}
|
|
6931
|
+
/**
|
|
6932
|
+
* Creates a release pull request
|
|
6933
|
+
*
|
|
6934
|
+
* Handles the complete process of creating a release PR:
|
|
6935
|
+
* 1. Creates release commit
|
|
6936
|
+
* 2. Creates release branch
|
|
6937
|
+
* 3. Creates and configures pull request
|
|
6938
|
+
*
|
|
6939
|
+
* @param workspaces - Array of workspace configurations
|
|
6940
|
+
*
|
|
6941
|
+
* @example
|
|
6942
|
+
* ```typescript
|
|
6943
|
+
* const workspaces = [{
|
|
6944
|
+
* name: 'pkg-a',
|
|
6945
|
+
* version: '1.0.0',
|
|
6946
|
+
* changelog: '...'
|
|
6947
|
+
* }];
|
|
6948
|
+
*
|
|
6949
|
+
* await plugin.releasePR(workspaces);
|
|
6950
|
+
* // Creates PR with release changes
|
|
6951
|
+
* ```
|
|
6952
|
+
*/
|
|
6050
6953
|
async releasePR(workspaces) {
|
|
6051
6954
|
await this.step({
|
|
6052
6955
|
label: "Release Commit",
|
|
@@ -6058,6 +6961,28 @@ var GithubPR = class extends GitBase {
|
|
|
6058
6961
|
});
|
|
6059
6962
|
await this.releasePullRequest(workspaces, releaseBranchParams);
|
|
6060
6963
|
}
|
|
6964
|
+
/**
|
|
6965
|
+
* Publishes releases to NPM and GitHub
|
|
6966
|
+
*
|
|
6967
|
+
* In non-dry-run mode:
|
|
6968
|
+
* 1. Publishes packages to NPM
|
|
6969
|
+
* 2. Pushes tags to GitHub
|
|
6970
|
+
* 3. Creates GitHub releases
|
|
6971
|
+
*
|
|
6972
|
+
* @param workspaces - Array of workspace configurations
|
|
6973
|
+
*
|
|
6974
|
+
* @example
|
|
6975
|
+
* ```typescript
|
|
6976
|
+
* const workspaces = [{
|
|
6977
|
+
* name: 'pkg-a',
|
|
6978
|
+
* version: '1.0.0',
|
|
6979
|
+
* changelog: '...'
|
|
6980
|
+
* }];
|
|
6981
|
+
*
|
|
6982
|
+
* await plugin.publishPR(workspaces);
|
|
6983
|
+
* // Publishes to NPM and creates GitHub releases
|
|
6984
|
+
* ```
|
|
6985
|
+
*/
|
|
6061
6986
|
async publishPR(workspaces) {
|
|
6062
6987
|
if (!this.getConfig("dryRunCreatePR")) {
|
|
6063
6988
|
await this.context.runChangesetsCli("publish");
|
|
@@ -6073,6 +6998,34 @@ var GithubPR = class extends GitBase {
|
|
|
6073
6998
|
)
|
|
6074
6999
|
});
|
|
6075
7000
|
}
|
|
7001
|
+
/**
|
|
7002
|
+
* Creates release commit(s)
|
|
7003
|
+
*
|
|
7004
|
+
* Creates either a single commit for all workspaces or
|
|
7005
|
+
* individual commits per workspace. Uses configured commit
|
|
7006
|
+
* message template.
|
|
7007
|
+
*
|
|
7008
|
+
* @param workspaces - Array of workspace configurations
|
|
7009
|
+
*
|
|
7010
|
+
* @example Single workspace
|
|
7011
|
+
* ```typescript
|
|
7012
|
+
* await plugin.relesaeCommit([{
|
|
7013
|
+
* name: 'pkg-a',
|
|
7014
|
+
* version: '1.0.0'
|
|
7015
|
+
* }]);
|
|
7016
|
+
* // Creates: "chore(tag): pkg-a v1.0.0"
|
|
7017
|
+
* ```
|
|
7018
|
+
*
|
|
7019
|
+
* @example Multiple workspaces
|
|
7020
|
+
* ```typescript
|
|
7021
|
+
* await plugin.relesaeCommit([
|
|
7022
|
+
* { name: 'pkg-a', version: '1.0.0' },
|
|
7023
|
+
* { name: 'pkg-b', version: '2.0.0' }
|
|
7024
|
+
* ]);
|
|
7025
|
+
* // Creates: "chore(tag): pkg-a v1.0.0,pkg-b v2.0.0"
|
|
7026
|
+
* ```
|
|
7027
|
+
* @private
|
|
7028
|
+
*/
|
|
6076
7029
|
async relesaeCommit(workspaces) {
|
|
6077
7030
|
const commitArgs = this.getConfig("commitArgs", []);
|
|
6078
7031
|
if (workspaces.length === 1) {
|
|
@@ -6084,6 +7037,34 @@ var GithubPR = class extends GitBase {
|
|
|
6084
7037
|
const commitMessage = `chore(tag): ${workspaces.map((w) => `${w.name} v${w.version}`).join(",")}`;
|
|
6085
7038
|
await this.commit(commitMessage, commitArgs);
|
|
6086
7039
|
}
|
|
7040
|
+
/**
|
|
7041
|
+
* Creates and optionally merges a release pull request
|
|
7042
|
+
*
|
|
7043
|
+
* Creates a PR with release changes and handles auto-merge
|
|
7044
|
+
* if configured. Adds release and change labels to the PR.
|
|
7045
|
+
*
|
|
7046
|
+
* @param workspaces - Array of workspace configurations
|
|
7047
|
+
* @param releaseBranchParams - Branch and tag information
|
|
7048
|
+
*
|
|
7049
|
+
* @example Manual merge
|
|
7050
|
+
* ```typescript
|
|
7051
|
+
* await plugin.releasePullRequest(
|
|
7052
|
+
* workspaces,
|
|
7053
|
+
* { releaseBranch: 'release-v1.0.0', tagName: 'v1.0.0' }
|
|
7054
|
+
* );
|
|
7055
|
+
* // Creates PR for manual merge
|
|
7056
|
+
* ```
|
|
7057
|
+
*
|
|
7058
|
+
* @example Auto-merge
|
|
7059
|
+
* ```typescript
|
|
7060
|
+
* const plugin = new GithubPR(context, {
|
|
7061
|
+
* autoMergeReleasePR: true
|
|
7062
|
+
* });
|
|
7063
|
+
*
|
|
7064
|
+
* await plugin.releasePullRequest(workspaces, params);
|
|
7065
|
+
* // Creates and auto-merges PR
|
|
7066
|
+
* ```
|
|
7067
|
+
*/
|
|
6087
7068
|
async releasePullRequest(workspaces, releaseBranchParams) {
|
|
6088
7069
|
const prNumber = await this.step({
|
|
6089
7070
|
label: "Create Release PR",
|
|
@@ -6105,8 +7086,36 @@ var GithubPR = class extends GitBase {
|
|
|
6105
7086
|
`Please manually merge PR(#${prNumber}) and complete the publishing process afterwards`
|
|
6106
7087
|
);
|
|
6107
7088
|
}
|
|
7089
|
+
/**
|
|
7090
|
+
* Creates a commit for a single workspace
|
|
7091
|
+
*
|
|
7092
|
+
* Uses the configured commit message template to create a
|
|
7093
|
+
* commit for the workspace's changes.
|
|
7094
|
+
*
|
|
7095
|
+
* @param workspace - Workspace configuration
|
|
7096
|
+
* @param commitArgs - Additional Git commit arguments
|
|
7097
|
+
* @returns Promise resolving to commit output
|
|
7098
|
+
*
|
|
7099
|
+
* @example Basic commit
|
|
7100
|
+
* ```typescript
|
|
7101
|
+
* await plugin.commitWorkspace({
|
|
7102
|
+
* name: 'pkg-a',
|
|
7103
|
+
* version: '1.0.0'
|
|
7104
|
+
* });
|
|
7105
|
+
* // Creates: "chore(tag): pkg-a v1.0.0"
|
|
7106
|
+
* ```
|
|
7107
|
+
*
|
|
7108
|
+
* @example With arguments
|
|
7109
|
+
* ```typescript
|
|
7110
|
+
* await plugin.commitWorkspace(
|
|
7111
|
+
* { name: 'pkg-a', version: '1.0.0' },
|
|
7112
|
+
* ['--no-verify']
|
|
7113
|
+
* );
|
|
7114
|
+
* ```
|
|
7115
|
+
* @private
|
|
7116
|
+
*/
|
|
6108
7117
|
async commitWorkspace(workspace, commitArgs = []) {
|
|
6109
|
-
const commitMessage =
|
|
7118
|
+
const commitMessage = import_scripts_context6.Shell.format(
|
|
6110
7119
|
this.getConfig("commitMessage", DEFAULT_COMMIT_MESSAGE),
|
|
6111
7120
|
workspace
|
|
6112
7121
|
);
|
|
@@ -6122,16 +7131,48 @@ var GithubPR = class extends GitBase {
|
|
|
6122
7131
|
*
|
|
6123
7132
|
* @returns The release branch.
|
|
6124
7133
|
*/
|
|
7134
|
+
/**
|
|
7135
|
+
* Creates a release branch for changes
|
|
7136
|
+
*
|
|
7137
|
+
* Creates a new branch from the current branch for release
|
|
7138
|
+
* changes. The branch name is generated from the configured
|
|
7139
|
+
* template and workspace information.
|
|
7140
|
+
*
|
|
7141
|
+
* Process:
|
|
7142
|
+
* 1. Generate branch parameters
|
|
7143
|
+
* 2. Fetch required branches
|
|
7144
|
+
* 3. Create and push release branch
|
|
7145
|
+
*
|
|
7146
|
+
* @param workspaces - Array of workspace configurations
|
|
7147
|
+
* @returns Promise resolving to branch parameters
|
|
7148
|
+
*
|
|
7149
|
+
* @example
|
|
7150
|
+
* ```typescript
|
|
7151
|
+
* const params = await plugin.createReleaseBranch([{
|
|
7152
|
+
* name: 'pkg-a',
|
|
7153
|
+
* version: '1.0.0'
|
|
7154
|
+
* }]);
|
|
7155
|
+
* // {
|
|
7156
|
+
* // tagName: 'pkg-a@1.0.0',
|
|
7157
|
+
* // releaseBranch: 'release-pkg-a-1.0.0'
|
|
7158
|
+
* // }
|
|
7159
|
+
* ```
|
|
7160
|
+
*
|
|
7161
|
+
* @throws Error if tag name is invalid
|
|
7162
|
+
* @throws Error if branch creation fails
|
|
7163
|
+
* @private
|
|
7164
|
+
*/
|
|
6125
7165
|
async createReleaseBranch(workspaces) {
|
|
6126
7166
|
const params = this.releaseParams.getReleaseBranchParams(
|
|
6127
7167
|
workspaces,
|
|
7168
|
+
// @ts-expect-error TODO: fix this
|
|
6128
7169
|
this.context.getTemplateContext()
|
|
6129
7170
|
);
|
|
6130
7171
|
const { tagName, releaseBranch } = params;
|
|
6131
7172
|
if (typeof tagName !== "string") {
|
|
6132
7173
|
throw new Error("Tag name is not a string");
|
|
6133
7174
|
}
|
|
6134
|
-
const { sourceBranch, currentBranch } = this.context.
|
|
7175
|
+
const { sourceBranch, currentBranch } = this.context.getOptions();
|
|
6135
7176
|
this.context.logger.debug("PR TagName is:", tagName);
|
|
6136
7177
|
this.context.logger.debug("PR CurrentBranch is:", currentBranch);
|
|
6137
7178
|
this.context.logger.debug("PR SourceBranch is:", sourceBranch);
|
|
@@ -6163,11 +7204,47 @@ var GithubPR = class extends GitBase {
|
|
|
6163
7204
|
* @param releaseBranchParams - The release branch params.
|
|
6164
7205
|
* @returns The created pull request number.
|
|
6165
7206
|
*/
|
|
7207
|
+
/**
|
|
7208
|
+
* Creates a release pull request
|
|
7209
|
+
*
|
|
7210
|
+
* Creates a pull request with:
|
|
7211
|
+
* 1. Release label
|
|
7212
|
+
* 2. Change labels (if configured)
|
|
7213
|
+
* 3. Generated title and body
|
|
7214
|
+
* 4. Proper branch configuration
|
|
7215
|
+
*
|
|
7216
|
+
* @param workspaces - Array of workspace configurations
|
|
7217
|
+
* @param releaseBranchParams - Branch and tag information
|
|
7218
|
+
* @returns Promise resolving to PR number
|
|
7219
|
+
*
|
|
7220
|
+
* @example Basic PR
|
|
7221
|
+
* ```typescript
|
|
7222
|
+
* const prNumber = await plugin.createReleasePR(
|
|
7223
|
+
* workspaces,
|
|
7224
|
+
* { releaseBranch: 'release-v1.0.0', tagName: 'v1.0.0' }
|
|
7225
|
+
* );
|
|
7226
|
+
* // Creates PR with default labels
|
|
7227
|
+
* ```
|
|
7228
|
+
*
|
|
7229
|
+
* @example With change labels
|
|
7230
|
+
* ```typescript
|
|
7231
|
+
* const plugin = new GithubPR(context, {
|
|
7232
|
+
* pushChangeLabels: true
|
|
7233
|
+
* });
|
|
7234
|
+
*
|
|
7235
|
+
* const prNumber = await plugin.createReleasePR(
|
|
7236
|
+
* workspaces,
|
|
7237
|
+
* params
|
|
7238
|
+
* );
|
|
7239
|
+
* // Creates PR with release and change labels
|
|
7240
|
+
* ```
|
|
7241
|
+
* @private
|
|
7242
|
+
*/
|
|
6166
7243
|
async createReleasePR(workspaces, releaseBranchParams) {
|
|
6167
7244
|
const label = await this.githubManager.createReleasePRLabel();
|
|
6168
7245
|
let labels = [label.name];
|
|
6169
7246
|
if (this.getConfig("pushChangeLabels")) {
|
|
6170
|
-
const changeLabels = this.context.
|
|
7247
|
+
const changeLabels = this.context.getOptions("workspaces.changeLabels");
|
|
6171
7248
|
if (Array.isArray(changeLabels) && changeLabels.length > 0) {
|
|
6172
7249
|
labels.push(...changeLabels);
|
|
6173
7250
|
}
|
|
@@ -6196,21 +7273,137 @@ var import_node_path2 = require("path");
|
|
|
6196
7273
|
|
|
6197
7274
|
// src/implments/ReleaseLabel.ts
|
|
6198
7275
|
var ReleaseLabel = class {
|
|
7276
|
+
/**
|
|
7277
|
+
* Creates a new ReleaseLabel instance
|
|
7278
|
+
*
|
|
7279
|
+
* @param options - Configuration options for label management
|
|
7280
|
+
*
|
|
7281
|
+
* @example
|
|
7282
|
+
* ```typescript
|
|
7283
|
+
* const label = new ReleaseLabel({
|
|
7284
|
+
* // Label template with ${name} placeholder
|
|
7285
|
+
* changePackagesLabel: 'changed:${name}',
|
|
7286
|
+
*
|
|
7287
|
+
* // Package directories to monitor
|
|
7288
|
+
* packagesDirectories: ['packages/a', 'packages/b'],
|
|
7289
|
+
*
|
|
7290
|
+
* // Optional custom comparison logic
|
|
7291
|
+
* compare: (file, pkg) => file.includes(pkg)
|
|
7292
|
+
* });
|
|
7293
|
+
* ```
|
|
7294
|
+
*/
|
|
6199
7295
|
constructor(options) {
|
|
6200
7296
|
this.options = options;
|
|
6201
7297
|
}
|
|
7298
|
+
/**
|
|
7299
|
+
* Compares a changed file path against a package path
|
|
7300
|
+
*
|
|
7301
|
+
* Uses custom comparison function if provided, otherwise
|
|
7302
|
+
* checks if the file path starts with the package path.
|
|
7303
|
+
*
|
|
7304
|
+
* @param changedFilePath - Path of the changed file
|
|
7305
|
+
* @param packagePath - Path of the package to check against
|
|
7306
|
+
* @returns True if the file belongs to the package
|
|
7307
|
+
*
|
|
7308
|
+
* @example
|
|
7309
|
+
* ```typescript
|
|
7310
|
+
* // Default comparison
|
|
7311
|
+
* label.compare('packages/a/src/index.ts', 'packages/a');
|
|
7312
|
+
* // true
|
|
7313
|
+
*
|
|
7314
|
+
* // Custom comparison
|
|
7315
|
+
* const label = new ReleaseLabel({
|
|
7316
|
+
* ...options,
|
|
7317
|
+
* compare: (file, pkg) => file.includes(pkg)
|
|
7318
|
+
* });
|
|
7319
|
+
* label.compare('src/packages/a/index.ts', 'packages/a');
|
|
7320
|
+
* // true
|
|
7321
|
+
* ```
|
|
7322
|
+
*/
|
|
6202
7323
|
compare(changedFilePath, packagePath) {
|
|
6203
7324
|
if (typeof this.options.compare === "function") {
|
|
6204
7325
|
return this.options.compare(changedFilePath, packagePath);
|
|
6205
7326
|
}
|
|
6206
7327
|
return changedFilePath.startsWith(packagePath);
|
|
6207
7328
|
}
|
|
7329
|
+
/**
|
|
7330
|
+
* Generates a change label for a single package
|
|
7331
|
+
*
|
|
7332
|
+
* Replaces ${name} placeholder in the label template with
|
|
7333
|
+
* the package path.
|
|
7334
|
+
*
|
|
7335
|
+
* @param packagePath - Path of the package
|
|
7336
|
+
* @param label - Optional custom label template
|
|
7337
|
+
* @returns Formatted change label
|
|
7338
|
+
*
|
|
7339
|
+
* @example
|
|
7340
|
+
* ```typescript
|
|
7341
|
+
* // Default label template
|
|
7342
|
+
* label.toChangeLabel('packages/a');
|
|
7343
|
+
* // 'changed:packages/a'
|
|
7344
|
+
*
|
|
7345
|
+
* // Custom label template
|
|
7346
|
+
* label.toChangeLabel('packages/a', 'modified:${name}');
|
|
7347
|
+
* // 'modified:packages/a'
|
|
7348
|
+
* ```
|
|
7349
|
+
*/
|
|
6208
7350
|
toChangeLabel(packagePath, label = this.options.changePackagesLabel) {
|
|
6209
7351
|
return label.replace("${name}", packagePath);
|
|
6210
7352
|
}
|
|
7353
|
+
/**
|
|
7354
|
+
* Generates change labels for multiple packages
|
|
7355
|
+
*
|
|
7356
|
+
* Maps each package path to a formatted change label.
|
|
7357
|
+
*
|
|
7358
|
+
* @param packages - Array of package paths
|
|
7359
|
+
* @param label - Optional custom label template
|
|
7360
|
+
* @returns Array of formatted change labels
|
|
7361
|
+
*
|
|
7362
|
+
* @example
|
|
7363
|
+
* ```typescript
|
|
7364
|
+
* // Default label template
|
|
7365
|
+
* label.toChangeLabels(['packages/a', 'packages/b']);
|
|
7366
|
+
* // ['changed:packages/a', 'changed:packages/b']
|
|
7367
|
+
*
|
|
7368
|
+
* // Custom label template
|
|
7369
|
+
* label.toChangeLabels(
|
|
7370
|
+
* ['packages/a', 'packages/b'],
|
|
7371
|
+
* 'modified:${name}'
|
|
7372
|
+
* );
|
|
7373
|
+
* // ['modified:packages/a', 'modified:packages/b']
|
|
7374
|
+
* ```
|
|
7375
|
+
*/
|
|
6211
7376
|
toChangeLabels(packages, label = this.options.changePackagesLabel) {
|
|
6212
7377
|
return packages.map((pkg) => this.toChangeLabel(pkg, label));
|
|
6213
7378
|
}
|
|
7379
|
+
/**
|
|
7380
|
+
* Identifies packages affected by changed files
|
|
7381
|
+
*
|
|
7382
|
+
* Checks each changed file against package paths to determine
|
|
7383
|
+
* which packages have been modified.
|
|
7384
|
+
*
|
|
7385
|
+
* @param changedFiles - Array or Set of changed file paths
|
|
7386
|
+
* @param packages - Optional array of package paths to check
|
|
7387
|
+
* @returns Array of affected package paths
|
|
7388
|
+
*
|
|
7389
|
+
* @example
|
|
7390
|
+
* ```typescript
|
|
7391
|
+
* // Check against default packages
|
|
7392
|
+
* label.pick(['packages/a/src/index.ts']);
|
|
7393
|
+
* // ['packages/a']
|
|
7394
|
+
*
|
|
7395
|
+
* // Check specific packages
|
|
7396
|
+
* label.pick(
|
|
7397
|
+
* ['packages/a/index.ts', 'packages/b/test.ts'],
|
|
7398
|
+
* ['packages/a', 'packages/c']
|
|
7399
|
+
* );
|
|
7400
|
+
* // ['packages/a']
|
|
7401
|
+
*
|
|
7402
|
+
* // Using Set of files
|
|
7403
|
+
* label.pick(new Set(['packages/a/index.ts']));
|
|
7404
|
+
* // ['packages/a']
|
|
7405
|
+
* ```
|
|
7406
|
+
*/
|
|
6214
7407
|
pick(changedFiles, packages = this.options.packagesDirectories) {
|
|
6215
7408
|
const result = [];
|
|
6216
7409
|
for (const pkgPath of packages) {
|
|
@@ -6255,7 +7448,8 @@ var WorkspaceCreator = class _WorkspaceCreator {
|
|
|
6255
7448
|
};
|
|
6256
7449
|
|
|
6257
7450
|
// src/plugins/workspaces/Workspaces.ts
|
|
6258
|
-
var
|
|
7451
|
+
var import_scripts_context7 = require("@qlover/scripts-context");
|
|
7452
|
+
var Workspaces = class extends import_scripts_context7.ScriptPlugin {
|
|
6259
7453
|
releaseTask = null;
|
|
6260
7454
|
workspacesList = [];
|
|
6261
7455
|
_skip = false;
|
|
@@ -6263,8 +7457,8 @@ var Workspaces = class extends Plugin {
|
|
|
6263
7457
|
constructor(context) {
|
|
6264
7458
|
super(context, "workspaces");
|
|
6265
7459
|
this.releaseLabel = new ReleaseLabel({
|
|
6266
|
-
changePackagesLabel: this.context.
|
|
6267
|
-
packagesDirectories: this.context.
|
|
7460
|
+
changePackagesLabel: this.context.options.changePackagesLabel || "change:${name}",
|
|
7461
|
+
packagesDirectories: this.context.options.packagesDirectories || [],
|
|
6268
7462
|
compare: (changedFilePath, packagePath) => (0, import_node_path2.resolve)(changedFilePath).startsWith((0, import_node_path2.resolve)(packagePath))
|
|
6269
7463
|
});
|
|
6270
7464
|
}
|
|
@@ -6282,7 +7476,7 @@ var Workspaces = class extends Plugin {
|
|
|
6282
7476
|
if (this.getConfig("skipCheckPackage") || workspaces.length === 0) {
|
|
6283
7477
|
throw new Error("No changes to publish packages");
|
|
6284
7478
|
}
|
|
6285
|
-
const
|
|
7479
|
+
const publishPath = this.context.getOptions("publishPath");
|
|
6286
7480
|
if (publishPath) {
|
|
6287
7481
|
const targetWorkspace = workspaces.find(
|
|
6288
7482
|
(workspace2) => (0, import_node_path2.resolve)(workspace2.root) === (0, import_node_path2.resolve)(publishPath)
|
|
@@ -6316,7 +7510,7 @@ var Workspaces = class extends Plugin {
|
|
|
6316
7510
|
this.releaseTask = releaseTask;
|
|
6317
7511
|
}
|
|
6318
7512
|
setCurrentWorkspace(workspace, workspaces) {
|
|
6319
|
-
this.context.
|
|
7513
|
+
this.context.setOptions({
|
|
6320
7514
|
publishPath: workspace.path
|
|
6321
7515
|
});
|
|
6322
7516
|
this.setConfig({
|
|
@@ -6348,7 +7542,7 @@ var Workspaces = class extends Plugin {
|
|
|
6348
7542
|
}
|
|
6349
7543
|
getProjectWorkspaces() {
|
|
6350
7544
|
const rootPath = this.context.rootPath;
|
|
6351
|
-
const packagesDirectories = this.context.
|
|
7545
|
+
const packagesDirectories = this.context.options.packagesDirectories;
|
|
6352
7546
|
if (Array.isArray(packagesDirectories) && packagesDirectories.length > 0) {
|
|
6353
7547
|
return packagesDirectories.map(
|
|
6354
7548
|
(path) => WorkspaceCreator.toWorkspace({ path }, rootPath)
|
|
@@ -6572,8 +7766,34 @@ async function loaderPluginsFromPluginTuples(context, pluginsTuples, maxLimit =
|
|
|
6572
7766
|
// src/plugins/Changelog.ts
|
|
6573
7767
|
var import_path2 = require("path");
|
|
6574
7768
|
var import_fs2 = require("fs");
|
|
7769
|
+
var import_scripts_context8 = require("@qlover/scripts-context");
|
|
6575
7770
|
var contentTmplate = "---\n'${name}': '${increment}'\n---\n\n${changelog}";
|
|
6576
|
-
var Changelog = class extends
|
|
7771
|
+
var Changelog = class extends import_scripts_context8.ScriptPlugin {
|
|
7772
|
+
/**
|
|
7773
|
+
* Creates a new Changelog plugin instance
|
|
7774
|
+
*
|
|
7775
|
+
* Initializes the plugin with default configuration values and
|
|
7776
|
+
* merges them with provided options.
|
|
7777
|
+
*
|
|
7778
|
+
* Default values:
|
|
7779
|
+
* - increment: 'patch'
|
|
7780
|
+
* - changesetRoot: '.changeset'
|
|
7781
|
+
* - tagTemplate: '${name}@${version}'
|
|
7782
|
+
* - tagPrefix: '${name}'
|
|
7783
|
+
* - tagMatch: '${name}@*'
|
|
7784
|
+
*
|
|
7785
|
+
* @param context - Release context
|
|
7786
|
+
* @param props - Plugin configuration
|
|
7787
|
+
*
|
|
7788
|
+
* @example
|
|
7789
|
+
* ```typescript
|
|
7790
|
+
* const plugin = new Changelog(context, {
|
|
7791
|
+
* increment: 'minor',
|
|
7792
|
+
* changesetRoot: 'custom/changeset',
|
|
7793
|
+
* tagTemplate: 'v${version}'
|
|
7794
|
+
* });
|
|
7795
|
+
* ```
|
|
7796
|
+
*/
|
|
6577
7797
|
constructor(context, props) {
|
|
6578
7798
|
super(context, "changelog", {
|
|
6579
7799
|
increment: "patch",
|
|
@@ -6584,15 +7804,78 @@ var Changelog = class extends Plugin {
|
|
|
6584
7804
|
...props
|
|
6585
7805
|
});
|
|
6586
7806
|
}
|
|
7807
|
+
/**
|
|
7808
|
+
* Gets the absolute path to the changeset root directory
|
|
7809
|
+
*
|
|
7810
|
+
* Combines the project root path with the configured changeset
|
|
7811
|
+
* directory path.
|
|
7812
|
+
*
|
|
7813
|
+
* @returns Absolute path to changeset directory
|
|
7814
|
+
*
|
|
7815
|
+
* @example
|
|
7816
|
+
* ```typescript
|
|
7817
|
+
* const root = plugin.changesetRoot;
|
|
7818
|
+
* // '/path/to/project/.changeset'
|
|
7819
|
+
* ```
|
|
7820
|
+
*/
|
|
6587
7821
|
get changesetRoot() {
|
|
6588
7822
|
return (0, import_path2.join)(this.context.rootPath, this.getConfig("changesetRoot"));
|
|
6589
7823
|
}
|
|
7824
|
+
/**
|
|
7825
|
+
* Gets the path to the changeset configuration file
|
|
7826
|
+
*
|
|
7827
|
+
* Returns the absolute path to the config.json file in the
|
|
7828
|
+
* changeset directory.
|
|
7829
|
+
*
|
|
7830
|
+
* @returns Path to changeset config file
|
|
7831
|
+
*
|
|
7832
|
+
* @example
|
|
7833
|
+
* ```typescript
|
|
7834
|
+
* const configPath = plugin.changesetConfigPath;
|
|
7835
|
+
* // '/path/to/project/.changeset/config.json'
|
|
7836
|
+
* ```
|
|
7837
|
+
*/
|
|
6590
7838
|
get changesetConfigPath() {
|
|
6591
7839
|
return (0, import_path2.join)(this.changesetRoot, "config.json");
|
|
6592
7840
|
}
|
|
7841
|
+
/**
|
|
7842
|
+
* Determines if the plugin should be enabled
|
|
7843
|
+
*
|
|
7844
|
+
* Plugin is enabled unless explicitly skipped via configuration.
|
|
7845
|
+
* This allows for conditional changelog generation.
|
|
7846
|
+
*
|
|
7847
|
+
* @returns True if plugin should be enabled
|
|
7848
|
+
*
|
|
7849
|
+
* @example
|
|
7850
|
+
* ```typescript
|
|
7851
|
+
* const plugin = new Changelog(context, { skip: true });
|
|
7852
|
+
* plugin.enabled(); // false
|
|
7853
|
+
*
|
|
7854
|
+
* const plugin2 = new Changelog(context, {});
|
|
7855
|
+
* plugin2.enabled(); // true
|
|
7856
|
+
* ```
|
|
7857
|
+
*/
|
|
6593
7858
|
enabled() {
|
|
6594
7859
|
return !this.getConfig("skip");
|
|
6595
7860
|
}
|
|
7861
|
+
/**
|
|
7862
|
+
* Plugin initialization hook
|
|
7863
|
+
*
|
|
7864
|
+
* Verifies that the changeset directory exists before proceeding
|
|
7865
|
+
* with changelog generation.
|
|
7866
|
+
*
|
|
7867
|
+
* @throws Error if changeset directory does not exist
|
|
7868
|
+
*
|
|
7869
|
+
* @example
|
|
7870
|
+
* ```typescript
|
|
7871
|
+
* const plugin = new Changelog(context, {
|
|
7872
|
+
* changesetRoot: '.changeset'
|
|
7873
|
+
* });
|
|
7874
|
+
*
|
|
7875
|
+
* await plugin.onBefore();
|
|
7876
|
+
* // Throws if .changeset directory doesn't exist
|
|
7877
|
+
* ```
|
|
7878
|
+
*/
|
|
6596
7879
|
async onBefore() {
|
|
6597
7880
|
if (!(0, import_fs2.existsSync)(this.changesetRoot)) {
|
|
6598
7881
|
throw new Error(
|
|
@@ -6601,6 +7884,33 @@ var Changelog = class extends Plugin {
|
|
|
6601
7884
|
}
|
|
6602
7885
|
this.logger.debug(`${this.changesetRoot} exists`);
|
|
6603
7886
|
}
|
|
7887
|
+
/**
|
|
7888
|
+
* Updates workspace information with latest versions
|
|
7889
|
+
*
|
|
7890
|
+
* Reads the latest version information from each workspace's
|
|
7891
|
+
* package.json and updates the workspace objects with new
|
|
7892
|
+
* versions and tag names.
|
|
7893
|
+
*
|
|
7894
|
+
* @param workspaces - Array of workspace configurations
|
|
7895
|
+
* @returns Updated workspace configurations
|
|
7896
|
+
*
|
|
7897
|
+
* @example
|
|
7898
|
+
* ```typescript
|
|
7899
|
+
* const workspaces = [
|
|
7900
|
+
* { name: 'pkg-a', path: 'packages/a', version: '1.0.0' }
|
|
7901
|
+
* ];
|
|
7902
|
+
*
|
|
7903
|
+
* const updated = plugin.mergeWorkspaces(workspaces);
|
|
7904
|
+
* // [
|
|
7905
|
+
* // {
|
|
7906
|
+
* // name: 'pkg-a',
|
|
7907
|
+
* // path: 'packages/a',
|
|
7908
|
+
* // version: '1.1.0', // Updated version
|
|
7909
|
+
* // tagName: 'pkg-a@1.1.0'
|
|
7910
|
+
* // }
|
|
7911
|
+
* // ]
|
|
7912
|
+
* ```
|
|
7913
|
+
*/
|
|
6604
7914
|
mergeWorkspaces(workspaces) {
|
|
6605
7915
|
return workspaces.map((workspace) => {
|
|
6606
7916
|
const newPackgeJson = WorkspaceCreator.toWorkspace(
|
|
@@ -6617,6 +7927,25 @@ var Changelog = class extends Plugin {
|
|
|
6617
7927
|
return newWorkspace;
|
|
6618
7928
|
});
|
|
6619
7929
|
}
|
|
7930
|
+
/**
|
|
7931
|
+
* Main plugin execution hook
|
|
7932
|
+
*
|
|
7933
|
+
* Generates changelogs for all workspaces in parallel and updates
|
|
7934
|
+
* the context with the results.
|
|
7935
|
+
*
|
|
7936
|
+
* Process:
|
|
7937
|
+
* 1. Generate changelogs for each workspace
|
|
7938
|
+
* 2. Update context with new workspace information
|
|
7939
|
+
*
|
|
7940
|
+
* @param _context - Execution context
|
|
7941
|
+
*
|
|
7942
|
+
* @example
|
|
7943
|
+
* ```typescript
|
|
7944
|
+
* const plugin = new Changelog(context, {});
|
|
7945
|
+
* await plugin.onExec(execContext);
|
|
7946
|
+
* // Generates changelogs for all workspaces
|
|
7947
|
+
* ```
|
|
7948
|
+
*/
|
|
6620
7949
|
async onExec(_context) {
|
|
6621
7950
|
const workspaces = await this.step({
|
|
6622
7951
|
label: "Generate Changelogs",
|
|
@@ -6628,6 +7957,28 @@ var Changelog = class extends Plugin {
|
|
|
6628
7957
|
});
|
|
6629
7958
|
this.context.setWorkspaces(workspaces);
|
|
6630
7959
|
}
|
|
7960
|
+
/**
|
|
7961
|
+
* Success hook after plugin execution
|
|
7962
|
+
*
|
|
7963
|
+
* Handles post-changelog generation tasks:
|
|
7964
|
+
* 1. Creates changeset files (if not skipped)
|
|
7965
|
+
* 2. Updates package versions
|
|
7966
|
+
* 3. Restores unchanged packages (if configured)
|
|
7967
|
+
* 4. Updates workspace information
|
|
7968
|
+
*
|
|
7969
|
+
* @example
|
|
7970
|
+
* ```typescript
|
|
7971
|
+
* const plugin = new Changelog(context, {
|
|
7972
|
+
* skipChangeset: false,
|
|
7973
|
+
* ignoreNonUpdatedPackages: true
|
|
7974
|
+
* });
|
|
7975
|
+
*
|
|
7976
|
+
* await plugin.onSuccess();
|
|
7977
|
+
* // - Creates changeset files
|
|
7978
|
+
* // - Updates versions
|
|
7979
|
+
* // - Restores unchanged packages
|
|
7980
|
+
* ```
|
|
7981
|
+
*/
|
|
6631
7982
|
async onSuccess() {
|
|
6632
7983
|
const workspaces = this.context.workspaces;
|
|
6633
7984
|
if (!this.getConfig("skipChangeset")) {
|
|
@@ -6651,8 +8002,27 @@ var Changelog = class extends Plugin {
|
|
|
6651
8002
|
this.logger.debug("new workspaces", newWorkspaces);
|
|
6652
8003
|
this.context.setWorkspaces(newWorkspaces);
|
|
6653
8004
|
}
|
|
8005
|
+
/**
|
|
8006
|
+
* Restores unchanged packages to their original state
|
|
8007
|
+
*
|
|
8008
|
+
* When ignoreNonUpdatedPackages is enabled, this method:
|
|
8009
|
+
* 1. Identifies packages without changes
|
|
8010
|
+
* 2. Uses git restore to revert them to original state
|
|
8011
|
+
*
|
|
8012
|
+
* @example
|
|
8013
|
+
* ```typescript
|
|
8014
|
+
* // With changed and unchanged packages
|
|
8015
|
+
* context.options.workspaces = {
|
|
8016
|
+
* packages: ['pkg-a', 'pkg-b', 'pkg-c'],
|
|
8017
|
+
* changedPaths: ['pkg-a', 'pkg-b']
|
|
8018
|
+
* };
|
|
8019
|
+
*
|
|
8020
|
+
* await plugin.restoreIgnorePackages();
|
|
8021
|
+
* // Restores 'pkg-c' to original state
|
|
8022
|
+
* ```
|
|
8023
|
+
*/
|
|
6654
8024
|
async restoreIgnorePackages() {
|
|
6655
|
-
const { changedPaths = [], packages = [] } = this.context.
|
|
8025
|
+
const { changedPaths = [], packages = [] } = this.context.getOptions(
|
|
6656
8026
|
"workspaces"
|
|
6657
8027
|
);
|
|
6658
8028
|
const noChangedPackages = packages.filter((pkgPath) => !changedPaths.includes(pkgPath)).map(
|
|
@@ -6663,12 +8033,60 @@ var Changelog = class extends Plugin {
|
|
|
6663
8033
|
await this.shell.exec(["git", "restore", ...noChangedPackages]);
|
|
6664
8034
|
}
|
|
6665
8035
|
}
|
|
8036
|
+
/**
|
|
8037
|
+
* Gets the tag prefix for a workspace
|
|
8038
|
+
*
|
|
8039
|
+
* Formats the configured tag prefix template with workspace
|
|
8040
|
+
* information. Used for generating Git tag names.
|
|
8041
|
+
*
|
|
8042
|
+
* @param workspace - Workspace configuration
|
|
8043
|
+
* @returns Formatted tag prefix
|
|
8044
|
+
*
|
|
8045
|
+
* @example
|
|
8046
|
+
* ```typescript
|
|
8047
|
+
* const workspace = {
|
|
8048
|
+
* name: 'pkg-a',
|
|
8049
|
+
* version: '1.0.0'
|
|
8050
|
+
* };
|
|
8051
|
+
*
|
|
8052
|
+
* const prefix = plugin.getTagPrefix(workspace);
|
|
8053
|
+
* // With default template: 'pkg-a'
|
|
8054
|
+
* // With custom template: 'v1.0.0'
|
|
8055
|
+
* ```
|
|
8056
|
+
*/
|
|
6666
8057
|
getTagPrefix(workspace) {
|
|
6667
|
-
return
|
|
8058
|
+
return import_scripts_context8.Shell.format(
|
|
6668
8059
|
this.getConfig("tagPrefix"),
|
|
6669
8060
|
workspace
|
|
6670
8061
|
);
|
|
6671
8062
|
}
|
|
8063
|
+
/**
|
|
8064
|
+
* Generates a changelog for a workspace
|
|
8065
|
+
*
|
|
8066
|
+
* Creates a changelog by:
|
|
8067
|
+
* 1. Getting the appropriate tag name
|
|
8068
|
+
* 2. Retrieving commits since last tag
|
|
8069
|
+
* 3. Formatting commits into changelog entries
|
|
8070
|
+
*
|
|
8071
|
+
* @param workspace - Workspace configuration
|
|
8072
|
+
* @returns Updated workspace with changelog
|
|
8073
|
+
*
|
|
8074
|
+
* @example
|
|
8075
|
+
* ```typescript
|
|
8076
|
+
* const workspace = {
|
|
8077
|
+
* name: 'pkg-a',
|
|
8078
|
+
* path: 'packages/a',
|
|
8079
|
+
* version: '1.0.0'
|
|
8080
|
+
* };
|
|
8081
|
+
*
|
|
8082
|
+
* const updated = await plugin.generateChangelog(workspace);
|
|
8083
|
+
* // {
|
|
8084
|
+
* // ...workspace,
|
|
8085
|
+
* // lastTag: 'pkg-a@1.0.0',
|
|
8086
|
+
* // changelog: '- feat: new feature\n- fix: bug fix'
|
|
8087
|
+
* // }
|
|
8088
|
+
* ```
|
|
8089
|
+
*/
|
|
6672
8090
|
async generateChangelog(workspace) {
|
|
6673
8091
|
let tagName = await this.getTagName(workspace);
|
|
6674
8092
|
if (workspace.lastTag) {
|
|
@@ -6681,8 +8099,8 @@ var Changelog = class extends Plugin {
|
|
|
6681
8099
|
...baseConfig,
|
|
6682
8100
|
from: tagName,
|
|
6683
8101
|
directory: workspace.path,
|
|
6684
|
-
shell: this.shell,
|
|
6685
|
-
|
|
8102
|
+
shell: this.context.shell,
|
|
8103
|
+
fields: CHANGELOG_ALL_FIELDS,
|
|
6686
8104
|
logger: this.logger
|
|
6687
8105
|
};
|
|
6688
8106
|
const gitChangelog = new GitChangelog(props);
|
|
@@ -6694,10 +8112,36 @@ var Changelog = class extends Plugin {
|
|
|
6694
8112
|
changelog: changelog.join("\n")
|
|
6695
8113
|
};
|
|
6696
8114
|
}
|
|
8115
|
+
/**
|
|
8116
|
+
* Generates a tag name for a workspace
|
|
8117
|
+
*
|
|
8118
|
+
* Uses the configured tag template to generate a tag name
|
|
8119
|
+
* for the workspace. Handles errors by providing a fallback.
|
|
8120
|
+
*
|
|
8121
|
+
* @param workspace - Workspace configuration
|
|
8122
|
+
* @returns Generated tag name
|
|
8123
|
+
*
|
|
8124
|
+
* @example
|
|
8125
|
+
* ```typescript
|
|
8126
|
+
* // With default template
|
|
8127
|
+
* const tag = plugin.generateTagName({
|
|
8128
|
+
* name: 'pkg-a',
|
|
8129
|
+
* version: '1.0.0'
|
|
8130
|
+
* });
|
|
8131
|
+
* // 'pkg-a@1.0.0'
|
|
8132
|
+
*
|
|
8133
|
+
* // With error (fallback)
|
|
8134
|
+
* const tag = plugin.generateTagName({
|
|
8135
|
+
* name: 'pkg-a'
|
|
8136
|
+
* });
|
|
8137
|
+
* // 'pkg-a-v0.0.0'
|
|
8138
|
+
* ```
|
|
8139
|
+
* @private
|
|
8140
|
+
*/
|
|
6697
8141
|
generateTagName(workspace) {
|
|
6698
8142
|
try {
|
|
6699
8143
|
const tagTemplate = this.getConfig("tagTemplate");
|
|
6700
|
-
return
|
|
8144
|
+
return import_scripts_context8.Shell.format(
|
|
6701
8145
|
tagTemplate,
|
|
6702
8146
|
workspace
|
|
6703
8147
|
);
|
|
@@ -6706,10 +8150,42 @@ var Changelog = class extends Plugin {
|
|
|
6706
8150
|
return `${workspace.name}-v0.0.0`;
|
|
6707
8151
|
}
|
|
6708
8152
|
}
|
|
8153
|
+
/**
|
|
8154
|
+
* Gets the appropriate tag name for a workspace
|
|
8155
|
+
*
|
|
8156
|
+
* Attempts to find the latest tag for the workspace, falling back
|
|
8157
|
+
* to generating a new tag if none exists. Uses git commands to
|
|
8158
|
+
* find and sort tags by creation date.
|
|
8159
|
+
*
|
|
8160
|
+
* Process:
|
|
8161
|
+
* 1. Generate current tag pattern
|
|
8162
|
+
* 2. Search for existing tags matching pattern
|
|
8163
|
+
* 3. Return latest tag or generate new one
|
|
8164
|
+
*
|
|
8165
|
+
* @param workspace - Workspace configuration
|
|
8166
|
+
* @returns Promise resolving to tag name
|
|
8167
|
+
*
|
|
8168
|
+
* @example
|
|
8169
|
+
* ```typescript
|
|
8170
|
+
* // With existing tags
|
|
8171
|
+
* const tag = await plugin.getTagName({
|
|
8172
|
+
* name: 'pkg-a',
|
|
8173
|
+
* version: '1.0.0'
|
|
8174
|
+
* });
|
|
8175
|
+
* // Returns latest matching tag: 'pkg-a@0.9.0'
|
|
8176
|
+
*
|
|
8177
|
+
* // Without existing tags
|
|
8178
|
+
* const tag = await plugin.getTagName({
|
|
8179
|
+
* name: 'pkg-b',
|
|
8180
|
+
* version: '1.0.0'
|
|
8181
|
+
* });
|
|
8182
|
+
* // Returns new tag: 'pkg-b@1.0.0'
|
|
8183
|
+
* ```
|
|
8184
|
+
*/
|
|
6709
8185
|
async getTagName(workspace) {
|
|
6710
8186
|
try {
|
|
6711
8187
|
const currentTagPattern = this.generateTagName(workspace);
|
|
6712
|
-
const tagMatch =
|
|
8188
|
+
const tagMatch = import_scripts_context8.Shell.format(
|
|
6713
8189
|
this.getConfig("tagMatch"),
|
|
6714
8190
|
workspace
|
|
6715
8191
|
);
|
|
@@ -6732,8 +8208,33 @@ var Changelog = class extends Plugin {
|
|
|
6732
8208
|
return fallbackTag;
|
|
6733
8209
|
}
|
|
6734
8210
|
}
|
|
8211
|
+
/**
|
|
8212
|
+
* Determines the version increment type
|
|
8213
|
+
*
|
|
8214
|
+
* Checks for increment labels in the following order:
|
|
8215
|
+
* 1. 'increment:major' label
|
|
8216
|
+
* 2. 'increment:minor' label
|
|
8217
|
+
* 3. Configured increment value
|
|
8218
|
+
* 4. Default to 'patch'
|
|
8219
|
+
*
|
|
8220
|
+
* @returns Version increment type
|
|
8221
|
+
*
|
|
8222
|
+
* @example
|
|
8223
|
+
* ```typescript
|
|
8224
|
+
* // With labels
|
|
8225
|
+
* context.options.workspaces.changeLabels = ['increment:major'];
|
|
8226
|
+
* plugin.getIncrement(); // 'major'
|
|
8227
|
+
*
|
|
8228
|
+
* // With configuration
|
|
8229
|
+
* const plugin = new Changelog(context, { increment: 'minor' });
|
|
8230
|
+
* plugin.getIncrement(); // 'minor'
|
|
8231
|
+
*
|
|
8232
|
+
* // Default
|
|
8233
|
+
* plugin.getIncrement(); // 'patch'
|
|
8234
|
+
* ```
|
|
8235
|
+
*/
|
|
6735
8236
|
getIncrement() {
|
|
6736
|
-
const lables = this.context.
|
|
8237
|
+
const lables = this.context.getOptions("workspaces.changeLabels");
|
|
6737
8238
|
if (Array.isArray(lables) && lables.length > 0) {
|
|
6738
8239
|
if (lables.includes("increment:major")) {
|
|
6739
8240
|
return "major";
|
|
@@ -6745,13 +8246,50 @@ var Changelog = class extends Plugin {
|
|
|
6745
8246
|
const increment = this.getConfig("increment", "patch");
|
|
6746
8247
|
return increment;
|
|
6747
8248
|
}
|
|
8249
|
+
/**
|
|
8250
|
+
* Generates a changeset file for a workspace
|
|
8251
|
+
*
|
|
8252
|
+
* Creates a changeset file containing version increment
|
|
8253
|
+
* information and changelog content. Handles dry run mode
|
|
8254
|
+
* and existing files.
|
|
8255
|
+
*
|
|
8256
|
+
* File format:
|
|
8257
|
+
* ```yaml
|
|
8258
|
+
* ---
|
|
8259
|
+
* 'package-name': 'increment-type'
|
|
8260
|
+
* ---
|
|
8261
|
+
*
|
|
8262
|
+
* changelog content
|
|
8263
|
+
* ```
|
|
8264
|
+
*
|
|
8265
|
+
* @param workspace - Workspace configuration
|
|
8266
|
+
*
|
|
8267
|
+
* @example
|
|
8268
|
+
* ```typescript
|
|
8269
|
+
* const workspace = {
|
|
8270
|
+
* name: 'pkg-a',
|
|
8271
|
+
* version: '1.0.0',
|
|
8272
|
+
* changelog: '- feat: new feature'
|
|
8273
|
+
* };
|
|
8274
|
+
*
|
|
8275
|
+
* await plugin.generateChangesetFile(workspace);
|
|
8276
|
+
* // Creates .changeset/pkg-a-1.0.0.md
|
|
8277
|
+
* ```
|
|
8278
|
+
*
|
|
8279
|
+
* @example Dry run
|
|
8280
|
+
* ```typescript
|
|
8281
|
+
* context.dryRun = true;
|
|
8282
|
+
* await plugin.generateChangesetFile(workspace);
|
|
8283
|
+
* // Logs file content without creating file
|
|
8284
|
+
* ```
|
|
8285
|
+
*/
|
|
6748
8286
|
async generateChangesetFile(workspace) {
|
|
6749
8287
|
const { name, version: version2 } = workspace;
|
|
6750
8288
|
const changesetName = `${name}-${version2}`.replace(/[\/\\]/g, "_");
|
|
6751
8289
|
const changesetPath = (0, import_path2.join)(this.changesetRoot, `${changesetName}.md`);
|
|
6752
8290
|
const increment = this.getIncrement();
|
|
6753
8291
|
this.logger.debug("increment is:", [increment]);
|
|
6754
|
-
const fileContent =
|
|
8292
|
+
const fileContent = import_scripts_context8.Shell.format(contentTmplate, {
|
|
6755
8293
|
...workspace,
|
|
6756
8294
|
increment
|
|
6757
8295
|
});
|
|
@@ -6776,18 +8314,93 @@ var innerTuples = [
|
|
|
6776
8314
|
tuple(Changelog, {}),
|
|
6777
8315
|
tuple(GithubPR, {})
|
|
6778
8316
|
];
|
|
8317
|
+
var defaultName = "release";
|
|
6779
8318
|
var ReleaseTask = class {
|
|
8319
|
+
/**
|
|
8320
|
+
* Creates a new ReleaseTask instance
|
|
8321
|
+
*
|
|
8322
|
+
* Initializes the release context and sets up plugin configuration.
|
|
8323
|
+
* Supports custom executors and plugin configurations.
|
|
8324
|
+
*
|
|
8325
|
+
* @param options - Release context configuration
|
|
8326
|
+
* @param executor - Custom async executor (optional)
|
|
8327
|
+
* @param defaultTuples - Plugin configuration tuples (optional)
|
|
8328
|
+
*
|
|
8329
|
+
* @example
|
|
8330
|
+
* ```typescript
|
|
8331
|
+
* // Basic initialization
|
|
8332
|
+
* const task = new ReleaseTask({
|
|
8333
|
+
* rootPath: '/path/to/project',
|
|
8334
|
+
* sourceBranch: 'main'
|
|
8335
|
+
* });
|
|
8336
|
+
*
|
|
8337
|
+
* // With custom executor and plugins
|
|
8338
|
+
* const task = new ReleaseTask(
|
|
8339
|
+
* { rootPath: '/path/to/project' },
|
|
8340
|
+
* new AsyncExecutor(),
|
|
8341
|
+
* [tuple(CustomPlugin, { option: 'value' })]
|
|
8342
|
+
* );
|
|
8343
|
+
* ```
|
|
8344
|
+
*/
|
|
6780
8345
|
constructor(options = {}, executor = new import_fe_corekit.AsyncExecutor(), defaultTuples = innerTuples) {
|
|
6781
8346
|
this.executor = executor;
|
|
6782
8347
|
this.defaultTuples = defaultTuples;
|
|
6783
|
-
this.context = new ReleaseContext(options);
|
|
8348
|
+
this.context = new ReleaseContext(defaultName, options);
|
|
6784
8349
|
}
|
|
8350
|
+
/**
|
|
8351
|
+
* Release context instance
|
|
8352
|
+
* @protected
|
|
8353
|
+
*/
|
|
6785
8354
|
context;
|
|
8355
|
+
/**
|
|
8356
|
+
* Gets the current release context
|
|
8357
|
+
*
|
|
8358
|
+
* @returns Release context instance
|
|
8359
|
+
*
|
|
8360
|
+
* @example
|
|
8361
|
+
* ```typescript
|
|
8362
|
+
* const task = new ReleaseTask();
|
|
8363
|
+
* const context = task.getContext();
|
|
8364
|
+
*
|
|
8365
|
+
* console.log(context.releaseEnv);
|
|
8366
|
+
* console.log(context.sourceBranch);
|
|
8367
|
+
* ```
|
|
8368
|
+
*/
|
|
6786
8369
|
getContext() {
|
|
6787
8370
|
return this.context;
|
|
6788
8371
|
}
|
|
8372
|
+
/**
|
|
8373
|
+
* Loads and configures plugins for the release task
|
|
8374
|
+
*
|
|
8375
|
+
* Combines default and external plugins, initializes them with
|
|
8376
|
+
* the current context, and configures special cases like the
|
|
8377
|
+
* Workspaces plugin.
|
|
8378
|
+
*
|
|
8379
|
+
* Plugin Loading Process:
|
|
8380
|
+
* 1. Merge default and external plugins
|
|
8381
|
+
* 2. Initialize plugins with context
|
|
8382
|
+
* 3. Configure special plugins
|
|
8383
|
+
* 4. Add plugins to executor
|
|
8384
|
+
*
|
|
8385
|
+
* @param externalTuples - Additional plugin configurations
|
|
8386
|
+
* @returns Array of initialized plugins
|
|
8387
|
+
*
|
|
8388
|
+
* @example Basic usage
|
|
8389
|
+
* ```typescript
|
|
8390
|
+
* const task = new ReleaseTask();
|
|
8391
|
+
* const plugins = await task.usePlugins();
|
|
8392
|
+
* ```
|
|
8393
|
+
*
|
|
8394
|
+
* @example Custom plugins
|
|
8395
|
+
* ```typescript
|
|
8396
|
+
* const task = new ReleaseTask();
|
|
8397
|
+
* const plugins = await task.usePlugins([
|
|
8398
|
+
* tuple(CustomPlugin, { option: 'value' })
|
|
8399
|
+
* ]);
|
|
8400
|
+
* ```
|
|
8401
|
+
*/
|
|
6789
8402
|
async usePlugins(externalTuples) {
|
|
6790
|
-
externalTuples = externalTuples || this.context.
|
|
8403
|
+
externalTuples = externalTuples || this.context.options.plugins || [];
|
|
6791
8404
|
const plugins = await loaderPluginsFromPluginTuples(this.context, [
|
|
6792
8405
|
...this.defaultTuples,
|
|
6793
8406
|
...externalTuples
|
|
@@ -6800,12 +8413,65 @@ var ReleaseTask = class {
|
|
|
6800
8413
|
});
|
|
6801
8414
|
return plugins;
|
|
6802
8415
|
}
|
|
8416
|
+
/**
|
|
8417
|
+
* Executes the release task
|
|
8418
|
+
*
|
|
8419
|
+
* Internal method that runs the task through the executor.
|
|
8420
|
+
* Preserves the context through the execution chain.
|
|
8421
|
+
*
|
|
8422
|
+
* @returns Execution result
|
|
8423
|
+
* @internal
|
|
8424
|
+
*/
|
|
6803
8425
|
async run() {
|
|
6804
8426
|
return this.executor.exec(
|
|
6805
8427
|
this.context,
|
|
6806
8428
|
(context) => Promise.resolve(context)
|
|
6807
8429
|
);
|
|
6808
8430
|
}
|
|
8431
|
+
/**
|
|
8432
|
+
* Main entry point for executing the release task
|
|
8433
|
+
*
|
|
8434
|
+
* Checks environment conditions, loads plugins, and executes
|
|
8435
|
+
* the release process. Supports additional plugin configuration
|
|
8436
|
+
* at execution time.
|
|
8437
|
+
*
|
|
8438
|
+
* Environment Control:
|
|
8439
|
+
* - Checks FE_RELEASE environment variable
|
|
8440
|
+
* - Skips release if FE_RELEASE=false
|
|
8441
|
+
*
|
|
8442
|
+
* @param externalTuples - Additional plugin configurations
|
|
8443
|
+
* @returns Execution result
|
|
8444
|
+
* @throws Error if release is skipped via environment variable
|
|
8445
|
+
*
|
|
8446
|
+
* @example Basic execution
|
|
8447
|
+
* ```typescript
|
|
8448
|
+
* const task = new ReleaseTask();
|
|
8449
|
+
* await task.exec();
|
|
8450
|
+
* ```
|
|
8451
|
+
*
|
|
8452
|
+
* @example With additional plugins
|
|
8453
|
+
* ```typescript
|
|
8454
|
+
* const task = new ReleaseTask();
|
|
8455
|
+
* await task.exec([
|
|
8456
|
+
* tuple(CustomPlugin, { option: 'value' })
|
|
8457
|
+
* ]);
|
|
8458
|
+
* ```
|
|
8459
|
+
*
|
|
8460
|
+
* @example Environment control
|
|
8461
|
+
* ```typescript
|
|
8462
|
+
* // Skip release
|
|
8463
|
+
* process.env.FE_RELEASE = 'false';
|
|
8464
|
+
*
|
|
8465
|
+
* const task = new ReleaseTask();
|
|
8466
|
+
* try {
|
|
8467
|
+
* await task.exec();
|
|
8468
|
+
* } catch (e) {
|
|
8469
|
+
* if (e.message === 'Skip Release') {
|
|
8470
|
+
* console.log('Release skipped via environment variable');
|
|
8471
|
+
* }
|
|
8472
|
+
* }
|
|
8473
|
+
* ```
|
|
8474
|
+
*/
|
|
6809
8475
|
async exec(externalTuples) {
|
|
6810
8476
|
if (this.context.env.get("FE_RELEASE") === "false") {
|
|
6811
8477
|
throw new Error("Skip Release");
|
|
@@ -6864,16 +8530,11 @@ function programArgs() {
|
|
|
6864
8530
|
splitWithComma
|
|
6865
8531
|
);
|
|
6866
8532
|
program.parse();
|
|
6867
|
-
return reduceOptions(program.opts(), "
|
|
8533
|
+
return reduceOptions(program.opts(), "global");
|
|
6868
8534
|
}
|
|
6869
8535
|
async function main() {
|
|
6870
|
-
const {
|
|
6871
|
-
|
|
6872
|
-
const options = Object.assign(
|
|
6873
|
-
allOptions,
|
|
6874
|
-
{}
|
|
6875
|
-
);
|
|
6876
|
-
await new ReleaseTask({ dryRun, verbose, options, shared }).exec();
|
|
8536
|
+
const { global: global2, ...allOptions } = programArgs();
|
|
8537
|
+
await new ReleaseTask({ ...global2, options: allOptions }).exec();
|
|
6877
8538
|
}
|
|
6878
8539
|
main().catch((e) => {
|
|
6879
8540
|
console.error(e.message);
|