watskeburt 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -98,17 +98,17 @@ The JSON output (which looks a lot like the array above) is unfiltered and
98
98
  also contains other extensions.
99
99
 
100
100
  ```
101
- Usage: cli [options] [revision]
101
+ Usage: watskeburt [options] [old-revision] [new-revision]
102
102
 
103
- lists files & their statuses since [revision].
103
+ lists files & their statuses since [old-revision] or between [old-revision] and [new-revision].
104
104
 
105
- -> When you don't pass a revision the revision defaults to the current one.
105
+ -> When you don't pass a revision at all old-revision defaults to the current one.
106
106
 
107
107
  Options:
108
- -V, --version output the version number
109
- -T, --output-type <type> json,regex (default: "regex")
110
- --tracked-only only take tracked files into account (default: false)
111
- -h, --help display help for command
108
+ -T, --outputType <type> what format to emit (choices: "json", "regex", default: "regex")
109
+ --trackedOnly only take tracked files into account (default: false)
110
+ -V, --version output the version number
111
+ -h, --help display help for command
112
112
  ```
113
113
 
114
114
  ## 🇳🇱 what does 'watskeburt' mean?
package/bin/cli.js CHANGED
@@ -1,29 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
- import { EOL } from "node:os";
4
- import { Option, program } from "commander";
5
- import { list } from "../dist/esm/main.js";
6
- import { VERSION } from "./version.js";
7
2
 
8
- program
9
- .description(
10
- "lists files & their statuses since [old-revision] " +
11
- "or between [old-revision] and [new-revision]." +
12
- `${EOL}${EOL}` +
13
- "-> When you don't pass a revision at all old-revision defaults to the current one."
14
- )
15
- .addOption(
16
- new Option("-T, --output-type <type>", "what format to emit")
17
- .choices(["json", "regex"])
18
- .default("regex")
19
- )
20
- .option("--tracked-only", "only take tracked files into account", false)
21
- .arguments("[old-revision] [new-revision]")
22
- .version(VERSION)
23
- .parse(process.argv);
3
+ import { cli } from "../dist/esm/cli.js";
24
4
 
