WIP: Add link to lois from décrets
This commit is contained in:
parent
3269afe03a
commit
3e49648c2d
3 changed files with 732 additions and 599 deletions
1285
package-lock.json
generated
1285
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -29,9 +29,9 @@
|
|||
"@auditors/core": "^0.3.0",
|
||||
"@iconify-icons/codicon": "^1.2.15",
|
||||
"@playwright/test": "^1.22.2",
|
||||
"@sveltejs/adapter-node": "^1.1.7",
|
||||
"@sveltejs/kit": "^1.5.0",
|
||||
"@sveltejs/package": "^1.0.0-next.5",
|
||||
"@sveltejs/adapter-node": "^1.2.1",
|
||||
"@sveltejs/kit": "^1.10.0",
|
||||
"@sveltejs/package": "^2.0.2",
|
||||
"@tailwindcss/typography": "^0.5.3",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
"@types/he": "^1.1.2",
|
||||
|
@ -50,6 +50,7 @@
|
|||
"fs-extra": "^11.1.0",
|
||||
"he": "^1.2.0",
|
||||
"iconify-icon": "^1.0.3",
|
||||
"metslesliens": "git+https://git.en-root.org/eraviart/metslesliens.git",
|
||||
"morgan": "^1.10.0",
|
||||
"papaparse": "^5.3.2",
|
||||
"postcss": "^8.4.14",
|
||||
|
|
39
src/scripts/link_decrets_and_lois.ts
Normal file
39
src/scripts/link_decrets_and_lois.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
import metslesliens from "metslesliens"
|
||||
import sade from "sade"
|
||||
|
||||
import type { JorfTexteVersion } from "$lib"
|
||||
import { db } from "$lib/server/database"
|
||||
|
||||
async function linkDecretsToLois(): Promise<void> {
|
||||
for (const texteVersion of (
|
||||
await db<{ data: JorfTexteVersion }[]>`
|
||||
SELECT data
|
||||
FROM texte_version
|
||||
WHERE
|
||||
data -> 'META' -> 'META_COMMUN' ->> 'NATURE' = 'DECRET'
|
||||
AND data -> 'META' -> 'META_COMMUN' ->> 'ORIGINE' = 'JORF'
|
||||
`
|
||||
).map(({ data }) => data)) {
|
||||
const notice = texteVersion.NOTICE?.CONTENU
|
||||
if (notice === undefined) {
|
||||
continue
|
||||
}
|
||||
console.log(
|
||||
"\n################################################################################",
|
||||
)
|
||||
console.log(notice)
|
||||
console.log(
|
||||
"--------------------------------------------------------------------------------",
|
||||
)
|
||||
const links = metslesliens.getLinks(notice /* , metslesliens.getParser() */)
|
||||
console.log(JSON.stringify(links, null, 2))
|
||||
}
|
||||
}
|
||||
|
||||
sade("link_decrets_and_lois", true)
|
||||
.describe("Link decrets to lois in database")
|
||||
.action(async () => {
|
||||
await linkDecretsToLois()
|
||||
process.exit(0)
|
||||
})
|
||||
.parse(process.argv)
|
Loading…
Add table
Reference in a new issue