diff --git a/.gitattributes b/.gitattributes index d70d720..06cd0b7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,10 +1,11 @@ /.editorconfig export-ignore /.gitattributes export-ignore -/.gitignore export-ignore /.github export-ignore +/.gitignore export-ignore /.nvmrc export-ignore /.prettierignore export-ignore -/.stylelintrc export-ignore +/.prettierrc export-ignore /CODE_OF_CONDUCT.md export-ignore +/Makfile export-ignore /package.json export-ignore /pnpm-lock.yaml export-ignore diff --git a/.prettierignore b/.prettierignore index f24e79f..c6fcd8f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,5 @@ composer.json *.noLinter.* +LICENSE +pnpm-lock.yaml +Resources/Private/Templates/InlineAssets diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..f9191ef --- /dev/null +++ b/.prettierrc @@ -0,0 +1,24 @@ +{ + "overrides": [ + { + "files": ["*.yaml", "*.yml"], + "options": { + "singleQuote": true + } + }, + { + "files": ["*.md"], + "options": { + "tabWidth": 2, + "singleQuote": true + } + }, + { + "files": ["*.php"], + "options": { + "singleQuote": true + } + } + ], + "plugins": ["@prettier/plugin-php"] +} diff --git a/.stylelintrc b/.stylelintrc deleted file mode 100644 index d83e4be..0000000 --- a/.stylelintrc +++ /dev/null @@ -1,73 +0,0 @@ -{ - "extends": "stylelint-config-recommended-scss", - "ignoreFiles": [ - "**/Public/**", - "**/Private/Templates/**", - "node_modules/**", - "**/*.noLinter.*" - ], - "rules": { - "scss/at-rule-no-unknown": [ - true, - { - "ignoreAtRules": [ - "tailwind", - "apply", - "screen", - "responsive", - "variants" - ] - } - ], - "at-rule-no-unknown": [ - true, - { - "ignoreAtRules": [ - "tailwind", - "apply", - "screen", - "responsive", - "variants" - ] - } - ], - "property-no-unknown": [ - true, - { - "ignoreProperties": [ - "font-range", - "min-font-size", - "max-font-size", - "lower-font-range", - "upper-font-range", - "font-awesome", - "tap-highlight-color", - "touch-callout" - ] - } - ], - "selector-pseudo-class-no-unknown": [ - true, - { - "ignorePseudoClasses": [ - "at-least", - "at-most", - "between", - "exactly", - "global" - ] - } - ], - "selector-pseudo-element-no-unknown": [ - true, - { - "ignorePseudoElements": [ - "track", - "thumb" - ] - } - ], - "selector-type-no-unknown": null, - "no-descending-specificity": null - } -} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..70962e9 --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +.PHONY: help install watch dev production build prettier + +.DEFAULT_GOAL := build + +## Prettier files +prettier: + pnpm prettier --write --no-error-on-unmatched-pattern '{*,**/*}.{mjs,php,yaml,pcss,js,json,md}' + +## Install dependencies and build production version +build: install prettier production + +## Install dependencies +install: + pnpm install + +## Watch for changes in JS and CSS files +watch: + pnpm watch + +## Build development version +dev: + pnpm dev + +## Build production version +production: + pnpm build + +# Define colors +GREEN := $(shell tput -Txterm setaf 2) +YELLOW := $(shell tput -Txterm setaf 3) +WHITE := $(shell tput -Txterm setaf 7) +RESET := $(shell tput -Txterm sgr0) + +# define indention for descriptions +TARGET_MAX_CHAR_NUM=15 + +## Show help +help: + @echo '' + @echo '${GREEN}CLI command list:${RESET}' + @echo '' + @echo 'Usage:' + @echo ' ${YELLOW}make${RESET} ${GREEN}${RESET}' + @echo '' + @echo 'Targets:' + @awk '/^[a-zA-Z\-\_0-9]+:/ { \ + helpMessage = match(lastLine, /^## (.*)/); \ + if (helpMessage) { \ + helpCommand = substr($$1, 0, index($$1, ":")-1); \ + helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ + printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ + } \ + } \ + { lastLine = $$0 }' $(MAKEFILE_LIST) + @echo '' diff --git a/package.json b/package.json index fa17b98..5a0bb33 100755 --- a/package.json +++ b/package.json @@ -8,38 +8,19 @@ "url": "git://github.com/jonnitto/Jonnitto.ImagesInARow.git" }, "author": "Jon Uhlmann (https://www.uhlmann.pro)", - "browserslist": [ - "> 0.5%", - "last 2 versions", - "Firefox ESR", - "not ie <= 10", - "not ie_mob <= 10", - "not bb <= 10", - "not op_mob <= 12.1" - ], - "prettier": { - "overrides": [ - { - "files": [ - "*.yaml", - "*.yml" - ], - "options": { - "singleQuote": true - } - } - ] - }, "scripts": { "build": "postcss Resources/Private/Assets/*.pcss --use postcss-nested postcss-assets autoprefixer cssnano --no-map --ext css --dir Resources/Private/Templates/InlineAssets", - "start": "pnpm install && pnpm build" + "dev": "postcss Resources/Private/Assets/*.pcss --use postcss-nested postcss-assets autoprefixer --no-map --ext css --dir Resources/Private/Templates/InlineAssets", + "watch": "postcss Resources/Private/Assets/*.pcss --use postcss-nested postcss-assets autoprefixer cssnano --no-map --ext css --dir Resources/Private/Templates/InlineAssets --watch" }, "devDependencies": { + "@prettier/plugin-php": "^0.22.1", "autoprefixer": "^10.4.0", "cssnano": "^6.0.2", "postcss": "^8.3.11", "postcss-assets": "^6.0.0", "postcss-cli": "^11.0.0", - "postcss-nested": "^6.0.1" + "postcss-nested": "^6.0.1", + "prettier": "^3.1.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 603a582..a722ee9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false devDependencies: + '@prettier/plugin-php': + specifier: ^0.22.1 + version: 0.22.1(prettier@3.1.1) autoprefixer: specifier: ^10.4.0 version: 10.4.16(postcss@8.4.32) @@ -23,6 +26,9 @@ devDependencies: postcss-nested: specifier: ^6.0.1 version: 6.0.1(postcss@8.4.32) + prettier: + specifier: ^3.1.1 + version: 3.1.1 packages: @@ -47,6 +53,17 @@ packages: fastq: 1.16.0 dev: true + /@prettier/plugin-php@0.22.1(prettier@3.1.1): + resolution: {integrity: sha512-TN7tzC2/jCM1/H/mlUjqPos8lIV+vm8Qwp83KofuZclGlG9PoUWHU7m0yqskjAoCy+R4ZCV0hxdBLPBkU69S2Q==} + peerDependencies: + prettier: ^3.0.0 + dependencies: + linguist-languages: 7.27.0 + mem: 9.0.2 + php-parser: 3.1.5 + prettier: 3.1.1 + dev: true + /@sindresorhus/merge-streams@1.0.0: resolution: {integrity: sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==} engines: {node: '>=18'} @@ -576,6 +593,10 @@ packages: engines: {node: '>=14'} dev: true + /linguist-languages@7.27.0: + resolution: {integrity: sha512-Wzx/22c5Jsv2ag+uKy+ITanGA5hzvBZngrNGDXLTC7ZjGM6FLCYGgomauTkxNJeP9of353OM0pWqngYA180xgw==} + dev: true + /lodash.memoize@4.1.2: resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} dev: true @@ -588,6 +609,13 @@ packages: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} dev: true + /map-age-cleaner@0.1.3: + resolution: {integrity: sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==} + engines: {node: '>=6'} + dependencies: + p-defer: 1.0.0 + dev: true + /mdn-data@2.0.28: resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==} dev: true @@ -596,6 +624,14 @@ packages: resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} dev: true + /mem@9.0.2: + resolution: {integrity: sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A==} + engines: {node: '>=12.20'} + dependencies: + map-age-cleaner: 0.1.3 + mimic-fn: 4.0.0 + dev: true + /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} @@ -615,6 +651,11 @@ packages: hasBin: true dev: true + /mimic-fn@4.0.0: + resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} + engines: {node: '>=12'} + dev: true + /minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -653,6 +694,11 @@ packages: wrappy: 1.0.2 dev: true + /p-defer@1.0.0: + resolution: {integrity: sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==} + engines: {node: '>=4'} + dev: true + /path-is-absolute@1.0.1: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} @@ -663,6 +709,10 @@ packages: engines: {node: '>=12'} dev: true + /php-parser@3.1.5: + resolution: {integrity: sha512-jEY2DcbgCm5aclzBdfW86GM6VEIWcSlhTBSHN1qhJguVePlYe28GhwS0yoeLYXpM2K8y6wzLwrbq814n2PHSoQ==} + dev: true + /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} dev: true @@ -1062,6 +1112,12 @@ packages: source-map-js: 1.0.2 dev: true + /prettier@3.1.1: + resolution: {integrity: sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==} + engines: {node: '>=14'} + hasBin: true + dev: true + /pretty-hrtime@1.0.3: resolution: {integrity: sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A==} engines: {node: '>= 0.8'}