Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 1.72 KB

README.md

File metadata and controls

61 lines (48 loc) · 1.72 KB

Prettier Apex Server in docker image

Docker image version tag badge with image size

Run apex parsing server in docker to speed up apex formatting with prettier.

How to use

Developer machine

docker run -it -p 2117:2117 ziemniakoss/prettier-apex-server:latest

And after that whenever you run prettier, add these flags:

--apex-standalone-parser built-in

Bitbucket

Make sure that you have these dependencies and scripts in package.json

"devDependencies": {
	"prettier": "^2.8.1",
	"prettier-plugin-apex": "^1.12.0",
	"wait-on": "^6.0.1"
},
"scripts": {
	"preprettier-check": "wait-on http://127.0.0.1:2117/api/ast/",
	"prettier-check": "prettier  --apex-standalone-parser built-in --list-different ."
}

After that, add prettier apex server definition to bitbucket-pipelines.yml

image: atlassian/default-image:3
definitions:
  services:
    prettier-apex:
      image: ziemniakoss/prettier-apex-server:latest # or your selected version
pipelines:
  default:
    - step:
        name: "Validate with prettier"
        services:
          - docker
          - prettier-apex
        caches:
          - docker
        script:
          - npm ci
          - npm run prettier-check

Github

Just like in bitbucket, this can be implemented using service containers