From de95ba96bcaa9b29117b96e425d3f1d7cd132e7b Mon Sep 17 00:00:00 2001 From: javacs3 Date: Sat, 27 Nov 2021 15:04:57 +0800 Subject: [PATCH 1/2] chore: upgrade projen --- .eslintrc.json | 5 +- .gitattributes | 41 ++- .github/workflows/build.yml | 4 +- .github/workflows/pull-request-lint.yml | 28 ++ .github/workflows/release.yml | 19 +- .../{upgrade-projen.yml => upgrade-main.yml} | 42 ++- .github/workflows/upgrade.yml | 101 ------ .gitignore | 9 +- .npmignore | 3 +- .projen/tasks.json | 314 +++++++++--------- .projenrc.js | 8 +- package.json | 32 +- tsconfig.eslint.json | 35 -- tsconfig.jest.json | 35 -- yarn.lock | 38 +-- 15 files changed, 280 insertions(+), 434 deletions(-) create mode 100644 .github/workflows/pull-request-lint.yml rename .github/workflows/{upgrade-projen.yml => upgrade-main.yml} (71%) delete mode 100644 .github/workflows/upgrade.yml delete mode 100644 tsconfig.eslint.json delete mode 100644 tsconfig.jest.json diff --git a/.eslintrc.json b/.eslintrc.json index af1765b5..f7cd2255 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,7 +12,7 @@ "parserOptions": { "ecmaVersion": 2018, "sourceType": "module", - "project": "./tsconfig.eslint.json" + "project": "./tsconfig.dev.json" }, "extends": [ "plugin:import/typescript" @@ -27,7 +27,8 @@ "import/resolver": { "node": {}, "typescript": { - "project": "./tsconfig.eslint.json" + "project": "./tsconfig.dev.json", + "alwaysTryTypes": true } } }, diff --git a/.gitattributes b/.gitattributes index 59c04ecc..1a28d43c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,23 +1,22 @@ # ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -*.snap linguist-generated -/.eslintrc.json linguist-generated -/.gitattributes linguist-generated -/.github/pull_request_template.md linguist-generated -/.github/workflows/auto-approve.yml linguist-generated -/.github/workflows/build.yml linguist-generated -/.github/workflows/release.yml linguist-generated -/.github/workflows/stale.yml linguist-generated -/.github/workflows/upgrade-projen.yml linguist-generated -/.github/workflows/upgrade.yml linguist-generated -/.gitignore linguist-generated -/.mergify.yml linguist-generated -/.npmignore linguist-generated -/.projen/** linguist-generated -/.projen/deps.json linguist-generated -/.projen/tasks.json linguist-generated -/LICENSE linguist-generated -/package.json linguist-generated -/tsconfig.eslint.json linguist-generated -/tsconfig.jest.json linguist-generated -/yarn.lock linguist-generated \ No newline at end of file +*.snap linguist-generated +/.eslintrc.json linguist-generated +/.gitattributes linguist-generated +/.github/pull_request_template.md linguist-generated +/.github/workflows/auto-approve.yml linguist-generated +/.github/workflows/build.yml linguist-generated +/.github/workflows/pull-request-lint.yml linguist-generated +/.github/workflows/release.yml linguist-generated +/.github/workflows/stale.yml linguist-generated +/.github/workflows/upgrade-main.yml linguist-generated +/.gitignore linguist-generated +/.mergify.yml linguist-generated +/.npmignore linguist-generated +/.projen/** linguist-generated +/.projen/deps.json linguist-generated +/.projen/tasks.json linguist-generated +/LICENSE linguist-generated +/package.json linguist-generated +/tsconfig.dev.json linguist-generated +/yarn.lock linguist-generated \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 257b26ae..621ce960 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} - name: Set git identity run: |- - git config user.name "Automation" + git config user.name "github-actions" git config user.email "github-actions@github.com" - name: Install dependencies run: yarn install --check-files --frozen-lockfile @@ -48,4 +48,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} container: - image: jsii/superchain:node14 + image: jsii/superchain:1-buster-slim diff --git a/.github/workflows/pull-request-lint.yml b/.github/workflows/pull-request-lint.yml new file mode 100644 index 00000000..2945378d --- /dev/null +++ b/.github/workflows/pull-request-lint.yml @@ -0,0 +1,28 @@ +# ~~ 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@v3.4.6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: |- + feat + fix + chore + requireScope: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 285c3d84..31c04ca3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,7 @@ jobs: fetch-depth: 0 - name: Set git identity run: |- - git config user.name "Automation" + git config user.name "github-actions" git config user.email "github-actions@github.com" - name: Install dependencies run: yarn install --check-files --frozen-lockfile @@ -39,7 +39,7 @@ jobs: name: dist path: dist container: - image: jsii/superchain:node14 + image: jsii/superchain:1-buster-slim release_github: name: Publish to GitHub Releases needs: release @@ -54,14 +54,15 @@ jobs: name: dist path: dist - name: Release - run: errout=$(mktemp); gh release create v$(cat dist/version.txt) -R - $GITHUB_REPOSITORY -F dist/changelog.md -t v$(cat dist/version.txt) 2> - $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q - "Release.tag_name already exists" $errout; then cat $errout; exit - $exitcode; fi + run: errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R + $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) + --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode + -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then + cat $errout; exit $exitcode; fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_REF: ${{ github.ref }} release_npm: name: Publish to npm needs: release @@ -82,7 +83,7 @@ jobs: NPM_REGISTRY: registry.npmjs.org NPM_TOKEN: ${{ secrets.NPM_TOKEN }} container: - image: jsii/superchain:node14 + image: jsii/superchain:1-buster-slim-node14 release_pypi: name: Publish to PyPI needs: release @@ -102,7 +103,7 @@ jobs: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} container: - image: jsii/superchain:node14 + image: jsii/superchain:1-buster-slim-node14 release_prebuilt_lambda: name: Publish Lambda to GitHub Releases needs: release diff --git a/.github/workflows/upgrade-projen.yml b/.github/workflows/upgrade-main.yml similarity index 71% rename from .github/workflows/upgrade-projen.yml rename to .github/workflows/upgrade-main.yml index d0cfc22f..f1f0c5dd 100644 --- a/.github/workflows/upgrade-projen.yml +++ b/.github/workflows/upgrade-main.yml @@ -1,10 +1,10 @@ # ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". -name: upgrade-projen +name: upgrade-main on: workflow_dispatch: {} schedule: - - cron: 0 6 * * * + - cron: 0 0 * * * jobs: upgrade: name: Upgrade @@ -16,10 +16,16 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + ref: main + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" - name: Install dependencies run: yarn install --check-files --frozen-lockfile - name: Upgrade dependencies - run: npx projen upgrade-projen + run: npx projen upgrade - name: Build id: build run: npx projen build && echo "::set-output name=conclusion::success" || echo @@ -34,7 +40,7 @@ jobs: name: .upgrade.tmp.patch path: .upgrade.tmp.patch container: - image: jsii/superchain:node14 + image: jsii/superchain:1-buster-slim pr: name: Create Pull Request needs: upgrade @@ -46,6 +52,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + ref: main + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" - name: Download patch uses: actions/download-artifact@v2 with: @@ -60,7 +72,7 @@ jobs: with: token: ${{ secrets.AUTOMATION }} commit-message: >- - chore(deps): upgrade projen + chore(deps): upgrade dependencies Upgrades project dependencies. See details in [workflow run]. @@ -72,9 +84,10 @@ jobs: ------ - *Automatically created by projen via the "upgrade-projen" workflow* - branch: github-actions/upgrade-projen - title: "chore(deps): upgrade projen" + *Automatically created by projen via the "upgrade-main" workflow* + branch: github-actions/upgrade-main + title: "chore(deps): upgrade dependencies" + labels: auto-approve body: >- Upgrades project dependencies. See details in [workflow run]. @@ -85,18 +98,19 @@ jobs: ------ - *Automatically created by projen via the "upgrade-projen" workflow* - author: Automation - committer: Automation + *Automatically created by projen via the "upgrade-main" workflow* + author: github-actions + committer: github-actions + signoff: true - name: Update status check if: steps.create-pr.outputs.pull-request-url != '' run: "curl -i --fail -X POST -H \"Accept: application/vnd.github.v3+json\" -H \"Authorization: token ${GITHUB_TOKEN}\" https://api.github.com/repos/${{ github.repository }}/check-runs -d - '{\"name\":\"build\",\"head_sha\":\"github-actions/upgrade-projen\",\ - \"status\":\"completed\",\"conclusion\":\"${{ + '{\"name\":\"build\",\"head_sha\":\"github-actions/upgrade-main\",\"s\ + tatus\":\"completed\",\"conclusion\":\"${{ needs.upgrade.outputs.conclusion }}\",\"output\":{\"title\":\"Created - via the upgrade-projen workflow.\",\"summary\":\"Action run URL: + via the upgrade-main workflow.\",\"summary\":\"Action run URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}}'" env: diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml deleted file mode 100644 index 6519aa35..00000000 --- a/.github/workflows/upgrade.yml +++ /dev/null @@ -1,101 +0,0 @@ -# ~~ 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: - conclusion: ${{ steps.build.outputs.conclusion }} - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Install dependencies - run: yarn install --check-files --frozen-lockfile - - name: Upgrade dependencies - run: npx projen upgrade - - name: Build - id: build - run: npx projen build && echo "::set-output name=conclusion::success" || echo - "::set-output name=conclusion::failure" - - name: Create Patch - run: |- - git add . - git diff --patch --staged > .upgrade.tmp.patch - - name: Upload patch - uses: actions/upload-artifact@v2 - with: - name: .upgrade.tmp.patch - path: .upgrade.tmp.patch - pr: - name: Create Pull Request - needs: upgrade - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - checks: write - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Download patch - uses: actions/download-artifact@v2 - with: - name: .upgrade.tmp.patch - path: ${{ runner.temp }} - - name: Apply patch - run: '[ -s ${{ runner.temp }}/.upgrade.tmp.patch ] && git apply ${{ runner.temp - }}/.upgrade.tmp.patch || echo "Empty patch. Skipping."' - - name: Create Pull Request - id: create-pr - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.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" - labels: auto-approve,auto-merge - 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: Automation - committer: Automation - - name: Update status check - if: steps.create-pr.outputs.pull-request-url != '' - run: "curl -i --fail -X POST -H \"Accept: application/vnd.github.v3+json\" -H - \"Authorization: token ${GITHUB_TOKEN}\" - https://api.github.com/repos/${{ github.repository }}/check-runs -d - '{\"name\":\"build\",\"head_sha\":\"github-actions/upgrade\",\"status\ - \":\"completed\",\"conclusion\":\"${{ needs.upgrade.outputs.conclusion - }}\",\"output\":{\"title\":\"Created via the upgrade - workflow.\",\"summary\":\"Action run URL: https://github.com/${{ - github.repository }}/actions/runs/${{ github.run_id }}\"}}'" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 515210ea..dfd775c1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ !/.gitattributes !/.projen/tasks.json !/.projen/deps.json +!/.github/workflows/pull-request-lint.yml !/.github/workflows/auto-approve.yml !/.github/workflows/stale.yml !/package.json @@ -38,18 +39,16 @@ junit.xml !/.github/workflows/build.yml /dist/changelog.md /dist/version.txt +!/.github/workflows/release.yml !/.mergify.yml -!/.github/workflows/upgrade.yml -!/.github/workflows/upgrade-projen.yml !/.github/pull_request_template.md !/test/ +!/tsconfig.dev.json !/src/ /lib /dist/ -!/tsconfig.jest.json !/.eslintrc.json -!/tsconfig.eslint.json .jsii tsconfig.json !/API.md -!/.github/workflows/release.yml +!/.github/workflows/upgrade-main.yml diff --git a/.npmignore b/.npmignore index 0faff61c..3a01ae6c 100644 --- a/.npmignore +++ b/.npmignore @@ -8,6 +8,7 @@ junit.xml /dist/version.txt /.mergify.yml /test/ +/tsconfig.dev.json /src/ !/lib/ !/lib/**/*.js @@ -19,7 +20,5 @@ dist /.idea/ /.projenrc.js tsconfig.tsbuildinfo -/tsconfig.jest.json /.eslintrc.json -/tsconfig.eslint.json !.jsii diff --git a/.projen/tasks.json b/.projen/tasks.json index 8ffc35de..bc5f3548 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -1,5 +1,45 @@ { "tasks": { + "build": { + "name": "build", + "description": "Full release build", + "steps": [ + { + "spawn": "default" + }, + { + "spawn": "pre-compile" + }, + { + "spawn": "compile" + }, + { + "spawn": "post-compile" + }, + { + "spawn": "test" + }, + { + "spawn": "package" + } + ] + }, + "bump": { + "name": "bump", + "description": "Bumps version based on latest git tag and generates a changelog entry", + "env": { + "OUTFILE": "package.json", + "CHANGELOG": "dist/changelog.md", + "BUMPFILE": "dist/version.txt", + "RELEASETAG": "dist/releasetag.txt" + }, + "steps": [ + { + "builtin": "release/bump-version" + } + ], + "condition": "! git log --oneline -1 | grep -q \"chore(release):\"" + }, "clobber": { "name": "clobber", "description": "hard resets to HEAD of origin and cleans the local repo", @@ -32,268 +72,224 @@ ], "condition": "git diff --exit-code > /dev/null" }, - "compile": { - "name": "compile", - "description": "Only compile", + "compat": { + "name": "compat", + "description": "Perform API compatibility check against latest version", "steps": [ { - "exec": "jsii --silence-warnings=reserved-word --no-fix-peer-dependencies" - }, - { - "spawn": "docgen" + "exec": "jsii-diff npm:$(node -p \"require('./package.json').name\") -k --ignore-file .compatignore || (echo \"\nUNEXPECTED BREAKING CHANGES: add keys such as 'removed:constructs.Node.of' to .compatignore to skip.\n\" && exit 1)" } ] }, - "test:compile": { - "name": "test:compile", - "description": "compiles the test code", + "compile": { + "name": "compile", + "description": "Only compile", "steps": [ { - "exec": "tsc --noEmit --project tsconfig.jest.json" + "exec": "jsii --silence-warnings=reserved-word --no-fix-peer-dependencies" } ] }, - "test": { - "name": "test", - "description": "Run tests", + "default": { + "name": "default", + "description": "Synthesize project files", "steps": [ { - "exec": "rm -fr lib/" - }, - { - "spawn": "test:compile" - }, - { - "exec": "jest --passWithNoTests --all --updateSnapshot" - }, - { - "spawn": "eslint" + "exec": "node .projenrc.js" } ] }, - "build": { - "name": "build", - "description": "Full release build (test+compile)", + "docgen": { + "name": "docgen", + "description": "Generate API.md from .jsii manifest", "steps": [ { - "exec": "npx projen" - }, - { - "spawn": "test" - }, - { - "spawn": "compile" - }, - { - "spawn": "package" + "exec": "jsii-docgen" } ] }, - "test:watch": { - "name": "test:watch", - "description": "Run jest in watch mode", + "eslint": { + "name": "eslint", + "description": "Runs eslint against the codebase", "steps": [ { - "exec": "jest --watch" + "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern src test build-tools .projenrc.js" } ] }, - "test:update": { - "name": "test:update", - "description": "Update jest snapshots", + "package": { + "name": "package", + "description": "Creates the distribution package", "steps": [ { - "exec": "jest --updateSnapshot" + "exec": "jsii-pacmak" } ] }, - "bump": { - "name": "bump", - "description": "Bumps version based on latest git tag and generates a changelog entry", - "env": { - "OUTFILE": "package.json", - "CHANGELOG": "dist/changelog.md", - "BUMPFILE": "dist/version.txt" - }, + "post-compile": { + "name": "post-compile", + "description": "Runs after successful compilation", "steps": [ { - "builtin": "release/bump-version" - } - ], - "condition": "! git log --oneline -1 | grep -q \"chore(release):\"" - }, - "unbump": { - "name": "unbump", - "description": "Restores version to 0.0.0", - "env": { - "OUTFILE": "package.json", - "CHANGELOG": "dist/changelog.md", - "BUMPFILE": "dist/version.txt" - }, - "steps": [ - { - "builtin": "release/reset-version" + "spawn": "docgen" } ] }, + "pre-compile": { + "name": "pre-compile", + "description": "Prepare the project for compilation" + }, "publish:github": { "name": "publish:github", "description": "Publish this package to GitHub Releases", "requiredEnv": [ "GITHUB_TOKEN", - "GITHUB_REPOSITORY" + "GITHUB_REPOSITORY", + "GITHUB_REF" ], "steps": [ { - "exec": "errout=$(mktemp); gh release create v$(cat dist/version.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t v$(cat dist/version.txt) 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \"Release.tag_name already exists\" $errout; then cat $errout; exit $exitcode; fi" + "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \"Release.tag_name already exists\" $errout; then cat $errout; exit $exitcode; fi" } ] }, - "upgrade": { - "name": "upgrade", - "description": "upgrade dependencies", + "publish:npm": { + "name": "publish:npm", + "description": "Publish this package to npm", "env": { - "CI": "0" + "NPM_DIST_TAG": "latest", + "NPM_REGISTRY": "registry.npmjs.org" }, + "requiredEnv": [ + "NPM_TOKEN" + ], "steps": [ { - "exec": "npm-check-updates --upgrade --target=minor --reject='projen'" - }, - { - "exec": "yarn install --check-files" - }, - { - "exec": "yarn upgrade @aws-cdk/assert @aws-cdk/aws-ecr @aws-cdk/aws-ecr-assets @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint eslint-import-resolver-node eslint-import-resolver-typescript eslint-plugin-import jest jest-junit jsii jsii-diff jsii-docgen jsii-pacmak json-schema npm-check-updates standard-version ts-jest typescript got @aws-cdk/aws-ec2 @aws-cdk/aws-iam @aws-cdk/aws-lambda @aws-cdk/core constructs @aws-cdk/aws-ec2 @aws-cdk/aws-iam @aws-cdk/aws-lambda @aws-cdk/core got" - }, + "exec": "npx -p jsii-release@latest jsii-release-npm" + } + ] + }, + "publish:pypi": { + "name": "publish:pypi", + "description": "Publish this package to PyPI", + "requiredEnv": [ + "TWINE_USERNAME", + "TWINE_PASSWORD" + ], + "steps": [ { - "exec": "npx projen" + "exec": "npx -p jsii-release@latest jsii-release-pypi" } ] }, - "upgrade-projen": { - "name": "upgrade-projen", - "description": "upgrade projen", + "release": { + "name": "release", + "description": "Prepare a release from \"main\" branch", "env": { - "CI": "0" + "RELEASE": "true" }, "steps": [ { - "exec": "npm-check-updates --upgrade --target=minor --filter='projen'" + "exec": "rm -fr dist" }, { - "exec": "yarn install --check-files" + "spawn": "bump" }, { - "exec": "yarn upgrade projen" + "spawn": "build" }, { - "exec": "npx projen" - } - ] - }, - "default": { - "name": "default", - "steps": [ + "spawn": "unbump" + }, { - "exec": "node .projenrc.js" + "exec": "git diff --ignore-space-at-eol --exit-code" } ] }, - "watch": { - "name": "watch", - "description": "Watch & compile in the background", + "test": { + "name": "test", + "description": "Run tests", "steps": [ { - "exec": "jsii -w --silence-warnings=reserved-word --no-fix-peer-dependencies" - } - ] - }, - "package": { - "name": "package", - "description": "Create an npm tarball", - "steps": [ + "exec": "jest --passWithNoTests --all --updateSnapshot" + }, { - "exec": "jsii-pacmak" + "spawn": "eslint" } ] }, - "eslint": { - "name": "eslint", - "description": "Runs eslint against the codebase", + "test:update": { + "name": "test:update", + "description": "Update jest snapshots", "steps": [ { - "exec": "eslint --ext .ts,.tsx --fix --no-error-on-unmatched-pattern src test build-tools .projenrc.js" + "exec": "jest --updateSnapshot" } ] }, - "compat": { - "name": "compat", - "description": "Perform API compatibility check against latest version", + "test:watch": { + "name": "test:watch", + "description": "Run jest in watch mode", "steps": [ { - "exec": "jsii-diff npm:$(node -p \"require('./package.json').name\") -k --ignore-file .compatignore || (echo \"\nUNEXPECTED BREAKING CHANGES: add keys such as 'removed:constructs.Node.of' to .compatignore to skip.\n\" && exit 1)" + "exec": "jest --watch" } ] }, - "publish:npm": { - "name": "publish:npm", - "description": "Publish this package to npm", + "unbump": { + "name": "unbump", + "description": "Restores version to 0.0.0", "env": { - "NPM_DIST_TAG": "latest", - "NPM_REGISTRY": "registry.npmjs.org" + "OUTFILE": "package.json", + "CHANGELOG": "dist/changelog.md", + "BUMPFILE": "dist/version.txt", + "RELEASETAG": "dist/releasetag.txt" }, - "requiredEnv": [ - "NPM_TOKEN" - ], - "steps": [ - { - "exec": "npx -p jsii-release@latest jsii-release-npm" - } - ] - }, - "publish:pypi": { - "name": "publish:pypi", - "description": "Publish this package to PyPI", - "requiredEnv": [ - "TWINE_USERNAME", - "TWINE_PASSWORD" - ], "steps": [ { - "exec": "npx -p jsii-release@latest jsii-release-pypi" - } - ] - }, - "docgen": { - "name": "docgen", - "description": "Generate API.md from .jsii manifest", - "steps": [ - { - "exec": "jsii-docgen" + "builtin": "release/reset-version" } ] }, - "release": { - "name": "release", - "description": "Prepare a release from \"main\" branch", + "upgrade": { + "name": "upgrade", + "description": "upgrade dependencies", "env": { - "RELEASE": "true" + "CI": "0" }, "steps": [ { - "exec": "rm -fr dist" + "exec": "npm-check-updates --dep dev --upgrade --target=minor" }, { - "spawn": "bump" + "exec": "npm-check-updates --dep optional --upgrade --target=minor" }, { - "spawn": "build" + "exec": "npm-check-updates --dep peer --upgrade --target=minor" }, { - "spawn": "unbump" + "exec": "npm-check-updates --dep prod --upgrade --target=minor" }, { - "exec": "git diff --ignore-space-at-eol --exit-code" + "exec": "npm-check-updates --dep bundle --upgrade --target=minor" + }, + { + "exec": "yarn install --check-files" + }, + { + "exec": "yarn upgrade" + }, + { + "exec": "npx projen" + } + ] + }, + "watch": { + "name": "watch", + "description": "Watch & compile in the background", + "steps": [ + { + "exec": "jsii -w --silence-warnings=reserved-word --no-fix-peer-dependencies" } ] } diff --git a/.projenrc.js b/.projenrc.js index 5e432bb9..07d37fa2 100644 --- a/.projenrc.js +++ b/.projenrc.js @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 -const { AwsCdkConstructLibrary, DependenciesUpgradeMechanism } = require('projen'); +const { AwsCdkConstructLibrary } = require('projen'); const project = new AwsCdkConstructLibrary({ author: 'wchaws', @@ -16,11 +16,7 @@ const project = new AwsCdkConstructLibrary({ allowedUsernames: ['dependabot[bot]'], }, autoApproveUpgrades: true, - depsUpgrade: DependenciesUpgradeMechanism.githubWorkflow({ - workflowOptions: { - labels: ['auto-approve', 'auto-merge'], - }, - }), + depsUpgrade: true, publishToPypi: { distName: 'cdk-ecr-deployment', module: 'cdk_ecr_deployment', diff --git a/package.json b/package.json index 4f78c25d..4619ae66 100644 --- a/package.json +++ b/package.json @@ -6,27 +6,27 @@ "url": "https://github.com/cdklabs/cdk-ecr-deployment" }, "scripts": { - "clobber": "npx projen clobber", - "compile": "npx projen compile", - "test:compile": "npx projen test:compile", - "test": "npx projen test", "build": "npx projen build", - "test:watch": "npx projen test:watch", - "test:update": "npx projen test:update", "bump": "npx projen bump", - "unbump": "npx projen unbump", - "publish:github": "npx projen publish:github", - "upgrade": "npx projen upgrade", - "upgrade-projen": "npx projen upgrade-projen", + "clobber": "npx projen clobber", + "compat": "npx projen compat", + "compile": "npx projen compile", "default": "npx projen default", - "watch": "npx projen watch", - "package": "npx projen package", + "docgen": "npx projen docgen", "eslint": "npx projen eslint", - "compat": "npx projen compat", + "package": "npx projen package", + "post-compile": "npx projen post-compile", + "pre-compile": "npx projen pre-compile", + "publish:github": "npx projen publish:github", "publish:npm": "npx projen publish:npm", "publish:pypi": "npx projen publish:pypi", - "docgen": "npx projen docgen", "release": "npx projen release", + "test": "npx projen test", + "test:update": "npx projen test:update", + "test:watch": "npx projen test:watch", + "unbump": "npx projen unbump", + "upgrade": "npx projen upgrade", + "watch": "npx projen watch", "projen": "npx projen" }, "author": { @@ -53,7 +53,7 @@ "jsii-pacmak": "^1.39.0", "json-schema": "^0.3.0", "npm-check-updates": "^11", - "projen": "^0.28.0", + "projen": "^0.34.23", "standard-version": "^9", "ts-jest": "^27.0.7", "typescript": "^4.4.4" @@ -116,7 +116,7 @@ "preset": "ts-jest", "globals": { "ts-jest": { - "tsconfig": "tsconfig.jest.json" + "tsconfig": "tsconfig.dev.json" } } }, diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json deleted file mode 100644 index 06833d13..00000000 --- a/tsconfig.eslint.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "declaration": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "inlineSources": true, - "lib": [ - "es2018" - ], - "module": "CommonJS", - "noEmitOnError": false, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "resolveJsonModule": true, - "strict": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "stripInternal": true, - "target": "ES2018" - }, - "include": [ - ".projenrc.js", - "src/**/*.ts", - "test/**/*.ts" - ], - "exclude": [ - "node_modules" - ], - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." -} diff --git a/tsconfig.jest.json b/tsconfig.jest.json deleted file mode 100644 index 06833d13..00000000 --- a/tsconfig.jest.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "declaration": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "inlineSources": true, - "lib": [ - "es2018" - ], - "module": "CommonJS", - "noEmitOnError": false, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "resolveJsonModule": true, - "strict": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "stripInternal": true, - "target": "ES2018" - }, - "include": [ - ".projenrc.js", - "src/**/*.ts", - "test/**/*.ts" - ], - "exclude": [ - "node_modules" - ], - "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"." -} diff --git a/yarn.lock b/yarn.lock index 00abdeef..ef2d70c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1105,9 +1105,9 @@ integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== "@types/node@*": - version "16.11.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.0.tgz#4b95f2327bacd1ef8f08d8ceda193039c5d7f52e" - integrity sha512-8MLkBIYQMuhRBQzGN9875bYsOhPnf/0rgXGo66S2FemHkhbn9qtsz9ywV1iCG+vbjigE4WUNVvw37Dx+L0qsPg== + version "16.11.10" + resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.10.tgz#2e3ad0a680d96367103d3e670d41c2fed3da61ae" + integrity sha512-3aRnHa1KlOEEhJ6+CvyHKK5vE9BcLGjtUpwvqYLRvYNQKMfabu3BwfJaA/SLW8dxe28LsNDjtHwePTuzn3gmOA== "@types/node@^10.17.60": version "10.17.60" @@ -1967,7 +1967,7 @@ conventional-changelog-codemirror@^2.0.8: dependencies: q "^1.5.1" -conventional-changelog-config-spec@2.1.0: +conventional-changelog-config-spec@2.1.0, conventional-changelog-config-spec@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/conventional-changelog-config-spec/-/conventional-changelog-config-spec-2.1.0.tgz#874a635287ef8b581fd8558532bf655d4fb59f2d" integrity sha512-IpVePh16EbbB02V+UA+HQnnPIohgXvJRxHcS5+Uwk4AT5LjzCZJm5sp/yqs5C6KZJ1jMsV4paEV13BN1pvDuxQ== @@ -2240,11 +2240,6 @@ decamelize@^1.1.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= -decamelize@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" - integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== - decamelize@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-5.0.1.tgz#db11a92e58c741ef339fb0a2868d8a06a9a7b1e9" @@ -3120,19 +3115,7 @@ glob-parent@^5.1.2: dependencies: is-glob "^4.0.1" -glob@^7, glob@^7.0.0: - version "7.1.7" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" - integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7: +glob@^7, glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.1.7: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== @@ -5447,14 +5430,15 @@ progress@^2.0.0, progress@^2.0.3: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -projen@^0.28.0: - version "0.28.0" - resolved "https://registry.yarnpkg.com/projen/-/projen-0.28.0.tgz#f96e71a1b946240fd31313e4a87506203b7b4a85" - integrity sha512-GrLJiuo5iqCME7m5MqSBGTLsPTlA1V617O70n0FbWcCTzGoiwPL9PAmxnnV201ERjPaVIn+UGvqeawRIJApILg== +projen@^0.34.23: + version "0.34.23" + resolved "https://registry.yarnpkg.com/projen/-/projen-0.34.23.tgz#13f6ea308dcff970f8a54f30b75c4cd51eb288a3" + integrity sha512-Xuxq0yLOgKiWxEQUwsw8fF6aEVeoJtMmg/favhP7Q7bLxzTPw6qWfD4ylyRfucPl1oeK4G0kXpI9ftcre9CT8A== dependencies: "@iarna/toml" "^2.2.5" + case "^1.6.3" chalk "^4.1.2" - decamelize "^4.0.0" + conventional-changelog-config-spec "^2.1.0" fs-extra "^9.1.0" glob "^7" ini "^2.0.0" From a09a370ff01047afff28058a9c6d0164382c6d44 Mon Sep 17 00:00:00 2001 From: javacs3 Date: Sat, 27 Nov 2021 15:15:22 +0800 Subject: [PATCH 2/2] fix: ci error --- .github/workflows/build-lambda.yml | 26 ++++++++++++++++++++++++++ test/lambda.test.ts | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-lambda.yml diff --git a/.github/workflows/build-lambda.yml b/.github/workflows/build-lambda.yml new file mode 100644 index 00000000..e015458c --- /dev/null +++ b/.github/workflows/build-lambda.yml @@ -0,0 +1,26 @@ +name: build-lambda +on: + pull_request: {} + workflow_dispatch: {} +jobs: + build: + runs-on: ubuntu-latest + permissions: + checks: write + contents: write + env: + CI: "true" + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + - name: Set git identity + run: |- + git config user.name "github-actions" + git config user.email "github-actions@github.com" + - name: Install dependencies + run: yarn install --check-files --frozen-lockfile + - name: build + run: cd test/lambda && ./test.sh diff --git a/test/lambda.test.ts b/test/lambda.test.ts index 163d6f79..46c68fc2 100644 --- a/test/lambda.test.ts +++ b/test/lambda.test.ts @@ -5,7 +5,7 @@ import { spawnSync } from 'child_process'; import * as path from 'path'; -test('lambda python pytest', () => { +test.skip('lambda python pytest', () => { const result = spawnSync(path.join(__dirname, 'lambda', 'test.sh'), { stdio: 'inherit' }); expect(result.status).toBe(0); }); \ No newline at end of file