@tricoteuses/assemblee 2.5.15 → 2.5.17

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/README.md CHANGED
@@ -43,6 +43,7 @@ npm install
43
43
  ### Basic usage
44
44
 
45
45
  Create a directory to store the data, then run the following command to download, reorganize and clean the data.
46
+
46
47
  ```bash
47
48
  mkdir ../assemblee-data/
48
49
  npm run data:download ../assemblee-data
@@ -59,7 +60,6 @@ npm run data:download ../assemblee-data
59
60
  - `npm run data:retrieve_documents <dir>`: Retrieval of legislative documents from Assemblée nationale's website
60
61
  - `npm run data:retrieve_pending_amendements <dir>`: Retrieval of pending amendments from Assemblée nationale's website (waiting to be processed by Assemblée services)
61
62
 
62
-
63
63
  _Notes_:
64
64
 
65
65
  - Reorganized files (generated by the _data:reorganize_data_ command) are also available in [Tricoteuses / Data / Données brutes de l'Assemblée](https://git.en-root.org/tricoteuses/data/assemblee-brut). They are updated on a regular basis.
@@ -92,6 +92,7 @@ npm run data:download ../assemblee-data -- -l 16 -l 17
92
92
  - `--pull` or `-p`: Pull repositories before starting
93
93
  - `--clone` or `-C <url>`: Clone Git repositories from a remote group or organization
94
94
  - `--remote` or `-r <name>`: Push commits to specified Git remote(s)
95
+ - `--keepDir`: Keep Dir (Implement before cleaning data)
95
96
 
96
97
  If you use such options, use them in all subsequent commands too (_data:regorganize_data_ and _data:clean_data_).
97
98
 
@@ -109,7 +110,6 @@ If you use such options, use them in all subsequent commands too (_data:regorgan
109
110
  - `--full` or `-f`: Retrieve all documents, even those already downloaded
110
111
  - `--document-type` or `-T <type>`: Restrict to specific document types (e.g., `PION`)
111
112
 
112
-
113
113
  ## Download using Docker
114
114
 
115
115
  A Docker image that downloads and cleans the data all at once is available. Build it locally or run it from the container registry.
@@ -139,7 +139,7 @@ import {
139
139
  iterLoadAssembleeAmendements,
140
140
  iterLoadAssembleeQuestions,
141
141
  iterLoadAssembleeComptesRendus,
142
- } from "@tricoteuses/assemblee/loaders";
142
+ } from "@tricoteuses/assemblee/loaders"
143
143
 
144
144
  // Pass data directory and legislature as arguments
145
145
  for (const { acteur } of iterLoadAssembleeActeurs("../assemblee-data", 17)) {
package/lib/git.d.ts CHANGED
@@ -4,4 +4,3 @@ export declare function resetAndPull(gitDir: string): boolean;
4
4
  export declare function clone(gitGroupUrl: string | undefined, gitName: string, workingDir: string): void;
5
5
  export declare function run(repositoryDir: string, args: string, verbose?: boolean): string;
6
6
  export declare function test(repositoryDir: string, args: string, verbose?: boolean): boolean;
7
- export declare function uidBranchUpdate(repositoryDir: string, subdirectories: any, notHard: boolean): boolean;
package/lib/git.js CHANGED
@@ -1,121 +1,98 @@
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,
1
+ import { execSync as i } from "node:child_process";
2
+ const r = 50 * 1024 * 1024;
3
+ function u(t, n) {
4
+ i("git add .", {
5
+ cwd: t,
9
6
  env: process.env,
10
7
  encoding: "utf-8",
11
8
  stdio: ["ignore", "ignore", "pipe"],
12
- maxBuffer: a
9
+ maxBuffer: r
13
10
  });
14
11
  try {
15
- return r(`git commit -m "${c}" --quiet`, {
16
- cwd: e,
12
+ return i(`git commit -m "${n}" --quiet`, {
13
+ cwd: t,
17
14
  env: process.env,
18
15
  encoding: "utf-8",
19
16
  stdio: ["ignore", "pipe", "pipe"]
20
17
  }), !0;
21
- } catch (t) {
22
- if (t.stdout === null || !/nothing to commit/.test(t.stdout))
23
- throw console.error(t.output), t;
18
+ } catch (e) {
19
+ if (e.stdout === null || !/nothing to commit/.test(e.stdout))
20
+ throw console.error(e.output), e;
24
21
  return !1;
25
22
  }
26
23
  }
27
- function E(e, c, t) {
28
- let n = 0;
29
- if (v(e, c))
30
- for (const s of t || [])
24
+ function f(t, n, e) {
25
+ let o = 0;
26
+ if (u(t, n))
27
+ for (const c of e || [])
31
28
  try {
32
- r(`git push ${s} master`, {
33
- cwd: e,
29
+ i(`git push ${c} master`, {
30
+ cwd: t,
34
31
  env: process.env,
35
32
  encoding: "utf-8",
36
33
  stdio: ["ignore", "ignore", "pipe"]
37
34
  });
38
- } catch (i) {
39
- console.error(i.output), n = i.status;
35
+ } catch (s) {
36
+ console.error(s.output), o = s.status;
40
37
  }
41
38
  else
42
- n = 10;
43
- return n;
39
+ o = 10;
40
+ return o;
44
41
  }
45
- function P(e) {
46
- return r("git reset --hard origin/master", {
47
- cwd: e,
42
+ function g(t) {
43
+ return i("git reset --hard origin/master", {
44
+ cwd: t,
48
45
  env: process.env,
49
46
  encoding: "utf-8",
50
47
  stdio: ["ignore", "ignore", "pipe"]
51
- }), r("git pull --rebase", {
52
- cwd: e,
48
+ }), i("git pull --rebase", {
49
+ cwd: t,
53
50
  env: process.env,
54
51
  encoding: "utf-8",
55
52
  stdio: ["ignore", "ignore", "pipe"]
56
53
  }), !0;
57
54
  }
58
- function H(e, c, t) {
59
- e !== void 0 && r(`git clone ${e}/${c}.git`, {
60
- cwd: t,
55
+ function p(t, n, e) {
56
+ t !== void 0 && i(`git clone ${t}/${n}.git`, {
57
+ cwd: e,
61
58
  env: process.env,
62
59
  encoding: "utf-8",
63
60
  stdio: ["ignore", "ignore", "pipe"]
64
61
  });
65
62
  }
66
- function o(e, c, t) {
63
+ function l(t, n, e) {
67
64
  try {
68
- t && console.log(`git -C ${e} ${c}`);
69
- const n = r(`git ${c}`, {
70
- cwd: e,
71
- maxBuffer: a
65
+ e && console.log(`git -C ${t} ${n}`);
66
+ const o = i(`git ${n}`, {
67
+ cwd: t,
68
+ maxBuffer: r
72
69
  }).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;
70
+ return e && console.log(o), o;
71
+ } catch (o) {
72
+ for (const c of ["stdout", "stderr"])
73
+ console.error(`${c}: ${o[c]}`);
74
+ throw o;
78
75
  }
79
76
  }
80
- function d(e, c, t) {
77
+ function m(t, n, e) {
81
78
  try {
82
- t && console.log(`git -C ${e} ${c}`);
83
- const n = r(`git ${c}`, {
84
- cwd: e,
79
+ e && console.log(`git -C ${t} ${n}`);
80
+ const o = i(`git ${n}`, {
81
+ cwd: t,
85
82
  stdio: ["ignore", "pipe", "pipe"],
86
- maxBuffer: a
83
+ maxBuffer: r
87
84
  }).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}`);
85
+ return e && console.log(o), !0;
86
+ } catch (o) {
87
+ if (o.status != 0) return !1;
88
+ throw o;
109
89
  }
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
90
  }
113
91
  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
92
+ p as clone,
93
+ u as commit,
94
+ f as commitAndPush,
95
+ g as resetAndPull,
96
+ l as run,
97
+ m as test
121
98
  };