@thisismanta/semantic-version 11.4.0 → 11.6.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/lib/index.d.ts +1 -1
- package/lib/src.js +8 -3
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ interface GitCommit {
|
|
|
15
15
|
subject: string;
|
|
16
16
|
}
|
|
17
17
|
export declare function getReleaseType(commits: Array<GitCommit>): string | null;
|
|
18
|
-
export declare function getCurrentPackageVersion(): Promise<
|
|
18
|
+
export declare function getCurrentPackageVersion(): Promise<string>;
|
|
19
19
|
export declare function getGitHistory(version: string): Promise<Array<GitCommit>>;
|
|
20
20
|
export declare function getReleaseNote(commits: Array<GitCommit>): string;
|
|
21
21
|
export {};
|
package/lib/src.js
CHANGED
|
@@ -453,7 +453,8 @@ function yn(value, { lenient: lenient$1 = false, default: default_ } = {}) {
|
|
|
453
453
|
}
|
|
454
454
|
//#endregion
|
|
455
455
|
//#region src/index.ts
|
|
456
|
-
const
|
|
456
|
+
const debuggingEnabled = yn(process.env.DEBUG) || yn(process.env.RUNNER_DEBUG);
|
|
457
|
+
const debug = debuggingEnabled ? (text) => {
|
|
457
458
|
console.log("::debug::" + text);
|
|
458
459
|
} : () => {};
|
|
459
460
|
function run(command) {
|
|
@@ -464,7 +465,10 @@ function run(command) {
|
|
|
464
465
|
if (stdout.length > 0) debug("Output » " + stdout);
|
|
465
466
|
stderr = stderr.trim();
|
|
466
467
|
if (stderr.length > 0) debug("Error » " + stderr);
|
|
467
|
-
if (error)
|
|
468
|
+
if (error) if (debuggingEnabled && stdout.includes("[ERR_PNPM_UNCLEAN_WORKING_TREE]")) run("git --no-pager diff").finally(() => {
|
|
469
|
+
reject(error);
|
|
470
|
+
});
|
|
471
|
+
else reject(error);
|
|
468
472
|
else resolve(stdout);
|
|
469
473
|
});
|
|
470
474
|
});
|
|
@@ -510,7 +514,8 @@ function getReleaseType(commits) {
|
|
|
510
514
|
return null;
|
|
511
515
|
}
|
|
512
516
|
async function getCurrentPackageVersion() {
|
|
513
|
-
|
|
517
|
+
const version = (await run(`${npm} pkg get version`)).trim().replace(/^"/, "").replace(/"$/, "");
|
|
518
|
+
if ((0, import_valid.default)(version)) return version;
|
|
514
519
|
else throw new Error("Expected a valid version field in package.json.");
|
|
515
520
|
}
|
|
516
521
|
async function getGitHistory(version) {
|