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 updates #70

Merged
merged 13 commits into from
Apr 25, 2022
10 changes: 10 additions & 0 deletions .changeset/flat-wombats-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"gboost-notifications-demo": patch
"gboost-docs": patch
"gboost": patch
"gboost-common": patch
"gboost-infra": patch
"gboost-ui": patch
---

Update dependencies
5 changes: 5 additions & 0 deletions .changeset/giant-worms-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost-ui": minor
---

Add `FlowStepper` component
5 changes: 5 additions & 0 deletions .changeset/good-dryers-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost-infra": minor
---

Add GraphQLApi construct with nag suppression
5 changes: 5 additions & 0 deletions .changeset/grumpy-pigs-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost": minor
---

Add destroy-dev command
5 changes: 5 additions & 0 deletions .changeset/hungry-cameras-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost-infra": minor
---

Rename suppressAwsManagedConstructs to SuppressOkNags
5 changes: 5 additions & 0 deletions .changeset/soft-maps-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost-ui": minor
---

Add ability to hide action bar and pagination for `QueryTable`
5 changes: 5 additions & 0 deletions .changeset/soft-toes-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost-ui": minor
---

Refactor `getErrorMessage`
5 changes: 5 additions & 0 deletions .changeset/tender-pots-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost-infra": minor
---

Use CloudFront function instead of custom error responses to redirect requests to SPA's index.html
5 changes: 5 additions & 0 deletions .changeset/young-camels-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gboost": patch
---

Update templates
20 changes: 0 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,6 @@ documentation, we greatly value feedback and contributions from our community.
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
information to effectively respond to your bug report or contribution.

## Testing out GB while packages are not on NPM
*Note, you may need to prefix commands with `sudo` for global commands*
1. Install pnpm: https://pnpm.io/installation:
1. Activate Node.js 16: `pnpm env use --global 16`
1. Install AWS CDK v2 globally: `pnpm add -g aws-cdk`
1. Ensure AWS Account you will test GB in has been boostrapped with AWS CDK: `cdk bootstrap aws://123456789012/us-east-1`
1. Clone GB repo: `git clone https://gitlab.aws.dev/rdt/green-boost.git`
1. Install dependencies: `cd green-boost && pnpm i`
1. Build gb-cli: `cd packages/gboost && pnpm build`
1. Globally link gb-cli: `pnpm link --global`
1. In the parent directory of green-boost create a gb app: `cd ../../../ && gboost create`
1. Follow prompts
1. Install dependencies: `cd my-gb-app && pnpm i`
1. Deploy dev env: `gboost deploy-dev`

Get the CloudFront URL created and check out the web app!


What you just did is meant purely for "personal" development; team development, test, and prod environments will be deployed via `cdk deploy` although I'm still working on it getting cdk pipelines working.


## Reporting Bugs/Feature Requests

Expand Down
16 changes: 8 additions & 8 deletions docs/demos/notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
"preview": "vite preview"
},
"dependencies": {
"@aws-amplify/ui-react": "^2.10.1",
"@fontsource/inter": "^4.5.5",
"aws-amplify": "^4.3.16",
"@aws-amplify/ui-react": "^2.15.5",
"@fontsource/inter": "^4.5.7",
"aws-amplify": "^4.3.20",
"gboost-ui": "^0.13.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"vite": "^2.8.6"
"vite": "^2.9.5"
},
"devDependencies": {
"@types/react": "^17.0.40",
"@types/react-dom": "^17.0.13",
"@vitejs/plugin-react": "^1.0.7",
"typescript": "^4.6.2"
"@types/react": "^17.0.44",
"@types/react-dom": "^17.0.15",
"@vitejs/plugin-react": "^1.3.1",
"typescript": "^4.6.3"
}
}
27 changes: 22 additions & 5 deletions docs/docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Contributing

Instructions below allow you to edit .ts files and test out your changes without having to compile to .js each time you make a change.
First clone the repository: `git clone https://github.com/awslabs/green-boost.git` and install dependencies: `pnpm i`.

## Developing Libraries

