Requirements:
- Node v16+
- Yarn
git clone [email protected]:Shopify/prettier-plugin-liquid.git
yarn
yarn test
There's a lot of abstract concepts that goes into making this plugin.
- Take a look at our plugin's principles.
- Read HOW_IT_WORKS.md for a technical overview.
- Read Whitespace Handling for an overview of how we deal with that internally.
The source code for this plugin is in TypeScript.
- PR should explain what the feature does, and why the change exists.
- PR should include any carrier specific documentation explaining how it works.
- Code should be generic and reusable.
This plugin uses prettier to format its TypeScript codebase. To format your code before a commit, run the following command:
yarn format
This prettier plugin has two suites of tests: unit tests and integration tests.
To run the unit tests:
yarn test:unit
To run the integration tests (where we make sure an input file gets transformed into another after running prettier):
yarn test:integration
To run the idempotence tests (where we make sure running prettier twice on an input file returns the same result):
yarn test:idempotence
To run all tests:
yarn test
To run from source on another repo or file:
# build the code so you can run it (only need to do it once)
yarn build
# run prettier on a file or folder
prettier --plugin . --write path/to/files.liquid
- Copy any of the folder in the
test/
directory and rename it to something appropriate. - In the
index.liquid
file, type code that should be made prettier - In the
fixed.liquid
file, type what you'd expect the plugin to output
- Fork it ( https://github.com/Shopify/prettier-plugin-liquid/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request