diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml index b5ce2c0..a1df02c 100644 --- a/.devcontainer/docker-compose.yaml +++ b/.devcontainer/docker-compose.yaml @@ -4,7 +4,6 @@ name: clic-website-devcontainer services: - # Custom strapi service strapi: # Build the strapi service from its folder @@ -46,4 +45,4 @@ services: volumes: # Persist strapi database - strapi-data: \ No newline at end of file + strapi-data: diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..1d894eb --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +**/.git +**/.svn +**/.hg +**/node_modules +**/dist +**/.cache \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 1351540..7ec871b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,20 +1,20 @@ { - /* - * Base VSCode settings - */ - "editor.codeActionsOnSave": { - "source.organizeImports": true - }, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnPaste": true, - "editor.formatOnSave": true, - /* - * Extension settings - * wayou.vscode-todo-highlight - */ - "todohighlight.defaultStyle": { - "color": "white", - "backgroundColor": "orange" - }, - "todohighlight.keywordsPattern": "(todo|TODO|fixme|FIXME)(:?)", -} \ No newline at end of file + /* + * Base VSCode settings + */ + "editor.codeActionsOnSave": { + "source.organizeImports": true + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnPaste": true, + "editor.formatOnSave": true, + /* + * Extension settings + * wayou.vscode-todo-highlight + */ + "todohighlight.defaultStyle": { + "color": "white", + "backgroundColor": "orange" + }, + "todohighlight.keywordsPattern": "(todo|TODO|fixme|FIXME)(:?)" +} diff --git a/commitlint.config.js b/commitlint.config.js index 48f6f0e..2bb2fa3 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,135 +1,135 @@ module.exports = { - parserPreset: 'conventional-changelog-conventionalcommits', - rules: { - 'body-leading-blank': [1, 'always'], - 'body-max-line-length': [2, 'always', 100], - 'footer-leading-blank': [1, 'always'], - 'footer-max-line-length': [2, 'always', 100], - 'header-max-length': [2, 'always', 100], - 'subject-case': [ - 2, - 'never', - ['sentence-case', 'start-case', 'pascal-case', 'upper-case'], - ], - 'subject-empty': [2, 'never'], - 'subject-full-stop': [2, 'never', '.'], - 'type-case': [2, 'always', 'lower-case'], - 'type-empty': [2, 'never'], - 'type-enum': [ - 2, - 'always', - [ - 'build', - 'chore', - 'ci', - 'docs', - 'feat', - 'fix', - 'perf', - 'refactor', - 'revert', - 'style', - 'test', - ], - ], - }, - prompt: { - questions: { - type: { - description: "Select the type of change that you're committing", - enum: { - feat: { - description: 'A new feature', - title: 'Features', - emoji: '✨', - }, - fix: { - description: 'A bug fix', - title: 'Bug Fixes', - emoji: '🐛', - }, - docs: { - description: 'Documentation only changes', - title: 'Documentation', - emoji: '📚', - }, - style: { - description: - 'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)', - title: 'Styles', - emoji: '💎', - }, - refactor: { - description: - 'A code change that neither fixes a bug nor adds a feature', - title: 'Code Refactoring', - emoji: '📦', - }, - perf: { - description: 'A code change that improves performance', - title: 'Performance Improvements', - emoji: '🚀', - }, - test: { - description: 'Adding missing tests or correcting existing tests', - title: 'Tests', - emoji: '🚨', - }, - build: { - description: - 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)', - title: 'Builds', - emoji: '🛠', - }, - ci: { - description: - 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)', - title: 'Continuous Integrations', - emoji: '⚙️', - }, - chore: { - description: "Other changes that don't modify src or test files", - title: 'Chores', - emoji: '♻️', - }, - revert: { - description: 'Reverts a previous commit', - title: 'Reverts', - emoji: '🗑', - }, - }, - }, - scope: { - description: - 'What is the scope of this change (e.g. component or file name)', - }, - subject: { - description: - 'Write a short, imperative tense description of the change', - }, - body: { - description: 'Provide a longer description of the change', - }, - isBreaking: { - description: 'Are there any breaking changes?', - }, - breakingBody: { - description: - 'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself', - }, - breaking: { - description: 'Describe the breaking changes', - }, - isIssueAffected: { - description: 'Does this change affect any open issues?', - }, - issuesBody: { - description: - 'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself', - }, - issues: { - description: 'Add issue references (e.g. "fix #123", "re #123".)', - }, - }, - }, -}; \ No newline at end of file + parserPreset: "conventional-changelog-conventionalcommits", + rules: { + "body-leading-blank": [1, "always"], + "body-max-line-length": [2, "always", 100], + "footer-leading-blank": [1, "always"], + "footer-max-line-length": [2, "always", 100], + "header-max-length": [2, "always", 100], + "subject-case": [ + 2, + "never", + ["sentence-case", "start-case", "pascal-case", "upper-case"], + ], + "subject-empty": [2, "never"], + "subject-full-stop": [2, "never", "."], + "type-case": [2, "always", "lower-case"], + "type-empty": [2, "never"], + "type-enum": [ + 2, + "always", + [ + "build", + "chore", + "ci", + "docs", + "feat", + "fix", + "perf", + "refactor", + "revert", + "style", + "test", + ], + ], + }, + prompt: { + questions: { + type: { + description: "Select the type of change that you're committing", + enum: { + feat: { + description: "A new feature", + title: "Features", + emoji: "✨", + }, + fix: { + description: "A bug fix", + title: "Bug Fixes", + emoji: "🐛", + }, + docs: { + description: "Documentation only changes", + title: "Documentation", + emoji: "📚", + }, + style: { + description: + "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)", + title: "Styles", + emoji: "💎", + }, + refactor: { + description: + "A code change that neither fixes a bug nor adds a feature", + title: "Code Refactoring", + emoji: "📦", + }, + perf: { + description: "A code change that improves performance", + title: "Performance Improvements", + emoji: "🚀", + }, + test: { + description: "Adding missing tests or correcting existing tests", + title: "Tests", + emoji: "🚨", + }, + build: { + description: + "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)", + title: "Builds", + emoji: "🛠", + }, + ci: { + description: + "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)", + title: "Continuous Integrations", + emoji: "⚙️", + }, + chore: { + description: "Other changes that don't modify src or test files", + title: "Chores", + emoji: "♻️", + }, + revert: { + description: "Reverts a previous commit", + title: "Reverts", + emoji: "🗑", + }, + }, + }, + scope: { + description: + "What is the scope of this change (e.g. component or file name)", + }, + subject: { + description: + "Write a short, imperative tense description of the change", + }, + body: { + description: "Provide a longer description of the change", + }, + isBreaking: { + description: "Are there any breaking changes?", + }, + breakingBody: { + description: + "A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself", + }, + breaking: { + description: "Describe the breaking changes", + }, + isIssueAffected: { + description: "Does this change affect any open issues?", + }, + issuesBody: { + description: + "If issues are closed, the commit requires a body. Please enter a longer description of the commit itself", + }, + issues: { + description: 'Add issue references (e.g. "fix #123", "re #123".)', + }, + }, + }, +}; diff --git a/strapi/.devcontainer/devcontainer.json b/strapi/.devcontainer/devcontainer.json index c7f29e4..67be020 100644 --- a/strapi/.devcontainer/devcontainer.json +++ b/strapi/.devcontainer/devcontainer.json @@ -2,32 +2,32 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: // https://github.com/microsoft/vscode-dev-containers/tree/v0.238.0/containers/typescript-node { - "name": "clic-website-devcontainer/strapi", - // Use docker-compose stack, relative to current file - "dockerComposeFile": "../../.devcontainer/docker-compose.yaml", - // Connect VSCode to following service defined in dockerComposeFile - "service": "strapi", - // Working directory inside devcontainer, where project is located - "workspaceFolder": "/app", - // Configure tool-specific properties. - "customizations": { - // Configure properties specific to VS Code. - "vscode": { - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - // todo highlighter - "wayou.vscode-todo-highlight", - // linter - "dbaeumer.vscode-eslint", - // formatter - "esbenp.prettier-vscode" - ] - } - }, - // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "node" - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "yarn install", -} \ No newline at end of file + "name": "clic-website-devcontainer/strapi", + // Use docker-compose stack, relative to current file + "dockerComposeFile": "../../.devcontainer/docker-compose.yaml", + // Connect VSCode to following service defined in dockerComposeFile + "service": "strapi", + // Working directory inside devcontainer, where project is located + "workspaceFolder": "/app", + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + // todo highlighter + "wayou.vscode-todo-highlight", + // linter + "dbaeumer.vscode-eslint", + // formatter + "esbenp.prettier-vscode" + ] + } + }, + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "node" + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "yarn install", +} diff --git a/strapi/.env-check.dev.ts b/strapi/.env-check.dev.ts index c75014c..17641b7 100644 --- a/strapi/.env-check.dev.ts +++ b/strapi/.env-check.dev.ts @@ -2,7 +2,6 @@ * This script checks and populates the local environment variables files * SHOULD ONLY BE USED IN DEVELOPMENT ENVIRONMENTS! */ - import crypto from "crypto"; import deepEqual from "deep-equal"; import { parse, stringify } from "envfile"; diff --git a/strapi/.prettierrc b/strapi/.prettierrc index f2fe770..c8bef39 100644 --- a/strapi/.prettierrc +++ b/strapi/.prettierrc @@ -1,9 +1,9 @@ { - "printWidth": 80, - "tabWidth": 2, - "semi": true, - "trailingComma": "es5", - "bracketSpacing": true, - "bracketSameLine": false, - "arrowParens": "always" -} \ No newline at end of file + "printWidth": 80, + "tabWidth": 2, + "semi": true, + "trailingComma": "es5", + "bracketSpacing": true, + "bracketSameLine": false, + "arrowParens": "always" +} diff --git a/strapi/config/admin.ts b/strapi/config/admin.ts index f26fdae..a63bec1 100644 --- a/strapi/config/admin.ts +++ b/strapi/config/admin.ts @@ -1,8 +1,8 @@ export default ({ env }) => ({ auth: { - secret: env('ADMIN_JWT_SECRET'), + secret: env("ADMIN_JWT_SECRET"), }, apiToken: { - salt: env('API_TOKEN_SALT'), + salt: env("API_TOKEN_SALT"), }, }); diff --git a/strapi/config/database.ts b/strapi/config/database.ts index da667a1..8b2b59a 100644 --- a/strapi/config/database.ts +++ b/strapi/config/database.ts @@ -1,18 +1,26 @@ -import isDocker from 'is-docker'; -import path from 'path'; +import isDocker from "is-docker"; +import path from "path"; export default ({ env }) => { - const dbClient = env('DATABASE_CLIENT', 'sqlite') + const dbClient = env("DATABASE_CLIENT", "sqlite"); - const dbConnectionSettings = (dbClient === 'sqlite') ? ({ - filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')), - }) : ({ - host: env('DATABASE_HOST'), - port: env('DATABASE_PORT'), - database: env('DATABASE_NAME'), - user: env('DATABASE_USER'), - password: env('DATABASE_PASSWORD'), - }); + const dbConnectionSettings = + dbClient === "sqlite" + ? { + filename: path.join( + __dirname, + "..", + "..", + env("DATABASE_FILENAME", ".tmp/data.db") + ), + } + : { + host: env("DATABASE_HOST"), + port: env("DATABASE_PORT"), + database: env("DATABASE_NAME"), + user: env("DATABASE_USER"), + password: env("DATABASE_PASSWORD"), + }; return { connection: { @@ -23,7 +31,7 @@ export default ({ env }) => { // When using Docker, change the pool min value to 0 as Docker will kill any idle connections // https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/databases.html#database-pooling-options min: isDocker() ? 0 : undefined, // with undefined, strapi will grab its default value - } - } - } + }, + }, + }; }; diff --git a/strapi/config/middlewares.ts b/strapi/config/middlewares.ts index 3ab20d9..5191241 100644 --- a/strapi/config/middlewares.ts +++ b/strapi/config/middlewares.ts @@ -1,12 +1,12 @@ export default [ - 'strapi::errors', - 'strapi::security', - 'strapi::cors', - 'strapi::poweredBy', - 'strapi::logger', - 'strapi::query', - 'strapi::body', - 'strapi::session', - 'strapi::favicon', - 'strapi::public', + "strapi::errors", + "strapi::security", + "strapi::cors", + "strapi::poweredBy", + "strapi::logger", + "strapi::query", + "strapi::body", + "strapi::session", + "strapi::favicon", + "strapi::public", ]; diff --git a/strapi/config/server.ts b/strapi/config/server.ts index 50eaed4..219f41e 100644 --- a/strapi/config/server.ts +++ b/strapi/config/server.ts @@ -1,7 +1,7 @@ export default ({ env }) => ({ - host: env('HOST', '0.0.0.0'), - port: env.int('PORT', 8001), + host: env("HOST", "0.0.0.0"), + port: env.int("PORT", 8001), app: { - keys: env.array('APP_KEYS'), + keys: env.array("APP_KEYS"), }, }); diff --git a/strapi/src/admin/tsconfig.json b/strapi/src/admin/tsconfig.json index 9be5078..2894cac 100644 --- a/strapi/src/admin/tsconfig.json +++ b/strapi/src/admin/tsconfig.json @@ -1,13 +1,5 @@ { "extends": "@strapi/typescript-utils/tsconfigs/admin", - "include": [ - "../plugins/**/admin/src/**/*", - "./" - ], - "exclude": [ - "node_modules/", - "build/", - "dist/", - "**/*.test.ts" - ] + "include": ["../plugins/**/admin/src/**/*", "./"], + "exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"] } diff --git a/strapi/src/admin/webpack.config.example.js b/strapi/src/admin/webpack.config.example.js index 1ca45c2..cc55df8 100644 --- a/strapi/src/admin/webpack.config.example.js +++ b/strapi/src/admin/webpack.config.example.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; /* eslint-disable no-unused-vars */ module.exports = (config, webpack) => { diff --git a/strapi/tsconfig.json b/strapi/tsconfig.json index b9532e3..e6663b0 100644 --- a/strapi/tsconfig.json +++ b/strapi/tsconfig.json @@ -4,12 +4,7 @@ "outDir": "dist", "rootDir": "." }, - "include": [ - "./", - "./**/*.ts", - "./**/*.js", - "src/**/*.json" - ], + "include": ["./", "./**/*.ts", "./**/*.js", "src/**/*.json"], "exclude": [ "node_modules/", "build/",