First packaging

This commit is contained in:
Emmanuel 2022-08-29 10:24:08 +02:00
parent d331d0ccf8
commit 592f722bbd
5 changed files with 68 additions and 6 deletions

View file

@ -1,6 +1,6 @@
# Tricoteuses Legal Explorer # Tricoteuses Legal Explorer
## _Web API & site to browse legal open data from French Direction de l'information légale et administrative (Dila)_ ## _Web API, site & library to browse legal open data from French Direction de l'information légale et administrative (Dila)_
_Tricoteuses Legal Explorer_ is free and open source software. _Tricoteuses Legal Explorer_ is free and open source software.

53
src/lib/index.ts Normal file
View file

@ -0,0 +1,53 @@
export {
type Aggregate,
allFollows,
allFollowsMutable,
type Follow,
type GetArticleResult,
type GetRechercheResult,
type GetTexteResult,
type ListTextesResult,
} from "$lib/aggregates"
export { default as ArticleView } from "$lib/components/ArticleView.svelte"
export { default as LienView } from "$lib/components/LienView.svelte"
export { default as SectionTaView } from "$lib/components/SectionTaView.svelte"
export { default as TextelrView } from "$lib/components/TextelrView.svelte"
export { default as TexteVersionView } from "$lib/components/TexteVersionView.svelte"
export {
type Article,
type ArticleVersion,
bestItemForDate,
type Contexte,
type DossierLegislatif,
type Etat,
type Idcc,
type Jo,
type LegalObject,
type LegalObjectType,
type Lien,
type LienArt,
type LienSectionTa,
type MetaCommun,
type MetaTexteChronicle,
pathnameFromLegalId,
pathnameFromLegalObject,
pathnameFromLegalObjectTypeAndId,
rootTypeFromLegalId,
type SectionTa,
type Textekali,
type Textelr,
type TextelrVersion,
type TextelrVersionLienTxt,
type TexteVersion,
type TitreTm,
type TitreTxt,
type Tm,
type TmLienTxt,
type Versions,
} from "$lib/legal"

View file

@ -440,7 +440,7 @@ export function pathnameFromLegalObject(
} }
} }
export function pathnameFromLegalObjectId( export function pathnameFromLegalObjectTypeAndId(
type: LegalObjectType, type: LegalObjectType,
id: string, id: string,
): string { ): string {

View file

@ -17,7 +17,7 @@ import {
type LienSectionTa, type LienSectionTa,
pathnameFromLegalId, pathnameFromLegalId,
pathnameFromLegalObject, pathnameFromLegalObject,
pathnameFromLegalObjectId, pathnameFromLegalObjectTypeAndId,
type SectionTa, type SectionTa,
type Textekali, type Textekali,
type Textelr, type Textelr,
@ -126,7 +126,7 @@ export const summarizeArticleProperties: Summarizer = (access, value) => {
], ],
type: "concatenation", type: "concatenation",
}, },
href: pathnameFromLegalObjectId("article", lienArt["@id"]), href: pathnameFromLegalObjectTypeAndId("article", lienArt["@id"]),
type: "link", type: "link",
} }
} }
@ -375,7 +375,7 @@ export const summarizeLienArt: Summarizer = (access, value) => {
} }
return { return {
content: `Article ${lienArt["@num"]}`, content: `Article ${lienArt["@num"]}`,
href: pathnameFromLegalObjectId("article", lienArt["@id"]), href: pathnameFromLegalObjectTypeAndId("article", lienArt["@id"]),
type: "link", type: "link",
} }
} }
@ -431,7 +431,7 @@ export const summarizeLienSectionTa: Summarizer = (access, value) => {
} }
return { return {
content: lienSectionTa["#text"], content: lienSectionTa["#text"],
href: pathnameFromLegalObjectId("section_ta", lienSectionTa["@id"]), href: pathnameFromLegalObjectTypeAndId("section_ta", lienSectionTa["@id"]),
type: "link", type: "link",
} }
} }

View file

@ -3,6 +3,15 @@ import preprocess from "svelte-preprocess"
/** @type {import('@sveltejs/kit').Config} */ /** @type {import('@sveltejs/kit').Config} */
const config = { const config = {
package: {
exports: (filePath) => {
return !filePath.startsWith("scripts/") && !filePath.startsWith("server/")
},
files: (filePath) => {
return !filePath.startsWith("scripts/") && !filePath.startsWith("server/")
},
},
// Consult https://github.com/sveltejs/svelte-preprocess // Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors // for more information about preprocessors
preprocess: [ preprocess: [