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

TypeScript migration #105

Merged
merged 63 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
42a9275
Add AppSync Support
direnakkoc Nov 21, 2022
a4e9dcc
Handle lifecycle hook
direnakkoc Nov 23, 2022
9af9274
Add alarms and dashboard widgets for AppSync
direnakkoc Nov 25, 2022
8afae38
Use different y-axes for metrics of different units
direnakkoc Nov 28, 2022
7d25779
Migrate TS from JS
direnakkoc Dec 27, 2022
ed0be06
Restructure alarms and dashboards
direnakkoc Feb 9, 2023
f8fbcb0
Use a library for alarm properties
direnakkoc Feb 17, 2023
0d8c9ce
Fix GitHub actions
direnakkoc Feb 23, 2023
09deaef
Refactor alarm modules and combine additional resources into compiled…
direnakkoc Mar 20, 2023
12840ee
Manage packages, remove redundant use-strict
direnakkoc Mar 23, 2023
5b1cf88
Sam requires esbuild to be installed globally
direnakkoc Apr 14, 2023
ac0df47
Edit alarm names by using intrinsic functions to retrieve actual data…
direnakkoc Apr 18, 2023
ea891ed
Macro requires handler to be async
direnakkoc May 23, 2023
f6e35f9
Manage all AlarmName and AlarmDescription specific to each modules
direnakkoc May 29, 2023
528d9ec
Upgrade node version for ALB and AppSync projects
direnakkoc May 31, 2023
d8486fb
Fix types confusion for the default config
direnakkoc Jun 8, 2023
baf28b7
For input types use also cloudformation properties types
direnakkoc Jun 9, 2023
1bc2949
Using generics to split the type into pre and post merged types. I've…
dlynam01 Jun 13, 2023
25135f9
Assign all missing config types
direnakkoc Jun 13, 2023
74bf164
Change the import path in index files
direnakkoc Jun 19, 2023
532194d
Change back the import path for now
direnakkoc Jun 21, 2023
e7f938b
Fix slic-watch-core workspace issue
direnakkoc Jun 22, 2023
d492444
chore: update build to do TS compilation
eoinsha Jun 22, 2023
e5a78a7
chore: update macro version sync to use CommonJS
eoinsha Jun 22, 2023
6b5d11b
3.0.0-rc1
eoinsha Jun 22, 2023
5b76237
Version bump: 3.0.0-rc1
eoinsha Jun 22, 2023
c9e5766
Merge branch 'main' into ts-migrate
eoinsha Jun 22, 2023
25f1f21
chore: remove superfluous slic-watch-core dependency
eoinsha Jun 22, 2023
a0a1449
chore: add ALB project test to build workflow
eoinsha Jun 22, 2023
63928b1
chore: include all package in version script
eoinsha Jun 22, 2023
ba42b6a
chore: clean up deps
eoinsha Jun 22, 2023
39c69a2
chore: include all package in version script
eoinsha Jun 22, 2023
a780ff4
chore: ensure macro version change is committed and tagged
eoinsha Jun 22, 2023
4422ea8
3.0.0-rc2
eoinsha Jun 22, 2023
7a1181d
This might work
dlynam01 Jun 22, 2023
99a9fe3
Converting to commonjs
dlynam01 Jun 23, 2023
7634116
fixing lint
dlynam01 Jun 23, 2023
0022835
finishing commonjs modules change
dlynam01 Jun 23, 2023
cd3feef
Use tap to create coverage report, delete c8 report provider
direnakkoc Jun 26, 2023
e2d3ff7
fixing up code coverage
dlynam01 Jun 26, 2023
7de268a
Update unit-test scripts
direnakkoc Jun 26, 2023
c349fab
adding the cf-macro v3
dlynam01 Jun 27, 2023
d145630
Fix some coverage issues
direnakkoc Jun 28, 2023
1febecf
increased coverage to 100%
dlynam01 Jun 29, 2023
0222156
chore: fix comment indent
eoinsha Jun 30, 2023
82ac5d8
3.0.0-rc3
direnakkoc Jun 30, 2023
9fab096
chore: update versions with audit fix
eoinsha Jun 30, 2023
f0940e6
chore: add TS build to release workflow
eoinsha Jun 30, 2023
9971cb1
chore: add TS build to build workflow
eoinsha Jun 30, 2023
7e32a3c
bundling packages again
dlynam01 Jul 3, 2023
a04b3ce
fixing lambdas not configured bug
dlynam01 Jul 4, 2023
abf0d82
3.0.0-rc4
direnakkoc Jul 7, 2023
f7d0d00
Fixing issues around the resourceId naming
dlynam01 Aug 4, 2023
be98960
Forcing update of alarm names which will redeploy all API Gateway ala…
dlynam01 Aug 8, 2023
6db17a0
3.0.0-rc5
direnakkoc Aug 8, 2023
cdbc87d
chore: update to current Node LTS (18, 20)
eoinsha Oct 31, 2023
1564b61
fix: restore logging in sls plugin, use Tap 18
eoinsha Oct 31, 2023
cbb54c8
Allow incomplete coverage
eoinsha Oct 31, 2023
d54b30d
chore: ignore coveralls for 18.x
eoinsha Oct 31, 2023
d31c36b
chore: rename items and add more comments
eoinsha Oct 31, 2023
40cf43e
chore: use more consistent logical IDs for alarms
eoinsha Nov 1, 2023
9aa8401
chore: use portable bucket names in test projects
eoinsha Nov 1, 2023
61607c7
fix(docs): remove v2 supported label from README
eoinsha Nov 2, 2023
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
14 changes: 0 additions & 14 deletions .eslintrc.js

