diff --git a/.eslintrc.json b/.eslintrc.json index f7cd225..e9df2b1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -38,7 +38,9 @@ "*.d.ts", "node_modules/", "*.generated.ts", - "coverage" + "coverage", + "!.projenrc.ts", + "!projenrc/**/*.ts" ], "rules": { "indent": [ @@ -145,7 +147,9 @@ { "devDependencies": [ "**/test/**", - "**/build-tools/**" + "**/build-tools/**", + ".projenrc.ts", + "projenrc/**/*.ts" ], "optionalDependencies": false, "peerDependencies": true diff --git a/.gitattributes b/.gitattributes index 057a0b6..f4abd3a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,6 +5,7 @@ /.gitattributes linguist-generated /.github/pull_request_template.md linguist-generated /.github/workflows/build.yml linguist-generated +/.github/workflows/link-checker.yml linguist-generated /.github/workflows/pull-request-lint.yml linguist-generated /.github/workflows/release.yml linguist-generated /.github/workflows/upgrade-main.yml linguist-generated diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml new file mode 100644 index 0000000..82d649c --- /dev/null +++ b/.github/workflows/link-checker.yml @@ -0,0 +1,33 @@ +# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen". + +name: link-checker +on: + schedule: + - cron: 0 0 1 * * + workflow_dispatch: {} +jobs: + linkchecker: + name: Link Checker + runs-on: ubuntu-latest + permissions: + actions: write + contents: read + id-token: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Check Links + id: lychee + uses: lycheeverse/lychee-action@v1.5.1 + with: + args: --verbose --max-concurrency 32 --timeout 120 --no-progress *.md + - name: Create Issue From File + if: ${{ steps.lychee.outputs.exit_code != 0 }} + uses: peter-evans/create-issue-from-file@v4 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue + - name: Fail if there were link errors + if: ${{ steps.lychee.outputs.exit_code != 0 }} + run: exit ${{ steps.lychee.outputs.exit_code }} diff --git a/.gitignore b/.gitignore index 746540d..93b5bfc 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,4 @@ junit.xml .jsii tsconfig.json !/API.md +!/.github/workflows/link-checker.yml diff --git a/.projen/deps.json b/.projen/deps.json index 02662aa..840443e 100644 --- a/.projen/deps.json +++ b/.projen/deps.json @@ -92,6 +92,11 @@ "name": "ts-jest", "type": "build" }, + { + "name": "ts-node", + "version": "^9", + "type": "build" + }, { "name": "typescript", "type": "build" diff --git a/.projen/files.json b/.projen/files.json index 2ac1784..577d970 100644 --- a/.projen/files.json +++ b/.projen/files.json @@ -4,6 +4,7 @@ ".gitattributes", ".github/pull_request_template.md", ".github/workflows/build.yml", + ".github/workflows/link-checker.yml", ".github/workflows/pull-request-lint.yml", ".github/workflows/release.yml", ".github/workflows/upgrade-main.yml", diff --git a/.projen/tasks.json b/.projen/tasks.json index 27092ff..9c97e32 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -104,7 +104,7 @@ "description": "Synthesize project files", "steps": [ { - "exec": "node .projenrc.js" + "exec": "ts-node --project tsconfig.dev.json .projenrc.ts" } ] }, @@ -270,7 +270,7 @@ "exec": "yarn install --check-files" }, { - "exec": "yarn upgrade @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser awesome-lint eslint-import-resolver-node eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit jsii jsii-diff jsii-docgen jsii-pacmak json-schema npm-check-updates p6-projen-project-awesome-list standard-version ts-jest typescript" + "exec": "yarn upgrade @types/jest @types/node @typescript-eslint/eslint-plugin @typescript-eslint/parser awesome-lint eslint-import-resolver-node eslint-import-resolver-typescript eslint-plugin-import eslint jest jest-junit jsii jsii-diff jsii-docgen jsii-pacmak json-schema npm-check-updates p6-projen-project-awesome-list standard-version ts-jest ts-node typescript" }, { "exec": "npx projen" diff --git a/.projenrc.js b/.projenrc.js deleted file mode 100644 index 44ec601..0000000 --- a/.projenrc.js +++ /dev/null @@ -1,14 +0,0 @@ -const { AwesomeList } = require('p6-projen-project-awesome-list'); -const project = new AwesomeList({ - author: 'Philip M. Gollucci', - authorAddress: 'pgollucci@p6m7g8.com', - defaultReleaseBranch: 'main', - devDeps: ['p6-projen-project-awesome-list@1.0.1'], - name: 'awesome-projen', - repositoryUrl: 'https://github.com/pgollucci/awesome-projen.git', - - // deps: [], /* Runtime dependencies of this module. */ - // description: undefined, /* The description is just a string that helps people understand the purpose of the package. */ - // packageName: undefined, /* The "name" in package.json. */ -}); -project.synth(); \ No newline at end of file diff --git a/.projenrc.ts b/.projenrc.ts new file mode 100644 index 0000000..8c11da8 --- /dev/null +++ b/.projenrc.ts @@ -0,0 +1,58 @@ +import { AwesomeList } from 'p6-projen-project-awesome-list'; +import { JobPermission } from 'projen/lib/github/workflows-model'; + +const project = new AwesomeList({ + author: 'Philip M. Gollucci', + authorAddress: 'pgollucci@p6m7g8.com', + defaultReleaseBranch: 'main', + devDeps: ['p6-projen-project-awesome-list@1.0.1'], + name: 'awesome-projen', + repositoryUrl: 'https://github.com/pgollucci/awesome-projen.git', + projenrcTs: true, + // deps: [], /* Runtime dependencies of this module. */ + // description: undefined, /* The description is just a string that helps people understand the purpose of the package. */ + // packageName: undefined, /* The "name" in package.json. */ + +}); + +const linkChecker = project.github?.addWorkflow('link-checker'); +linkChecker?.on({ schedule: [{ cron: '0 0 1 * *' }], workflowDispatch: {} }); +linkChecker?.addJobs({ + linkchecker: { + runsOn: ['ubuntu-latest'], + name: 'Link Checker', + permissions: { + actions: JobPermission.WRITE, + contents: JobPermission.READ, + idToken: JobPermission.WRITE, + }, + steps: [ + { name: 'Checkout code', uses: 'actions/checkout@v3' }, + { + name: 'Check Links', + id: 'lychee', + uses: 'lycheeverse/lychee-action@v1.5.1', + with: { + args: '--verbose --max-concurrency 32 --timeout 120 --no-progress *.md', + }, + }, + { + name: 'Create Issue From File', + if: '${{ steps.lychee.outputs.exit_code != 0 }}', + uses: 'peter-evans/create-issue-from-file@v4', + with: { + 'title': 'Link Checker Report', + 'content-filepath': './lychee/out.md', + 'labels': 'report, automated issue', + }, + }, + { + name: 'Fail if there were link errors', + if: '${{ steps.lychee.outputs.exit_code != 0 }}', + run: 'exit ${{ steps.lychee.outputs.exit_code }}', + }, + ], + }, +}); + +project.synth(); diff --git a/package.json b/package.json index 14a46c9..2552091 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "projen": "^0.53.13", "standard-version": "^9", "ts-jest": "^27.1.4", + "ts-node": "^9", "typescript": "^4.6.3" }, "main": "lib/index.js", diff --git a/tsconfig.dev.json b/tsconfig.dev.json index 2e29dba..24ccaa6 100644 --- a/tsconfig.dev.json +++ b/tsconfig.dev.json @@ -27,7 +27,9 @@ "include": [ ".projenrc.js", "src/**/*.ts", - "test/**/*.ts" + "test/**/*.ts", + ".projenrc.ts", + "projenrc/**/*.ts" ], "exclude": [ "node_modules" diff --git a/yarn.lock b/yarn.lock index b305c45..dcccf08 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1085,6 +1085,11 @@ are-we-there-yet@^3.0.0: delegates "^1.0.0" readable-stream "^3.6.0" +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + argparse@^1.0.7: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" @@ -1923,6 +1928,11 @@ core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + cross-spawn@^6.0.0: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -2154,6 +2164,11 @@ diff-sequences@^27.5.1: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327" integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -4431,7 +4446,7 @@ make-dir@^3.0.0: dependencies: semver "^6.0.0" -make-error@1.x: +make-error@1.x, make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== @@ -6359,7 +6374,7 @@ sort-json@^2.0.1: detect-newline "^2.1.0" minimist "^1.2.0" -source-map-support@^0.5.21, source-map-support@^0.5.6: +source-map-support@^0.5.17, source-map-support@^0.5.21, source-map-support@^0.5.6: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== @@ -6771,6 +6786,18 @@ ts-jest@^27.1.4: semver "7.x" yargs-parser "20.x" +ts-node@^9: + version "9.1.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" + integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== + dependencies: + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.17" + yn "3.1.1" + tsconfig-paths@^3.14.1: version "3.14.1" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz#ba0734599e8ea36c862798e920bcf163277b137a" @@ -7417,6 +7444,11 @@ yargs@^16.0.0, yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"