Skip to content

Commit 2d45e35

Browse files
committed
chore: setup prettier formatting via lint-staged, enforce in CI
1 parent 6438798 commit 2d45e35

File tree

17 files changed

+1353
-516
lines changed

17 files changed

+1353
-516
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"name": "VS Code DEV Container for AWS CDK development",
3-
"image": "jsii/superchain:1-buster-slim-node16"
2+
"name": "VS Code DEV Container for AWS CDK development",
3+
"image": "jsii/superchain:1-buster-slim-node16"
44
}

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## :warning: Checklist if your PR is changing anything else than documentation
2+
23
- [ ] Posted the link to a successful manually triggered deployment workflow (successful including the resources destruction)
34

45
## Merge request description

.github/workflows/deploy.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
- name: Generate distribution packages
3131
run: npm run package
3232

33-
3433
- name: Install deployment environment
3534
id: install_deploy_env
3635
run: |

.github/workflows/distribute.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
runs-on: ubuntu-latest
1414
needs: package
1515
steps:
16-
1716
- uses: actions/download-artifact@v4
1817
with:
1918
name: python

.github/workflows/lint.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,15 @@ jobs:
2424
2525
- name: Run pre-commit
2626
run: pre-commit run --all-files
27+
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: "18"
32+
cache: "npm"
33+
34+
- name: Install Node.js dependencies
35+
run: npm ci
36+
37+
- name: Run Prettier check
38+
run: npx prettier --check .

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.prettierignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
CHANGELOG.md
2+
3+
# Dependencies
4+
node_modules/
5+
6+
# Build / Dist output
7+
dist/
8+
lib/ # If TS output directory, make sure it's ignored if not meant to be formatted
9+
10+
# Other generated files
11+
.jsii
12+
coverage/
13+
build/
14+
15+
# Package manager lock files
16+
package-lock.json
17+
yarn.lock
18+
pnpm-lock.yaml
19+
20+
# Diagrams or other specific directories
21+
diagrams/
22+
23+
# Python specific (optional, if ruff handles *.py formatting)
24+
.venv/
25+
toxenv/
26+
integration_tests/cdk/cdk.out/
27+
*.py
28+