This file was deleted.

25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"root": true,
"plugins": [
"@typescript-eslint"
],
"extends": [
"standard-with-typescript"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"@typescript-eslint/no-floating-promises": 0,
"no-template-curly-in-string": 0,
"@typescript-eslint/restrict-template-expressions": 0,
"@typescript-eslint/explicit-function-return-type": 0
},
"ignorePatterns": [
"core/coverage",
"cf-macro/coverage",
"serverless-plugin/dist/index.js",
"cf-macro/dist/index.js",
"**/dist/*"
]
}
28 changes: 15 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,33 @@ jobs:

strategy:
matrix:
node-version: [14, 16, 18]
eoinsha marked this conversation as resolved.
Show resolved Hide resolved
node-version: [16, 18]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}.x
- name: Ensure npm >= 7
run: npm i -g npm@^7
cache: 'npm'
- run: npm ci
- run: npm run audit
- run: npm test
name: Run unit tests
- working-directory: ./serverless-test-project
run: npm test
name: Run Serverless Framework packaging test
- working-directory: ./serverless-test-project-alb
name: Run Serverless Framework packaging test for ALB test project
run: npm test
- working-directory: ./serverless-test-project-appsync
name: Run Serverless Framework packaging test for AppSync test project
run: npm test
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: run-node-${{ matrix.node-version }}
parallel: true
path-to-lcov: coverage/lcov.info
- name: Package test project with Serverless v2
working-directory: ./serverless-test-project
run: |
npm i serverless@2
npm run test:v2
finish:
needs: build
runs-on: ubuntu-latest
Expand All @@ -48,4 +50,4 @@ jobs:
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
path-to-lcov: coverage/lcov.info
path-to-lcov: coverage/lcov.info
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ __pycache__/
build/
develop-eggs/
dist/
core/dist/
downloads/
eggs/
.eggs/
Expand Down
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Automatic, best-practice CloudWatch **Dashboards** and **Alarms** for your SAM, CloudFormation, CDK and Serverless Framework applications.

SLIC Watch supports: _AWS Lambda, API Gateway, DynamoDB, Kinesis Data Streams, SQS Queues, Step Functions, ECS (Fargate or EC2), SNS, EventBridge and Application Load Balancer._
SLIC Watch supports: _AWS Lambda, API Gateway, DynamoDB, Kinesis Data Streams, SQS Queues, Step Functions, ECS (Fargate or EC2), SNS, EventBridge, Application Load Balancer and AppSync._