First clone the repository and instal dependencies with `pnpm i`.
To develop `gboost-ui` or `gboost-infra` or `gboost-common` in your Green Boost application repository (created with `gboost create`), run `pnpm add ../path/to/gboost/packages/gboost-*` replacing the path with the path to wherever the package is locally. This will change your package.json.

Instructions below allow you to edit .ts files and test out your changes without having to compile to .js each time you make a change.

To develop `gboost-ui` or `gboost-infra` or `gboost-common`, in your Green Boost application repository (created with `gboost create`), run `pnpm add ../path/to/gboost/packages/gboost-*` replacing the path with the path to wherever the package is locally. This will change your package.json.
### gboost-ui

For `gboost-ui`, you'll need to add this plugin in your vite.config.ts
```ts
Expand Down Expand Up @@ -45,6 +49,19 @@ export default defineConfig(({ mode }) => {
});
```

If you run into issues with duplicate node_modules being resolved, check out [this](https://blog.maximeheckel.com/posts/duplicate-dependencies-npm-link/) article and look at Vite's `dedupe` config but you shouldn't need to.
Also, for any library used in `gboost-ui` and the consuming package (ui folder), you'll want to add that library to Vite's [resolve.dedupe](https://vitejs.dev/config/#resolve-dedupe) configuration parameter. See an explanation [here](https://blog.maximeheckel.com/posts/duplicate-dependencies-npm-link/). Here is an inexhaustive list:

`["aws-amplify", "@aws-amplify/ui-react", "graphql", "graphql-tag", "react", "react-dom", "react-icons", "react-router-dom"]`

### gboost

To develop `gboost` locally, run `pnpm dlx ts-node --esm ../path/to/green-boost/packages/gboost/src/index.ts` or you can globally install ts-node with `pnpm add -g ts-node` and then run `ts-node --esm ../path/to/green-boost/packages/gboost/src/index.ts`

## Commit Workflow

To develop `gboost` locally, run `pnpm dlx ts-node --esm ../path/to/green-boost/packages/gboost/src/index.ts` or you can globally install ts-node with `pnpm add -g ts-node` and then run `ts-node --esm ../path/to/green-boost/packages/gboost/src/index.ts`
1. Create a feature branch. Please use a descriptive name like `feat-description` or `fix-description` or `refactor-description` etc.
1. Add feature, fix bug, refactor, etc.
1. Create changeset with: `pnpm changeset` in root of repo. Answer prompts, typically you'll be creating a minor change
1. Stage changes _including_ changeset file (i.e. `git add -A`)
1. Commit changes. Husky git commits should trigger lint-staged to run validating your staged files
1. Push branch and create a PR into main ensuring status checks run successfully
20 changes: 10 additions & 10 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@
"@easyops-cn/docusaurus-search-local": "^0.21.4",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"docusaurus-plugin-typedoc": "^0.17.2",
"docusaurus-plugin-typedoc": "^0.17.4",
"prism-react-renderer": "^1.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"typedoc": "^0.22.13",
"typedoc-plugin-markdown": "^3.11.14"
"typedoc": "^0.22.15",
"typedoc-plugin-markdown": "^3.12.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.16",
"@docusaurus/plugin-content-docs": "^2.0.0-beta.17",
"@docusaurus/plugin-content-docs": "^2.0.0-beta.18",
"@docusaurus/theme-classic": "2.0.0-beta.16",
"@tsconfig/docusaurus": "^1.0.5",
"@types/react": "^17.0.40",
"eslint": "^8.11.0",
"@types/react": "^17.0.44",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.0",
"eslint-define-config": "^1.3.0",
"eslint-config-react-app": "^7.0.1",
"eslint-define-config": "^1.4.0",
"eslint-plugin-jest": "^25.7.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.6.0",
"typescript": "^4.6.2"
"prettier": "^2.6.2",
"typescript": "^4.6.3"
},
"browserslist": {
"production": [
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
"preinstall": "npx only-allow pnpm"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.3",
"@changesets/cli": "^2.21.1",
"@changesets/changelog-github": "^0.4.4",
"@changesets/cli": "^2.22.0",
"@types/license-checker": "^25.0.3",
"@types/node": "^16.11.7",
"@types/node": "^16.11.27",
"husky": "^7.0.4",
"license-checker": "^25.0.1",
"lint-staged": "^12.3.6",
"lint-staged": "^12.4.0",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
"typescript": "^4.6.3"
},
"license": "Apache-2.0"
}
14 changes: 7 additions & 7 deletions packages/gboost-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
},
"devDependencies": {
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.15.0",
"@typescript-eslint/parser": "^5.15.0",
"eslint": "^8.11.0",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-define-config": "^1.3.0",
"eslint-define-config": "^1.4.0",
"eslint-plugin-jest": "^25.7.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.1",
"prettier": "^2.6.0",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"ts-jest": "^27.1.4",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
"typescript": "^4.6.3"
},
"repository": {
"type": "git",
Expand Down
30 changes: 15 additions & 15 deletions packages/gboost-infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,32 @@
},
"dependencies": {
"@aws-cdk/aws-appsync-alpha": "^2.5.0-alpha.0",
"@aws-sdk/client-cognito-identity-provider": "^3.54.1",
"aws-cdk-lib": "^2.16.0",
"cdk-nag": "^2.11.1",
"constructs": "^10.0.89",
"esbuild": "^0.14.27",
"@aws-sdk/client-cognito-identity-provider": "^3.75.0",
"aws-cdk-lib": "^2.20.0",
"cdk-nag": "^2.12.32",
"constructs": "^10.0.125",
"esbuild": "^0.14.38",
"gboost-common": "workspace:^0.5.0",
"joi": "^17.6.0"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.93",
"@types/aws-lambda": "^8.10.95",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.1",
"@types/node": "^16.11.26",
"@typescript-eslint/eslint-plugin": "^5.15.0",
"@typescript-eslint/parser": "^5.15.0",
"eslint": "^8.11.0",
"@types/node": "^16.11.27",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-define-config": "^1.3.0",
"eslint-define-config": "^1.4.0",
"eslint-plugin-jest": "^25.7.0",
"eslint-plugin-prettier": "^4.0.0",
"fs-extra": "^10.0.1",
"fs-extra": "^10.1.0",
"jest": "^27.5.1",
"prettier": "^2.6.0",
"ts-jest": "^27.1.3",
"prettier": "^2.6.2",
"ts-jest": "^27.1.4",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
"typescript": "^4.6.3"
},
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
import { Stack } from "aws-cdk-lib";
import { IAspect } from "aws-cdk-lib";
import { NagSuppressions } from "cdk-nag";
import { IConstruct } from "constructs";

