diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 32dc0a8..c9cc28d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -26,10 +26,8 @@ RUN groupadd --gid $USER_GID $USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME \ && sudo chsh -s /bin/bash vscode -COPY --chown=vscode:vscode ../. /app -RUN chown vscode:vscode -R /app /var/log/apache2 +RUN chown vscode:vscode -R /var/log/apache2 RUN echo "xdebug.mode=off" | tee '/usr/local/etc/php/conf.d/xdebug.ini' WORKDIR /app -USER root diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3127192..fb3a0a3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -37,10 +37,11 @@ ] } }, - "forwardPorts": [80, 3306], + "forwardPorts": [ 80, 8000 ], "remoteUser": "vscode", "secrets": { }, - "postCreateCommand": ".devcontainer/postCreate.sh" + "postCreateCommand": ".devcontainer/postCreate.sh", + "postStartCommand": ".devcontainer/postStart.sh" } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index d362462..a4cd6bc 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -11,7 +11,7 @@ services: NODE_VERSION: "lts/*" volumes: - - ..:/workspace:cached + - ..:/app:cached # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. network_mode: service:db @@ -28,13 +28,24 @@ services: volumes: - mariadb-data:/var/lib/mysql environment: - MYSQL_ROOT_PASSWORD: mariadb - MYSQL_DATABASE: mariadb - MYSQL_USER: mariadb - MYSQL_PASSWORD: mariadb + MARIADB_DATABASE: app + MARIADB_USER: mariadb + MARIADB_PASSWORD: mariadb + MARIADB_ROOT_PASSWORD: mariadb # Add "forwardPorts": ["3306"] to **devcontainer.json** to forward MariaDB locally. # (Adding the "ports" property to this file will not forward from a Codespace.) + + phpmyadmin: + image: phpmyadmin + restart: always + environment: + PMA_HOST: db + PMA_USER: mariadb + PMA_PASSWORD: mariadb + APACHE_PORT: 8000 + network_mode: service:db + volumes: mariadb-data: diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh index 8ed80f7..1602f60 100755 --- a/.devcontainer/postCreate.sh +++ b/.devcontainer/postCreate.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash # Managed by https://github.com/linkorb/repo-ansible. Manual changes will be overwritten. +# Workaround for recent Python versions which prevent global pip package installation without an explicit flag +# or removal of a certain file. +sudo rm /usr/lib/python3.*/EXTERNALLY-MANAGED || true + git config commit.template .devcontainer/git/linkorb_commit.template cp .devcontainer/git/hooks/pre-push .git/hooks/pre-push @@ -9,3 +13,4 @@ chmod +x .git/hooks/pre-push composer install + diff --git a/.devcontainer/postStart.sh b/.devcontainer/postStart.sh new file mode 100755 index 0000000..8fa1418 --- /dev/null +++ b/.devcontainer/postStart.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Managed by https://github.com/linkorb/repo-ansible. Manual changes will be overwritten. + diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh new file mode 100755 index 0000000..cec959a --- /dev/null +++ b/.husky/_/husky.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env sh +if [ -z "$husky_skip_init" ]; then + debug () { + if [ "$HUSKY_DEBUG" = "1" ]; then + echo "husky (debug) - $1" + fi + } + + readonly hook_name="$(basename -- "$0")" + debug "starting $hook_name..." + + if [ "$HUSKY" = "0" ]; then + debug "HUSKY env variable is set to 0, skipping hook" + exit 0 + fi + + if [ -f ~/.huskyrc ]; then + debug "sourcing ~/.huskyrc" + . ~/.huskyrc + fi + + readonly husky_skip_init=1 + export husky_skip_init + sh -e "$0" "$@" + exitCode="$?" + + if [ $exitCode != 0 ]; then + echo "husky - $hook_name hook exited with code $exitCode (error)" + fi + + if [ $exitCode = 127 ]; then + echo "husky - command not found in PATH=$PATH" + fi + + exit $exitCode +fi diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..c160a77 --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx --no -- commitlint --edit ${1} diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..e62be57 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,139 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + //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: '🚨', + }, + /* + + NOTE: build type is not used at LinkORB. Use `chore(build)` or `ci` instead. + + 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/repo.yaml b/repo.yaml index 34785df..272f271 100644 --- a/repo.yaml +++ b/repo.yaml @@ -6,7 +6,7 @@ description: 'Envoi: Environment variables on steroids' license: mit license_year: 2019 name: envoi -type: library +type: php-cli visibility: public github: default_branch: master