Supported tools include:
* ⚡️ **Serverless Framework** v2 and v3 via the [_SLIC Watch Serverless Plugin_](#getting-started-with-serverless-framework)
Expand All @@ -33,6 +33,7 @@ Supported tools include:
- [SNS](#sns)
- [EventBridge](#eventbridge)
- [Application Load Balancer](#application-load-balancer)
- [AppSync](#appsync)
- [Configuration](#configuration)
- [Top-level configuration](#top-level-configuration)
- [Function-level configuration](#function-level-configuration)
Expand Down Expand Up @@ -108,7 +109,7 @@ Once you have deployed the macro, you can start using SLIC Watch in SAM or Cloud
```yaml
Transform:
- ...
- SlicWatch-v2
- SlicWatch-v3
```

🪛 _Optionally_, add some configuration for the plugin to the `Metadata -> slicWatch` section of `template.yml`.
Expand All @@ -134,24 +135,24 @@ export class MyStack extends cdk.Stack {
constructor (scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props)

this.addTransform('SlicWatch-v2')
this.addTransform('SlicWatch-v3')
...
}
}
```

```python
# Python:
self.add_transform("SlicWatch-v2")
self.add_transform("SlicWatch-v3")
```
```csharp
// C#:
this.AddTransform("SlicWatch-v2")
this.AddTransform("SlicWatch-v3")
```

```java
// Java:
this.addTransform("SlicWatch-v2");
this.addTransform("SlicWatch-v3");
```

🪛 _Optionally_, add some configuration for the plugin as below:
Expand Down Expand Up @@ -303,6 +304,18 @@ Application Load Balancer dashboard widgets show:
|**UnHealthy Host Count**|**Lambda User Error**|**Lambda Internal Error**|
|![UnHealthyHostCount](https://raw.githubusercontent.com/fourtheorem/slic-watch/main/docs/unHealthyHostCount.png) |![LambdaUserError](https://raw.githubusercontent.com/fourtheorem/slic-watch/main/docs/lambdaUserError.png)| |

### AppSync
AppSync alarms are created for:
1. 5XX Error
2. Latency

AppSync dashboard widgets show:

|5XX Error, Latency, 4XX Error, Request|
|--|
|![API Widget](https://raw.githubusercontent.com/fourtheorem/slic-watch/main/docs/appsyncAPI.png)|
|**Connect Server Error**, **Disconnect Server Error**, **Subscribe Server Error**, **Unsubscribe Server Error**,**PublishDataMessageServerError**|
|![Real-time Subscriptions Widget](https://raw.githubusercontent.com/fourtheorem/slic-watch/main/docs/appsyncRealTimeSubscriptions.png)|
## Configuration

Configuration is entirely optional - SLIC Watch provides defaults that work out of the box.
Expand Down
6 changes: 3 additions & 3 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

In order to release a new version of the project:

- update the package version with `npm version <version> -ws --include-workspace-root` to apply that version across all sub packages
- push these changes
- draft a new release in GitHub (the CI will do the publish to npm)
1. Update the package version with `npm version <version>` to apply that version across all sub packages. If the Major version has changed, the Macro name will be automatically updated by [the sync-macro-version script](scripts/sync-macro-version.cjs)
2. Push these changes (`git push --tags`)
3. Draft a new release in GitHub (the CI will do the publish to npm) with the same name as the version tag. If you select "pre-release", this will be published in NPM as a `next` label so it will only be installed by users who explictly request the `@next` version.
20 changes: 6 additions & 14 deletions cdk-test-project/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
{
"name": "cdk-test-project",
"version": "2.1.3",
"version": "3.0.0-rc2",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "echo",
"cdk": "cdk"
},
"devDependencies": {
"@types/jest": "^27.5.2",
"@types/node": "10.17.27",
"@types/prettier": "2.6.0",
"aws-cdk": "2.37.0",
"eslint-config-standard-with-typescript": "^22.0.0",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"ts-node": "^10.9.1",
"typescript": "~3.9.7"
},
"dependencies": {
"aws-cdk-lib": "2.37.0",
"constructs": "^10.0.0"
"aws-cdk-lib": "^2.67.0",
"constructs": "^10.1.266"
},
"devDependencies": {
"aws-cdk": "^2.67.0"
}
}
2 changes: 1 addition & 1 deletion cdk-test-project/source/ecs-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class CdkECSStack extends cdk.Stack {
constructor (scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props)

this.addTransform('SlicWatch-v2')
this.addTransform('SlicWatch-v3')
this.templateOptions.metadata = {
slicWatch: {
enabled: true,
Expand Down
4 changes: 2 additions & 2 deletions cdk-test-project/source/general-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import * as sns from 'aws-cdk-lib/aws-sns'
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'
import * as apigateway from 'aws-cdk-lib/aws-apigateway'
import * as sqs from 'aws-cdk-lib/aws-sqs'
import { CfnResource } from 'aws-cdk-lib'
import type { CfnResource } from 'aws-cdk-lib'
import * as events from 'aws-cdk-lib/aws-events'
import { LambdaFunction } from 'aws-cdk-lib/aws-events-targets'

export class CdkTestGeneralStack extends cdk.Stack {
constructor (scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props)

this.addTransform('SlicWatch-v2')
this.addTransform('SlicWatch-v3')
this.templateOptions.metadata = {
slicWatch: {
enabled: true,
Expand Down
5 changes: 3 additions & 2 deletions cdk-test-project/source/sfn-stack.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import * as cdk from 'aws-cdk-lib'
import * as lambda from 'aws-cdk-lib/aws-lambda'
import * as sns from 'aws-cdk-lib/aws-sns'
import { CfnResource, Duration } from 'aws-cdk-lib'
import { Duration } from 'aws-cdk-lib'
import type { CfnResource } from 'aws-cdk-lib'
import * as sfn from 'aws-cdk-lib/aws-stepfunctions'
import { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks'

export class CdkSFNStack extends cdk.Stack {
constructor (scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props)

this.addTransform('SlicWatch-v2')
this.addTransform('SlicWatch-v3')
this.templateOptions.metadata = {
slicWatch: {
enabled: true,
Expand Down
81 changes: 0 additions & 81 deletions cf-macro/index.js

This file was deleted.

Loading