// Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CloudscapeReactTsWebsiteProject Unit Tests Custom Options 1`] = ` { ".eslintrc.json": { "env": { "jest": true, "node": true, }, "extends": [ "plugin:import/typescript", ], "ignorePatterns": [ "*.js", "*.d.ts", "node_modules/", "*.generated.ts", "coverage", "!.projenrc.js", ], "overrides": [ { "files": [ ".projenrc.js", ], "rules": { "@typescript-eslint/no-require-imports": "off", "import/no-extraneous-dependencies": "off", }, }, ], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 2018, "project": "./tsconfig.dev.json", "sourceType": "module", }, "plugins": [ "@typescript-eslint", "import", ], "root": true, "rules": { "@typescript-eslint/indent": [ "error", 2, ], "@typescript-eslint/member-delimiter-style": [ "error", ], "@typescript-eslint/member-ordering": [ "error", { "default": [ "public-static-field", "public-static-method", "protected-static-field", "protected-static-method", "private-static-field", "private-static-method", "field", "constructor", "method", ], }, ], "@typescript-eslint/no-floating-promises": [ "error", ], "@typescript-eslint/no-require-imports": [ "error", ], "@typescript-eslint/no-shadow": [ "error", ], "@typescript-eslint/return-await": [ "error", ], "array-bracket-newline": [ "error", "consistent", ], "array-bracket-spacing": [ "error", "never", ], "brace-style": [ "error", "1tbs", { "allowSingleLine": true, }, ], "comma-dangle": [ "error", "always-multiline", ], "comma-spacing": [ "error", { "after": true, "before": false, }, ], "curly": [ "error", "multi-line", "consistent", ], "dot-notation": [ "error", ], "import/no-extraneous-dependencies": [ "error", { "devDependencies": [ "**/src/**/*.test.tsx", "**/src/setupTests.ts", ], "optionalDependencies": false, "peerDependencies": true, }, ], "import/no-unresolved": [ "error", ], "import/order": [ "warn", { "alphabetize": { "caseInsensitive": true, "order": "asc", }, "groups": [ "builtin", "external", ], }, ], "indent": [ "off", ], "key-spacing": [ "error", ], "keyword-spacing": [ "error", ], "max-len": [ "error", { "code": 150, "ignoreComments": true, "ignoreRegExpLiterals": true, "ignoreStrings": true, "ignoreTemplateLiterals": true, "ignoreUrls": true, }, ], "no-bitwise": [ "error", ], "no-duplicate-imports": [ "error", ], "no-multi-spaces": [ "error", { "ignoreEOLComments": false, }, ], "no-multiple-empty-lines": [ "error", ], "no-return-await": [ "off", ], "no-shadow": [ "off", ], "no-trailing-spaces": [ "error", ], "object-curly-newline": [ "error", { "consistent": true, "multiline": true, }, ], "object-curly-spacing": [ "error", "always", ], "object-property-newline": [ "error", { "allowAllPropertiesOnSameLine": true, }, ], "quote-props": [ "error", "consistent-as-needed", ], "quotes": [ "error", "single", { "avoidEscape": true, }, ], "semi": [ "error", "always", ], "space-before-blocks": [ "error", ], }, "settings": { "import/parsers": { "@typescript-eslint/parser": [ ".ts", ".tsx", ], }, "import/resolver": { "node": {}, "typescript": { "alwaysTryTypes": true, "project": "./tsconfig.dev.json", }, }, }, }, ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.eslintrc.json linguist-generated /.gitattributes linguist-generated /.github/pull_request_template.md linguist-generated /.github/workflows/build.yml linguist-generated /.github/workflows/pull-request-lint.yml linguist-generated /.github/workflows/upgrade.yml linguist-generated /.gitignore linguist-generated /.mergify.yml linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated /.projen/tasks.json linguist-generated /LICENSE linguist-generated /package.json linguist-generated /tsconfig.dev.json linguist-generated /tsconfig.json linguist-generated /yarn.lock linguist-generated", ".github/pull_request_template.md": "Fixes #", ".github/workflows/build.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". name: build on: pull_request: {} workflow_dispatch: {} jobs: build: runs-on: ubuntu-latest permissions: contents: write outputs: self_mutation_happened: \${{ steps.self_mutation.outputs.self_mutation_happened }} env: CI: "true" steps: - name: Checkout uses: actions/checkout@v3 with: ref: \${{ github.event.pull_request.head.ref }} repository: \${{ github.event.pull_request.head.repo.full_name }} - name: Install dependencies run: yarn install --check-files - name: build run: npx projen build - name: Find mutations id: self_mutation run: |- git add . git diff --staged --patch --exit-code > .repo.patch || echo "self_mutation_happened=true" >> $GITHUB_OUTPUT - name: Upload patch if: steps.self_mutation.outputs.self_mutation_happened uses: actions/upload-artifact@v3 with: name: .repo.patch path: .repo.patch - name: Fail build on mutation if: steps.self_mutation.outputs.self_mutation_happened run: |- echo "::error::Files were changed during build (see build log). If this was triggered from a fork, you will need to update your branch." cat .repo.patch exit 1 self-mutation: needs: build runs-on: ubuntu-latest permissions: contents: write if: always() && needs.build.outputs.self_mutation_happened && !(github.event.pull_request.head.repo.full_name != github.repository) steps: - name: Checkout uses: actions/checkout@v3 with: token: \${{ secrets.PROJEN_GITHUB_TOKEN }} ref: \${{ github.event.pull_request.head.ref }} repository: \${{ github.event.pull_request.head.repo.full_name }} - name: Download patch uses: actions/download-artifact@v3 with: name: .repo.patch path: \${{ runner.temp }} - name: Apply patch run: '[ -s \${{ runner.temp }}/.repo.patch ] && git apply \${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' - name: Set git identity run: |- git config user.name "github-actions" git config user.email "github-actions@github.com" - name: Push changes env: PULL_REQUEST_REF: \${{ github.event.pull_request.head.ref }} run: |- git add . git commit -s -m "chore: self mutation" git push origin HEAD:$PULL_REQUEST_REF ", ".github/workflows/pull-request-lint.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". name: pull-request-lint on: pull_request_target: types: - labeled - opened - synchronize - reopened - ready_for_review - edited jobs: validate: name: Validate PR title runs-on: ubuntu-latest permissions: pull-requests: write steps: - uses: amannn/action-semantic-pull-request@v5.0.2 env: GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} with: types: |- feat fix chore requireScope: false ", ".github/workflows/upgrade.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". name: upgrade on: workflow_dispatch: {} schedule: - cron: 0 0 * * * jobs: upgrade: name: Upgrade runs-on: ubuntu-latest permissions: contents: read outputs: patch_created: \${{ steps.create_patch.outputs.patch_created }} steps: - name: Checkout uses: actions/checkout@v3 - name: Install dependencies run: yarn install --check-files --frozen-lockfile - name: Upgrade dependencies run: npx projen upgrade - name: Find mutations id: create_patch run: |- git add . git diff --staged --patch --exit-code > .repo.patch || echo "patch_created=true" >> $GITHUB_OUTPUT - name: Upload patch if: steps.create_patch.outputs.patch_created uses: actions/upload-artifact@v3 with: name: .repo.patch path: .repo.patch pr: name: Create Pull Request needs: upgrade runs-on: ubuntu-latest permissions: contents: read if: \${{ needs.upgrade.outputs.patch_created }} steps: - name: Checkout uses: actions/checkout@v3 with: {} - name: Download patch uses: actions/download-artifact@v3 with: name: .repo.patch path: \${{ runner.temp }} - name: Apply patch run: '[ -s \${{ runner.temp }}/.repo.patch ] && git apply \${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' - name: Set git identity run: |- git config user.name "github-actions" git config user.email "github-actions@github.com" - name: Create Pull Request id: create-pr uses: peter-evans/create-pull-request@v4 with: token: \${{ secrets.PROJEN_GITHUB_TOKEN }} commit-message: |- chore(deps): upgrade dependencies Upgrades project dependencies. See details in [workflow run]. [Workflow Run]: https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} ------ *Automatically created by projen via the "upgrade" workflow* branch: github-actions/upgrade title: "chore(deps): upgrade dependencies" body: |- Upgrades project dependencies. See details in [workflow run]. [Workflow Run]: https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} ------ *Automatically created by projen via the "upgrade" workflow* author: github-actions committer: github-actions signoff: true ", ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". !/.gitattributes !/.projen/tasks.json !/.projen/deps.json !/.projen/files.json !/.github/workflows/pull-request-lint.yml !/package.json !/LICENSE !/.npmignore logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json pids *.pid *.seed *.pid.lock lib-cov coverage *.lcov .nyc_output build/Release node_modules/ jspm_packages/ *.tsbuildinfo .eslintcache *.tgz .yarn-integrity .cache runtime-config.json !/.projenrc.js !/.github/workflows/build.yml !/.mergify.yml !/.github/workflows/upgrade.yml !/.github/pull_request_template.md !/.npmrc !/test/ !/tsconfig.json !/tsconfig.dev.json !/src/ /lib /dist/ !/.eslintrc.json /build/ ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". queue_rules: - name: default update_method: merge conditions: - "#approved-reviews-by>=1" - -label~=(do-not-merge) - status-success=build pull_request_rules: - name: Automatic merge on approval and successful build actions: delete_head_branch: {} queue: method: squash name: default commit_message_template: |- {{ title }} (#{{ number }}) {{ body }} conditions: - "#approved-reviews-by>=1" - -label~=(do-not-merge) - status-success=build ", ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ permissions-backup.acl /.mergify.yml /test/ /tsconfig.dev.json /src/ !/lib/ !/lib/**/*.js !/lib/**/*.d.ts dist /tsconfig.json /.github/ /.vscode/ /.idea/ /.projenrc.js tsconfig.tsbuildinfo /.eslintrc.json /build/ ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ { "name": "@testing-library/jest-dom", "type": "build", }, { "name": "@testing-library/react", "type": "build", }, { "name": "@testing-library/user-event", "type": "build", }, { "name": "@types/jest", "type": "build", }, { "name": "@types/node", "type": "build", "version": "^16", }, { "name": "@types/react", "type": "build", }, { "name": "@types/react-dom", "type": "build", }, { "name": "@typescript-eslint/eslint-plugin", "type": "build", "version": "^5", }, { "name": "@typescript-eslint/parser", "type": "build", "version": "^5", }, { "name": "eslint-import-resolver-node", "type": "build", }, { "name": "eslint-import-resolver-typescript", "type": "build", }, { "name": "eslint-plugin-import", "type": "build", }, { "name": "eslint", "type": "build", "version": "^8", }, { "name": "npm-check-updates", "type": "build", "version": "^16", }, { "name": "projen", "type": "build", }, { "name": "typescript", "type": "build", "version": "^4.0.3", }, { "name": "@types/express-serve-static-core", "type": "override", "version": "4.17.30", }, { "name": "@types/express", "type": "override", "version": "4.17.13", }, { "name": "@aws-northstar/ui", "type": "runtime", }, { "name": "@cloudscape-design/components", "type": "runtime", }, { "name": "aws-prototoyping-sdk", "type": "runtime", }, { "name": "react", "type": "runtime", }, { "name": "react-dom", "type": "runtime", }, { "name": "react-router-dom", "type": "runtime", }, { "name": "react-scripts", "type": "runtime", "version": "^5", }, { "name": "web-vitals", "type": "runtime", }, ], }, ".projen/files.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "files": [ ".eslintrc.json", ".gitattributes", ".github/pull_request_template.md", ".github/workflows/build.yml", ".github/workflows/pull-request-lint.yml", ".github/workflows/upgrade.yml", ".gitignore", ".mergify.yml", ".npmignore", ".npmrc", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", "LICENSE", "tsconfig.dev.json", "tsconfig.json", ], }, ".projen/tasks.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "env": { "DISABLE_ESLINT_PLUGIN": "true", "PATH": "$(npx -c "node --print process.env.PATH")", }, "tasks": { "build": { "description": "Full release build", "name": "build", "steps": [ { "spawn": "default", }, { "spawn": "pre-compile", }, { "spawn": "compile", }, { "spawn": "post-compile", }, { "spawn": "test", }, { "spawn": "package", }, ], }, "clobber": { "condition": "git diff --exit-code > /dev/null", "description": "hard resets to HEAD of origin and cleans the local repo", "env": { "BRANCH": "$(git branch --show-current)", }, "name": "clobber", "steps": [ { "exec": "git checkout -b scratch", "name": "save current HEAD in "scratch" branch", }, { "exec": "git checkout $BRANCH", }, { "exec": "git fetch origin", "name": "fetch latest changes from origin", }, { "exec": "git reset --hard origin/$BRANCH", "name": "hard reset to origin commit", }, { "exec": "git clean -fdx", "name": "clean all untracked files", }, { "say": "ready to rock! (unpushed commits are under the "scratch" branch)", }, ], }, "compile": { "description": "Only compile", "name": "compile", "steps": [ { "exec": "react-scripts build", }, ], }, "default": { "description": "Synthesize project files", "name": "default", "steps": [ { "exec": "node .projenrc.js", }, ], }, "dev": { "description": "Starts the react application", "name": "dev", "steps": [ { "exec": "react-scripts start", }, ], }, "eject": { "description": "Remove projen from the project", "env": { "PROJEN_EJECTING": "true", }, "name": "eject", "steps": [ { "spawn": "default", }, ], }, "eslint": { "description": "Runs eslint against the codebase", "name": "eslint", "steps": [ { "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern src test build-tools .projenrc.js", }, ], }, "install": { "description": "Install project dependencies and update lockfile (non-frozen)", "name": "install", "steps": [ { "exec": "yarn install --check-files", }, ], }, "install:ci": { "description": "Install project dependencies using frozen lockfile", "name": "install:ci", "steps": [ { "exec": "yarn install --check-files --frozen-lockfile", }, ], }, "package": { "description": "Creates the distribution package", "name": "package", }, "post-compile": { "description": "Runs after successful compilation", "name": "post-compile", }, "post-upgrade": { "description": "Runs after upgrading dependencies", "name": "post-upgrade", }, "pre-compile": { "description": "Prepare the project for compilation", "name": "pre-compile", }, "test": { "description": "Run tests", "name": "test", "steps": [ { "spawn": "eslint", }, { "exec": "react-scripts test --watchAll=false --passWithNoTests", }, ], }, "upgrade": { "description": "upgrade dependencies", "env": { "CI": "0", }, "name": "upgrade", "steps": [ { "exec": "yarn upgrade npm-check-updates", }, { "exec": "npm-check-updates --dep dev --upgrade --target=minor", }, { "exec": "npm-check-updates --dep optional --upgrade --target=minor", }, { "exec": "npm-check-updates --dep peer --upgrade --target=minor", }, { "exec": "npm-check-updates --dep prod --upgrade --target=minor", }, { "exec": "npm-check-updates --dep bundle --upgrade --target=minor", }, { "exec": "yarn install --check-files", }, { "exec": "yarn upgrade", }, { "exec": "npx projen", }, { "spawn": "post-upgrade", }, ], }, "watch": { "description": "Watch & compile in the background", "name": "watch", "steps": [ { "exec": "tsc --build -w", }, ], }, }, }, "LICENSE": " Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ", "README.md": "## Getting started To create a new [Cloudscape](https://cloudscape.design/) React Typescript Project, there are a couple of options: ### Via Projen CLI \`\`\` npx projen new --from @aws-prototyping-sdk/cloudscape-react-ts-website cloudscape-react-ts-website [--application-name ] \`\`\` ### Programmatically \`\`\`ts new CloudscapeReactTsWebsiteProject({ defaultReleaseBranch: "mainline", name: "", applicationName: "", }); \`\`\` ### Running your synthesized Application To run your synthesized application locally, run \`npx projen dev\`. ## Developer Notes To enable Cognito auth, ensure you have a runtime-config.json file in the root of your deployed project which at least contains the following: \`\`\`json { "region": "", "identityPoolId":"", "userPoolId":"", "userPoolWebClientId":"" } \`\`\` The easiest way to get this set up is to use the static-website + identity packages to deploy your website. An example of how to do this is as follows: \`\`\`ts const userIdentity = new UserIdentity(this, 'UserIdentity'); new StaticWebsite(this, 'StaticWebsite', { websiteContentPath: '////', runtimeOptions: { jsonPayload: { region: Stack.of(this).region, identityPoolId: userIdentity.identityPool.identityPoolId, userPoolId: userIdentity.userPool?.userPoolId, userPoolWebClientId: userIdentity.userPoolClient?.userPoolClientId, } }, }); \`\`\` For local development, you will need to copy the generated runtime-config.json file into your /public directory. An example on how to do this is as follows: \`\`\` curl https://dxxxxxxxxxx.cloudfront.net/runtime-config.json > public/runtime-config.json \`\`\`", "package.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "browserslist": { "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version", ], "production": [ ">0.2%", "not dead", "not op_mini all", ], }, "dependencies": { "@aws-northstar/ui": "*", "@cloudscape-design/components": "*", "aws-prototoyping-sdk": "*", "react": "*", "react-dom": "*", "react-router-dom": "*", "react-scripts": "^5", "web-vitals": "*", }, "devDependencies": { "@testing-library/jest-dom": "*", "@testing-library/react": "*", "@testing-library/user-event": "*", "@types/jest": "*", "@types/node": "^16", "@types/react": "*", "@types/react-dom": "*", "@typescript-eslint/eslint-plugin": "^5", "@typescript-eslint/parser": "^5", "eslint": "^8", "eslint-import-resolver-node": "*", "eslint-import-resolver-typescript": "*", "eslint-plugin-import": "*", "npm-check-updates": "^16", "projen": "*", "typescript": "^4.0.3", }, "eslintConfig": { "extends": [ "react-app", "react-app/jest", ], }, "license": "Apache-2.0", "name": "CustomOptions", "resolutions": { "@types/express": "4.17.13", "@types/express-serve-static-core": "4.17.30", }, "scripts": { "build": "npx projen build", "clobber": "npx projen clobber", "compile": "npx projen compile", "default": "npx projen default", "dev": "npx projen dev", "eject": "npx projen eject", "eslint": "npx projen eslint", "package": "npx projen package", "post-compile": "npx projen post-compile", "post-upgrade": "npx projen post-upgrade", "pre-compile": "npx projen pre-compile", "projen": "npx projen", "test": "npx projen test", "upgrade": "npx projen upgrade", "watch": "npx projen watch", }, "version": "0.0.0", }, "public/index.html": " CustomOptions
", "public/robots.txt": "# https://www.robotstxt.org/robotstxt.html User-agent: * Disallow: ", "src/components/Auth/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { CognitoAuth } from "@aws-northstar/ui"; import React, { useContext } from "react"; import Config from "../../config.json"; import { RuntimeConfigContext } from "../RuntimeContext"; /** * Sets up the runtimeContext and Cognito auth. * * This assumes a runtime-config.json file is present at '/'. In order for Auth to be set up automatically, * the runtime-config.json must have the following properties configured: [region, userPoolId, userPoolWebClientId, identityPoolId]. */ const Auth: React.FC = ({ children }) => { const runtimeContext = useContext(RuntimeConfigContext); return runtimeContext?.userPoolId && runtimeContext?.userPoolWebClientId && runtimeContext?.region && runtimeContext?.identityPoolId ? ( {children} ) : ( <> ); }; export default Auth; ", "src/components/RuntimeContext/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import ErrorMessage from "@aws-northstar/ui/components/CognitoAuth/components/ErrorMessage"; import React, { createContext, useEffect, useState } from "react"; export interface RuntimeContext { readonly region: string; readonly userPoolId: string; readonly userPoolWebClientId: string; readonly identityPoolId: string; readonly [additionalProps: string]: string; } /** * Context for storing the runtimeContext. */ export const RuntimeConfigContext = createContext( undefined ); const RuntimeContextProvider: React.FC = ({ children }) => { const [runtimeContext, setRuntimeContext] = useState< RuntimeContext | undefined >(); const [error, setError] = useState(); useEffect(() => { fetch("/runtime-config.json") .then((response) => { return response.json(); }) .then((runtimeCtx) => { if ( runtimeCtx.region && runtimeCtx.userPoolId && runtimeCtx.userPoolWebClientId && runtimeCtx.identityPoolId ) { setRuntimeContext(runtimeCtx as RuntimeContext); } else { setError( "runtime-config.json should have region, userPoolId, userPoolWebClientId & identityPoolId." ); } }) .catch(() => { setError("No runtime-config.json detected"); }); }, [setRuntimeContext]); return error ? ( {error} ) : ( {children} ); }; export default RuntimeContextProvider; ", "src/config.json": { "applicationName": "CustomOptions", "logo": "data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4KPHN2ZyBmaWxsPSIjMjQ4YmFlIiB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0cm9rZT0iIzI0OGJhZSI+Cg08ZyBpZD0iU1ZHUmVwb19iZ0NhcnJpZXIiIHN0cm9rZS13aWR0aD0iMCIvPgoNPGcgaWQ9IlNWR1JlcG9fdHJhY2VyQ2FycmllciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cg08ZyBpZD0iU1ZHUmVwb19pY29uQ2FycmllciI+Cg08dGl0bGU+aW9uaWNvbnMtdjVfbG9nb3M8L3Rpd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TIzLjIyYy05LjcyLTEwLjUxLTE5LjQyLTIyLjE0LTI4Ljg4LTM0LjY0cTEzLjc5LjU0LDI4LjA4LjU0YzkuNzgsMCwxOS40Ni0uMjEsMjktLjY0QTQzOS4zMyw0MzkuMzMsMCwwLDEsMjU2LjgsMzg4LjE2Wm0xMjQuNTIsMjguNTljLTIuODYsMTUuNDQtOC42MSwyNS43NC0xNS43MiwyOS44Ni0xNS4xMyw4Ljc4LTQ3LjQ4LTIuNjMtODIuMzYtMzIuNzItNC0zLjQ0LTgtNy4xMy0xMi4wNy0xMWE0ODQuNTQsNDg0LjU0LDAsMCwwLDQwLjIzLTUxLjIsNDc3Ljg0LDQ3Ny44NCwwLDAsMCw2NS0xMC4wNXExLjQ3LDUuOTQsMi42LDExLjY0aDBDMzgzLjgxLDM3Ny41OCwzODQuNSwzOTkuNTYsMzgxLjMyLDQxNi43NVptMTcuNC0xMDIuNjRoMGMtMi42Mi44Ny01LjMyLDEuNzEtOC4wNiwyLjUzYTQ4My4yNiw0ODMuMjYsMCwwLDAtMjQuMzEtNjAuOTQsNDgxLjUyLDQ4MS41MiwwLDAsMCwyMy4zNi02MC4wNmM0LjkxLDEuNDMsOS42OCwyLjkzLDE0LjI3LDQuNTIsNDQuNDIsMTUuMzIsNzEuNTIsMzgsNzEuNTIsNTUuNDNDNDc1LjUsMjc0LjE5LDQ0Ni4yMywyOTguMzMsMzk4LjcyLDMxNC4xMVoiLz4KDTxwYXRoIGQ9Ik0yNTYsMjk4LjU1YTQzLDQzLDAsMSwwLTQyLjg2LTQzQTQyLjkxLDQyLjkxLDAsMCwwLDI1NiwyOTguNTVaIi8+Cg08L2c+Cg08L3N2Zz4=", }, "src/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { NorthStarThemeProvider } from "@aws-northstar/ui"; import React from "react"; import { createRoot } from "react-dom/client"; import { BrowserRouter } from "react-router-dom"; import Auth from "./components/Auth"; import RuntimeContextProvider from "./components/RuntimeContext"; import App from "./layouts/App"; createRoot(document.getElementById("root")!).render( ); ", "src/layouts/App/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { useCognitoAuthContext } from "@aws-northstar/ui"; import AppLayout from "@aws-northstar/ui/components/AppLayout"; import * as React from "react"; import { useEffect, useState } from "react"; import { NavItems } from "./navitems"; import Config from "../../config.json"; import Routes from "../Routes"; /** * Defines the App layout and contains logic for routing. */ const App: React.FC = () => { const [username, setUsername] = useState(); const [email, setEmail] = useState(); const { getAuthenticatedUser } = useCognitoAuthContext(); useEffect(() => { if (getAuthenticatedUser) { const authUser = getAuthenticatedUser(); setUsername(authUser?.getUsername()); authUser?.getSession(() => { authUser.getUserAttributes((_, attributes) => { setEmail(attributes?.find((a) => a.Name === "email")?.Value); }); }); } }, [getAuthenticatedUser, setUsername, setEmail]); return ( new Promise(() => { getAuthenticatedUser && getAuthenticatedUser()?.signOut(); window.location.href = "/"; }) } user={ username ? { username, email, } : undefined } > ); }; export default App; ", "src/layouts/App/navitems.ts": "import { SideNavigationProps } from "@cloudscape-design/components"; /** * Define your Navigation Items here */ export const NavItems: SideNavigationProps.Item[] = [ { text: "Home", type: "link", href: "/" }, ]; ", "src/layouts/Routes/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import * as React from "react"; import { Route, Routes as ReactRoutes } from "react-router-dom"; import Home from "../../pages/Home"; /** * Defines the Routes. */ const Routes: React.FC = () => { return ( } /> ); }; export default Routes; ", "src/pages/Home/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { Container, ContentLayout, Header, SpaceBetween, } from "@cloudscape-design/components"; /** * Component to render the home "/" route. */ const Home: React.FC = () => { return ( Home}> Welcome! ); }; export default Home; ", "src/react-app-env.d.ts": "/// ", "src/setupTests.ts": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ // jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import "@testing-library/jest-dom"; ", "tsconfig.dev.json": { "compilerOptions": { "allowJs": true, "allowSyntheticDefaultImports": true, "alwaysStrict": true, "declaration": true, "esModuleInterop": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, "inlineSourceMap": true, "inlineSources": true, "isolatedModules": true, "jsx": "react-jsx", "lib": [ "dom", "dom.iterable", "esnext", ], "module": "commonjs", "moduleResolution": "node", "noEmit": true, "noEmitOnError": false, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "resolveJsonModule": true, "skipLibCheck": true, "strict": true, "strictNullChecks": true, "strictPropertyInitialization": true, "stripInternal": true, "target": "es5", }, "exclude": [ "node_modules", ], "include": [ ".projenrc.js", "src/**/*.ts", "test/**/*.ts", "src", ], }, "tsconfig.json": { "compilerOptions": { "allowJs": true, "allowSyntheticDefaultImports": true, "alwaysStrict": true, "declaration": true, "esModuleInterop": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, "inlineSourceMap": true, "inlineSources": true, "isolatedModules": true, "jsx": "react-jsx", "lib": [ "dom", "dom.iterable", "esnext", ], "module": "commonjs", "moduleResolution": "node", "noEmit": true, "noEmitOnError": false, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "outDir": "lib", "resolveJsonModule": true, "rootDir": "src", "skipLibCheck": true, "strict": true, "strictNullChecks": true, "strictPropertyInitialization": true, "stripInternal": true, "target": "es5", }, "exclude": [], "include": [ "src/**/*.ts", "src", ], }, } `; exports[`CloudscapeReactTsWebsiteProject Unit Tests Defaults 1`] = ` { ".eslintrc.json": { "env": { "jest": true, "node": true, }, "extends": [ "plugin:import/typescript", ], "ignorePatterns": [ "*.js", "*.d.ts", "node_modules/", "*.generated.ts", "coverage", "!.projenrc.js", ], "overrides": [ { "files": [ ".projenrc.js", ], "rules": { "@typescript-eslint/no-require-imports": "off", "import/no-extraneous-dependencies": "off", }, }, ], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 2018, "project": "./tsconfig.dev.json", "sourceType": "module", }, "plugins": [ "@typescript-eslint", "import", ], "root": true, "rules": { "@typescript-eslint/indent": [ "error", 2, ], "@typescript-eslint/member-delimiter-style": [ "error", ], "@typescript-eslint/member-ordering": [ "error", { "default": [ "public-static-field", "public-static-method", "protected-static-field", "protected-static-method", "private-static-field", "private-static-method", "field", "constructor", "method", ], }, ], "@typescript-eslint/no-floating-promises": [ "error", ], "@typescript-eslint/no-require-imports": [ "error", ], "@typescript-eslint/no-shadow": [ "error", ], "@typescript-eslint/return-await": [ "error", ], "array-bracket-newline": [ "error", "consistent", ], "array-bracket-spacing": [ "error", "never", ], "brace-style": [ "error", "1tbs", { "allowSingleLine": true, }, ], "comma-dangle": [ "error", "always-multiline", ], "comma-spacing": [ "error", { "after": true, "before": false, }, ], "curly": [ "error", "multi-line", "consistent", ], "dot-notation": [ "error", ], "import/no-extraneous-dependencies": [ "error", { "devDependencies": [ "**/src/**/*.test.tsx", "**/src/setupTests.ts", ], "optionalDependencies": false, "peerDependencies": true, }, ], "import/no-unresolved": [ "error", ], "import/order": [ "warn", { "alphabetize": { "caseInsensitive": true, "order": "asc", }, "groups": [ "builtin", "external", ], }, ], "indent": [ "off", ], "key-spacing": [ "error", ], "keyword-spacing": [ "error", ], "max-len": [ "error", { "code": 150, "ignoreComments": true, "ignoreRegExpLiterals": true, "ignoreStrings": true, "ignoreTemplateLiterals": true, "ignoreUrls": true, }, ], "no-bitwise": [ "error", ], "no-duplicate-imports": [ "error", ], "no-multi-spaces": [ "error", { "ignoreEOLComments": false, }, ], "no-multiple-empty-lines": [ "error", ], "no-return-await": [ "off", ], "no-shadow": [ "off", ], "no-trailing-spaces": [ "error", ], "object-curly-newline": [ "error", { "consistent": true, "multiline": true, }, ], "object-curly-spacing": [ "error", "always", ], "object-property-newline": [ "error", { "allowAllPropertiesOnSameLine": true, }, ], "quote-props": [ "error", "consistent-as-needed", ], "quotes": [ "error", "single", { "avoidEscape": true, }, ], "semi": [ "error", "always", ], "space-before-blocks": [ "error", ], }, "settings": { "import/parsers": { "@typescript-eslint/parser": [ ".ts", ".tsx", ], }, "import/resolver": { "node": {}, "typescript": { "alwaysTryTypes": true, "project": "./tsconfig.dev.json", }, }, }, }, ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.eslintrc.json linguist-generated /.gitattributes linguist-generated /.github/pull_request_template.md linguist-generated /.github/workflows/build.yml linguist-generated /.github/workflows/pull-request-lint.yml linguist-generated /.github/workflows/upgrade.yml linguist-generated /.gitignore linguist-generated /.mergify.yml linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated /.projen/tasks.json linguist-generated /LICENSE linguist-generated /package.json linguist-generated /tsconfig.dev.json linguist-generated /tsconfig.json linguist-generated /yarn.lock linguist-generated", ".github/pull_request_template.md": "Fixes #", ".github/workflows/build.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". name: build on: pull_request: {} workflow_dispatch: {} jobs: build: runs-on: ubuntu-latest permissions: contents: write outputs: self_mutation_happened: \${{ steps.self_mutation.outputs.self_mutation_happened }} env: CI: "true" steps: - name: Checkout uses: actions/checkout@v3 with: ref: \${{ github.event.pull_request.head.ref }} repository: \${{ github.event.pull_request.head.repo.full_name }} - name: Install dependencies run: yarn install --check-files - name: build run: npx projen build - name: Find mutations id: self_mutation run: |- git add . git diff --staged --patch --exit-code > .repo.patch || echo "self_mutation_happened=true" >> $GITHUB_OUTPUT - name: Upload patch if: steps.self_mutation.outputs.self_mutation_happened uses: actions/upload-artifact@v3 with: name: .repo.patch path: .repo.patch - name: Fail build on mutation if: steps.self_mutation.outputs.self_mutation_happened run: |- echo "::error::Files were changed during build (see build log). If this was triggered from a fork, you will need to update your branch." cat .repo.patch exit 1 self-mutation: needs: build runs-on: ubuntu-latest permissions: contents: write if: always() && needs.build.outputs.self_mutation_happened && !(github.event.pull_request.head.repo.full_name != github.repository) steps: - name: Checkout uses: actions/checkout@v3 with: token: \${{ secrets.PROJEN_GITHUB_TOKEN }} ref: \${{ github.event.pull_request.head.ref }} repository: \${{ github.event.pull_request.head.repo.full_name }} - name: Download patch uses: actions/download-artifact@v3 with: name: .repo.patch path: \${{ runner.temp }} - name: Apply patch run: '[ -s \${{ runner.temp }}/.repo.patch ] && git apply \${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' - name: Set git identity run: |- git config user.name "github-actions" git config user.email "github-actions@github.com" - name: Push changes env: PULL_REQUEST_REF: \${{ github.event.pull_request.head.ref }} run: |- git add . git commit -s -m "chore: self mutation" git push origin HEAD:$PULL_REQUEST_REF ", ".github/workflows/pull-request-lint.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". name: pull-request-lint on: pull_request_target: types: - labeled - opened - synchronize - reopened - ready_for_review - edited jobs: validate: name: Validate PR title runs-on: ubuntu-latest permissions: pull-requests: write steps: - uses: amannn/action-semantic-pull-request@v5.0.2 env: GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }} with: types: |- feat fix chore requireScope: false ", ".github/workflows/upgrade.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". name: upgrade on: workflow_dispatch: {} schedule: - cron: 0 0 * * * jobs: upgrade: name: Upgrade runs-on: ubuntu-latest permissions: contents: read outputs: patch_created: \${{ steps.create_patch.outputs.patch_created }} steps: - name: Checkout uses: actions/checkout@v3 - name: Install dependencies run: yarn install --check-files --frozen-lockfile - name: Upgrade dependencies run: npx projen upgrade - name: Find mutations id: create_patch run: |- git add . git diff --staged --patch --exit-code > .repo.patch || echo "patch_created=true" >> $GITHUB_OUTPUT - name: Upload patch if: steps.create_patch.outputs.patch_created uses: actions/upload-artifact@v3 with: name: .repo.patch path: .repo.patch pr: name: Create Pull Request needs: upgrade runs-on: ubuntu-latest permissions: contents: read if: \${{ needs.upgrade.outputs.patch_created }} steps: - name: Checkout uses: actions/checkout@v3 with: {} - name: Download patch uses: actions/download-artifact@v3 with: name: .repo.patch path: \${{ runner.temp }} - name: Apply patch run: '[ -s \${{ runner.temp }}/.repo.patch ] && git apply \${{ runner.temp }}/.repo.patch || echo "Empty patch. Skipping."' - name: Set git identity run: |- git config user.name "github-actions" git config user.email "github-actions@github.com" - name: Create Pull Request id: create-pr uses: peter-evans/create-pull-request@v4 with: token: \${{ secrets.PROJEN_GITHUB_TOKEN }} commit-message: |- chore(deps): upgrade dependencies Upgrades project dependencies. See details in [workflow run]. [Workflow Run]: https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} ------ *Automatically created by projen via the "upgrade" workflow* branch: github-actions/upgrade title: "chore(deps): upgrade dependencies" body: |- Upgrades project dependencies. See details in [workflow run]. [Workflow Run]: https://github.com/\${{ github.repository }}/actions/runs/\${{ github.run_id }} ------ *Automatically created by projen via the "upgrade" workflow* author: github-actions committer: github-actions signoff: true ", ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". !/.gitattributes !/.projen/tasks.json !/.projen/deps.json !/.projen/files.json !/.github/workflows/pull-request-lint.yml !/package.json !/LICENSE !/.npmignore logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json pids *.pid *.seed *.pid.lock lib-cov coverage *.lcov .nyc_output build/Release node_modules/ jspm_packages/ *.tsbuildinfo .eslintcache *.tgz .yarn-integrity .cache runtime-config.json !/.projenrc.js !/.github/workflows/build.yml !/.mergify.yml !/.github/workflows/upgrade.yml !/.github/pull_request_template.md !/.npmrc !/test/ !/tsconfig.json !/tsconfig.dev.json !/src/ /lib /dist/ !/.eslintrc.json /build/ ", ".mergify.yml": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". queue_rules: - name: default update_method: merge conditions: - "#approved-reviews-by>=1" - -label~=(do-not-merge) - status-success=build pull_request_rules: - name: Automatic merge on approval and successful build actions: delete_head_branch: {} queue: method: squash name: default commit_message_template: |- {{ title }} (#{{ number }}) {{ body }} conditions: - "#approved-reviews-by>=1" - -label~=(do-not-merge) - status-success=build ", ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ permissions-backup.acl /.mergify.yml /test/ /tsconfig.dev.json /src/ !/lib/ !/lib/**/*.js !/lib/**/*.d.ts dist /tsconfig.json /.github/ /.vscode/ /.idea/ /.projenrc.js tsconfig.tsbuildinfo /.eslintrc.json /build/ ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ { "name": "@testing-library/jest-dom", "type": "build", }, { "name": "@testing-library/react", "type": "build", }, { "name": "@testing-library/user-event", "type": "build", }, { "name": "@types/jest", "type": "build", }, { "name": "@types/node", "type": "build", "version": "^16", }, { "name": "@types/react", "type": "build", }, { "name": "@types/react-dom", "type": "build", }, { "name": "@typescript-eslint/eslint-plugin", "type": "build", "version": "^5", }, { "name": "@typescript-eslint/parser", "type": "build", "version": "^5", }, { "name": "eslint-import-resolver-node", "type": "build", }, { "name": "eslint-import-resolver-typescript", "type": "build", }, { "name": "eslint-plugin-import", "type": "build", }, { "name": "eslint", "type": "build", "version": "^8", }, { "name": "npm-check-updates", "type": "build", "version": "^16", }, { "name": "projen", "type": "build", }, { "name": "typescript", "type": "build", "version": "^4.0.3", }, { "name": "@types/express-serve-static-core", "type": "override", "version": "4.17.30", }, { "name": "@types/express", "type": "override", "version": "4.17.13", }, { "name": "@aws-northstar/ui", "type": "runtime", }, { "name": "@cloudscape-design/components", "type": "runtime", }, { "name": "react", "type": "runtime", }, { "name": "react-dom", "type": "runtime", }, { "name": "react-router-dom", "type": "runtime", }, { "name": "react-scripts", "type": "runtime", "version": "^5", }, { "name": "web-vitals", "type": "runtime", }, ], }, ".projen/files.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "files": [ ".eslintrc.json", ".gitattributes", ".github/pull_request_template.md", ".github/workflows/build.yml", ".github/workflows/pull-request-lint.yml", ".github/workflows/upgrade.yml", ".gitignore", ".mergify.yml", ".npmignore", ".npmrc", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", "LICENSE", "tsconfig.dev.json", "tsconfig.json", ], }, ".projen/tasks.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "env": { "DISABLE_ESLINT_PLUGIN": "true", "PATH": "$(npx -c "node --print process.env.PATH")", }, "tasks": { "build": { "description": "Full release build", "name": "build", "steps": [ { "spawn": "default", }, { "spawn": "pre-compile", }, { "spawn": "compile", }, { "spawn": "post-compile", }, { "spawn": "test", }, { "spawn": "package", }, ], }, "clobber": { "condition": "git diff --exit-code > /dev/null", "description": "hard resets to HEAD of origin and cleans the local repo", "env": { "BRANCH": "$(git branch --show-current)", }, "name": "clobber", "steps": [ { "exec": "git checkout -b scratch", "name": "save current HEAD in "scratch" branch", }, { "exec": "git checkout $BRANCH", }, { "exec": "git fetch origin", "name": "fetch latest changes from origin", }, { "exec": "git reset --hard origin/$BRANCH", "name": "hard reset to origin commit", }, { "exec": "git clean -fdx", "name": "clean all untracked files", }, { "say": "ready to rock! (unpushed commits are under the "scratch" branch)", }, ], }, "compile": { "description": "Only compile", "name": "compile", "steps": [ { "exec": "react-scripts build", }, ], }, "default": { "description": "Synthesize project files", "name": "default", "steps": [ { "exec": "node .projenrc.js", }, ], }, "dev": { "description": "Starts the react application", "name": "dev", "steps": [ { "exec": "react-scripts start", }, ], }, "eject": { "description": "Remove projen from the project", "env": { "PROJEN_EJECTING": "true", }, "name": "eject", "steps": [ { "spawn": "default", }, ], }, "eslint": { "description": "Runs eslint against the codebase", "name": "eslint", "steps": [ { "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern src test build-tools .projenrc.js", }, ], }, "install": { "description": "Install project dependencies and update lockfile (non-frozen)", "name": "install", "steps": [ { "exec": "yarn install --check-files", }, ], }, "install:ci": { "description": "Install project dependencies using frozen lockfile", "name": "install:ci", "steps": [ { "exec": "yarn install --check-files --frozen-lockfile", }, ], }, "package": { "description": "Creates the distribution package", "name": "package", }, "post-compile": { "description": "Runs after successful compilation", "name": "post-compile", }, "post-upgrade": { "description": "Runs after upgrading dependencies", "name": "post-upgrade", }, "pre-compile": { "description": "Prepare the project for compilation", "name": "pre-compile", }, "test": { "description": "Run tests", "name": "test", "steps": [ { "spawn": "eslint", }, { "exec": "react-scripts test --watchAll=false --passWithNoTests", }, ], }, "upgrade": { "description": "upgrade dependencies", "env": { "CI": "0", }, "name": "upgrade", "steps": [ { "exec": "yarn upgrade npm-check-updates", }, { "exec": "npm-check-updates --dep dev --upgrade --target=minor", }, { "exec": "npm-check-updates --dep optional --upgrade --target=minor", }, { "exec": "npm-check-updates --dep peer --upgrade --target=minor", }, { "exec": "npm-check-updates --dep prod --upgrade --target=minor", }, { "exec": "npm-check-updates --dep bundle --upgrade --target=minor", }, { "exec": "yarn install --check-files", }, { "exec": "yarn upgrade", }, { "exec": "npx projen", }, { "spawn": "post-upgrade", }, ], }, "watch": { "description": "Watch & compile in the background", "name": "watch", "steps": [ { "exec": "tsc --build -w", }, ], }, }, }, "LICENSE": " Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ", "README.md": "## Getting started To create a new [Cloudscape](https://cloudscape.design/) React Typescript Project, there are a couple of options: ### Via Projen CLI \`\`\` npx projen new --from @aws-prototyping-sdk/cloudscape-react-ts-website cloudscape-react-ts-website [--application-name ] \`\`\` ### Programmatically \`\`\`ts new CloudscapeReactTsWebsiteProject({ defaultReleaseBranch: "mainline", name: "", applicationName: "", }); \`\`\` ### Running your synthesized Application To run your synthesized application locally, run \`npx projen dev\`. ## Developer Notes To enable Cognito auth, ensure you have a runtime-config.json file in the root of your deployed project which at least contains the following: \`\`\`json { "region": "", "identityPoolId":"", "userPoolId":"", "userPoolWebClientId":"" } \`\`\` The easiest way to get this set up is to use the static-website + identity packages to deploy your website. An example of how to do this is as follows: \`\`\`ts const userIdentity = new UserIdentity(this, 'UserIdentity'); new StaticWebsite(this, 'StaticWebsite', { websiteContentPath: '////', runtimeOptions: { jsonPayload: { region: Stack.of(this).region, identityPoolId: userIdentity.identityPool.identityPoolId, userPoolId: userIdentity.userPool?.userPoolId, userPoolWebClientId: userIdentity.userPoolClient?.userPoolClientId, } }, }); \`\`\` For local development, you will need to copy the generated runtime-config.json file into your /public directory. An example on how to do this is as follows: \`\`\` curl https://dxxxxxxxxxx.cloudfront.net/runtime-config.json > public/runtime-config.json \`\`\`", "package.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "browserslist": { "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version", ], "production": [ ">0.2%", "not dead", "not op_mini all", ], }, "dependencies": { "@aws-northstar/ui": "*", "@cloudscape-design/components": "*", "react": "*", "react-dom": "*", "react-router-dom": "*", "react-scripts": "^5", "web-vitals": "*", }, "devDependencies": { "@testing-library/jest-dom": "*", "@testing-library/react": "*", "@testing-library/user-event": "*", "@types/jest": "*", "@types/node": "^16", "@types/react": "*", "@types/react-dom": "*", "@typescript-eslint/eslint-plugin": "^5", "@typescript-eslint/parser": "^5", "eslint": "^8", "eslint-import-resolver-node": "*", "eslint-import-resolver-typescript": "*", "eslint-plugin-import": "*", "npm-check-updates": "^16", "projen": "*", "typescript": "^4.0.3", }, "eslintConfig": { "extends": [ "react-app", "react-app/jest", ], }, "license": "Apache-2.0", "name": "Defaults", "resolutions": { "@types/express": "4.17.13", "@types/express-serve-static-core": "4.17.30", }, "scripts": { "build": "npx projen build", "clobber": "npx projen clobber", "compile": "npx projen compile", "default": "npx projen default", "dev": "npx projen dev", "eject": "npx projen eject", "eslint": "npx projen eslint", "package": "npx projen package", "post-compile": "npx projen post-compile", "post-upgrade": "npx projen post-upgrade", "pre-compile": "npx projen pre-compile", "projen": "npx projen", "test": "npx projen test", "upgrade": "npx projen upgrade", "watch": "npx projen watch", }, "version": "0.0.0", }, "public/index.html": " Defaults
", "public/robots.txt": "# https://www.robotstxt.org/robotstxt.html User-agent: * Disallow: ", "src/components/Auth/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { CognitoAuth } from "@aws-northstar/ui"; import React, { useContext } from "react"; import Config from "../../config.json"; import { RuntimeConfigContext } from "../RuntimeContext"; /** * Sets up the runtimeContext and Cognito auth. * * This assumes a runtime-config.json file is present at '/'. In order for Auth to be set up automatically, * the runtime-config.json must have the following properties configured: [region, userPoolId, userPoolWebClientId, identityPoolId]. */ const Auth: React.FC = ({ children }) => { const runtimeContext = useContext(RuntimeConfigContext); return runtimeContext?.userPoolId && runtimeContext?.userPoolWebClientId && runtimeContext?.region && runtimeContext?.identityPoolId ? ( {children} ) : ( <> ); }; export default Auth; ", "src/components/RuntimeContext/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import ErrorMessage from "@aws-northstar/ui/components/CognitoAuth/components/ErrorMessage"; import React, { createContext, useEffect, useState } from "react"; export interface RuntimeContext { readonly region: string; readonly userPoolId: string; readonly userPoolWebClientId: string; readonly identityPoolId: string; readonly [additionalProps: string]: string; } /** * Context for storing the runtimeContext. */ export const RuntimeConfigContext = createContext( undefined ); const RuntimeContextProvider: React.FC = ({ children }) => { const [runtimeContext, setRuntimeContext] = useState< RuntimeContext | undefined >(); const [error, setError] = useState(); useEffect(() => { fetch("/runtime-config.json") .then((response) => { return response.json(); }) .then((runtimeCtx) => { if ( runtimeCtx.region && runtimeCtx.userPoolId && runtimeCtx.userPoolWebClientId && runtimeCtx.identityPoolId ) { setRuntimeContext(runtimeCtx as RuntimeContext); } else { setError( "runtime-config.json should have region, userPoolId, userPoolWebClientId & identityPoolId." ); } }) .catch(() => { setError("No runtime-config.json detected"); }); }, [setRuntimeContext]); return error ? ( {error} ) : ( {children} ); }; export default RuntimeContextProvider; ", "src/config.json": { "applicationName": "Defaults", "logo": "data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29scyAtLT4KPHN2ZyBmaWxsPSIjMjQ4YmFlIiB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0cm9rZT0iIzI0OGJhZSI+Cg08ZyBpZD0iU1ZHUmVwb19iZ0NhcnJpZXIiIHN0cm9rZS13aWR0aD0iMCIvPgoNPGcgaWQ9IlNWR1JlcG9fdHJhY2VyQ2FycmllciIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cg08ZyBpZD0iU1ZHUmVwb19pY29uQ2FycmllciI+Cg08dGl0bGU+aW9uaWNvbnMtdjVfbG9nb3M8L3RpdGxlPgoNPHBhdGggZD0iTTQxMC42NiwxODAuNzJoMHEtNy42Ny0yLjYyLTE1LjQ1LTQuODgsMS4yOS01LjI1LDI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uNzgsMCwxOS40Ni0uMjEsMjktLjY0QTQzOS4zMyw0MzkuMzMsMCwwLDEsMjU2LjgsMzg4LjE2Wm0xMjQuNTIsMjguNTljLTIuODYsMTUuNDQtOC42MSwyNS43NC0xNS43MiwyOS44Ni0xNS4xMyw4Ljc4LTQ3LjQ4LTIuNjMtODIuMzYtMzIuNzItNC0zLjQ0LTgtNy4xMy0xMi4wNy0xMWE0ODQuNTQsNDg0LjU0LDAsMCwwLDQwLjIzLTUxLjIsNDc3Ljg0LDQ3Ny44NCwwLDAsMCw2NS0xMC4wNXExLjQ3LDUuOTQsMi42LDExLjY0aDBDMzgzLjgxLDM3Ny41OCwzODQuNSwzOTkuNTYsMzgxLjMyLDQxNi43NVptMTcuNC0xMDIuNjRoMGMtMi42Mi44Ny01LjMyLDEuNzEtOC4wNiwyLjUzYTQ4My4yNiw0ODMuMjYsMCwwLDAtMjQuMzEtNjAuOTQsNDgxLjUyLDQ4MS41MiwwLDAsMCwyMy4zNi02MC4wNmM0LjkxLDEuNDMsOS42OCwyLjkzLDE0LjI3LDQuNTIsNDQuNDIsMTUuMzIsNzEuNTIsMzgsNzEuNTIsNTUuNDNDNDc1LjUsMjc0LjE5LDQ0Ni4yMywyOTguMzMsMzk4LjcyLDMxNC4xMVoiLz4KDTxwYXRoIGQ9Ik0yNTYsMjk4LjU1YTQzLDQzLDAsMSwwLTQyLjg2LTQzQTQyLjkxLDQyLjkxLDAsMCwwLDI1NiwyOTguNTVaIi8+Cg08L2c+Cg08L3N2Zz4=", }, "src/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { NorthStarThemeProvider } from "@aws-northstar/ui"; import React from "react"; import { createRoot } from "react-dom/client"; import { BrowserRouter } from "react-router-dom"; import Auth from "./components/Auth"; import RuntimeContextProvider from "./components/RuntimeContext"; import App from "./layouts/App"; createRoot(document.getElementById("root")!).render( ); ", "src/layouts/App/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { useCognitoAuthContext } from "@aws-northstar/ui"; import AppLayout from "@aws-northstar/ui/components/AppLayout"; import * as React from "react"; import { useEffect, useState } from "react"; import { NavItems } from "./navitems"; import Config from "../../config.json"; import Routes from "../Routes"; /** * Defines the App layout and contains logic for routing. */ const App: React.FC = () => { const [username, setUsername] = useState(); const [email, setEmail] = useState(); const { getAuthenticatedUser } = useCognitoAuthContext(); useEffect(() => { if (getAuthenticatedUser) { const authUser = getAuthenticatedUser(); setUsername(authUser?.getUsername()); authUser?.getSession(() => { authUser.getUserAttributes((_, attributes) => { setEmail(attributes?.find((a) => a.Name === "email")?.Value); }); }); } }, [getAuthenticatedUser, setUsername, setEmail]); return ( new Promise(() => { getAuthenticatedUser && getAuthenticatedUser()?.signOut(); window.location.href = "/"; }) } user={ username ? { username, email, } : undefined } > ); }; export default App; ", "src/layouts/App/navitems.ts": "import { SideNavigationProps } from "@cloudscape-design/components"; /** * Define your Navigation Items here */ export const NavItems: SideNavigationProps.Item[] = [ { text: "Home", type: "link", href: "/" }, ]; ", "src/layouts/Routes/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import * as React from "react"; import { Route, Routes as ReactRoutes } from "react-router-dom"; import Home from "../../pages/Home"; /** * Defines the Routes. */ const Routes: React.FC = () => { return ( } /> ); }; export default Routes; ", "src/pages/Home/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { Container, ContentLayout, Header, SpaceBetween, } from "@cloudscape-design/components"; /** * Component to render the home "/" route. */ const Home: React.FC = () => { return ( Home}> Welcome! ); }; export default Home; ", "src/react-app-env.d.ts": "/// ", "src/setupTests.ts": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ // jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import "@testing-library/jest-dom"; ", "tsconfig.dev.json": { "compilerOptions": { "allowJs": true, "allowSyntheticDefaultImports": true, "alwaysStrict": true, "declaration": true, "esModuleInterop": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, "inlineSourceMap": true, "inlineSources": true, "isolatedModules": true, "jsx": "react-jsx", "lib": [ "dom", "dom.iterable", "esnext", ], "module": "commonjs", "moduleResolution": "node", "noEmit": true, "noEmitOnError": false, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "resolveJsonModule": true, "skipLibCheck": true, "strict": true, "strictNullChecks": true, "strictPropertyInitialization": true, "stripInternal": true, "target": "es5", }, "exclude": [ "node_modules", ], "include": [ ".projenrc.js", "src/**/*.ts", "test/**/*.ts", "src", ], }, "tsconfig.json": { "compilerOptions": { "allowJs": true, "allowSyntheticDefaultImports": true, "alwaysStrict": true, "declaration": true, "esModuleInterop": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, "inlineSourceMap": true, "inlineSources": true, "isolatedModules": true, "jsx": "react-jsx", "lib": [ "dom", "dom.iterable", "esnext", ], "module": "commonjs", "moduleResolution": "node", "noEmit": true, "noEmitOnError": false, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "outDir": "lib", "resolveJsonModule": true, "rootDir": "src", "skipLibCheck": true, "strict": true, "strictNullChecks": true, "strictPropertyInitialization": true, "stripInternal": true, "target": "es5", }, "exclude": [], "include": [ "src/**/*.ts", "src", ], }, } `; exports[`CloudscapeReactTsWebsiteProject Unit Tests With TypeSafeApi - No Library 1`] = `"Cannot pass in a Type Safe Api without React Hooks Library configured!"`; exports[`CloudscapeReactTsWebsiteProject Unit Tests With TypeSafeApi 1`] = ` { ".eslintrc.json": { "env": { "jest": true, "node": true, }, "extends": [ "plugin:import/typescript", ], "ignorePatterns": [ "*.js", "*.d.ts", "node_modules/", "*.generated.ts", "coverage", ], "overrides": [], "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 2018, "project": "./tsconfig.dev.json", "sourceType": "module", }, "plugins": [ "@typescript-eslint", "import", ], "root": true, "rules": { "@typescript-eslint/indent": [ "error", 2, ], "@typescript-eslint/member-delimiter-style": [ "error", ], "@typescript-eslint/member-ordering": [ "error", { "default": [ "public-static-field", "public-static-method", "protected-static-field", "protected-static-method", "private-static-field", "private-static-method", "field", "constructor", "method", ], }, ], "@typescript-eslint/no-floating-promises": [ "error", ], "@typescript-eslint/no-require-imports": [ "error", ], "@typescript-eslint/no-shadow": [ "error", ], "@typescript-eslint/return-await": [ "error", ], "array-bracket-newline": [ "error", "consistent", ], "array-bracket-spacing": [ "error", "never", ], "brace-style": [ "error", "1tbs", { "allowSingleLine": true, }, ], "comma-dangle": [ "error", "always-multiline", ], "comma-spacing": [ "error", { "after": true, "before": false, }, ], "curly": [ "error", "multi-line", "consistent", ], "dot-notation": [ "error", ], "import/no-extraneous-dependencies": [ "error", { "devDependencies": [ "**/src/**/*.test.tsx", "**/src/setupTests.ts", ], "optionalDependencies": false, "peerDependencies": true, }, ], "import/no-unresolved": [ "error", ], "import/order": [ "warn", { "alphabetize": { "caseInsensitive": true, "order": "asc", }, "groups": [ "builtin", "external", ], }, ], "indent": [ "off", ], "key-spacing": [ "error", ], "keyword-spacing": [ "error", ], "max-len": [ "error", { "code": 150, "ignoreComments": true, "ignoreRegExpLiterals": true, "ignoreStrings": true, "ignoreTemplateLiterals": true, "ignoreUrls": true, }, ], "no-bitwise": [ "error", ], "no-duplicate-imports": [ "error", ], "no-multi-spaces": [ "error", { "ignoreEOLComments": false, }, ], "no-multiple-empty-lines": [ "error", ], "no-return-await": [ "off", ], "no-shadow": [ "off", ], "no-trailing-spaces": [ "error", ], "object-curly-newline": [ "error", { "consistent": true, "multiline": true, }, ], "object-curly-spacing": [ "error", "always", ], "object-property-newline": [ "error", { "allowAllPropertiesOnSameLine": true, }, ], "quote-props": [ "error", "consistent-as-needed", ], "quotes": [ "error", "single", { "avoidEscape": true, }, ], "semi": [ "error", "always", ], "space-before-blocks": [ "error", ], }, "settings": { "import/parsers": { "@typescript-eslint/parser": [ ".ts", ".tsx", ], }, "import/resolver": { "node": {}, "typescript": { "alwaysTryTypes": true, "project": "./tsconfig.dev.json", }, }, }, }, ".gitattributes": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.eslintrc.json linguist-generated /.gitattributes linguist-generated /.gitignore linguist-generated /.npmignore linguist-generated /.npmrc linguist-generated /.projen/** linguist-generated /.projen/deps.json linguist-generated /.projen/files.json linguist-generated /.projen/tasks.json linguist-generated /LICENSE linguist-generated /package.json linguist-generated /tsconfig.dev.json linguist-generated /tsconfig.json linguist-generated /yarn.lock linguist-generated", ".gitignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". !/.gitattributes !/.projen/tasks.json !/.projen/deps.json !/.projen/files.json !/package.json !/LICENSE !/.npmignore logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* lerna-debug.log* report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json pids *.pid *.seed *.pid.lock lib-cov coverage *.lcov .nyc_output build/Release node_modules/ jspm_packages/ *.tsbuildinfo .eslintcache *.tgz .yarn-integrity .cache runtime-config.json !/.projenrc.js !/.npmrc !/test/ !/tsconfig.json !/tsconfig.dev.json !/src/ /lib /dist/ !/.eslintrc.json /build/ ", ".npmignore": "# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". /.projen/ /test/ /tsconfig.dev.json /src/ !/lib/ !/lib/**/*.js !/lib/**/*.d.ts dist /tsconfig.json /.github/ /.vscode/ /.idea/ /.projenrc.js tsconfig.tsbuildinfo /.eslintrc.json /build/ ", ".projen/deps.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "dependencies": [ { "name": "@testing-library/jest-dom", "type": "build", }, { "name": "@testing-library/react", "type": "build", }, { "name": "@testing-library/user-event", "type": "build", }, { "name": "@types/jest", "type": "build", }, { "name": "@types/node", "type": "build", "version": "^16", }, { "name": "@types/react", "type": "build", }, { "name": "@types/react-dom", "type": "build", }, { "name": "@typescript-eslint/eslint-plugin", "type": "build", "version": "^5", }, { "name": "@typescript-eslint/parser", "type": "build", "version": "^5", }, { "name": "eslint-import-resolver-node", "type": "build", }, { "name": "eslint-import-resolver-typescript", "type": "build", }, { "name": "eslint-plugin-import", "type": "build", }, { "name": "eslint", "type": "build", "version": "^8", }, { "name": "npm-check-updates", "type": "build", "version": "^16", }, { "name": "projen", "type": "build", }, { "name": "typescript", "type": "build", "version": "^4.0.3", }, { "name": "@types/express-serve-static-core", "type": "override", "version": "4.17.30", }, { "name": "@types/express", "type": "override", "version": "4.17.13", }, { "name": "@aws-northstar/ui", "type": "runtime", }, { "name": "@cloudscape-design/components", "type": "runtime", }, { "name": "react", "type": "runtime", }, { "name": "react-dom", "type": "runtime", }, { "name": "react-router-dom", "type": "runtime", }, { "name": "react-scripts", "type": "runtime", "version": "^5", }, { "name": "testapi-typescript-react-query-hooks", "type": "runtime", }, { "name": "web-vitals", "type": "runtime", }, ], }, ".projen/files.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "files": [ ".eslintrc.json", ".gitattributes", ".gitignore", ".npmignore", ".npmrc", ".projen/deps.json", ".projen/files.json", ".projen/tasks.json", "LICENSE", "tsconfig.dev.json", "tsconfig.json", ], }, ".projen/tasks.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "env": { "DISABLE_ESLINT_PLUGIN": "true", "PATH": "$(npx -c "node --print process.env.PATH")", }, "tasks": { "build": { "description": "Full release build", "name": "build", "steps": [ { "spawn": "pre-compile", }, { "spawn": "compile", }, { "spawn": "post-compile", }, { "spawn": "test", }, { "spawn": "package", }, ], }, "compile": { "description": "Only compile", "name": "compile", "steps": [ { "exec": "react-scripts build", }, ], }, "default": { "description": "Synthesize project files", "name": "default", "steps": [ { "cwd": "../..", "exec": "npx projen default", }, ], }, "dev": { "description": "Starts the react application", "name": "dev", "steps": [ { "exec": "react-scripts start", }, ], }, "eslint": { "description": "Runs eslint against the codebase", "name": "eslint", "steps": [ { "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern src test build-tools", }, ], }, "install": { "description": "Install project dependencies and update lockfile (non-frozen)", "name": "install", "steps": [ { "exec": "yarn install --check-files", }, ], }, "install:ci": { "description": "Install project dependencies using frozen lockfile", "name": "install:ci", "steps": [ { "exec": "yarn install --check-files --frozen-lockfile", }, ], }, "package": { "description": "Creates the distribution package", "name": "package", }, "post-compile": { "description": "Runs after successful compilation", "name": "post-compile", }, "post-upgrade": { "description": "Runs after upgrading dependencies", "name": "post-upgrade", }, "pre-compile": { "description": "Prepare the project for compilation", "name": "pre-compile", }, "test": { "description": "Run tests", "name": "test", "steps": [ { "spawn": "eslint", }, { "exec": "react-scripts test --watchAll=false --passWithNoTests", }, ], }, "upgrade": { "description": "upgrade dependencies", "env": { "CI": "0", }, "name": "upgrade", "steps": [ { "exec": "yarn upgrade npm-check-updates", }, { "exec": "npm-check-updates --dep dev --upgrade --target=minor", }, { "exec": "npm-check-updates --dep optional --upgrade --target=minor", }, { "exec": "npm-check-updates --dep peer --upgrade --target=minor", }, { "exec": "npm-check-updates --dep prod --upgrade --target=minor", }, { "exec": "npm-check-updates --dep bundle --upgrade --target=minor", }, { "exec": "yarn install --check-files", }, { "exec": "yarn upgrade", }, { "exec": "npx projen", }, { "spawn": "post-upgrade", }, ], }, "watch": { "description": "Watch & compile in the background", "name": "watch", "steps": [ { "exec": "tsc --build -w", }, ], }, }, }, "LICENSE": " Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ", "README.md": "## Getting started To create a new [Cloudscape](https://cloudscape.design/) React Typescript Project, there are a couple of options: ### Via Projen CLI \`\`\` npx projen new --from @aws-prototyping-sdk/cloudscape-react-ts-website cloudscape-react-ts-website [--application-name ] \`\`\` ### Programmatically \`\`\`ts new CloudscapeReactTsWebsiteProject({ defaultReleaseBranch: "mainline", name: "", applicationName: "", }); \`\`\` ### Running your synthesized Application To run your synthesized application locally, run \`npx projen dev\`. ## Developer Notes To enable Cognito auth, ensure you have a runtime-config.json file in the root of your deployed project which at least contains the following: \`\`\`json { "region": "", "identityPoolId":"", "userPoolId":"", "userPoolWebClientId":"" } \`\`\` The easiest way to get this set up is to use the static-website + identity packages to deploy your website. An example of how to do this is as follows: \`\`\`ts const userIdentity = new UserIdentity(this, 'UserIdentity'); new StaticWebsite(this, 'StaticWebsite', { websiteContentPath: '////', runtimeOptions: { jsonPayload: { region: Stack.of(this).region, identityPoolId: userIdentity.identityPool.identityPoolId, userPoolId: userIdentity.userPool?.userPoolId, userPoolWebClientId: userIdentity.userPoolClient?.userPoolClientId, } }, }); \`\`\` For local development, you will need to copy the generated runtime-config.json file into your /public directory. An example on how to do this is as follows: \`\`\` curl https://dxxxxxxxxxx.cloudfront.net/runtime-config.json > public/runtime-config.json \`\`\`", "package.json": { "//": "~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".", "browserslist": { "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version", ], "production": [ ">0.2%", "not dead", "not op_mini all", ], }, "dependencies": { "@aws-northstar/ui": "*", "@cloudscape-design/components": "*", "react": "*", "react-dom": "*", "react-router-dom": "*", "react-scripts": "^5", "testapi-typescript-react-query-hooks": "*", "web-vitals": "*", }, "devDependencies": { "@testing-library/jest-dom": "*", "@testing-library/react": "*", "@testing-library/user-event": "*", "@types/jest": "*", "@types/node": "^16", "@types/react": "*", "@types/react-dom": "*", "@typescript-eslint/eslint-plugin": "^5", "@typescript-eslint/parser": "^5", "eslint": "^8", "eslint-import-resolver-node": "*", "eslint-import-resolver-typescript": "*", "eslint-plugin-import": "*", "npm-check-updates": "^16", "projen": "*", "typescript": "^4.0.3", }, "eslintConfig": { "extends": [ "react-app", "react-app/jest", ], }, "license": "Apache-2.0", "name": "WithAPI", "resolutions": { "@types/express": "4.17.13", "@types/express-serve-static-core": "4.17.30", }, "scripts": { "build": "npx projen build", "compile": "npx projen compile", "default": "npx projen default", "dev": "npx projen dev", "eslint": "npx projen eslint", "package": "npx projen package", "post-compile": "npx projen post-compile", "post-upgrade": "npx projen post-upgrade", "pre-compile": "npx projen pre-compile", "projen": "npx projen", "test": "npx projen test", "upgrade": "npx projen upgrade", "watch": "npx projen watch", }, "version": "0.0.0", }, "public/index.html": " WithAPI
", "public/robots.txt": "# https://www.robotstxt.org/robotstxt.html User-agent: * Disallow: ", "src/components/Auth/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { CognitoAuth } from "@aws-northstar/ui"; import React, { useContext } from "react"; import Config from "../../config.json"; import { RuntimeConfigContext } from "../RuntimeContext"; /** * Sets up the runtimeContext and Cognito auth. * * This assumes a runtime-config.json file is present at '/'. In order for Auth to be set up automatically, * the runtime-config.json must have the following properties configured: [region, userPoolId, userPoolWebClientId, identityPoolId]. */ const Auth: React.FC = ({ children }) => { const runtimeContext = useContext(RuntimeConfigContext); return runtimeContext?.userPoolId && runtimeContext?.userPoolWebClientId && runtimeContext?.region && runtimeContext?.identityPoolId ? ( {children} ) : ( <> ); }; export default Auth; ", "src/components/DefaultApi/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { DefaultApiClientProvider as DefaultApiClientProvider_ } from "testapi-typescript-react-query-hooks"; import React from "react"; import { useDefaultApiClient } from "../../hooks/useDefaultApiClient"; /** * Sets up the runtimeContext and Cognito auth. * * This assumes a runtime-config.json file is present at '/'. In order for Auth to be set up automatically, * the runtime-config.json must have the following properties configured: [region, userPoolId, userPoolWebClientId, identityPoolId]. */ const DefaultApiClientProvider: React.FC = ({ children }) => { const client = useDefaultApiClient(); return client ? ( {children} ) : ( <> ); }; export default DefaultApiClientProvider; ", "src/components/RuntimeContext/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import ErrorMessage from "@aws-northstar/ui/components/CognitoAuth/components/ErrorMessage"; import React, { createContext, useEffect, useState } from "react"; export interface RuntimeContext { readonly region: string; readonly userPoolId: string; readonly userPoolWebClientId: string; readonly identityPoolId: string; readonly [additionalProps: string]: string; } /** * Context for storing the runtimeContext. */ export const RuntimeConfigContext = createContext( undefined ); const RuntimeContextProvider: React.FC = ({ children }) => { const [runtimeContext, setRuntimeContext] = useState< RuntimeContext | undefined >(); const [error, setError] = useState(); useEffect(() => { fetch("/runtime-config.json") .then((response) => { return response.json(); }) .then((runtimeCtx) => { if ( runtimeCtx.region && runtimeCtx.userPoolId && runtimeCtx.userPoolWebClientId && runtimeCtx.identityPoolId ) { setRuntimeContext(runtimeCtx as RuntimeContext); } else { setError( "runtime-config.json should have region, userPoolId, userPoolWebClientId & identityPoolId." ); } }) .catch(() => { setError("No runtime-config.json detected"); }); }, [setRuntimeContext]); return error ? ( {error} ) : ( {children} ); }; export default RuntimeContextProvider; ", "src/config.json": { "applicationName": "WithAPI", "logo": "data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KDTwhLS0gVXBsb2FkZWQgdG86IFNWRyBSZXBvLCB3d3cuc3ZncmVwby5jb20sIFRyYW5zZm9ybWVkIGJ5OiBTVkcgUmVwbyBNaXhlciBUb29sc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yLjkzLDE0LjI3LDQuNTIsNDQuNDIsMTUuMzIsNzEuNTIsMzgsNzEuNTIsNTUuNDNDNDc1LjUsMjc0LjE5LDQ0Ni4yMywyOTguMzMsMzk4LjcyLDMxNC4xMVoiLz4KDTxwYXRoIGQ9Ik0yNTYsMjk4LjU1YTQzLDQzLDAsMSwwLTQyLjg2LTQzQTQyLjkxLDQyLjkxLDAsMCwwLDI1NiwyOTguNTVaIi8+Cg08L2c+Cg08L3N2Zz4=", }, "src/hooks/useDefaultApiClient.ts": "import useSigV4Client from "@aws-northstar/ui/components/CognitoAuth/hooks/useSigv4Client"; import { DefaultApi, Configuration } from "testapi-typescript-react-query-hooks"; import { useContext, useMemo } from "react"; import { RuntimeConfigContext } from "../components/RuntimeContext"; export const useDefaultApiClient = () => { const client = useSigV4Client(); const runtimeContext = useContext(RuntimeConfigContext); return useMemo(() => { return runtimeContext?.apiUrl ? new DefaultApi( new Configuration({ basePath: runtimeContext.apiUrl, fetchApi: client, }) ) : undefined; }, [client, runtimeContext?.apiUrl]); }; ", "src/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { NorthStarThemeProvider } from "@aws-northstar/ui"; import React from "react"; import { createRoot } from "react-dom/client"; import { BrowserRouter } from "react-router-dom"; import Auth from "./components/Auth"; import DefaultApiClientProvider from "./components/DefaultApi"; import RuntimeContextProvider from "./components/RuntimeContext"; import App from "./layouts/App"; createRoot(document.getElementById("root")!).render( ); ", "src/layouts/App/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { useCognitoAuthContext } from "@aws-northstar/ui"; import AppLayout from "@aws-northstar/ui/components/AppLayout"; import * as React from "react"; import { useEffect, useState } from "react"; import { NavItems } from "./navitems"; import Config from "../../config.json"; import Routes from "../Routes"; /** * Defines the App layout and contains logic for routing. */ const App: React.FC = () => { const [username, setUsername] = useState(); const [email, setEmail] = useState(); const { getAuthenticatedUser } = useCognitoAuthContext(); useEffect(() => { if (getAuthenticatedUser) { const authUser = getAuthenticatedUser(); setUsername(authUser?.getUsername()); authUser?.getSession(() => { authUser.getUserAttributes((_, attributes) => { setEmail(attributes?.find((a) => a.Name === "email")?.Value); }); }); } }, [getAuthenticatedUser, setUsername, setEmail]); return ( new Promise(() => { getAuthenticatedUser && getAuthenticatedUser()?.signOut(); window.location.href = "/"; }) } user={ username ? { username, email, } : undefined } > ); }; export default App; ", "src/layouts/App/navitems.ts": "import { SideNavigationProps } from "@cloudscape-design/components"; /** * Define your Navigation Items here */ export const NavItems: SideNavigationProps.Item[] = [ { text: "Home", type: "link", href: "/" }, ]; ", "src/layouts/Routes/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import * as React from "react"; import { Route, Routes as ReactRoutes } from "react-router-dom"; import Home from "../../pages/Home"; /** * Defines the Routes. */ const Routes: React.FC = () => { return ( } /> ); }; export default Routes; ", "src/pages/Home/index.tsx": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ import { Container, ContentLayout, Header, SpaceBetween, Spinner, } from "@cloudscape-design/components"; import { useSayHello } from "testapi-typescript-react-query-hooks"; /** * Component to render the home "/" route. */ const Home: React.FC = () => { const sayHello = useSayHello({ name: "World" }); return ( Home}> {sayHello.isLoading ? : <>{sayHello.data?.message}} ); }; export default Home; ", "src/react-app-env.d.ts": "/// ", "src/setupTests.ts": "/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ // jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom import "@testing-library/jest-dom"; ", "tsconfig.dev.json": { "compilerOptions": { "allowJs": true, "allowSyntheticDefaultImports": true, "alwaysStrict": true, "declaration": true, "esModuleInterop": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, "inlineSourceMap": true, "inlineSources": true, "isolatedModules": true, "jsx": "react-jsx", "lib": [ "dom", "dom.iterable", "esnext", ], "module": "commonjs", "moduleResolution": "node", "noEmit": true, "noEmitOnError": false, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "resolveJsonModule": true, "skipLibCheck": true, "strict": true, "strictNullChecks": true, "strictPropertyInitialization": true, "stripInternal": true, "target": "es5", }, "exclude": [ "node_modules", ], "include": [ ".projenrc.js", "src/**/*.ts", "test/**/*.ts", "src", ], }, "tsconfig.json": { "compilerOptions": { "allowJs": true, "allowSyntheticDefaultImports": true, "alwaysStrict": true, "declaration": true, "esModuleInterop": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, "inlineSourceMap": true, "inlineSources": true, "isolatedModules": true, "jsx": "react-jsx", "lib": [ "dom", "dom.iterable", "esnext", ], "module": "commonjs", "moduleResolution": "node", "noEmit": true, "noEmitOnError": false, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "outDir": "lib", "resolveJsonModule": true, "rootDir": "src", "skipLibCheck": true, "strict": true, "strictNullChecks": true, "strictPropertyInitialization": true, "stripInternal": true, "target": "es5", }, "exclude": [], "include": [ "src/**/*.ts", "src", ], }, } `;