-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from ckb-cell/release/0.2.0
Merge release/0.2.0 to main branch
- Loading branch information
Showing
121 changed files
with
2,740 additions
and
2,139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
// @ts-check | ||
/** | ||
* Based on the following format: | ||
* - https://github.com/changesets/changesets/blob/main/packages/changelog-github/src/index.ts | ||
* - https://github.com/stylelint/stylelint/blob/main/.changeset/changelog-stylelint.cjs | ||
*/ | ||
|
||
const { getInfo, getInfoFromPullRequest } = require('@changesets/get-github-info'); | ||
|
||
/** | ||
* @type {import('@changesets/types').ChangelogFunctions} | ||
*/ | ||
const changelogFunctions = { | ||
async getReleaseLine(changeset, _type, options) { | ||
if (!options || !options.repo) { | ||
throw new Error( | ||
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]', | ||
); | ||
} | ||
|
||
/** | ||
* @type {number | undefined} | ||
*/ | ||
let prFromSummary; | ||
/** | ||
* @type {string | undefined} | ||
*/ | ||
let commitFromSummary; | ||
/** | ||
* @type {string[]} | ||
*/ | ||
let usersFromSummary = []; | ||
|
||
const replacedChangelog = changeset.summary | ||
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr) => { | ||
let num = Number(pr); | ||
if (!isNaN(num)) { | ||
prFromSummary = num; | ||
} | ||
return ''; | ||
}) | ||
.replace(/^\s*commit:\s*([^\s]+)/im, (_, commit) => { | ||
commitFromSummary = commit; | ||
return ''; | ||
}) | ||
.replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, (_, user) => { | ||
usersFromSummary.push(user); | ||
return ''; | ||
}) | ||
.trim(); | ||
|
||
const [firstLine, ...futureLines] = replacedChangelog | ||
.split('\n') | ||
.map((l) => l.trimRight()); | ||
|
||
const links = await (async () => { | ||
if (prFromSummary !== undefined) { | ||
let { links } = await getInfoFromPullRequest({ | ||
repo: options.repo, | ||
pull: prFromSummary, | ||
}); | ||
if (commitFromSummary) { | ||
const shortCommitId = commitFromSummary.slice(0, 7); | ||
links = { | ||
...links, | ||
commit: `[\`${shortCommitId}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`, | ||
}; | ||
} | ||
return links; | ||
} | ||
const commitToFetchFrom = commitFromSummary || changeset.commit; | ||
if (commitToFetchFrom) { | ||
let { links } = await getInfo({ | ||
repo: options.repo, | ||
commit: commitToFetchFrom, | ||
}); | ||
return links; | ||
} | ||
return { | ||
commit: null, | ||
pull: null, | ||
user: null, | ||
}; | ||
})(); | ||
|
||
const users = usersFromSummary.length | ||
? usersFromSummary | ||
.map((userFromSummary) => `[@${userFromSummary}](https://github.com/${userFromSummary})`) | ||
.join(', ') | ||
: links.user; | ||
|
||
const pull = links.pull !== null ? links.pull : ''; | ||
const commit = links.commit !== null ? links.commit : ''; | ||
const prefix = pull || commit ? `${pull || commit}:` : ''; | ||
const mention = users !== null ? `(${users})` : users; | ||
const fullFirstLine = `${prefix} ${firstLine} ${mention}`; | ||
const futureLinesText = futureLines.map((l) => ` ${l}`).join('\n'); | ||
|
||
return `\n\n - ${fullFirstLine}\n${futureLinesText}`; | ||
}, | ||
async getDependencyReleaseLine(changesets, deps, options) { | ||
if (!options.repo) { | ||
throw new Error( | ||
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]', | ||
); | ||
} | ||
if (deps.length === 0) { | ||
return ''; | ||
} | ||
|
||
const commits = await Promise.all( | ||
changesets.map(async (cs) => { | ||
if (cs.commit) { | ||
let { links } = await getInfo({ | ||
repo: options.repo, | ||
commit: cs.commit, | ||
}); | ||
return links.commit; | ||
} | ||
}), | ||
); | ||
|
||
const changesetLink = `- Updated dependencies [${commits.join(', ')}]:`; | ||
const updatedDeps = deps.map((dep) => ` - ${dep.name}@${dep.newVersion}`); | ||
|
||
return [changesetLink, ...updatedDeps].join('\n'); | ||
}, | ||
}; | ||
|
||
module.exports = changelogFunctions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", | ||
"changelog": ["@changesets/changelog-github", { "repo": "ckb-cell/rgbpp-sdk" }], | ||
"changelog": ["./changelog-format.cjs", { "repo": "ckb-cell/rgbpp-sdk" }], | ||
"commit": false, | ||
"fixed": [["@rgbpp-sdk/*"]], | ||
"fixed": [["@rgbpp-sdk/*", "rgbpp"]], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"baseBranch": "origin/main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Test the entire process of RGBPP to ensure the proper functioning of the rgbpp-sdk package. | ||
|
||
name: Integration Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout rgbpp-sdk | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
|
||
- uses: pnpm/action-setup@v3 | ||
name: Install -g pnpm | ||
with: | ||
version: 8 | ||
run_install: false | ||
|
||
- name: Install dependencies | ||
run: pnpm i | ||
|
||
- name: Build packages | ||
run: pnpm run build:packages | ||
|
||
- name: Run integration:xudt script | ||
working-directory: ./tests/rgbpp | ||
run: pnpm run integration:xudt | ||
env: | ||
VITE_SERVICE_URL: ${{ secrets.SERVICE_URL }} | ||
VITE_SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }} | ||
VITE_SERVICE_ORIGIN: ${{ secrets.SERVICE_ORIGIN }} | ||
INTEGRATION_CKB_PRIVATE_KEY: ${{ secrets.INTEGRATION_CKB_PRIVATE_KEY }} | ||
INTEGRATION_BTC_PRIVATE_KEY: ${{ secrets.INTEGRATION_BTC_PRIVATE_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
NEXT_PUBLIC_SERVICE_URL= | ||
NEXT_PUBLIC_SERVICE_TOKEN= | ||
NEXT_PUBLIC_BTC_SERVICE_URL= | ||
NEXT_PUBLIC_BTC_SERVICE_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
VITE_SERVICE_URL= | ||
VITE_SERVICE_TOKEN= | ||
VITE_BTC_SERVICE_URL= | ||
VITE_BTC_SERVICE_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# True for CKB and BTC Mainnet and false for CKB and BTC Testnet, the default value is false | ||
IS_MAINNET=false | ||
|
||
# CKB Variables | ||
|
||
# The CKB secp256k1 private key whose format is 32bytes hex string with 0x prefix | ||
CKB_SECP256K1_PRIVATE_KEY=0x-private-key | ||
|
||
# CKB node url which should be matched with IS_MAINNET | ||
CKB_NODE_URL=https://testnet.ckb.dev/rpc | ||
|
||
# CKB indexer url which should be matched with IS_MAINNET | ||
CKB_INDEXER_URL=https://testnet.ckb.dev/indexer | ||
|
||
|
||
# BTC Variables | ||
|
||
# The BTC private key whose format is 32bytes hex string without 0x prefix | ||
BTC_PRIVATE_KEY=private-key | ||
|
||
# The BTC assets api url which should be matched with IS_MAINNET | ||
VITE_BTC_SERVICE_URL=https://btc-assets-api.testnet.mibao.pro | ||
|
||
# The BTC assets api token which should be matched with IS_MAINNET | ||
# To get an access token, please refer to https://github.com/ckb-cell/rgbpp-sdk/tree/develop/packages/service#get-an-access-token | ||
VITE_BTC_SERVICE_TOKEN= | ||
|
||
# The BTC assets api origin which should be matched with IS_MAINNET | ||
VITE_BTC_SERVICE_ORIGIN=https://btc-test.app |
Oops, something went wrong.