README.md

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,64 @@
1-
# eoAPI CDK Constructs
2-
3-
eoapi-cdk is a package of [AWS CDK constructs](https://docs.aws.amazon.com/prescriptive-guidance/latest/best-practices-cdk-typescript-iac/constructs-best-practices.html) designed to encapsulate eoAPI services and best practices as simple reusable components.
4-
5-
6-
For more background on the included services see [The Earth Observation API](https://eoapi.dev/)
7-
8-
## Included constructs
9-
Detailed API docs for the constructs can be found [here](https://developmentseed.org/eoapi-cdk/).
10-
11-
### [pgSTAC Database](https://developmentseed.org/eoapi-cdk/#pgstacdatabase-)
12-
An [RDS](https://aws.amazon.com/rds/) instance with [pgSTAC](https://github.com/stac-utils/pgstac) installed and the Postgres parameters optimized for the selected instance type.
13-
14-
### [STAC API](https://developmentseed.org/eoapi-cdk/#pgstacapilambda-)
15-
A STAC API implementation using [stac-fastapi](https://github.com/stac-utils/stac-fastapi) with a [pgSTAC backend](https://github.com/stac-utils/stac-fastapi-pgstac). Packaged as a complete runtime for deployment with API Gateway and Lambda.
16-
17-
### [pgSTAC Titiler API](https://developmentseed.org/eoapi-cdk/#titilerpgstacapilambda-)
18-
A complete dynamic tiling API using [titiler-pgstac](https://github.com/stac-utils/titiler-pgstac) to create dynamic mosaics of assets based on [STAC Search queries](https://github.com/radiantearth/stac-api-spec/tree/master/item-search). Packaged as a complete runtime for deployment with API Gateway and Lambda and fully integrated with the pgSTAC Database construct.
19-
20-
### [STAC browser](https://developmentseed.org/eoapi-cdk/#stacbrowser-)
21-
A CDK construct to host a static [Radiant Earth STAC browser](https://github.com/radiantearth/stac-browser) on S3.
22-
23-
### [OGC Features/Tiles API](https://developmentseed.org/eoapi-cdk/#titilerpgstacapilambda-)
24-
A complete OGC Features/Tiles API using [tipg](https://github.com/developmentseed/tipg). Packaged as a complete runtime for deployment with API Gateway and Lambda. By default the API will be connected to the Database's `public` schema.
25-
26-
### [STAC Ingestor](https://developmentseed.org/eoapi-cdk/#stacingestor-)
27-
An API for large scale STAC data ingestion and validation into a pgSTAC instance.
28-
29-
![ingestor](/diagrams/ingestor_diagram.png)
30-
31-
Authentication for the STAC Ingestor API can be configured with JWTs authenticated by JWKS. To learn more about securing FastAPI applications with this approach see [Securing FastAPI with JWKS (AWS Cognito, Auth0)](https://alukach.com/posts/fastapi-rs256-jwt/).
32-
33-
A sample Cognito-based authentication system is available at [aws-asdi-auth](https://github.com/developmentseed/aws-asdi-auth).
34-
35-
### [Bastion Host](https://developmentseed.org/eoapi-cdk/#bastionhost-)
36-
A bastion host is a secure gateway that provides access to resources in a private subnet. In this case it provides the ability to make administrative connections to eoAPI's pgSTAC instance.
37-
38-
![Alt text](/diagrams/bastion_diagram.png)
39-
40-
For more background on bastion hosts in AWS see [this article](https://dev.to/aws-builders/bastion-host-in-aws-vpc-2i63).
41-
42-
And for configuration instructions for this construct see [the docs](https://developmentseed.org/eoapi-cdk/#bastionhost-).
43-
44-
45-
## Published Packages
46-
47-
- https://pypi.org/project/eoapi-cdk/
48-
- https://www.npmjs.com/package/eoapi-cdk/
49-
50-
## Release
51-
52-
Versioning is automatically handled via [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and [Semantic Release](https://semantic-release.gitbook.io/semantic-release/).
53-
54-
_Warning_: If you rebase `main`, you must ensure that the commits referenced by tags point to commits that are within the `main` branch. If a commit references a commit that is no longer on the `main` branch, Semantic Release will fail to detect the correct version of the project. [More information](https://github.com/semantic-release/semantic-release/issues/1121#issuecomment-517945233).
55-
56-
57-
## Tests
58-
1+
# eoAPI CDK Constructs
2+
3+
eoapi-cdk is a package of [AWS CDK constructs](https://docs.aws.amazon.com/prescriptive-guidance/latest/best-practices-cdk-typescript-iac/constructs-best-practices.html) designed to encapsulate eoAPI services and best practices as simple reusable components.
4+
5+
For more background on the included services see [The Earth Observation API](https://eoapi.dev/)
6+
7+
## Included constructs
8+
9+
Detailed API docs for the constructs can be found [here](https://developmentseed.org/eoapi-cdk/).
10+
11+
### [pgSTAC Database](https://developmentseed.org/eoapi-cdk/#pgstacdatabase-)
12+
13+
An [RDS](https://aws.amazon.com/rds/) instance with [pgSTAC](https://github.com/stac-utils/pgstac) installed and the Postgres parameters optimized for the selected instance type.
14+
15+
### [STAC API](https://developmentseed.org/eoapi-cdk/#pgstacapilambda-)
16+
17+
A STAC API implementation using [stac-fastapi](https://github.com/stac-utils/stac-fastapi) with a [pgSTAC backend](https://github.com/stac-utils/stac-fastapi-pgstac). Packaged as a complete runtime for deployment with API Gateway and Lambda.
18+
19+
### [pgSTAC Titiler API](https://developmentseed.org/eoapi-cdk/#titilerpgstacapilambda-)
20+
21+
A complete dynamic tiling API using [titiler-pgstac](https://github.com/stac-utils/titiler-pgstac) to create dynamic mosaics of assets based on [STAC Search queries](https://github.com/radiantearth/stac-api-spec/tree/master/item-search). Packaged as a complete runtime for deployment with API Gateway and Lambda and fully integrated with the pgSTAC Database construct.
22+
23+
### [STAC browser](https://developmentseed.org/eoapi-cdk/#stacbrowser-)
24+
25+
A CDK construct to host a static [Radiant Earth STAC browser](https://github.com/radiantearth/stac-browser) on S3.
26+
27+
### [OGC Features/Tiles API](https://developmentseed.org/eoapi-cdk/#titilerpgstacapilambda-)
28+
29+
A complete OGC Features/Tiles API using [tipg](https://github.com/developmentseed/tipg). Packaged as a complete runtime for deployment with API Gateway and Lambda. By default the API will be connected to the Database's `public` schema.
30+
31+
### [STAC Ingestor](https://developmentseed.org/eoapi-cdk/#stacingestor-)
32+
33+
An API for large scale STAC data ingestion and validation into a pgSTAC instance.
34+
35+
![ingestor](/diagrams/ingestor_diagram.png)
36+
37+
Authentication for the STAC Ingestor API can be configured with JWTs authenticated by JWKS. To learn more about securing FastAPI applications with this approach see [Securing FastAPI with JWKS (AWS Cognito, Auth0)](https://alukach.com/posts/fastapi-rs256-jwt/).
38+
39+
A sample Cognito-based authentication system is available at [aws-asdi-auth](https://github.com/developmentseed/aws-asdi-auth).
40+
41+
### [Bastion Host](https://developmentseed.org/eoapi-cdk/#bastionhost-)
42+
43+
A bastion host is a secure gateway that provides access to resources in a private subnet. In this case it provides the ability to make administrative connections to eoAPI's pgSTAC instance.
44+
45+
![Alt text](/diagrams/bastion_diagram.png)
46+
47+
For more background on bastion hosts in AWS see [this article](https://dev.to/aws-builders/bastion-host-in-aws-vpc-2i63).
48+
49+
And for configuration instructions for this construct see [the docs](https://developmentseed.org/eoapi-cdk/#bastionhost-).
50+
51+
## Published Packages
52+
53+
- https://pypi.org/project/eoapi-cdk/
54+
- https://www.npmjs.com/package/eoapi-cdk/
55+
56+
## Release
57+
58+
Versioning is automatically handled via [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and [Semantic Release](https://semantic-release.gitbook.io/semantic-release/).
59+
60+
_Warning_: If you rebase `main`, you must ensure that the commits referenced by tags point to commits that are within the `main` branch. If a commit references a commit that is no longer on the `main` branch, Semantic Release will fail to detect the correct version of the project. [More information](https://github.com/semantic-release/semantic-release/issues/1121#issuecomment-517945233).
61+
62+
## Tests
63+
5964
Each pull request to `main` is added to a [merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue#triggering-merge-group-checks-with-github-actions) so that a "deployment test" workflow can run before the merge actually happens. If the deployment fails, the merge is cancelled. Here is [the definition of this workflow](https://github.com/developmentseed/eoapi-cdk/blob/main/.github/workflows/deploy.yaml) and the [tests definition](https://github.com/developmentseed/eoapi-cdk/blob/main/tests).

integration_tests/cdk/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Deployment CDK code for eoapi-cdk deployment tests
32

43
This is a wrapper CDK code that is used to test a deployment of the `eoapi-cdk` constructs.

integration_tests/cdk/cdk.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
{
22
"app": "python3 app.py",
33
"watch": {
4-
"include": [
5-
"**"
6-
],
4+
"include": ["**"],
75
"exclude": [
86
"README.md",
97
"cdk*.json",
@@ -24,9 +22,6 @@
2422
"@aws-cdk/aws-lambda:recognizeVersionProps": true,
2523
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
2624
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
27-
"@aws-cdk/core:target-partitions": [
28-
"aws",
29-
"aws-cn"
30-
]
25+
"@aws-cdk/core:target-partitions": ["aws", "aws-cn"]
3126
}
3227
}

0 commit comments

Comments
 (0)