watskeburt 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/version.js +1 -1
- package/dist/cjs-bundle.cjs +1 -1
- package/dist/esm/git-primitives.js +7 -7
- package/dist/esm/main.js +5 -7
- package/package.json +28 -19
package/bin/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// generated by tools/get-version.ts - edits will be overwritten
|
2
|
-
export const VERSION = "0.10.
|
2
|
+
export const VERSION = "0.10.2";
|
package/dist/cjs-bundle.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var p=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var n in e)p(t,n,{get:e[n],enumerable:!0})},A=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E(e))!N.call(t,o)&&o!==n&&p(t,o,{get:()=>e[o],enumerable:!(r=w(e,o))||r.enumerable});return t};var _=t=>A(p({},"__esModule",{value:!0}),t);var R={};x(R,{getSHASync:()=>a,listSync:()=>P});module.exports=_(R);var u=require("os"),D=/^(?<changeType>[ACDMRTUXB])(?<similarity>[0-9]{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/,L=/^(?<stagedChangeType>[ ACDMRTUXB?!])(?<unStagedChangeType>[ ACDMRTUXB?!])[ \t]+(?<name>[^ \t]+)(( -> )(?<newName>[^ \t]+))?$/,O={A:"added",C:"copied",D:"deleted",M:"modified",R:"renamed",T:"type changed",U:"unmerged",B:"pairing broken"," ":"unmodified","?":"untracked","!":"ignored"};function g(t){return O[t]??"unknown"}function j(t){let e=t.match(L),n={};if(e!=null&&e.groups){let r=g(e.groups.stagedChangeType),o=g(e.groups.unStagedChangeType);n.changeType=r==="unmodified"?o:r,e.groups.newName?(n.name=e.groups.newName,n.oldName=e.groups.name):n.name=e.groups.name}return n}function k(t){let e=t.match(D),n={};return e!=null&&e.groups&&(n.changeType=g(e.groups.changeType),e.groups.newName?(n.name=e.groups.newName,n.oldName=e.groups.name):n.name=e.groups.name),n}function T(t){return t.split(u.EOL).filter(Boolean).map(j).filter(({name:e,changeType:n})=>!!e&&!!n)}function l(t){return t.split(u.EOL).filter(Boolean).map(k).filter(({name:e,changeType:n})=>!!e&&!!n)}var s=require("child_process");function d(t){return t instanceof Buffer?t.toString("utf8"):t}function B(t){throw t.code==="ENOENT"?new Error("git executable not found"):new Error(`internal spawn error: ${t}`)}function c(t,e,n){let r=n("git",t,{cwd:process.cwd(),env:process.env});if(r.error&&B(r.error),r.status===0)return d(r.stdout);throw new Error(e[r.status??0]||`internal git error: ${r.status} (${d(r.stderr)})`)}function h(t=s.spawnSync){let e={129:`'${process.cwd()}' does not seem to be a git repository`};return c(["status","--porcelain"],e,t)}function S(t,e,n=s.spawnSync){let r={128:`revision '${t}' ${e?`(or '${e}') `:""}unknown`,129:`'${process.cwd()}' does not seem to be a git repository`};return c(e?["diff",t,e,"--name-status"]:["diff",t,"--name-status"],r,n)}function a(t=s.spawnSync){return c(["rev-parse","HEAD"],{},t).slice(0,40)}var C=require("path"),U=new Set([".cjs",".cjsx",".coffee",".csx",".cts",".js",".json",".jsx",".litcoffee",".ls",".mjs",".mts",".svelte",".ts",".tsx",".vue",".vuex"]),$=new Set(["modified","added","renamed","copied","untracked"]);function f(t,e=U,n=$){return`^(${t.filter(o=>n.has(o.changeType)).map(({name:o})=>o).filter(o=>e.has((0,C.extname)(o))).join("|")})$`}function m(t){return JSON.stringify(t,null,2)}var b=t=>t,M=new Map([["regex",f],["json",m]]);function y(t,e){return(M.get(e??"unknown")||b)(t)}function P(t,e,n){let r=t||a(),o=n||{},i=l(S(r,e));return o.trackedOnly||(i=i.concat(T(h()).filter(({changeType:I})=>I==="untracked"))),y(i,o.outputType)}0&&(module.exports={getSHASync,listSync});
|
@@ -19,7 +19,7 @@ function throwSpawnError(pError) {
|
|
19
19
|
/**
|
20
20
|
* @throws {Error}
|
21
21
|
*/
|
22
|
-
function
|
22
|
+
function getGitResultSync(pArguments, pErrorMap, pSpawnFunction) {
|
23
23
|
const lGitResult = pSpawnFunction("git", pArguments, {
|
24
24
|
cwd: process.cwd(),
|
25
25
|
// eslint-disable-next-line node/no-process-env
|
@@ -39,26 +39,26 @@ function getGitResult(pArguments, pErrorMap, pSpawnFunction) {
|
|
39
39
|
/**
|
40
40
|
* @throws {Error}
|
41
41
|
*/
|
42
|
-
export function
|
42
|
+
export function getStatusShortSync(pSpawnFunction = spawnSync) {
|
43
43
|
const lErrorMap = {
|
44
44
|
129: `'${process.cwd()}' does not seem to be a git repository`,
|
45
45
|
};
|
46
|
-
return
|
46
|
+
return getGitResultSync(["status", "--porcelain"], lErrorMap, pSpawnFunction);
|
47
47
|
}
|
48
48
|
/**
|
49
49
|
*
|
50
50
|
* @throws {Error}
|
51
51
|
*/
|
52
|
-
export function
|
52
|
+
export function getDiffLinesSync(pOldRevision, pNewRevision, pSpawnFunction = spawnSync) {
|
53
53
|
const lErrorMap = {
|
54
54
|
128: `revision '${pOldRevision}' ${pNewRevision ? `(or '${pNewRevision}') ` : ""}unknown`,
|
55
55
|
129: `'${process.cwd()}' does not seem to be a git repository`,
|
56
56
|
};
|
57
|
-
return
|
57
|
+
return getGitResultSync(pNewRevision
|
58
58
|
? ["diff", pOldRevision, pNewRevision, "--name-status"]
|
59
59
|
: ["diff", pOldRevision, "--name-status"], lErrorMap, pSpawnFunction);
|
60
60
|
}
|
61
|
-
export function
|
61
|
+
export function getSHASync(pSpawnFunction = spawnSync) {
|
62
62
|
const lSha1Length = 40;
|
63
|
-
return
|
63
|
+
return getGitResultSync(["rev-parse", "HEAD"], {}, pSpawnFunction).slice(0, lSha1Length);
|
64
64
|
}
|
package/dist/esm/main.js
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
import { convertDiffLines, convertStatusLines, } from "./convert-to-change-object.js";
|
2
|
-
import {
|
2
|
+
import { getDiffLinesSync, getSHASync, getStatusShortSync, } from "./git-primitives.js";
|
3
3
|
import format from "./formatters/format.js";
|
4
|
-
export function getSHASync() {
|
5
|
-
return getSHA1();
|
6
|
-
}
|
7
4
|
export function listSync(pOldRevision, pNewRevision, pOptions) {
|
8
|
-
const lOldRevision = pOldRevision ||
|
5
|
+
const lOldRevision = pOldRevision || getSHASync();
|
9
6
|
const lOptions = pOptions || {};
|
10
|
-
let lChanges = convertDiffLines(
|
7
|
+
let lChanges = convertDiffLines(getDiffLinesSync(lOldRevision, pNewRevision));
|
11
8
|
if (!lOptions.trackedOnly) {
|
12
|
-
lChanges = lChanges.concat(convertStatusLines(
|
9
|
+
lChanges = lChanges.concat(convertStatusLines(getStatusShortSync()).filter(({ changeType }) => changeType === "untracked"));
|
13
10
|
}
|
14
11
|
return format(lChanges, lOptions.outputType);
|
15
12
|
}
|
13
|
+
export { getSHASync } from "./git-primitives.js";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "watskeburt",
|
3
|
-
"version": "0.10.
|
3
|
+
"version": "0.10.2",
|
4
4
|
"description": "List files changed since a git revision",
|
5
5
|
"keywords": [
|
6
6
|
"git",
|
@@ -48,14 +48,14 @@
|
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
50
|
"@types/mocha": "10.0.1",
|
51
|
-
"@types/node": "18.15.
|
52
|
-
"@typescript-eslint/eslint-plugin": "5.
|
51
|
+
"@types/node": "18.15.11",
|
52
|
+
"@typescript-eslint/eslint-plugin": "5.58.0",
|
53
53
|
"c8": "7.13.0",
|
54
|
-
"dependency-cruiser": "
|
55
|
-
"esbuild": "0.17.
|
56
|
-
"eslint": "8.
|
54
|
+
"dependency-cruiser": "13.0.0-beta-1",
|
55
|
+
"esbuild": "0.17.16",
|
56
|
+
"eslint": "8.38.0",
|
57
57
|
"eslint-config-moving-meadow": "4.0.2",
|
58
|
-
"eslint-config-prettier": "8.
|
58
|
+
"eslint-config-prettier": "8.8.0",
|
59
59
|
"eslint-plugin-budapestian": "5.0.1",
|
60
60
|
"eslint-plugin-eslint-comments": "3.2.0",
|
61
61
|
"eslint-plugin-import": "2.27.5",
|
@@ -65,11 +65,20 @@
|
|
65
65
|
"eslint-plugin-unicorn": "46.0.0",
|
66
66
|
"mocha": "10.2.0",
|
67
67
|
"npm-run-all": "4.1.5",
|
68
|
-
"prettier": "2.8.
|
68
|
+
"prettier": "2.8.7",
|
69
69
|
"ts-node": "10.9.1",
|
70
|
-
"typescript": "5.0.
|
70
|
+
"typescript": "5.0.4",
|
71
71
|
"upem": "7.3.2"
|
72
72
|
},
|
73
|
+
"upem": {
|
74
|
+
"policies": [
|
75
|
+
{
|
76
|
+
"package": "dependency-cruiser",
|
77
|
+
"policy": "wanted",
|
78
|
+
"because": "we're beta testing v13 & policy 'latest' would downgraded it back to v12 again"
|
79
|
+
}
|
80
|
+
]
|
81
|
+
},
|
73
82
|
"engines": {
|
74
83
|
"node": "^14||^16||>=18"
|
75
84
|
},
|
@@ -84,16 +93,16 @@
|
|
84
93
|
"clean": "rm -rf dist",
|
85
94
|
"test": "NODE_OPTIONS=--no-warnings mocha",
|
86
95
|
"test:cover": "NODE_OPTIONS=--no-warnings c8 mocha",
|
87
|
-
"depcruise": "depcruise bin dist src types
|
88
|
-
"depcruise:graph": "depcruise bin src types --include-only '^(bin|dist|src|types)' --
|
89
|
-
"depcruise:graph:archi": "depcruise bin src --include-only '^(bin|dist|src|types)' --
|
90
|
-
"depcruise:graph:dev": "depcruise bin dist src types --include-only '^(bin|dist|src|types)' --prefix vscode://file/$(pwd)/ --
|
91
|
-
"depcruise:graph:diff:dev": "depcruise bin dist src types --include-only '^(bin|dist|src|types)' --highlight \"$(node bin/cli.js main -T regex)\" --prefix vscode://file/$(pwd)/ --
|
92
|
-
"depcruise:graph:diff:mermaid": "depcruise bin dist src types --include-only '^(bin|dist|src|types)' --
|
93
|
-
"depcruise:html": "depcruise bin src types --progress --
|
94
|
-
"depcruise:text": "depcruise bin src types --progress --
|
95
|
-
"depcruise:focus": "depcruise bin src types --progress --
|
96
|
-
"depcruise:reaches": "depcruise bin src types --progress --
|
96
|
+
"depcruise": "depcruise bin dist src types",
|
97
|
+
"depcruise:graph": "depcruise bin src types --include-only '^(bin|dist|src|types)' --output-type dot | dot -T svg | tee docs/dependency-graph.svg | depcruise-wrap-stream-in-html > docs/dependency-graph.html",
|
98
|
+
"depcruise:graph:archi": "depcruise bin src --include-only '^(bin|dist|src|types)' --output-type archi | dot -T svg | depcruise-wrap-stream-in-html > docs/high-level-dependency-graph.html",
|
99
|
+
"depcruise:graph:dev": "depcruise bin dist src types --include-only '^(bin|dist|src|types)' --prefix vscode://file/$(pwd)/ --output-type dot | dot -T svg | depcruise-wrap-stream-in-html | browser",
|
100
|
+
"depcruise:graph:diff:dev": "depcruise bin dist src types --include-only '^(bin|dist|src|types)' --highlight \"$(node bin/cli.js main -T regex)\" --prefix vscode://file/$(pwd)/ --output-type dot | dot -T svg | depcruise-wrap-stream-in-html | browser",
|
101
|
+
"depcruise:graph:diff:mermaid": "depcruise bin dist src types --include-only '^(bin|dist|src|types)' --output-type mermaid --output-to - --highlight \"$(node bin/cli.js $SHA -T regex)\"",
|
102
|
+
"depcruise:html": "depcruise bin src types --progress --output-type err-html --output-to dependency-violation-report.html",
|
103
|
+
"depcruise:text": "depcruise bin src types --progress --output-type text",
|
104
|
+
"depcruise:focus": "depcruise bin src types --progress --output-type text --focus",
|
105
|
+
"depcruise:reaches": "depcruise bin src types --progress --output-type text --reaches",
|
97
106
|
"format": "prettier --write \"{bin,src,tools}/**/*.{js,ts}\" \"types/**/*.ts\" \"*.{json,yml,md,js}\"",
|
98
107
|
"format:check": "prettier --loglevel warn --check \"{bin,src,tools}/**/*.ts\" \"types/**/*.ts\" \"*.{json,yml,md,js}\"",
|
99
108
|
"lint": "npm-run-all --parallel --aggregate-output format:check lint:eslint lint:types",
|