/**
* Suppresses cdk-nag errors for AWS managed constructs regarding log
* retention, bucket deployments, and bucket notifications
*/
export function suppressAwsManagedConstructs(stack: Stack) {
for (const construct of stack.node.findAll()) {
if (construct.node.path.includes("LogRetention")) {
NagSuppressions.addResourceSuppressions(construct, [
{
id: "AwsSolutions-IAM4",
reason:
"The Lambda Basic Execution Role does not grant excessive access",
},
{
id: "AwsSolutions-IAM5",
reason:
"The CDK creates this role so that it can set custom retention periods on any CloudWatch Logs resource that gets created.",
},
]);
} else if (construct.node.path.includes("Custom::CDKBucketDeployment")) {
NagSuppressions.addResourceSuppressions(construct, [
export class SuppressOkNags implements IAspect {
visit(node: IConstruct) {
const path = node.node.path;
if (path.includes("Custom::CDKBucketDeployment")) {
NagSuppressions.addResourceSuppressions(node, [
{
id: "AwsSolutions-IAM4",
reason:
Expand All @@ -33,8 +22,8 @@ export function suppressAwsManagedConstructs(stack: Stack) {
"Wildcards are used to succinctly define a specific set or permissions to defined resources.",
},
]);
} else if (construct.node.path.includes("BucketNotificationsHandler")) {
NagSuppressions.addResourceSuppressions(construct, [
} else if (path.includes("BucketNotificationsHandler")) {
NagSuppressions.addResourceSuppressions(node, [
{
id: "AwsSolutions-IAM4",
reason:
Expand Down
Loading