25
- try {
26
- console.log(await list(program.args[0], program.args[1], program.opts()));
27
- } catch (pError) {
28
- console.error(`ERROR: ${pError.message}`);
29
- }
5
+ await cli();
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var M=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},H=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of _(e))!k.call(t,s)&&s!==n&&l(t,s,{get:()=>e[s],enumerable:!(r=v(e,s))||r.enumerable});return t};var b=t=>H(l({},"__esModule",{value:!0}),t);var tt={};M(tt,{getSHA:()=>W,getSHASync:()=>Z,list:()=>K,listSync:()=>Q});module.exports=b(tt);var y=require("os"),B=/^(?<changeType>[ACDMRTUXB])(?<similarity>[0-9]{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/,U=/^(?<stagedChangeType>[ ACDMRTUXB?!])(?<unStagedChangeType>[ ACDMRTUXB?!])[ \t]+(?<name>[^ \t]+)(( -> )(?<newName>[^ \t]+))?$/,j={A:"added",C:"copied",D:"deleted",M:"modified",R:"renamed",T:"type changed",U:"unmerged",B:"pairing broken"," ":"unmodified","?":"untracked","!":"ignored"};function m(t){return j[t]??"unknown"}function R(t){let e=t.match(U),n={};if(e!=null&&e.groups){let r=m(e.groups.stagedChangeType),s=m(e.groups.unStagedChangeType);n.changeType=r==="unmodified"?s:r,e.groups.newName?(n.name=e.groups.newName,n.oldName=e.groups.name):n.name=e.groups.name}return n}function F(t){let e=t.match(B),n={};return e!=null&&e.groups&&(n.changeType=m(e.groups.changeType),e.groups.newName?(n.name=e.groups.newName,n.oldName=e.groups.name):n.name=e.groups.name),n}function d(t){return t.split(y.EOL).filter(Boolean).map(R).filter(({name:e,changeType:n})=>!!e&&!!n)}function T(t){return t.split(y.EOL).filter(Boolean).map(F).filter(({name:e,changeType:n})=>!!e&&!!n)}var p=require("child_process");function A(t){return t instanceof Buffer?t.toString("utf8"):t}function G(t){throw t.code==="ENOENT"?new Error("git executable not found"):new Error(`internal spawn error: ${t}`)}function S(t,e,n){let r=n("git",t,{cwd:process.cwd(),env:process.env});if(r.error&&G(r.error),r.status===0)return A(r.stdout);throw new Error(e[r.status??0]||`internal git error: ${r.status} (${A(r.stderr)})`)}function N(t=p.spawnSync){let e={129:`'${process.cwd()}' does not seem to be a git repository`};return S(["status","--porcelain"],e,t)}function D(t,e,n=p.spawnSync){let r={128:`revision '${t}' ${e?`(or '${e}') `:""}unknown`,129:`'${process.cwd()}' does not seem to be a git repository`};return S(e?["diff",t,e,"--name-status"]:["diff",t,"--name-status"],r,n)}function h(t=p.spawnSync){return S(["rev-parse","HEAD"],{},t).slice(0,40)}var u=require("child_process");function L(t){return t instanceof Buffer?t.toString("utf8"):t}function w(t,e,n){let r=n("git",t,{cwd:process.cwd(),env:process.env}),s="",i="";return new Promise((c,a)=>{var g,x;(g=r.stdout)==null||g.on("data",o=>{s=s.concat(o)}),(x=r.stderr)==null||x.on("data",o=>{i=i.concat(o)}),r.on("close",o=>{o===0?c(L(s)):a(new Error(e[o??0]||`internal git error: ${o} (${L(i)})`))}),r.on("error",o=>{(o==null?void 0:o.code)==="ENOENT"?a(new Error("git executable not found")):a(new Error(`internal spawn error: ${o}`))})})}async function O(t=u.spawn){let e={129:`'${process.cwd()}' does not seem to be a git repository`};return await w(["status","--porcelain"],e,t)}async function P(t,e,n=u.spawn){let r={128:`revision '${t}' ${e?`(or '${e}') `:""}unknown`,129:`'${process.cwd()}' does not seem to be a git repository`};return await w(e?["diff",t,e,"--name-status"]:["diff",t,"--name-status"],r,n)}async function C(t=u.spawn){return(await w(["rev-parse","HEAD"],{},t)).slice(0,40)}var $=require("path"),Y=new Set([".cjs",".cjsx",".coffee",".csx",".cts",".js",".json",".jsx",".litcoffee",".ls",".mjs",".mts",".svelte",".ts",".tsx",".vue",".vuex"]),V=new Set(["modified","added","renamed","copied","untracked"]);function I(t,e=Y,n=V){return`^(${t.filter(s=>n.has(s.changeType)).map(({name:s})=>s).filter(s=>e.has((0,$.extname)(s))).map(s=>s.replace(/\./g,"\\.")).join("|")})$`}function E(t){return JSON.stringify(t,null,2)}var q=t=>t,z=new Map([["regex",I],["json",E]]);function f(t,e){return(z.get(e??"unknown")||q)(t)}async function K(t,e,n){let r=t||await C(),s=n||{},[i,c]=await Promise.all([P(r,e),s.trackedOnly?"":O()]),a=T(i);return s.trackedOnly||(a=a.concat(d(c).filter(({changeType:g})=>g==="untracked"))),f(a,s.outputType)}function Q(t,e,n){let r=t||h(),s=n||{},i=T(D(r,e));return s.trackedOnly||(i=i.concat(d(N()).filter(({changeType:c})=>c==="untracked"))),f(i,s.outputType)}function W(){return C()}function Z(){return h()}0&&(module.exports={getSHA,getSHASync,list,listSync});
1
+ "use strict";var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _(t))!k.call(e,s)&&s!==n&&l(e,s,{get:()=>t[s],enumerable:!(r=v(t,s))||r.enumerable});return e};var b=e=>H(l({},"__esModule",{value:!0}),e);var ee={};M(ee,{getSHA:()=>W,getSHASync:()=>Z,list:()=>K,listSync:()=>Q});module.exports=b(ee);var y=require("os"),B=/^(?<changeType>[ACDMRTUXB])(?<similarity>[0-9]{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/,U=/^(?<stagedChangeType>[ ACDMRTUXB?!])(?<unStagedChangeType>[ ACDMRTUXB?!])[ \t]+(?<name>[^ \t]+)(( -> )(?<newName>[^ \t]+))?$/,j={A:"added",C:"copied",D:"deleted",M:"modified",R:"renamed",T:"type changed",U:"unmerged",B:"pairing broken"," ":"unmodified","?":"untracked","!":"ignored"};function d(e){return e.split(y.EOL).filter(Boolean).map(R).filter(({name:t,changeType:n})=>!!t&&!!n)}function R(e){let t=e.match(U),n={};if(t!=null&&t.groups){let r=m(t.groups.stagedChangeType),s=m(t.groups.unStagedChangeType);n.changeType=r==="unmodified"?s:r,t.groups.newName?(n.name=t.groups.newName,n.oldName=t.groups.name):n.name=t.groups.name}return n}function T(e){return e.split(y.EOL).filter(Boolean).map(F).filter(({name:t,changeType:n})=>!!t&&!!n)}function F(e){let t=e.match(B),n={};return t!=null&&t.groups&&(n.changeType=m(t.groups.changeType),t.groups.newName?(n.name=t.groups.newName,n.oldName=t.groups.name):n.name=t.groups.name),n}function m(e){return j[e]??"unknown"}var p=require("child_process");function N(e=p.spawnSync){let t={129:`'${process.cwd()}' does not seem to be a git repository`};return h(["status","--porcelain"],t,e)}function D(e,t,n=p.spawnSync){let r={128:`revision '${e}' ${t?`(or '${t}') `:""}unknown`,129:`'${process.cwd()}' does not seem to be a git repository`};return h(t?["diff",e,t,"--name-status"]:["diff",e,"--name-status"],r,n)}function S(e=p.spawnSync){return h(["rev-parse","HEAD"],{},e).slice(0,40)}function h(e,t,n){let r=n("git",e,{cwd:process.cwd(),env:process.env});if(r.error&&G(r.error),r.status===0)return A(r.stdout);throw new Error(t[r.status??0]||`internal git error: ${r.status} (${A(r.stderr)})`)}function A(e){return e instanceof Buffer?e.toString("utf8"):e}function G(e){throw e.code==="ENOENT"?new Error("git executable not found"):new Error(`internal spawn error: ${e}`)}var u=require("child_process");async function O(e=u.spawn){let t={129:`'${process.cwd()}' does not seem to be a git repository`};return await C(["status","--porcelain"],t,e)}async function P(e,t,n=u.spawn){let r={128:`revision '${e}' ${t?`(or '${t}') `:""}unknown`,129:`'${process.cwd()}' does not seem to be a git repository`};return await C(t?["diff",e,t,"--name-status"]:["diff",e,"--name-status"],r,n)}async function w(e=u.spawn){return(await C(["rev-parse","HEAD"],{},e)).slice(0,40)}function C(e,t,n){let r=n("git",e,{cwd:process.cwd(),env:process.env}),s="",i="";return new Promise((c,a)=>{var g,x;(g=r.stdout)==null||g.on("data",o=>{s=s.concat(o)}),(x=r.stderr)==null||x.on("data",o=>{i=i.concat(o)}),r.on("close",o=>{o===0?c(L(s)):a(new Error(t[o??0]||`internal git error: ${o} (${L(i)})`))}),r.on("error",o=>{(o==null?void 0:o.code)==="ENOENT"?a(new Error("git executable not found")):a(new Error(`internal spawn error: ${o}`))})})}function L(e){return e instanceof Buffer?e.toString("utf8"):e}var $=require("path"),Y=new Set([".cjs",".cjsx",".coffee",".csx",".cts",".js",".json",".jsx",".litcoffee",".ls",".mjs",".mts",".svelte",".ts",".tsx",".vue",".vuex"]),V=new Set(["modified","added","renamed","copied","untracked"]);function I(e,t=Y,n=V){return`^(${e.filter(s=>n.has(s.changeType)).map(({name:s})=>s).filter(s=>t.has((0,$.extname)(s))).map(s=>s.replace(/\\/g,"\\\\").replace(/\./g,"\\.")).join("|")})$`}function E(e){return JSON.stringify(e,null,2)}var q=e=>e,z=new Map([["regex",I],["json",E]]);function f(e,t){return(z.get(t??"unknown")||q)(e)}async function K(e,t,n){let r=e||await w(),s=n||{},[i,c]=await Promise.all([P(r,t),s.trackedOnly?"":O()]),a=T(i);return s.trackedOnly||(a=a.concat(d(c).filter(({changeType:g})=>g==="untracked"))),f(a,s.outputType)}function Q(e,t,n){let r=e||S(),s=n||{},i=T(D(r,t));return s.trackedOnly||(i=i.concat(d(N()).filter(({changeType:c})=>c==="untracked"))),f(i,s.outputType)}function W(){return w()}function Z(){return S()}0&&(module.exports={getSHA,getSHASync,list,listSync});
@@ -0,0 +1,63 @@
1
+ import { EOL } from "node:os";
2
+ import { parseArgs } from "node:util";
3
+ import { list } from "./main.js";
4
+ import { VERSION } from "./version.js";
5
+ const HELP_MESSAGE = `Usage: watskeburt [options] [old-revision] [new-revision]
6
+
7
+ lists files & their statuses since [old-revision] or between [old-revision] and [new-revision].
8
+
9
+ -> When you don't pass a revision at all old-revision defaults to the current one.
10
+
11
+ Options:
12
+ -T, --outputType <type> what format to emit (choices: "json", "regex", default: "regex")
13
+ --trackedOnly only take tracked files into account (default: false)
14
+ -V, --version output the version number
15
+ -h, --help display help for command${EOL}`;
16
+ export async function cli(pArguments = process.argv.slice(2), pOutStream = process.stdout, pErrorStream = process.stderr) {
17
+ try {
18
+ const lArguments = getArguments(pArguments);
19
+ if (lArguments.values.help) {
20
+ pOutStream.write(HELP_MESSAGE);
21
+ return;
22
+ }
23
+ if (lArguments.values.version) {
24
+ pOutStream.write(`${VERSION}${EOL}`);
25
+ return;
26
+ }
27
+ if (!outputTypeIsValid(lArguments.values.outputType)) {
28
+ pErrorStream.write(`error: option '-T, --outputType <type>' argument '${lArguments.values.outputType}' is invalid. Allowed choices are json, regex.${EOL}`);
29
+ process.exitCode = 1;
30
+ return;
31
+ }
32
+ const lResult = await list(lArguments.positionals[0], lArguments.positionals[1], lArguments.values);
33
+ pOutStream.write(`${lResult}${EOL}`);
34
+ }
35
+ catch (pError) {
36
+ pErrorStream.write(`${EOL}ERROR: ${pError.message}${EOL}${EOL}`);
37
+ process.exitCode = 1;
38
+ }
39
+ }
40
+ function getArguments(pArguments) {
41
+ return parseArgs({
42
+ args: pArguments,
43
+ options: {
44
+ outputType: {
45
+ type: "string",
46
+ short: "T",
47
+ default: "regex",
48
+ },
49
+ trackedOnly: {
50
+ type: "boolean",
51
+ default: false,
52
+ },
53
+ help: { type: "boolean", short: "h", default: false },
54
+ version: { type: "boolean", short: "V", default: false },
55
+ },
56
+ strict: true,
57
+ allowPositionals: true,
58
+ tokens: false,
59
+ });
60
+ }
61
+ function outputTypeIsValid(pOutputType) {
62
+ return ["json", "regex"].includes(pOutputType);
63
+ }
@@ -14,8 +14,12 @@ const CHANGE_CHAR_2_CHANGE_TYPE = {
14
14
  "?": "untracked",
15
15
  "!": "ignored",
16
16
  };
17
- function changeChar2ChangeType(pChar) {
18
- return CHANGE_CHAR_2_CHANGE_TYPE[pChar] ?? "unknown";
17
+ export function convertStatusLines(pString) {
18
+ return pString
19
+ .split(EOL)
20
+ .filter(Boolean)
21
+ .map(convertStatusLine)
22
+ .filter(({ name, changeType }) => Boolean(name) && Boolean(changeType));
19
23
  }
20
24
  export function convertStatusLine(pString) {
21
25
  const lMatchResult = pString.match(DIFF_SHORT_STATUS_LINE_PATTERN);
@@ -37,6 +41,13 @@ export function convertStatusLine(pString) {
37
41
  }
38
42
  return lReturnValue;
39
43
  }
44
+ export function convertDiffLines(pString) {
45
+ return pString
46
+ .split(EOL)
47
+ .filter(Boolean)
48
+ .map(convertDiffLine)
49
+ .filter(({ name, changeType }) => Boolean(name) && Boolean(changeType));
50
+ }
40
51
  export function convertDiffLine(pString) {
41
52
  const lMatchResult = pString.match(DIFF_NAME_STATUS_LINE_PATTERN);
42
53
  const lReturnValue = {};
@@ -52,17 +63,6 @@ export function convertDiffLine(pString) {
52
63
  }
53
64
  return lReturnValue;
54
65
  }
55
- export function convertStatusLines(pString) {
56
- return pString
57
- .split(EOL)
58
- .filter(Boolean)
59
- .map(convertStatusLine)
60
- .filter(({ name, changeType }) => Boolean(name) && Boolean(changeType));
61
- }
62
- export function convertDiffLines(pString) {
63
- return pString
64
- .split(EOL)
65
- .filter(Boolean)
66
- .map(convertDiffLine)
67
- .filter(({ name, changeType }) => Boolean(name) && Boolean(changeType));
66
+ function changeChar2ChangeType(pChar) {
67
+ return CHANGE_CHAR_2_CHANGE_TYPE[pChar] ?? "unknown";
68
68
  }
@@ -30,7 +30,7 @@ export default function formatToRegex(pChanges, pExtensions = DEFAULT_EXTENSIONS
30
30
  .filter((pChange) => pChangeTypes.has(pChange.changeType))
31
31
  .map(({ name }) => name)
32
32
  .filter((pName) => pExtensions.has(extname(pName)))
33
- .map((pName) => pName.replace(/\./g, "\\."))
33
+ .map((pName) => pName.replace(/\\/g, "\\\\").replace(/\./g, "\\."))
34
34
  .join("|");
35
35
  return `^(${lChanges})$`;
36
36
  }
@@ -1,19 +1,22 @@
1
1
  import { spawnSync } from "node:child_process";
2
- function stringifyOutStream(pError) {
3
- if (pError instanceof Buffer) {
4
- return pError.toString("utf8");
5
- }
6
- else {
7
- return pError;
8
- }
2
+ export function getStatusShortSync(pSpawnFunction = spawnSync) {
3
+ const lErrorMap = {
4
+ 129: `'${process.cwd()}' does not seem to be a git repository`,
5
+ };
6
+ return getGitResultSync(["status", "--porcelain"], lErrorMap, pSpawnFunction);
9
7
  }
10
- function throwSpawnError(pError) {
11
- if (pError.code === "ENOENT") {
12
- throw new Error("git executable not found");
13
- }
14
- else {
15
- throw new Error(`internal spawn error: ${pError}`);
16
- }
8
+ export function getDiffLinesSync(pOldRevision, pNewRevision, pSpawnFunction = spawnSync) {
9
+ const lErrorMap = {
10
+ 128: `revision '${pOldRevision}' ${pNewRevision ? `(or '${pNewRevision}') ` : ""}unknown`,
11
+ 129: `'${process.cwd()}' does not seem to be a git repository`,
12
+ };
13
+ return getGitResultSync(pNewRevision
14
+ ? ["diff", pOldRevision, pNewRevision, "--name-status"]
15
+ : ["diff", pOldRevision, "--name-status"], lErrorMap, pSpawnFunction);
16
+ }
17
+ export function getSHASync(pSpawnFunction = spawnSync) {
18
+ const lSha1Length = 40;
19
+ return getGitResultSync(["rev-parse", "HEAD"], {}, pSpawnFunction).slice(0, lSha1Length);
17
20
  }
18
21
  function getGitResultSync(pArguments, pErrorMap, pSpawnFunction) {
19
22
  const lGitResult = pSpawnFunction("git", pArguments, {
@@ -31,22 +34,19 @@ function getGitResultSync(pArguments, pErrorMap, pSpawnFunction) {
31
34
  `internal git error: ${lGitResult.status} (${stringifyOutStream(lGitResult.stderr)})`);
32
35
  }
33
36
  }
34
- export function getStatusShortSync(pSpawnFunction = spawnSync) {
35
- const lErrorMap = {
36
- 129: `'${process.cwd()}' does not seem to be a git repository`,
37
- };
38
- return getGitResultSync(["status", "--porcelain"], lErrorMap, pSpawnFunction);
39
- }
40
- export function getDiffLinesSync(pOldRevision, pNewRevision, pSpawnFunction = spawnSync) {
41
- const lErrorMap = {
42
- 128: `revision '${pOldRevision}' ${pNewRevision ? `(or '${pNewRevision}') ` : ""}unknown`,
43
- 129: `'${process.cwd()}' does not seem to be a git repository`,
44
- };
45
- return getGitResultSync(pNewRevision
46
- ? ["diff", pOldRevision, pNewRevision, "--name-status"]
47
- : ["diff", pOldRevision, "--name-status"], lErrorMap, pSpawnFunction);
37
+ function stringifyOutStream(pError) {
38
+ if (pError instanceof Buffer) {
39
+ return pError.toString("utf8");
40
+ }
41
+ else {
42
+ return pError;
43
+ }
48
44
  }
49
- export function getSHASync(pSpawnFunction = spawnSync) {
50
- const lSha1Length = 40;
51
- return getGitResultSync(["rev-parse", "HEAD"], {}, pSpawnFunction).slice(0, lSha1Length);
45
+ function throwSpawnError(pError) {
46
+ if (pError.code === "ENOENT") {
47
+ throw new Error("git executable not found");
48
+ }
49
+ else {
50
+ throw new Error(`internal spawn error: ${pError}`);
51
+ }
52
52
  }
@@ -1,11 +1,25 @@
1
1
  import { spawn } from "node:child_process";
2
- function stringifyOutStream(pBufferOrString) {
3
- if (pBufferOrString instanceof Buffer) {
4
- return pBufferOrString.toString("utf8");
5
- }
6
- else {
7
- return pBufferOrString;
8
- }
2
+ export async function getStatusShort(pSpawnFunction = spawn) {
3
+ const lErrorMap = {
4
+ 129: `'${process.cwd()}' does not seem to be a git repository`,
5
+ };
6
+ const lResult = await getGitResult(["status", "--porcelain"], lErrorMap, pSpawnFunction);
7
+ return lResult;
8
+ }
9
+ export async function getDiffLines(pOldRevision, pNewRevision, pSpawnFunction = spawn) {
10
+ const lErrorMap = {
11
+ 128: `revision '${pOldRevision}' ${pNewRevision ? `(or '${pNewRevision}') ` : ""}unknown`,
12
+ 129: `'${process.cwd()}' does not seem to be a git repository`,
13
+ };
14
+ const lResult = await getGitResult(pNewRevision
15
+ ? ["diff", pOldRevision, pNewRevision, "--name-status"]
16
+ : ["diff", pOldRevision, "--name-status"], lErrorMap, pSpawnFunction);
17
+ return lResult;
18
+ }
19
+ export async function getSHA(pSpawnFunction = spawn) {
20
+ const lSha1Length = 40;
21
+ const lResult = await getGitResult(["rev-parse", "HEAD"], {}, pSpawnFunction);
22
+ return lResult.slice(0, lSha1Length);
9
23
  }
10
24
  function getGitResult(pArguments, pErrorMap, pSpawnFunction) {
11
25
  const lGit = pSpawnFunction("git", pArguments, {
@@ -40,25 +54,11 @@ function getGitResult(pArguments, pErrorMap, pSpawnFunction) {
40
54
  });
41
55
  });
42
56
  }
43
- export async function getStatusShort(pSpawnFunction = spawn) {
44
- const lErrorMap = {
45
- 129: `'${process.cwd()}' does not seem to be a git repository`,
46
- };
47
- const lResult = await getGitResult(["status", "--porcelain"], lErrorMap, pSpawnFunction);
48
- return lResult;
49
- }
50
- export async function getDiffLines(pOldRevision, pNewRevision, pSpawnFunction = spawn) {
51
- const lErrorMap = {
52
- 128: `revision '${pOldRevision}' ${pNewRevision ? `(or '${pNewRevision}') ` : ""}unknown`,
53
- 129: `'${process.cwd()}' does not seem to be a git repository`,
54
- };
55
- const lResult = await getGitResult(pNewRevision
56
- ? ["diff", pOldRevision, pNewRevision, "--name-status"]
57
- : ["diff", pOldRevision, "--name-status"], lErrorMap, pSpawnFunction);
58
- return lResult;
59
- }
60
- export async function getSHA(pSpawnFunction = spawn) {
61
- const lSha1Length = 40;
62
- const lResult = await getGitResult(["rev-parse", "HEAD"], {}, pSpawnFunction);
63
- return lResult.slice(0, lSha1Length);
57
+ function stringifyOutStream(pBufferOrString) {
58
+ if (pBufferOrString instanceof Buffer) {
59
+ return pBufferOrString.toString("utf8");
60
+ }
61
+ else {
62
+ return pBufferOrString;
63
+ }
64
64
  }
@@ -0,0 +1 @@
1
+ export const VERSION = "0.11.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watskeburt",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "List files changed since a git revision",
5
5
  "keywords": [
6
6
  "git",
@@ -43,17 +43,14 @@
43
43
  "package.json",
44
44
  "README.md"
45
45
  ],
46
- "dependencies": {
47
- "commander": "10.0.1"
48
- },
49
46
  "devDependencies": {
50
47
  "@types/mocha": "10.0.1",
51
- "@types/node": "20.1.4",
52
- "@typescript-eslint/eslint-plugin": "5.59.5",
53
- "c8": "7.13.0",
54
- "dependency-cruiser": "13.0.0",
48
+ "@types/node": "20.2.5",
49
+ "@typescript-eslint/eslint-plugin": "5.59.7",
50
+ "c8": "7.14.0",
51
+ "dependency-cruiser": "13.0.2",
55
52
  "esbuild": "0.17.19",
56
- "eslint": "8.40.0",
53
+ "eslint": "8.41.0",
57
54
  "eslint-config-moving-meadow": "4.0.2",
58
55
  "eslint-config-prettier": "8.8.0",
59
56
  "eslint-plugin-budapestian": "5.0.1",
@@ -71,11 +68,11 @@
71
68
  "upem": "7.3.2"
72
69
  },
73
70
  "engines": {
74
- "node": "^14||^16||>=18"
71
+ "node": "^16.19||^18.11||>=20"
75
72
  },
76
73
  "scripts": {
77
74
  "build": "npm-run-all --sequential build:clean build:version build:dist",
78
- "build:version": "node --no-warnings --loader ts-node/esm tools/get-version.ts > bin/version.js",
75
+ "build:version": "node --no-warnings --loader ts-node/esm tools/get-version.ts > src/version.ts",
79
76
  "build:clean": "rm -rf dist/*",
80
77
  "build:dist": "npm-run-all build:dist:*",
81
78
  "build:dist:cjs": "esbuild src/main.ts --format=cjs --target=node14 --platform=node --bundle --global-name=wkbtcjs --minify --outfile=dist/cjs-bundle.cjs",
package/bin/version.js DELETED
@@ -1,2 +0,0 @@
1
- // generated by tools/get-version.ts - edits will be overwritten
2
- export const VERSION = "0.11.2";