diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..bfed27b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Join the Discord + url: https://discord.gg/3EYgqrYJFS + about: Chat with maintainers and other community members diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdf304d..d9102ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,9 @@ name: CI on: pull_request: - push: - branches: main + pull_request_review: + types: [submitted, edited] + branches: changeset-release/main jobs: check: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8010597..9c29fd2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,9 +43,21 @@ jobs: - name: PR or Publish id: changesets - uses: changesets/action@b3300fad33b6ab794313da28d27424c0e2f78991 + uses: changesets/action@v1.4.1 with: - publish: pnpm changeset publish + version: pnpm changeset:version + publish: pnpm changeset:publish env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish Prerelease + if: steps.changesets.outputs.published != 'true' + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN" + git reset --hard origin/main + pnpm changeset version --no-git-tag --snapshot canary + pnpm changeset publish --no-git-tag --snapshot canary --tag canary diff --git a/package.json b/package.json index a00ae62..13e1ee4 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,9 @@ "build": "rollup -c scripts/rollup.config.mjs", "clean": "rimraf dist node_modules/.cache", "prepublishOnly": "run-s clean build check test", - "prepare": "node ./scripts/prepare.js" + "prepare": "node ./scripts/prepare.js", + "changeset:version": "changeset version && pnpm install --lockfile-only", + "changeset:publish": "changeset publish" }, "repository": "https://github.com/0no-co/wonka", "bugs": { @@ -70,8 +72,8 @@ ] }, "devDependencies": { - "@changesets/cli": "^2.25.2", - "@changesets/get-github-info": "^0.5.1", + "@changesets/cli": "^2.26.0", + "@changesets/get-github-info": "0.5.0", "@rollup/plugin-buble": "^1.0.1", "@rollup/plugin-commonjs": "^23.0.3", "@rollup/plugin-node-resolve": "^15.0.1", @@ -84,6 +86,7 @@ "callbag-from-iter": "^1.3.0", "callbag-iterate": "^1.0.0", "callbag-take": "^1.5.0", + "dotenv": "^16.0.3", "eslint": "^8.29.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-prettier": "^4.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eee4137..fa78842 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,8 +1,8 @@ lockfileVersion: 5.4 specifiers: - '@changesets/cli': ^2.25.2 - '@changesets/get-github-info': ^0.5.1 + '@changesets/cli': ^2.26.0 + '@changesets/get-github-info': 0.5.0 '@rollup/plugin-buble': ^1.0.1 '@rollup/plugin-commonjs': ^23.0.3 '@rollup/plugin-node-resolve': ^15.0.1 @@ -15,6 +15,7 @@ specifiers: callbag-from-iter: ^1.3.0 callbag-iterate: ^1.0.0 callbag-take: ^1.5.0 + dotenv: ^16.0.3 eslint: ^8.29.0 eslint-config-prettier: ^8.5.0 eslint-plugin-prettier: ^4.2.1 @@ -35,8 +36,8 @@ specifiers: zen-observable: ^0.10.0 devDependencies: - '@changesets/cli': 2.25.2 - '@changesets/get-github-info': 0.5.1 + '@changesets/cli': 2.26.0 + '@changesets/get-github-info': 0.5.0 '@rollup/plugin-buble': 1.0.1_rollup@3.5.1 '@rollup/plugin-commonjs': 23.0.3_rollup@3.5.1 '@rollup/plugin-node-resolve': 15.0.1_rollup@3.5.1 @@ -49,6 +50,7 @@ devDependencies: callbag-from-iter: 1.3.0 callbag-iterate: 1.0.0 callbag-take: 1.5.0 + dotenv: 16.0.3 eslint: 8.29.0 eslint-config-prettier: 8.5.0_eslint@8.29.0 eslint-plugin-prettier: 4.2.1_nrhoyyjffvfyk4vtlt5destxgm @@ -98,14 +100,14 @@ packages: regenerator-runtime: 0.13.11 dev: true - /@changesets/apply-release-plan/6.1.2: - resolution: {integrity: sha512-H8TV9E/WtJsDfoDVbrDGPXmkZFSv7W2KLqp4xX4MKZXshb0hsQZUNowUa8pnus9qb/5OZrFFRVsUsDCVHNW/AQ==} + /@changesets/apply-release-plan/6.1.3: + resolution: {integrity: sha512-ECDNeoc3nfeAe1jqJb5aFQX7CqzQhD2klXRez2JDb/aVpGUbX673HgKrnrgJRuQR/9f2TtLoYIzrGB9qwD77mg==} dependencies: '@babel/runtime': 7.20.6 - '@changesets/config': 2.2.0 + '@changesets/config': 2.3.0 '@changesets/get-version-range-type': 0.3.2 - '@changesets/git': 1.5.0 - '@changesets/types': 5.2.0 + '@changesets/git': 2.0.0 + '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 detect-indent: 6.1.0 fs-extra: 7.0.1 @@ -116,41 +118,41 @@ packages: semver: 5.7.1 dev: true - /@changesets/assemble-release-plan/5.2.2: - resolution: {integrity: sha512-B1qxErQd85AeZgZFZw2bDKyOfdXHhG+X5S+W3Da2yCem8l/pRy4G/S7iOpEcMwg6lH8q2ZhgbZZwZ817D+aLuQ==} + /@changesets/assemble-release-plan/5.2.3: + resolution: {integrity: sha512-g7EVZCmnWz3zMBAdrcKhid4hkHT+Ft1n0mLussFMcB1dE2zCuwcvGoy9ec3yOgPGF4hoMtgHaMIk3T3TBdvU9g==} dependencies: '@babel/runtime': 7.20.6 '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.4 - '@changesets/types': 5.2.0 + '@changesets/get-dependents-graph': 1.3.5 + '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 semver: 5.7.1 dev: true - /@changesets/changelog-git/0.1.13: - resolution: {integrity: sha512-zvJ50Q+EUALzeawAxax6nF2WIcSsC5PwbuLeWkckS8ulWnuPYx8Fn/Sjd3rF46OzeKA8t30loYYV6TIzp4DIdg==} + /@changesets/changelog-git/0.1.14: + resolution: {integrity: sha512-+vRfnKtXVWsDDxGctOfzJsPhaCdXRYoe+KyWYoq5X/GqoISREiat0l3L8B0a453B2B4dfHGcZaGyowHbp9BSaA==} dependencies: - '@changesets/types': 5.2.0 + '@changesets/types': 5.2.1 dev: true - /@changesets/cli/2.25.2: - resolution: {integrity: sha512-ACScBJXI3kRyMd2R8n8SzfttDHi4tmKSwVwXBazJOylQItSRSF4cGmej2E4FVf/eNfGy6THkL9GzAahU9ErZrA==} + /@changesets/cli/2.26.0: + resolution: {integrity: sha512-0cbTiDms+ICTVtEwAFLNW0jBNex9f5+fFv3I771nBvdnV/mOjd1QJ4+f8KtVSOrwD9SJkk9xbDkWFb0oXd8d1Q==} hasBin: true dependencies: '@babel/runtime': 7.20.6 - '@changesets/apply-release-plan': 6.1.2 - '@changesets/assemble-release-plan': 5.2.2 - '@changesets/changelog-git': 0.1.13 - '@changesets/config': 2.2.0 + '@changesets/apply-release-plan': 6.1.3 + '@changesets/assemble-release-plan': 5.2.3 + '@changesets/changelog-git': 0.1.14 + '@changesets/config': 2.3.0 '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.4 - '@changesets/get-release-plan': 3.0.15 - '@changesets/git': 1.5.0 + '@changesets/get-dependents-graph': 1.3.5 + '@changesets/get-release-plan': 3.0.16 + '@changesets/git': 2.0.0 '@changesets/logger': 0.0.5 - '@changesets/pre': 1.0.13 - '@changesets/read': 0.5.8 - '@changesets/types': 5.2.0 - '@changesets/write': 0.2.2 + '@changesets/pre': 1.0.14 + '@changesets/read': 0.5.9 + '@changesets/types': 5.2.1 + '@changesets/write': 0.2.3 '@manypkg/get-packages': 1.1.3 '@types/is-ci': 3.0.0 '@types/semver': 6.2.3 @@ -172,13 +174,13 @@ packages: tty-table: 4.1.6 dev: true - /@changesets/config/2.2.0: - resolution: {integrity: sha512-GGaokp3nm5FEDk/Fv2PCRcQCOxGKKPRZ7prcMqxEr7VSsG75MnChQE8plaW1k6V8L2bJE+jZWiRm19LbnproOw==} + /@changesets/config/2.3.0: + resolution: {integrity: sha512-EgP/px6mhCx8QeaMAvWtRrgyxW08k/Bx2tpGT+M84jEdX37v3VKfh4Cz1BkwrYKuMV2HZKeHOh8sHvja/HcXfQ==} dependencies: '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.4 + '@changesets/get-dependents-graph': 1.3.5 '@changesets/logger': 0.0.5 - '@changesets/types': 5.2.0 + '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 fs-extra: 7.0.1 micromatch: 4.0.5 @@ -190,18 +192,18 @@ packages: extendable-error: 0.1.7 dev: true - /@changesets/get-dependents-graph/1.3.4: - resolution: {integrity: sha512-+C4AOrrFY146ydrgKOo5vTZfj7vetNu1tWshOID+UjPUU9afYGDXI8yLnAeib1ffeBXV3TuGVcyphKpJ3cKe+A==} + /@changesets/get-dependents-graph/1.3.5: + resolution: {integrity: sha512-w1eEvnWlbVDIY8mWXqWuYE9oKhvIaBhzqzo4ITSJY9hgoqQ3RoBqwlcAzg11qHxv/b8ReDWnMrpjpKrW6m1ZTA==} dependencies: - '@changesets/types': 5.2.0 + '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 chalk: 2.4.2 fs-extra: 7.0.1 semver: 5.7.1 dev: true - /@changesets/get-github-info/0.5.1: - resolution: {integrity: sha512-w2yl3AuG+hFuEEmT6j1zDlg7GQLM/J2UxTmk0uJBMdRqHni4zXGe/vUlPfLom5KfX3cRfHc0hzGvloDPjWFNZw==} + /@changesets/get-github-info/0.5.0: + resolution: {integrity: sha512-vm5VgHwrxkMkUjFyn3UVNKLbDp9YMHd3vMf1IyJoa/7B+6VpqmtAaXyDS0zBLfN5bhzVCHrRnj4GcZXXcqrFTw==} dependencies: dataloader: 1.4.0 node-fetch: 2.6.7 @@ -209,15 +211,15 @@ packages: - encoding dev: true - /@changesets/get-release-plan/3.0.15: - resolution: {integrity: sha512-W1tFwxE178/en+zSj/Nqbc3mvz88mcdqUMJhRzN1jDYqN3QI4ifVaRF9mcWUU+KI0gyYEtYR65tour690PqTcA==} + /@changesets/get-release-plan/3.0.16: + resolution: {integrity: sha512-OpP9QILpBp1bY2YNIKFzwigKh7Qe9KizRsZomzLe6pK8IUo8onkAAVUD8+JRKSr8R7d4+JRuQrfSSNlEwKyPYg==} dependencies: '@babel/runtime': 7.20.6 - '@changesets/assemble-release-plan': 5.2.2 - '@changesets/config': 2.2.0 - '@changesets/pre': 1.0.13 - '@changesets/read': 0.5.8 - '@changesets/types': 5.2.0 + '@changesets/assemble-release-plan': 5.2.3 + '@changesets/config': 2.3.0 + '@changesets/pre': 1.0.14 + '@changesets/read': 0.5.9 + '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 dev: true @@ -225,14 +227,15 @@ packages: resolution: {integrity: sha512-SVqwYs5pULYjYT4op21F2pVbcrca4qA/bAA3FmFXKMN7Y+HcO8sbZUTx3TAy2VXulP2FACd1aC7f2nTuqSPbqg==} dev: true - /@changesets/git/1.5.0: - resolution: {integrity: sha512-Xo8AT2G7rQJSwV87c8PwMm6BAc98BnufRMsML7m7Iw8Or18WFvFmxqG5aOL5PBvhgq9KrKvaeIBNIymracSuHg==} + /@changesets/git/2.0.0: + resolution: {integrity: sha512-enUVEWbiqUTxqSnmesyJGWfzd51PY4H7mH9yUw0hPVpZBJ6tQZFMU3F3mT/t9OJ/GjyiM4770i+sehAn6ymx6A==} dependencies: '@babel/runtime': 7.20.6 '@changesets/errors': 0.1.4 - '@changesets/types': 5.2.0 + '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 is-subdir: 1.2.0 + micromatch: 4.0.5 spawndamnit: 2.0.0 dev: true @@ -242,31 +245,31 @@ packages: chalk: 2.4.2 dev: true - /@changesets/parse/0.3.15: - resolution: {integrity: sha512-3eDVqVuBtp63i+BxEWHPFj2P1s3syk0PTrk2d94W9JD30iG+OER0Y6n65TeLlY8T2yB9Fvj6Ev5Gg0+cKe/ZUA==} + /@changesets/parse/0.3.16: + resolution: {integrity: sha512-127JKNd167ayAuBjUggZBkmDS5fIKsthnr9jr6bdnuUljroiERW7FBTDNnNVyJ4l69PzR57pk6mXQdtJyBCJKg==} dependencies: - '@changesets/types': 5.2.0 + '@changesets/types': 5.2.1 js-yaml: 3.14.1 dev: true - /@changesets/pre/1.0.13: - resolution: {integrity: sha512-jrZc766+kGZHDukjKhpBXhBJjVQMied4Fu076y9guY1D3H622NOw8AQaLV3oQsDtKBTrT2AUFjt9Z2Y9Qx+GfA==} + /@changesets/pre/1.0.14: + resolution: {integrity: sha512-dTsHmxQWEQekHYHbg+M1mDVYFvegDh9j/kySNuDKdylwfMEevTeDouR7IfHNyVodxZXu17sXoJuf2D0vi55FHQ==} dependencies: '@babel/runtime': 7.20.6 '@changesets/errors': 0.1.4 - '@changesets/types': 5.2.0 + '@changesets/types': 5.2.1 '@manypkg/get-packages': 1.1.3 fs-extra: 7.0.1 dev: true - /@changesets/read/0.5.8: - resolution: {integrity: sha512-eYaNfxemgX7f7ELC58e7yqQICW5FB7V+bd1lKt7g57mxUrTveYME+JPaBPpYx02nP53XI6CQp6YxnR9NfmFPKw==} + /@changesets/read/0.5.9: + resolution: {integrity: sha512-T8BJ6JS6j1gfO1HFq50kU3qawYxa4NTbI/ASNVVCBTsKquy2HYwM9r7ZnzkiMe8IEObAJtUVGSrePCOxAK2haQ==} dependencies: '@babel/runtime': 7.20.6 - '@changesets/git': 1.5.0 + '@changesets/git': 2.0.0 '@changesets/logger': 0.0.5 - '@changesets/parse': 0.3.15 - '@changesets/types': 5.2.0 + '@changesets/parse': 0.3.16 + '@changesets/types': 5.2.1 chalk: 2.4.2 fs-extra: 7.0.1 p-filter: 2.1.0 @@ -276,15 +279,15 @@ packages: resolution: {integrity: sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==} dev: true - /@changesets/types/5.2.0: - resolution: {integrity: sha512-km/66KOqJC+eicZXsm2oq8A8bVTSpkZJ60iPV/Nl5Z5c7p9kk8xxh6XGRTlnludHldxOOfudhnDN2qPxtHmXzA==} + /@changesets/types/5.2.1: + resolution: {integrity: sha512-myLfHbVOqaq9UtUKqR/nZA/OY7xFjQMdfgfqeZIBK4d0hA6pgxArvdv8M+6NUzzBsjWLOtvApv8YHr4qM+Kpfg==} dev: true - /@changesets/write/0.2.2: - resolution: {integrity: sha512-kCYNHyF3xaId1Q/QE+DF3UTrHTyg3Cj/f++T8S8/EkC+jh1uK2LFnM9h+EzV+fsmnZDrs7r0J4LLpeI/VWC5Hg==} + /@changesets/write/0.2.3: + resolution: {integrity: sha512-Dbamr7AIMvslKnNYsLFafaVORx4H0pvCA2MHqgtNCySMe1blImEyAEOzDmcgKAkgz4+uwoLz7demIrX+JBr/Xw==} dependencies: '@babel/runtime': 7.20.6 - '@changesets/types': 5.2.0 + '@changesets/types': 5.2.1 fs-extra: 7.0.1 human-id: 1.0.2 prettier: 2.8.0 @@ -1265,6 +1268,11 @@ packages: esutils: 2.0.3 dev: true + /dotenv/16.0.3: + resolution: {integrity: sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==} + engines: {node: '>=12'} + dev: true + /eastasianwidth/0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true diff --git a/scripts/changelog.js b/scripts/changelog.js index 2b05982..01629c0 100644 --- a/scripts/changelog.js +++ b/scripts/changelog.js @@ -1,21 +1,22 @@ +const { config } = require('dotenv'); const { getInfo } = require('@changesets/get-github-info'); +config(); + const REPO = '0no-co/wonka'; const SEE_LINE = /^See:\s*(.*)/i; const TRAILING_CHAR = /[.;:]$/g; const listFormatter = new Intl.ListFormat('en-US'); const getSummaryLines = cs => { - const lines = cs.summary - .trim() - .split(/[\r\n]+/) - .map(l => l.trim()) - .filter(Boolean); - const size = lines.length; - if (size > 0) { - lines[size - 1] = lines[size - 1].replace(TRAILING_CHAR, ''); + let lines = cs.summary.trim().split(/\r?\n/); + if (!lines.some(line => /```/.test(line))) { + lines = lines.map(l => l.trim()).filter(Boolean); + const size = lines.length; + if (size > 0) { + lines[size - 1] = lines[size - 1].replace(TRAILING_CHAR, ''); + } } - return lines; }; @@ -102,8 +103,11 @@ const changelogFunctions = { str += `\n${futureLines.map(l => ` ${l}`).join('\n')}`; } - if (user) { + const endsWithParagraph = /(?<=(?:[!;?.]|```) *)$/g; + if (user && !endsWithParagraph) { str += `, by ${user}`; + } else { + str += `\nSubmitted by ${user}`; } if (pull || commit) {