watskeburt 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},C=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of y(t))!x.call(e,r)&&r!==n&&a(e,r,{get:()=>t[r],enumerable:!(o=w(t,r))||o.enumerable});return e};var _=e=>C(a({},"__esModule",{value:!0}),e);var I={};A(I,{getSHASync:()=>M,listSync:()=>F});module.exports=_(I);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]+))?$/,R={A:"added",C:"copied",D:"deleted",M:"modified",R:"renamed",T:"type changed",U:"unmerged",B:"pairing broken"," ":"unmodified","?":"untracked","!":"ignored"};function i(e){return R[e]||"unknown"}function U(e){let t=e.match(L),n={};if(t){let o=i(t.groups.stagedChangeType),r=i(t.groups.unStagedChangeType);n.changeType=o==="unmodified"?r:o,t.groups.newName?(n.name=t.groups.newName,n.oldName=t.groups.name):n.name=t.groups.name}return n}function O(e){let t=e.match(D),n={};return t&&(n.changeType=i(t.groups.changeType),t.groups.newName?(n.name=t.groups.newName,n.oldName=t.groups.name):n.name=t.groups.name),n}function g(e){return e.split(u.EOL).filter(Boolean).map(U).filter(({changeType:t})=>Boolean(t))}function d(e){return e.split(u.EOL).filter(Boolean).map(O).filter(({changeType:t})=>Boolean(t))}var s=require("child_process");function T(e){return e instanceof Buffer?e.toString("utf8"):e}function v(e){throw e.code==="ENOENT"?new Error("git executable not found"):new Error(`internal spawn error: ${e}`)}function c(e,t,n){let o=n("git",e,{cwd:process.cwd(),env:process.env});if(o.error&&v(o.error),o.status===0)return T(o.stdout);throw new Error(t[o.status]||`internal git error: ${o.status} (${T(o.stderr)})`)}function S(e=s.spawnSync){let t={129:`'${process.cwd()}' does not seem to be a git repository`};return c(["status","--porcelain"],t,e)}function h(e,t=s.spawnSync){let n={128:`revision '${e}' unknown `,129:`'${process.cwd()}' does not seem to be a git repository`};return c(["diff",e,"--name-status"],n,t)}function f(e=s.spawnSync){return c(["rev-parse","HEAD"],{},e).slice(0,40)}var N=require("path"),j=new Set([".cjs",".cjsx",".coffee",".csx",".js",".json",".jsx",".litcoffee",".ls",".mjs",".svelte",".ts",".tsx",".vue",".vuex"]),$=new Set(["modified","added","renamed","copied","untracked"]);function p(e,t=j,n=$){return`^(${e.filter(r=>n.has(r.changeType)).map(({name:r})=>r).filter(r=>t.has((0,N.extname)(r))).join("|")})$`}function l(e){return JSON.stringify(e,null,2)}var B={regex:p,json:l,object:e=>e},H="object";function m(e,t){return B[t||H](e)}function M(){return f()}function F(e,t){let n=e||f(),o=d(h(n)),r=t||{};return r.trackedOnly||(o=o.concat(g(S()).filter(({changeType:E})=>E==="untracked"))),m(o,r.outputType)}0&&(module.exports={getSHASync,listSync});
1
+ "use strict";var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},A=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of E(t))!x.call(e,r)&&r!==n&&a(e,r,{get:()=>t[r],enumerable:!(o=y(t,r))||o.enumerable});return e};var _=e=>A(a({},"__esModule",{value:!0}),e);var k={};C(k,{getSHASync:()=>j,listSync:()=>I});module.exports=_(k);var u=require("os"),D=/^(?<changeType>[ACDMRTUXB])(?<similarity>[0-9]{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/,R=/^(?<stagedChangeType>[ ACDMRTUXB?!])(?<unStagedChangeType>[ ACDMRTUXB?!])[ \t]+(?<name>[^ \t]+)(( -> )(?<newName>[^ \t]+))?$/,L={A:"added",C:"copied",D:"deleted",M:"modified",R:"renamed",T:"type changed",U:"unmerged",B:"pairing broken"," ":"unmodified","?":"untracked","!":"ignored"};function i(e){return L[e]||"unknown"}function v(e){let t=e.match(R),n={};if(t){let o=i(t.groups.stagedChangeType),r=i(t.groups.unStagedChangeType);n.changeType=o==="unmodified"?r:o,t.groups.newName?(n.name=t.groups.newName,n.oldName=t.groups.name):n.name=t.groups.name}return n}function O(e){let t=e.match(D),n={};return t&&(n.changeType=i(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 e.split(u.EOL).filter(Boolean).map(v).filter(({changeType:t})=>Boolean(t))}function d(e){return e.split(u.EOL).filter(Boolean).map(O).filter(({changeType:t})=>Boolean(t))}var s=require("child_process");function T(e){return e instanceof Buffer?e.toString("utf8"):e}function U(e){throw e.code==="ENOENT"?new Error("git executable not found"):new Error(`internal spawn error: ${e}`)}function c(e,t,n){let o=n("git",e,{cwd:process.cwd(),env:process.env});if(o.error&&U(o.error),o.status===0)return T(o.stdout);throw new Error(t[o.status]||`internal git error: ${o.status} (${T(o.stderr)})`)}function S(e=s.spawnSync){let t={129:`'${process.cwd()}' does not seem to be a git repository`};return c(["status","--porcelain"],t,e)}function h(e,t=s.spawnSync){let n={128:`revision '${e}' unknown `,129:`'${process.cwd()}' does not seem to be a git repository`};return c(["diff",e,"--name-status"],n,t)}function f(e=s.spawnSync){return c(["rev-parse","HEAD"],{},e).slice(0,40)}var N=require("path"),M=new Set([".cjs",".cjsx",".coffee",".csx",".js",".json",".jsx",".litcoffee",".ls",".mjs",".svelte",".ts",".tsx",".vue",".vuex"]),$=new Set(["modified","added","renamed","copied","untracked"]);function p(e,t=M,n=$){return`^(${e.filter(r=>n.has(r.changeType)).map(({name:r})=>r).filter(r=>t.has((0,N.extname)(r))).join("|")})$`}function l(e){return JSON.stringify(e,null,2)}var B=e=>e,H=new Map([["regex",p],["json",l]]);function g(e,t){return(H.get(t)||B)(e)}function j(){return f()}function I(e,t){let n=e||f(),o=d(h(n)),r=t||{};return r.trackedOnly||(o=o.concat(m(S()).filter(({changeType:w})=>w==="untracked"))),g(o,r.outputType)}0&&(module.exports={getSHASync,listSync});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watskeburt",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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": "^9.1.1",
51
- "@types/node": "^18.0.6",
52
- "@typescript-eslint/eslint-plugin": "^5.30.7",
51
+ "@types/node": "^18.6.3",
52
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
53
53
  "c8": "^7.12.0",
54
- "dependency-cruiser": "^11.12.0",
55
- "esbuild": "^0.14.49",
56
- "eslint": "^8.20.0",
54
+ "dependency-cruiser": "^11.14.1",
55
+ "esbuild": "^0.14.51",
56
+ "eslint": "^8.21.0",
57
57
  "eslint-config-moving-meadow": "^3.0.0",
58
58
  "eslint-config-prettier": "^8.5.0",
59
59
  "eslint-plugin-budapestian": "^4.0.0",
@@ -78,15 +78,16 @@
78
78
  "clean": "rm -rf dist",
79
79
  "test": "mocha \"src/**/*.spec.mjs\"",
80
80
  "test:cover": "c8 --check-coverage --statements 100 --branches 100 --functions 100 --lines 100 --exclude \"**/*.spec.mjs\" --reporter text-summary --reporter html --reporter json-summary npm test",
81
- "depcruise": "depcruise src types --config",
82
- "depcruise:graph": "depcruise src types --include-only '^(src|types)' --config --output-type dot | dot -T svg | tee docs/dependency-graph.svg | depcruise-wrap-stream-in-html > docs/dependency-graph.html",
83
- "depcruise:graph:archi": "depcruise src --include-only '^(src)' --config --output-type archi | dot -T svg | depcruise-wrap-stream-in-html > docs/high-level-dependency-graph.html",
84
- "depcruise:graph:dev": "depcruise src --include-only '^(src)' --prefix vscode://file/$(pwd)/ --config --output-type dot | dot -T svg | depcruise-wrap-stream-in-html | browser",
85
- "depcruise:graph:diff:dev": "depcruise src types --include-only '^(src|types)' --focus \"$(node src/cli.mjs main -T regex)\" --focus-depth 0 --prefix vscode://file/$(pwd)/ --config --output-type dot | dot -T svg | depcruise-wrap-stream-in-html | browser",
86
- "depcruise:graph:diff:mermaid": "depcruise src types --include-only '^(src|types)' --config --output-type mermaid --output-to - --focus \"$(node src/cli.mjs $SHA -T regex)\" --focus-depth 0",
87
- "depcruise:html": "depcruise src --progress --config --output-type err-html --output-to dependency-violation-report.html",
88
- "depcruise:text": "depcruise src --progress --config --output-type text",
89
- "depcruise:focus": "depcruise src --progress --config --output-type text --focus",
81
+ "depcruise": "depcruise src types --config --cache",
82
+ "depcruise:graph": "depcruise src types --cache --include-only '^(src|types)' --config --output-type dot | dot -T svg | tee docs/dependency-graph.svg | depcruise-wrap-stream-in-html > docs/dependency-graph.html",
83
+ "depcruise:graph:archi": "depcruise src --cache --include-only '^(src)' --config --output-type archi | dot -T svg | depcruise-wrap-stream-in-html > docs/high-level-dependency-graph.html",
84
+ "depcruise:graph:dev": "depcruise src --cache --include-only '^(src)' --prefix vscode://file/$(pwd)/ --config --output-type dot | dot -T svg | depcruise-wrap-stream-in-html | browser",
85
+ "depcruise:graph:diff:dev": "depcruise src types --cache --include-only '^(src|types)' --focus \"$(node src/cli.mjs main -T regex)\" --focus-depth 0 --prefix vscode://file/$(pwd)/ --config --output-type dot | dot -T svg | depcruise-wrap-stream-in-html | browser",
86
+ "depcruise:graph:diff:mermaid": "depcruise src types --cache --include-only '^(src|types)' --config --output-type mermaid --output-to - --focus \"$(node src/cli.mjs $SHA -T regex)\" --focus-depth 0",
87
+ "depcruise:html": "depcruise src types --progress --cache --config --output-type err-html --output-to dependency-violation-report.html",
88
+ "depcruise:text": "depcruise src types --progress --cache --config --output-type text",
89
+ "depcruise:focus": "depcruise src types --progress --cache --config --output-type text --focus",
90
+ "depcruise:reaches": "depcruise src types --progress --cache --config --output-type text --reaches",
90
91
  "lint": "npm-run-all --parallel --aggregate-output lint:format lint:eslint lint:types",
91
92
  "lint:fix": "npm-run-all --parallel --aggregate-output lint:format:fix lint:eslint:fix",
92
93
  "lint:eslint": "eslint src types tools --cache --cache-location node_modules/.cache/eslint/",
@@ -1,12 +1,11 @@
1
1
  import formatToRegex from "./regex.mjs";
2
2
  import formatToJSON from "./json.mjs";
3
3
 
4
- const OUTPUT_TYPE_TO_FUNCTION = {
5
- regex: formatToRegex,
6
- json: formatToJSON,
7
- object: (pX) => pX,
8
- };
9
- const DEFAULT_OUTPUT_TYPE = "object";
4
+ const identity = (pX) => pX;
5
+ const OUTPUT_TYPE_TO_FUNCTION = new Map([
6
+ ["regex", formatToRegex],
7
+ ["json", formatToJSON],
8
+ ]);
10
9
 
11
10
  /**
12
11
  *
@@ -15,5 +14,5 @@ const DEFAULT_OUTPUT_TYPE = "object";
15
14
  * @returns {string|import("../../types/watskeburt.js").IChange[]}
16
15
  */
17
16
  export default function format(pChanges, pOutputType) {
18
- return OUTPUT_TYPE_TO_FUNCTION[pOutputType || DEFAULT_OUTPUT_TYPE](pChanges);
17
+ return (OUTPUT_TYPE_TO_FUNCTION.get(pOutputType) || identity)(pChanges);
19
18
  }
package/src/version.mjs CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.6.0";
1
+ export const VERSION = "0.6.1";
@@ -37,9 +37,9 @@ export interface IOptions {
37
37
  outputType: outputTypeType;
38
38
  /**
39
39
  * When true _only_ takes already tracked files into account.
40
- * When true also takes untracked files into account.
40
+ * When false also takes untracked files into account.
41
41
  *
42
- * Defaults to true.
42
+ * Defaults to false.
43
43
  */
44
44
  trackedOnly: boolean;
45
45
  }
@@ -54,14 +54,14 @@ export interface IOptions {
54
54
  * filter what is returned and
55
55
  * @throws {Error}
56
56
  */
57
- export type listSync = (
57
+ export function listSync(
58
58
  pOldRevision?: string,
59
59
  pOptions?: IOptions
60
- ) => IChange[] | string;
60
+ ): IChange[] | string;
61
61
 
62
62
  /**
63
63
  * Returns the SHA1 of the current HEAD
64
64
  *
65
65
  * @throws {Error}
66
66
  */
67
- export type getSHASync = () => string;
67
+ export function getSHASync(): string;