diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..47627d0a7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + branches: + - master + - dev + - "v*.*" + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v3 + with: + node-version: "20" + check-latest: true + cache: npm + cache-dependency-path: package-lock.json + + - run: npm ci + + - run: npm run format-check diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..5ac2a3cc3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +*.local +*.log +*.swp +.DS_Store +.cache +.env* +.vscode +node_modules diff --git a/.prettierrc b/.prettierrc index 6d96e0835..946a3dd0e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,10 +1,16 @@ { + "plugins": [ + "@prettier/plugin-php" + ], + "arrowParens": "avoid", + "braceStyle": "per-cs", "endOfLine": "auto", - "tabWidth": 4, + "phpVersion": "5.3", "printWidth": 180, - "useTabs": true, "semi": true, "singleQuote": true, + "tabWidth": 4, "trailingComma": "all", - "arrowParens": "avoid" + "trailingCommaPHP": false, + "useTabs": true } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..3d9d5096e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,105 @@ +{ + "name": "litespeed-cache", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "litespeed-cache", + "license": "GPLv3", + "devDependencies": { + "@prettier/plugin-php": "^0.21.0", + "prettier": "^3.0.3" + } + }, + "node_modules/@prettier/plugin-php": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/@prettier/plugin-php/-/plugin-php-0.21.0.tgz", + "integrity": "sha512-vWC6HIUUfhvl/7F5IxVQ0ItGB/7ZY+jDlX7KsTqvfKMODW/zvzj8r1Ab4harS22+O3xxHykVVd5jvylmxMMctg==", + "dev": true, + "dependencies": { + "linguist-languages": "^7.21.0", + "mem": "^9.0.2", + "php-parser": "^3.1.5" + }, + "peerDependencies": { + "prettier": "^3.0.0" + } + }, + "node_modules/linguist-languages": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/linguist-languages/-/linguist-languages-7.27.0.tgz", + "integrity": "sha512-Wzx/22c5Jsv2ag+uKy+ITanGA5hzvBZngrNGDXLTC7ZjGM6FLCYGgomauTkxNJeP9of353OM0pWqngYA180xgw==", + "dev": true + }, + "node_modules/map-age-cleaner": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", + "integrity": "sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w==", + "dev": true, + "dependencies": { + "p-defer": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/mem": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/mem/-/mem-9.0.2.tgz", + "integrity": "sha512-F2t4YIv9XQUBHt6AOJ0y7lSmP1+cY7Fm1DRh9GClTGzKST7UWLMx6ly9WZdLH/G/ppM5RL4MlQfRT71ri9t19A==", + "dev": true, + "dependencies": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sindresorhus/mem?sponsor=1" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/php-parser": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/php-parser/-/php-parser-3.1.5.tgz", + "integrity": "sha512-jEY2DcbgCm5aclzBdfW86GM6VEIWcSlhTBSHN1qhJguVePlYe28GhwS0yoeLYXpM2K8y6wzLwrbq814n2PHSoQ==", + "dev": true + }, + "node_modules/prettier": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..036883a2e --- /dev/null +++ b/package.json @@ -0,0 +1,14 @@ +{ + "name": "litespeed-cache", + "description": "High-performance page caching and site optimization from LiteSpeed", + "license": "GPLv3", + "scripts": { + "format": "npm run prettier -- --write", + "format-check": "npm run prettier -- --check", + "prettier": "prettier *.php cli/*.php cli/**/*.php inc/*.php inc/**/*.php src/*.php src/**/*.php thirdparty/*.php thirdparty/**/*.php tpl/*.php tpl/**/*.php" + }, + "devDependencies": { + "@prettier/plugin-php": "^0.21.0", + "prettier": "^3.0.3" + } +}