watskeburt 0.11.1 → 0.11.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -2
- package/bin/version.js +1 -1
- package/dist/cjs-bundle.cjs +1 -1
- package/dist/esm/formatters/regex.js +1 -0
- package/dist/esm/main.js +20 -16
- package/package.json +8 -17
package/README.md
CHANGED
@@ -87,7 +87,7 @@ For now there's also a simple command line interface
|
|
87
87
|
```shell
|
88
88
|
# list all JavaScript-ish files changed since main in a regular expression
|
89
89
|
$ npx watskeburt main
|
90
|
-
^(src/cli
|
90
|
+
^(src/cli\.mjs|src/formatters/regex\.mjs|src/version\.mjs)$
|
91
91
|
```
|
92
92
|
|
93
93
|
By default this returns a regex that contains all changed files that could be
|
@@ -116,4 +116,4 @@ Options:
|
|
116
116
|
_watskeburt_ is a fast pronunciation of the Dutch "wat is er gebeurd?"
|
117
117
|
(_what has happened?_) or "wat er is gebeurd" (_what has happened_). It's
|
118
118
|
also the title of a song by the Dutch band "De Jeugd van Tegenwoordig"
|
119
|
-
(_Youth these
|
119
|
+
(_Youth these days_).
|
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.11.
|
2
|
+
export const VERSION = "0.11.2";
|
package/dist/cjs-bundle.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
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});
|
@@ -30,6 +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
34
|
.join("|");
|
34
35
|
return `^(${lChanges})$`;
|
35
36
|
}
|
package/dist/esm/main.js
CHANGED
@@ -1,22 +1,13 @@
|
|
1
1
|
import { convertDiffLines, convertStatusLines, } from "./convert-to-change-object.js";
|
2
|
-
import
|
2
|
+
import * as primitivesSync from "./git-primitives-sync.js";
|
3
|
+
import * as primitives from "./git-primitives.js";
|
3
4
|
import format from "./formatters/format.js";
|
4
|
-
import { getDiffLines, getStatusShort, getSHA } from "./git-primitives.js";
|
5
|
-
export function listSync(pOldRevision, pNewRevision, pOptions) {
|
6
|
-
const lOldRevision = pOldRevision || getSHASync();
|
7
|
-
const lOptions = pOptions || {};
|
8
|
-
let lChanges = convertDiffLines(getDiffLinesSync(lOldRevision, pNewRevision));
|
9
|
-
if (!lOptions.trackedOnly) {
|
10
|
-
lChanges = lChanges.concat(convertStatusLines(getStatusShortSync()).filter(({ changeType }) => changeType === "untracked"));
|
11
|
-
}
|
12
|
-
return format(lChanges, lOptions.outputType);
|
13
|
-
}
|
14
5
|
export async function list(pOldRevision, pNewRevision, pOptions) {
|
15
|
-
const lOldRevision = pOldRevision || (await getSHA());
|
6
|
+
const lOldRevision = pOldRevision || (await primitives.getSHA());
|
16
7
|
const lOptions = pOptions || {};
|
17
8
|
const [lDiffLines, lStatusLines] = await Promise.all([
|
18
|
-
getDiffLines(lOldRevision, pNewRevision),
|
19
|
-
!lOptions.trackedOnly ? getStatusShort() : "",
|
9
|
+
primitives.getDiffLines(lOldRevision, pNewRevision),
|
10
|
+
!lOptions.trackedOnly ? primitives.getStatusShort() : "",
|
20
11
|
]);
|
21
12
|
let lChanges = convertDiffLines(lDiffLines);
|
22
13
|
if (!lOptions.trackedOnly) {
|
@@ -24,5 +15,18 @@ export async function list(pOldRevision, pNewRevision, pOptions) {
|
|
24
15
|
}
|
25
16
|
return format(lChanges, lOptions.outputType);
|
26
17
|
}
|
27
|
-
export
|
28
|
-
|
18
|
+
export function listSync(pOldRevision, pNewRevision, pOptions) {
|
19
|
+
const lOldRevision = pOldRevision || primitivesSync.getSHASync();
|
20
|
+
const lOptions = pOptions || {};
|
21
|
+
let lChanges = convertDiffLines(primitivesSync.getDiffLinesSync(lOldRevision, pNewRevision));
|
22
|
+
if (!lOptions.trackedOnly) {
|
23
|
+
lChanges = lChanges.concat(convertStatusLines(primitivesSync.getStatusShortSync()).filter(({ changeType }) => changeType === "untracked"));
|
24
|
+
}
|
25
|
+
return format(lChanges, lOptions.outputType);
|
26
|
+
}
|
27
|
+
export function getSHA() {
|
28
|
+
return primitives.getSHA();
|
29
|
+
}
|
30
|
+
export function getSHASync() {
|
31
|
+
return primitivesSync.getSHASync();
|
32
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "watskeburt",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.2",
|
4
4
|
"description": "List files changed since a git revision",
|
5
5
|
"keywords": [
|
6
6
|
"git",
|
@@ -48,12 +48,12 @@
|
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
50
|
"@types/mocha": "10.0.1",
|
51
|
-
"@types/node": "
|
52
|
-
"@typescript-eslint/eslint-plugin": "5.59.
|
51
|
+
"@types/node": "20.1.4",
|
52
|
+
"@typescript-eslint/eslint-plugin": "5.59.5",
|
53
53
|
"c8": "7.13.0",
|
54
|
-
"dependency-cruiser": "13.0.0
|
55
|
-
"esbuild": "0.17.
|
56
|
-
"eslint": "8.
|
54
|
+
"dependency-cruiser": "13.0.0",
|
55
|
+
"esbuild": "0.17.19",
|
56
|
+
"eslint": "8.40.0",
|
57
57
|
"eslint-config-moving-meadow": "4.0.2",
|
58
58
|
"eslint-config-prettier": "8.8.0",
|
59
59
|
"eslint-plugin-budapestian": "5.0.1",
|
@@ -62,7 +62,7 @@
|
|
62
62
|
"eslint-plugin-mocha": "10.1.0",
|
63
63
|
"eslint-plugin-node": "11.1.0",
|
64
64
|
"eslint-plugin-security": "1.7.1",
|
65
|
-
"eslint-plugin-unicorn": "
|
65
|
+
"eslint-plugin-unicorn": "47.0.0",
|
66
66
|
"mocha": "10.2.0",
|
67
67
|
"npm-run-all": "4.1.5",
|
68
68
|
"prettier": "2.8.8",
|
@@ -70,21 +70,12 @@
|
|
70
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
|
-
},
|
82
73
|
"engines": {
|
83
74
|
"node": "^14||^16||>=18"
|
84
75
|
},
|
85
76
|
"scripts": {
|
86
77
|
"build": "npm-run-all --sequential build:clean build:version build:dist",
|
87
|
-
"build:version": "ts-node
|
78
|
+
"build:version": "node --no-warnings --loader ts-node/esm tools/get-version.ts > bin/version.js",
|
88
79
|
"build:clean": "rm -rf dist/*",
|
89
80
|
"build:dist": "npm-run-all build:dist:*",
|
90
81
|
"build:dist:cjs": "esbuild src/main.ts --format=cjs --target=node14 --platform=node --bundle --global-name=wkbtcjs --minify --outfile=dist/cjs-bundle.cjs",
|