@tricoteuses/assemblee 2.5.19 → 2.5.21
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/git.d.ts +19 -0
- package/lib/git.js +51 -25
- package/lib/loaders.d.ts +9 -0
- package/lib/loaders.js +568 -485
- package/package.json +1 -1
package/lib/git.d.ts
CHANGED
|
@@ -5,3 +5,22 @@ export declare function resetAndPull(gitDir: string): boolean;
|
|
|
5
5
|
export declare function clone(gitGroupUrl: string | undefined, gitName: string, workingDir: string): void;
|
|
6
6
|
export declare function run(repositoryDir: string, args: string, verbose?: boolean): string;
|
|
7
7
|
export declare function test(repositoryDir: string, args: string, verbose?: boolean): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Information about a changed file in git
|
|
10
|
+
*/
|
|
11
|
+
export interface GitChangedFile {
|
|
12
|
+
path: string;
|
|
13
|
+
status: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get the list of files that have changed since a specific commit in a git repository.
|
|
17
|
+
* @param repositoryDir The directory of the git repository
|
|
18
|
+
* @param sinceCommit The commit hash to compare against (e.g., "HEAD~1", "abc123", etc.)
|
|
19
|
+
* @param options Options for filtering
|
|
20
|
+
* @param options.diffFilter Git diff-filter string (default: "AMR").
|
|
21
|
+
* A=Added, M=Modified, D=Deleted, R=Renamed, C=Copied, T=Type changed, U=Unmerged
|
|
22
|
+
* @returns A Map of file paths to their git status
|
|
23
|
+
*/
|
|
24
|
+
export declare function getChangedFilesSinceCommit(repositoryDir: string, sinceCommit: string, options?: {
|
|
25
|
+
diffFilter?: string;
|
|
26
|
+
}): Map<string, GitChangedFile["status"]>;
|
package/lib/git.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { execSync as i } from "node:child_process";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
|
|
2
|
+
import g from "fs-extra";
|
|
3
|
+
import a from "node:path";
|
|
4
|
+
const u = 50 * 1024 * 1024;
|
|
5
|
+
function m(t) {
|
|
6
|
+
g.existsSync(a.join(t, ".git")) || (g.ensureDirSync(t), i("git init", {
|
|
7
7
|
cwd: t,
|
|
8
8
|
env: process.env,
|
|
9
9
|
encoding: "utf-8",
|
|
10
10
|
stdio: ["ignore", "ignore", "pipe"]
|
|
11
11
|
}));
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function h(t, o) {
|
|
14
|
+
m(t), i("git add .", {
|
|
15
15
|
cwd: t,
|
|
16
16
|
env: process.env,
|
|
17
17
|
encoding: "utf-8",
|
|
18
18
|
stdio: ["ignore", "ignore", "pipe"],
|
|
19
|
-
maxBuffer:
|
|
19
|
+
maxBuffer: u
|
|
20
20
|
});
|
|
21
21
|
try {
|
|
22
22
|
return i(`git commit -m "${o}" --quiet`, {
|
|
@@ -31,9 +31,9 @@ function g(t, o) {
|
|
|
31
31
|
return !1;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function P(t, o, e) {
|
|
35
35
|
let n = 0;
|
|
36
|
-
if (
|
|
36
|
+
if (h(t, o))
|
|
37
37
|
for (const c of e || [])
|
|
38
38
|
try {
|
|
39
39
|
i(`git push ${c} master`, {
|
|
@@ -42,14 +42,14 @@ function a(t, o, e) {
|
|
|
42
42
|
encoding: "utf-8",
|
|
43
43
|
stdio: ["ignore", "ignore", "pipe"]
|
|
44
44
|
});
|
|
45
|
-
} catch (
|
|
46
|
-
console.error(
|
|
45
|
+
} catch (r) {
|
|
46
|
+
console.error(r.output), n = r.status;
|
|
47
47
|
}
|
|
48
48
|
else
|
|
49
49
|
n = 10;
|
|
50
50
|
return n;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function S(t) {
|
|
53
53
|
return i("git reset --hard origin/master", {
|
|
54
54
|
cwd: t,
|
|
55
55
|
env: process.env,
|
|
@@ -62,7 +62,7 @@ function h(t) {
|
|
|
62
62
|
stdio: ["ignore", "ignore", "pipe"]
|
|
63
63
|
}), !0;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function A(t, o, e) {
|
|
66
66
|
t !== void 0 && i(`git clone ${t}/${o}.git`, {
|
|
67
67
|
cwd: e,
|
|
68
68
|
env: process.env,
|
|
@@ -70,12 +70,12 @@ function v(t, o, e) {
|
|
|
70
70
|
stdio: ["ignore", "ignore", "pipe"]
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function $(t, o, e) {
|
|
74
74
|
try {
|
|
75
75
|
e && console.log(`git -C ${t} ${o}`);
|
|
76
76
|
const n = i(`git ${o}`, {
|
|
77
77
|
cwd: t,
|
|
78
|
-
maxBuffer:
|
|
78
|
+
maxBuffer: u
|
|
79
79
|
}).toString().trim();
|
|
80
80
|
return e && console.log(n), n;
|
|
81
81
|
} catch (n) {
|
|
@@ -84,13 +84,13 @@ function w(t, o, e) {
|
|
|
84
84
|
throw n;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function F(t, o, e) {
|
|
88
88
|
try {
|
|
89
89
|
e && console.log(`git -C ${t} ${o}`);
|
|
90
90
|
const n = i(`git ${o}`, {
|
|
91
91
|
cwd: t,
|
|
92
92
|
stdio: ["ignore", "pipe", "pipe"],
|
|
93
|
-
maxBuffer:
|
|
93
|
+
maxBuffer: u
|
|
94
94
|
}).toString().trim();
|
|
95
95
|
return e && console.log(n), !0;
|
|
96
96
|
} catch (n) {
|
|
@@ -98,12 +98,38 @@ function $(t, o, e) {
|
|
|
98
98
|
throw n;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
function B(t, o, e = {}) {
|
|
102
|
+
const { diffFilter: n } = e;
|
|
103
|
+
try {
|
|
104
|
+
const r = $(
|
|
105
|
+
t,
|
|
106
|
+
`diff --name-status --diff-filter=${n ?? "AMR"} ${o}`,
|
|
107
|
+
!1
|
|
108
|
+
), f = /* @__PURE__ */ new Map();
|
|
109
|
+
for (const d of r.split(`
|
|
110
|
+
`)) {
|
|
111
|
+
if (d.trim().length === 0) continue;
|
|
112
|
+
const s = d.split(" ");
|
|
113
|
+
if (s.length >= 2) {
|
|
114
|
+
const l = s[0].charAt(0), p = s[1];
|
|
115
|
+
f.set(p, l);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return f;
|
|
119
|
+
} catch (c) {
|
|
120
|
+
return console.error(
|
|
121
|
+
`Error getting changed files since commit ${o}:`,
|
|
122
|
+
c
|
|
123
|
+
), /* @__PURE__ */ new Map();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
101
126
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
$ as
|
|
127
|
+
A as clone,
|
|
128
|
+
h as commit,
|
|
129
|
+
P as commitAndPush,
|
|
130
|
+
B as getChangedFilesSinceCommit,
|
|
131
|
+
m as initRepo,
|
|
132
|
+
S as resetAndPull,
|
|
133
|
+
$ as run,
|
|
134
|
+
F as test
|
|
109
135
|
};
|
package/lib/loaders.d.ts
CHANGED
|
@@ -58,46 +58,55 @@ export declare function iterLoadAssembleeActeurs(dataDir: string, legislature: L
|
|
|
58
58
|
acteur: Acteur;
|
|
59
59
|
datasetLegislature: Legislature;
|
|
60
60
|
filePath: string;
|
|
61
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
61
62
|
}, void, unknown>;
|
|
62
63
|
export declare function iterLoadAssembleeOrganes(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
63
64
|
organe: Organe;
|
|
64
65
|
datasetLegislature: Legislature;
|
|
65
66
|
filePath: string;
|
|
67
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
66
68
|
}, void, unknown>;
|
|
67
69
|
export declare function iterLoadAssembleeAmendements(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
68
70
|
amendement: Amendement;
|
|
69
71
|
datasetLegislature: Legislature;
|
|
70
72
|
filePath: string;
|
|
73
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
71
74
|
}, void, unknown>;
|
|
72
75
|
export declare function iterLoadAssembleeDocuments(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
73
76
|
document: Document;
|
|
74
77
|
datasetLegislature: Legislature;
|
|
75
78
|
filePath: string;
|
|
79
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
76
80
|
}, void, unknown>;
|
|
77
81
|
export declare function iterLoadAssembleeDossiersParlementaires(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
78
82
|
dossierParlementaire: DossierParlementaire;
|
|
79
83
|
datasetLegislature: Legislature;
|
|
80
84
|
filePath: string;
|
|
85
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
81
86
|
}, void, unknown>;
|
|
82
87
|
export declare function iterLoadAssembleeReunions(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
83
88
|
reunion: Reunion;
|
|
84
89
|
datasetLegislature: Legislature;
|
|
85
90
|
filePath: string;
|
|
91
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
86
92
|
}, void, unknown>;
|
|
87
93
|
export declare function iterLoadAssembleeScrutins(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
88
94
|
scrutin: Scrutin;
|
|
89
95
|
datasetLegislature: Legislature;
|
|
90
96
|
filePath: string;
|
|
97
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
91
98
|
}, void, unknown>;
|
|
92
99
|
export declare function iterLoadAssembleeQuestions(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
93
100
|
question: Question;
|
|
94
101
|
datasetLegislature: Legislature;
|
|
95
102
|
filePath: string;
|
|
103
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
96
104
|
}, void, unknown>;
|
|
97
105
|
export declare function iterLoadAssembleeComptesRendus(dataDir: string, legislature: Legislature, options?: {}): Generator<{
|
|
98
106
|
compteRendu: CompteRendu;
|
|
99
107
|
datasetLegislature: Legislature;
|
|
100
108
|
filePath: string;
|
|
109
|
+
gitStatus?: "A" | "M" | "D" | "R" | "C" | "T" | "U";
|
|
101
110
|
}, void, unknown>;
|
|
102
111
|
export declare function iterLoadAssembleeComptesRendusCommissions(dataDir: string, legislature: Legislature, { enriched }?: {
|
|
103
112
|
enriched?: boolean | undefined;
|