Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable prettier for scenarios #212

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
- name: Check Python formatting
run: uvx ruff format --check . --config pyproject.toml

- name: Check Scenarios formatting
run: |
npm ci
npx prettier --check "scenarios/**/*.{toml,json,yaml}"

typos:
runs-on: ubuntu-latest
name: Check typos
Expand Down
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["prettier-plugin-toml"]
}
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,12 @@ manually back out the change. See [this comment][index-incorrect-snapshot] for
an example.

[index-incorrect-snapshot]: https://github.com/astral-sh/packse/pull/175#issuecomment-2056964089

## Formatting Scenarios

This step requires NodeJS installed.

```
npm install
npx prettier --write "scenarios/**/*.{toml,json,yaml}"
```
65 changes: 65 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"devDependencies": {
"prettier": "^3.3.3",
"prettier-plugin-toml": "^2.0.1"
}
}
60 changes: 27 additions & 33 deletions scenarios/examples/example.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
{
"name": "example",
"description": "This is an example scenario, in which the user depends on a single package `a` which requires `b`.",
"expected": {
"satisfiable": true,
"packages": {
"a": "1.0.0",
"b": "2.0.0"
},
"explanation": "The latest valid version of `b` should be installed. `b==3.0.0` is not valid because it requires `c` which does not exist."
"name": "example",
"description": "This is an example scenario, in which the user depends on a single package `a` which requires `b`.",
"expected": {
"satisfiable": true,
"packages": {
"a": "1.0.0",
"b": "2.0.0"
},
"root": {
"requires": [
"a"
]
"explanation": "The latest valid version of `b` should be installed. `b==3.0.0` is not valid because it requires `c` which does not exist."
},
"root": {
"requires": ["a"]
},
"packages": {
"a": {
"versions": {
"1.0.0": {
"requires": ["b>1.0.0"]
}
}
},
"packages": {
"a": {
"versions": {
"1.0.0": {
"requires": [
"b>1.0.0"
]
}
}
},
"b": {
"versions": {
"1.0.0": {},
"2.0.0": {},
"3.0.0": {
"requires": [
"c"
]
}
}
"b": {
"versions": {
"1.0.0": {},
"2.0.0": {},
"3.0.0": {
"requires": ["c"]
}
}
}
}
}
18 changes: 9 additions & 9 deletions scenarios/examples/example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ description = "This is an example scenario written in TOML, in which the user de
satisfiable = true
explanation = "The latest valid version of `b` should be installed. `b==3.0.0` is not valid because it requires `c` which does not exist."

[expected.packages]
a = "1.0.0"
b = "2.0.0"
[expected.packages]
a = "1.0.0"
b = "2.0.0"

[root]
requires = [ "a" ]
requires = ["a"]

[packages.a.versions."1.0.0"]
requires = [ "b>1.0.0" ]
requires = ["b>1.0.0"]

[packages.b.versions]
"1.0.0" = { }
"2.0.0" = { }
"1.0.0" = {}
"2.0.0" = {}

[packages.b.versions."3.0.0"]
requires = [ "c" ]
[packages.b.versions."3.0.0"]
requires = ["c"]
16 changes: 9 additions & 7 deletions scenarios/examples/example.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
- name: example-yaml
description: This is an example scenario written in YAML, in which the user depends on a single
package `a` which requires `b`.
description:
This is an example scenario written in YAML, in which the user depends on a
single package `a` which requires `b`.
expected:
satisfiable: true
packages:
a: 1.0.0
b: 2.0.0
explanation: The latest valid version of `b` should be installed. `b==3.0.0` is
not valid because it requires `c` which does not exist.
explanation:
The latest valid version of `b` should be installed. `b==3.0.0` is not
valid because it requires `c` which does not exist.
root:
requires:
- a
- a
packages:
a:
versions:
1.0.0:
requires:
- b>1.0.0
- b>1.0.0
b:
versions:
1.0.0: {}
2.0.0: {}
3.0.0:
requires:
- c
- c