From 8e6db5b6d8301b3005d868e39da35baf7aa6e93b Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Mon, 30 Oct 2023 11:48:18 -0400 Subject: [PATCH] fixup: automation Signed-off-by: Todd Baert --- .github/workflows/audit-pending-releases.yml | 49 +++++++++++++ package-lock.json | 72 +++++++++----------- package.json | 6 +- packages/client/package.json | 6 +- packages/client/typedoc.json | 8 +++ packages/react/package.json | 10 +-- packages/react/typedoc.json | 8 +++ packages/server/package.json | 6 +- packages/server/tsconfig.json | 2 +- packages/server/typedoc.json | 8 +++ packages/shared/package.json | 2 +- packages/shared/tsconfig.json | 10 +-- packages/shared/typedoc.json | 8 +++ rollup.config.mjs | 6 -- typedoc.json | 8 ++- 15 files changed, 135 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/audit-pending-releases.yml create mode 100644 packages/client/typedoc.json create mode 100644 packages/react/typedoc.json create mode 100644 packages/server/typedoc.json create mode 100644 packages/shared/typedoc.json diff --git a/.github/workflows/audit-pending-releases.yml b/.github/workflows/audit-pending-releases.yml new file mode 100644 index 000000000..d8bd1c658 --- /dev/null +++ b/.github/workflows/audit-pending-releases.yml @@ -0,0 +1,49 @@ +on: + push: + branches: + - 'release-please**' + +env: + CORE_PACKAGE: core + +name: Audit Pending Releases +jobs: + npm-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.ref }} + + # if this is an SDK release, make sure there's no pending releases for @openfeature/core + - name: Check for Pending Dependency PRs + if: ${{ !endsWith(github.ref_name, env.CORE_PACKAGE) }} + run: | + if [ $(gh pr list --search '"release ${{ env.CORE_PACKAGE }}" in:title' | wc -l) -gt 0 ]; \ + then echo "Pending @openfeaure/${{ env.CORE_PACKAGE }} release. Please release @openfeaure/${{ env.CORE_PACKAGE }} first!" && exit 1; \ + else echo "No pending @openfeaure/${{ env.CORE_PACKAGE }} releases"; \ + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 16 + registry-url: "https://registry.npmjs.org" + cache: 'npm' + + # if this is an @openfeature/core release, but the SDKs to use this version as a peer, and commit back + - name: Update Peer Version in Dependants + if: ${{ endsWith(github.ref_name, env.CORE_PACKAGE) }} + run: | + npm run update-core-peers && \ + ! git diff-files --quiet && \ + ( echo 'Updated peer dependency in dependants, commiting...' + git add --all && \ + git config user.name "openfeature-peer-update-bot" && \ + git config user.email "openfeature-peer-update-bot@openfeature.dev" && \ + git commit -m 'chore: bump @openfeaure/${{ env.CORE_PACKAGE }} peer' -s && \ + git push ) || echo 'Peer dependency in dependants is already up to date.' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package-lock.json b/package-lock.json index 7c4f3c06b..8e9fb49ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "shx": "^0.3.4", "ts-jest": "^29.0.5", "ts-node": "^10.8.2", - "typedoc": "^0.24.8", + "typedoc": "^0.25.3", "typescript": "^4.7.4", "uuid": "^9.0.0" }, @@ -845,13 +845,13 @@ } }, "node_modules/@grpc/grpc-js": { - "version": "1.8.20", - "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.8.20.tgz", - "integrity": "sha512-SPse1wE4PcIFojOISsAnrWXCBsCBwDdcDqz2SS0T8nBSxg9jwmCK70Jy7ypRn2nIspwLy3Ls5TNaKNHo+6dF8A==", + "version": "1.9.8", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.8.tgz", + "integrity": "sha512-FFPzDS333Vw8hvf+1FaEsaCYVPBdNdUCw7zArTiF7+6gOzln967b4GBCBekKGqoKEgna8d3Ayxv8t+IvazXG3g==", "dev": true, "peer": true, "dependencies": { - "@grpc/proto-loader": "^0.7.0", + "@grpc/proto-loader": "^0.7.8", "@types/node": ">=12.12.47" }, "engines": { @@ -859,15 +859,14 @@ } }, "node_modules/@grpc/proto-loader": { - "version": "0.7.8", - "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.8.tgz", - "integrity": "sha512-GU12e2c8dmdXb7XUlOgYWZ2o2i+z9/VeACkxTA/zzAe2IjclC5PnVL0lpgjhrqfpDYHzM8B1TF6pqWegMYAzlA==", + "version": "0.7.10", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.10.tgz", + "integrity": "sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==", "dev": true, "peer": true, "dependencies": { - "@types/long": "^4.0.1", "lodash.camelcase": "^4.3.0", - "long": "^4.0.0", + "long": "^5.0.0", "protobufjs": "^7.2.4", "yargs": "^17.7.2" }, @@ -878,6 +877,13 @@ "node": ">=6" } }, + "node_modules/@grpc/proto-loader/node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "dev": true, + "peer": true + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.11", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", @@ -3841,6 +3847,7 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, "engines": { "node": ">=0.8.x" } @@ -4239,20 +4246,6 @@ "dev": true, "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.1", "dev": true, @@ -10484,9 +10477,9 @@ } }, "node_modules/protobufjs": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.4.tgz", - "integrity": "sha512-AT+RJgD2sH8phPmCf7OUZR8xGdcJRga4+1cOaXJ64hvcSkVhNcRHOwIxUatPH15+nj59WAGTDv3LSGZPEQbJaQ==", + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", + "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", "dev": true, "hasInstallScript": true, "peer": true, @@ -12257,24 +12250,24 @@ } }, "node_modules/typedoc": { - "version": "0.24.8", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.8.tgz", - "integrity": "sha512-ahJ6Cpcvxwaxfu4KtjA8qZNqS43wYt6JL27wYiIgl1vd38WW/KWX11YuAeZhuz9v+ttrutSsgK+XO1CjL1kA3w==", + "version": "0.25.3", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.3.tgz", + "integrity": "sha512-Ow8Bo7uY1Lwy7GTmphRIMEo6IOZ+yYUyrc8n5KXIZg1svpqhZSWgni2ZrDhe+wLosFS8yswowUzljTAV/3jmWw==", "dev": true, "dependencies": { "lunr": "^2.3.9", "marked": "^4.3.0", - "minimatch": "^9.0.0", + "minimatch": "^9.0.3", "shiki": "^0.14.1" }, "bin": { "typedoc": "bin/typedoc" }, "engines": { - "node": ">= 14.14" + "node": ">= 16" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x" + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x" } }, "node_modules/typedoc/node_modules/brace-expansion": { @@ -12287,9 +12280,9 @@ } }, "node_modules/typedoc/node_modules/minimatch": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz", - "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -12818,8 +12811,7 @@ "@openfeature/core": "*" }, "peerDependencies": { - "@openfeature/core": ">=0.1.0", - "events": ">=3.0.0" + "@openfeature/core": ">=0.1.0" } }, "packages/react": { @@ -12827,6 +12819,7 @@ "version": "0.0.1-experimental", "license": "Apache-2.0", "devDependencies": { + "@openfeature/core": "*", "@openfeature/web-sdk": "*" }, "peerDependencies": { @@ -12844,6 +12837,9 @@ }, "engines": { "node": ">=16" + }, + "peerDependencies": { + "@openfeature/core": ">=0.1.0" } }, "packages/shared": { diff --git a/package.json b/package.json index 289a0938c..bf023348e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,9 @@ "clean": "shx rm -rf ./dist", "build": "npm run build --workspace=packages/shared --workspace=packages/server --workspace=packages/client --workspace=packages/react", "publish-all": "npm run publish-if-not-exists --workspace=packages/server --workspace=packages/client --workspace=packages/react", - "docs": "typedoc" + "docs": "typedoc", + "core-version": "npm run version --workspace=packages/shared", + "update-core-peers": "export OPENFEATURE_CORE_VERSION=$(npm run --silent core-version) && npm run update-core-peer --workspace=packages/server --workspace=packages/client --workspace=packages/react" }, "repository": { "type": "git", @@ -66,7 +68,7 @@ "shx": "^0.3.4", "ts-jest": "^29.0.5", "ts-node": "^10.8.2", - "typedoc": "^0.24.8", + "typedoc": "^0.25.3", "typescript": "^4.7.4", "uuid": "^9.0.0" }, diff --git a/packages/client/package.json b/packages/client/package.json index 7ee6d275f..b0890b074 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -25,7 +25,7 @@ "current-version": "echo $npm_package_version", "prepack": "shx cp ./../../LICENSE ./LICENSE", "publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi", - "docs": "typedoc" + "update-core-peer": "npm install --save-peer --save-exact @openfeature/core@$OPENFEATURE_CORE_VERSION" }, "repository": { "type": "git", @@ -50,9 +50,5 @@ }, "devDependencies": { "@openfeature/core": "*" - }, - "typedoc": { - "displayName": "OpenFeature Web SDK", - "entryPoint": "./src/index.ts" } } diff --git a/packages/client/typedoc.json b/packages/client/typedoc.json new file mode 100644 index 000000000..88ea8bd77 --- /dev/null +++ b/packages/client/typedoc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "name": "@openfeature/web-sdk", + "includeVersion": true, + "entryPoints": [ + "src/index.ts", + ] +} \ No newline at end of file diff --git a/packages/react/package.json b/packages/react/package.json index 87433a189..d1779651f 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -25,7 +25,7 @@ "current-version": "echo $npm_package_version", "prepack": "shx cp ./../../LICENSE ./LICENSE", "publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi", - "docs": "typedoc" + "update-core-peer": "npm install --save-peer --save-exact @openfeature/core@$OPENFEATURE_CORE_VERSION" }, "repository": { "type": "git", @@ -47,16 +47,12 @@ }, "homepage": "https://github.com/open-feature/js-sdk#readme", "peerDependencies": { - "react": ">=18.0.0", "@openfeature/core": ">=0.1.0", - "@openfeature/web-sdk": ">=0.4.0" + "@openfeature/web-sdk": ">=0.4.0", + "react": ">=18.0.0" }, "devDependencies": { "@openfeature/core": "*", "@openfeature/web-sdk": "*" - }, - "typedoc": { - "displayName": "OpenFeature React SDK", - "entryPoint": "./src/index.ts" } } diff --git a/packages/react/typedoc.json b/packages/react/typedoc.json new file mode 100644 index 000000000..76a22f57e --- /dev/null +++ b/packages/react/typedoc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "name": "@openfeature/react-sdk", + "includeVersion": true, + "entryPoints": [ + "src/index.ts", + ] +} \ No newline at end of file diff --git a/packages/server/package.json b/packages/server/package.json index 90587c380..447390f34 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -25,7 +25,7 @@ "current-version": "echo $npm_package_version", "prepack": "shx cp ./../../LICENSE ./LICENSE", "publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi", - "docs": "typedoc" + "update-core-peer": "npm install --save-peer --save-exact @openfeature/core@$OPENFEATURE_CORE_VERSION" }, "repository": { "type": "git", @@ -52,9 +52,5 @@ }, "devDependencies": { "@openfeature/core": "*" - }, - "typedoc": { - "displayName": "OpenFeature Server SDK", - "entryPoint": "./src/index.ts" } } diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index d0164246a..0e8c768cd 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -44,7 +44,7 @@ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./dist/esm", /* Specify an output folder for all emitted files. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ diff --git a/packages/server/typedoc.json b/packages/server/typedoc.json new file mode 100644 index 000000000..124ef48c2 --- /dev/null +++ b/packages/server/typedoc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "name": "@openfeature/server-sdk", + "includeVersion": true, + "entryPoints": [ + "src/index.ts", + ] +} \ No newline at end of file diff --git a/packages/shared/package.json b/packages/shared/package.json index bbe57a17e..c2b051eae 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -27,7 +27,7 @@ "current-version": "echo $npm_package_version", "prepack": "shx cp ./../../LICENSE ./LICENSE", "publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi", - "docs": "typedoc" + "version": "echo $npm_package_version" }, "repository": { "type": "git", diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index 624fa2800..adf8d22c8 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -10,7 +10,9 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ "target": "ES2015", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "lib": [ + "ES2020" + ], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "jsx": "preserve", /* Specify what JSX code is generated. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ @@ -90,12 +92,6 @@ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, - "typedocOptions": { - "name": "OpenFeature SDK", - "entryPoints": [ - "src/index.ts" - ] - }, "include": [ "./src/**/*" ], diff --git a/packages/shared/typedoc.json b/packages/shared/typedoc.json new file mode 100644 index 000000000..4b97f3ab3 --- /dev/null +++ b/packages/shared/typedoc.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "name": "@openfeature/core", + "includeVersion": true, + "entryPoints": [ + "src/index.ts", + ] +} \ No newline at end of file diff --git a/rollup.config.mjs b/rollup.config.mjs index 2dc6e1845..1d55f41f9 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -18,12 +18,6 @@ export default { } ], plugins: [ - // TODO delete? - // alias({ - // entries: [ - // { find: '@openfeature/core', replacement: '../shared/dist/types.d.ts' }, - // ], - // }), dts({tsconfig: './tsconfig.json'}), ], }; \ No newline at end of file diff --git a/typedoc.json b/typedoc.json index f449dc6f2..29f21239d 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,9 +1,13 @@ { "$schema": "https://typedoc.org/schema.json", - "entryPointStrategy": "legacy-packages", + "entryPointStrategy": "packages", "entryPoints": [ "packages/server", - "packages/client" + "packages/client", + "packages/shared", + ], + "sort": [ + "source-order" ], "out": "typedoc" } \ No newline at end of file