@tricoteuses/assemblee 2.4.0 → 2.4.2
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/file_systems-CzTtoLWb.js +33 -0
- package/lib/git.js +121 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +229 -223
- package/lib/loaders.d.ts +10 -0
- package/lib/loaders.js +441 -425
- package/lib/numbers.d.ts +4 -0
- package/lib/scripts/retrieve_documents.d.ts +2 -1
- package/lib/scripts/shared/utils.d.ts +0 -1
- package/lib/{scrutins-DhX6h3KY.js → uids-DaRrTkI-.js} +100 -94
- package/lib/uids.d.ts +6 -0
- package/package.json +6 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import c from "fs-extra";
|
|
2
|
+
import { glob as f } from "glob";
|
|
3
|
+
import r from "node:path";
|
|
4
|
+
function* l(i, o = []) {
|
|
5
|
+
const t = r.join(i, ...o);
|
|
6
|
+
if (c.existsSync(t))
|
|
7
|
+
for (const s of c.readdirSync(t)) {
|
|
8
|
+
if (s[0] === ".")
|
|
9
|
+
continue;
|
|
10
|
+
const e = r.join(t, s), n = [...o, s];
|
|
11
|
+
c.statSync(e).isDirectory() ? yield* l(i, n) : yield n;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class a {
|
|
15
|
+
constructor(o) {
|
|
16
|
+
this.message = o;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function g(i) {
|
|
20
|
+
let o = [];
|
|
21
|
+
function t(s) {
|
|
22
|
+
if (f.hasMagic(s)) {
|
|
23
|
+
const e = f.globSync(s, { cwd: process.cwd() });
|
|
24
|
+
e.length > 0 && (o = o.concat(e));
|
|
25
|
+
} else if (o.push(s), !c.existsSync(s))
|
|
26
|
+
throw new a(`${s} file does not exist`);
|
|
27
|
+
}
|
|
28
|
+
return i.forEach(t), o;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
g,
|
|
32
|
+
l as w
|
|
33
|
+
};
|
package/lib/git.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import l from "fs-extra";
|
|
2
|
+
import { execSync as r } from "node:child_process";
|
|
3
|
+
import $ from "node:path";
|
|
4
|
+
import { g as p } from "./file_systems-CzTtoLWb.js";
|
|
5
|
+
const a = 50 * 1024 * 1024;
|
|
6
|
+
function v(e, c) {
|
|
7
|
+
r("git add .", {
|
|
8
|
+
cwd: e,
|
|
9
|
+
env: process.env,
|
|
10
|
+
encoding: "utf-8",
|
|
11
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
12
|
+
maxBuffer: a
|
|
13
|
+
});
|
|
14
|
+
try {
|
|
15
|
+
return r(`git commit -m "${c}" --quiet`, {
|
|
16
|
+
cwd: e,
|
|
17
|
+
env: process.env,
|
|
18
|
+
encoding: "utf-8",
|
|
19
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
20
|
+
}), !0;
|
|
21
|
+
} catch (t) {
|
|
22
|
+
if (t.stdout === null || !/nothing to commit/.test(t.stdout))
|
|
23
|
+
throw console.error(t.output), t;
|
|
24
|
+
return !1;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function E(e, c, t) {
|
|
28
|
+
let n = 0;
|
|
29
|
+
if (v(e, c))
|
|
30
|
+
for (const s of t || [])
|
|
31
|
+
try {
|
|
32
|
+
r(`git push ${s} master`, {
|
|
33
|
+
cwd: e,
|
|
34
|
+
env: process.env,
|
|
35
|
+
encoding: "utf-8",
|
|
36
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
37
|
+
});
|
|
38
|
+
} catch (i) {
|
|
39
|
+
console.error(i.output), n = i.status;
|
|
40
|
+
}
|
|
41
|
+
else
|
|
42
|
+
n = 10;
|
|
43
|
+
return n;
|
|
44
|
+
}
|
|
45
|
+
function P(e) {
|
|
46
|
+
return r("git reset --hard origin/master", {
|
|
47
|
+
cwd: e,
|
|
48
|
+
env: process.env,
|
|
49
|
+
encoding: "utf-8",
|
|
50
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
51
|
+
}), r("git pull --rebase", {
|
|
52
|
+
cwd: e,
|
|
53
|
+
env: process.env,
|
|
54
|
+
encoding: "utf-8",
|
|
55
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
56
|
+
}), !0;
|
|
57
|
+
}
|
|
58
|
+
function H(e, c, t) {
|
|
59
|
+
e !== void 0 && r(`git clone ${e}/${c}.git`, {
|
|
60
|
+
cwd: t,
|
|
61
|
+
env: process.env,
|
|
62
|
+
encoding: "utf-8",
|
|
63
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function o(e, c, t) {
|
|
67
|
+
try {
|
|
68
|
+
t && console.log(`git -C ${e} ${c}`);
|
|
69
|
+
const n = r(`git ${c}`, {
|
|
70
|
+
cwd: e,
|
|
71
|
+
maxBuffer: a
|
|
72
|
+
}).toString().trim();
|
|
73
|
+
return t && console.log(n), n;
|
|
74
|
+
} catch (n) {
|
|
75
|
+
for (const s of ["stdout", "stderr"])
|
|
76
|
+
console.error(`${s}: ${n[s]}`);
|
|
77
|
+
throw n;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function d(e, c, t) {
|
|
81
|
+
try {
|
|
82
|
+
t && console.log(`git -C ${e} ${c}`);
|
|
83
|
+
const n = r(`git ${c}`, {
|
|
84
|
+
cwd: e,
|
|
85
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
86
|
+
maxBuffer: a
|
|
87
|
+
}).toString().trim();
|
|
88
|
+
return t && console.log(n), !0;
|
|
89
|
+
} catch (n) {
|
|
90
|
+
if (n.status != 0) return !1;
|
|
91
|
+
throw n;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function S(e, c, t) {
|
|
95
|
+
const n = o(e, "rev-parse --abbrev-ref HEAD"), s = "uid", i = process.cwd();
|
|
96
|
+
process.chdir(e);
|
|
97
|
+
for (const f of c) {
|
|
98
|
+
const u = `${f}/uid`;
|
|
99
|
+
l.ensureDirSync(u);
|
|
100
|
+
for (const g of p([`${f}/**/*.json`])) {
|
|
101
|
+
const h = $.basename(g);
|
|
102
|
+
l.renameSync(g, `${u}/${h}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
process.chdir(i), d(e, `rev-parse remotes/origin/${s}`) ? (o(e, `branch --force ${s} origin/${s}`), o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset")) : d(e, `rev-parse refs/heads/${s}`) ? (o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset")) : (o(e, `branch --force ${s} master`), o(e, `symbolic-ref HEAD refs/heads/${s}`), o(e, "reset"), o(e, "rm -r ."));
|
|
106
|
+
for (const f of c) {
|
|
107
|
+
const u = `${f}/uid`;
|
|
108
|
+
o(e, `add ${u}`);
|
|
109
|
+
}
|
|
110
|
+
let m = !1;
|
|
111
|
+
return d(e, "diff --quiet --cached") || (o(e, "commit -m 'Update'"), m = !0), o(e, `symbolic-ref HEAD refs/heads/${n}`), o(e, `reset ${t ? "" : "--hard"}`), m;
|
|
112
|
+
}
|
|
113
|
+
export {
|
|
114
|
+
H as clone,
|
|
115
|
+
v as commit,
|
|
116
|
+
E as commitAndPush,
|
|
117
|
+
P as resetAndPull,
|
|
118
|
+
o as run,
|
|
119
|
+
d as test,
|
|
120
|
+
S as uidBranchUpdate
|
|
121
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -14,4 +14,5 @@ export { Cause, DocumentDenominationStructurelle, DossierParlementaireXsiType, M
|
|
|
14
14
|
export { Legislature } from './types/legislatures';
|
|
15
15
|
export { TypeQuestion, type Analyse, type AuteurQuestion, type Cloture, type Groupe, type Identifiant, type IdentiteAuteurQuestion, type IndexationAn, type InfoJoQuestion, type MinAttribElement, type MinAttribs, type Question, type QuestionXsiType, type Renouvellement, type Renouvellements, type Signalement, type TexteQuestion, type TextesQuestion, type TextesReponse, TypeJoQuestion, } from './types/questions';
|
|
16
16
|
export { CausePositionVote, CodeSortScrutin, CodeTypeVote, type DecompteNominatif, type DecompteVoix, type Demandeur, type Dysfonctionnement, LibelleSortScrutin, LibelleTypeVote, LieuVote, type MiseAuPoint, ModePublicationDesVotes, type ObjetVote, PositionMajoritaire, type SortScrutin, type Scrutin, type SyntheseVote, TypeMajorite, type TypeVote, type VentilationVotes, type VentilationVotesGroupe, type Votant, type Vote, } from './types/scrutins';
|
|
17
|
+
export { compteRenduUidRegex, documentUidRegex, dossierUidRegex, questionUidRegex, reunionUidRegex, scrutinUidRegex, } from './uids';
|
|
17
18
|
export { DocumentUrlFormat, iterDocumentOrDivisionUrls, urlFromDocument, urlFromScrutin, } from './urls';
|