Skip to content

Run apex parsing for prettier in docker to speed up formatting

License

Notifications You must be signed in to change notification settings

Ziemniakoss/prettier-apex-server-in-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Run apex parsing for prettier in docker to speed up formatting

Topics

Resources

License

Stars

Watchers

Forks