diff --git a/.eslintrc.cjs b/.eslintrc.cjs index a835323..fe58b1d 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,24 +1,24 @@ module.exports = { - root: true, - parser: "@typescript-eslint/parser", - extends: [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "prettier", - ], - plugins: ["svelte3", "@typescript-eslint"], - ignorePatterns: ["*.cjs"], - overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }], - settings: { - "svelte3/typescript": () => require("typescript"), - }, - parserOptions: { - sourceType: "module", - ecmaVersion: 2020, - }, env: { browser: true, es2017: true, node: true, }, + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "prettier", + ], + ignorePatterns: ["*.cjs"], + overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }], + plugins: ["svelte3", "@typescript-eslint"], + parser: "@typescript-eslint/parser", + parserOptions: { + sourceType: "module", + ecmaVersion: 2020, + }, + root: true, + settings: { + "svelte3/typescript": () => require("typescript"), + }, } diff --git a/.gitignore b/.gitignore index f4401a3..1934e92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ .DS_Store -node_modules -/build /.svelte-kit -/package -.env -.env.* -!.env.example +/build +/node_modules +/*.env +!/example.env diff --git a/.prettierignore b/.prettierignore index 3897265..fe258ea 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,11 +1,11 @@ -.DS_Store -node_modules -/build /.svelte-kit +/build /package +.DS_Store .env .env.* !.env.example +node_modules # Ignore files for PNPM, NPM and YARN pnpm-lock.yaml diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..fa51838 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,14 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "bradlc.vscode-tailwindcss", + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "svelte.svelte-vscode" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..94beef2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,21 @@ +{ + "editor.formatOnSave": true, + "[css]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[html]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[markdown]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[svelte]": { + "editor.defaultFormatter": "svelte.svelte-vscode" + } +} diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6be0cd8 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,22 @@ +# Tricoteuses Legal Explorer + +## _Web API & site to browse legal open data from French Direction de l'information légale et administrative (Dila)_ + +By: Emmanuel Raviart + +Copyright (C) 2022 Emmanuel Raviart + +https://git.en-root.org/tricoteuses/tricoteuses-legal-explorer + +> Tricoteuses Legal Explorer is free software; you can redistribute it and/or modify +> it under the terms of the GNU Affero General Public License as +> published by the Free Software Foundation, either version 3 of the +> License, or (at your option) any later version. +> +> Tricoteuses Legal Explorer is distributed in the hope that it will be useful, +> but WITHOUT ANY WARRANTY; without even the implied warranty of +> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +> GNU Affero General Public License for more details. +> +> You should have received a copy of the GNU Affero General Public License +> along with this program. If not, see . diff --git a/README.md b/README.md index 5c91169..421e945 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,40 @@ -# create-svelte +# Tricoteuses Legal Explorer -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). +## _Web API & site to browse legal open data from French Direction de l'information légale et administrative (Dila)_ -## Creating a project +_Tricoteuses Legal Explorer_ is free and open source software. -If you're seeing this, you've probably already done this step. Congrats! +- [software repository](https://git.en-root.org/tricoteuses/tricoteuses-legal-explorer) +- [GNU Affero General Public License version 3 or greater](https://git.en-root.org/tricoteuses/tricoteuses-legal-explorer/blob/master/LICENSE.md) + +## Installation + +### Install dependencies ```bash -# create a new project in the current directory -npm create svelte@latest - -# create a new project in my-app -npm create svelte@latest my-app +npm install ``` -## Developing +## Server Configuration -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: +Create a `.env` file to set configuration variables (you can use `example.env` as a template). Then: + +```bash +npm run configure +npm run package +``` + +## Server Launch + +In development mode: ```bash npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open ``` -## Building - -To create a production version of your app: +In production mode: ```bash npm run build +npm run preview ``` - -You can preview the production build with `npm run preview`. - -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. diff --git a/package.json b/package.json index 954a14b..81101af 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,24 @@ { - "name": "tricoteuses-legal", + "name": "@tricoteuses/legal-explorer", + "description": "Web API & site to browse legal open data from French Direction de l'information légale et administrative (Dila)", + "license": "AGPL-3.0-or-later", + "repository": { + "type": "git", + "url": "https://git.en-root.org/tricoteuses/tricoteuses-legal-explorer.git" + }, "version": "0.0.1", + "author": "Emmanuel Raviart ", + "type": "module", "scripts": { - "dev": "vite dev", "build": "vite build", - "package": "svelte-kit package", - "preview": "vite preview", - "test": "playwright test", "check": "svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", + "dev": "vite dev", + "format": "prettier --write --plugin-search-dir=. .", "lint": "prettier --check --plugin-search-dir=. . && eslint .", - "format": "prettier --write --plugin-search-dir=. ." + "package": "svelte-kit package", + "preview": "vite preview", + "test": "playwright test" }, "devDependencies": { "@playwright/test": "^1.22.2", @@ -35,6 +43,5 @@ "tailwindcss": "^3.1.5", "@tailwindcss/typography": "^0.5.3", "daisyui": "^2.18.1" - }, - "type": "module" + } } diff --git a/src/app.html b/src/app.html index 4e53b26..ab9c015 100644 --- a/src/app.html +++ b/src/app.html @@ -1,5 +1,5 @@ - + diff --git a/svelte.config.js b/svelte.config.js index b9db51e..8cfa22a 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,4 +1,4 @@ -import adapter from "@sveltejs/adapter-auto" +import adapter from "@sveltejs/adapter-node" import preprocess from "svelte-preprocess" /** @type {import('@sveltejs/kit').Config} */ @@ -12,7 +12,9 @@ const config = { ], kit: { - adapter: adapter(), + adapter: adapter({ + precompress: true, + }), }, }