Skip to content

Commit

Permalink
feat: export backend packages in @ckb-ccc/shell
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanssen0 committed Jan 9, 2025
1 parent 5491373 commit 0b908aa
Show file tree
Hide file tree
Showing 30 changed files with 333 additions and 23 deletions.
7 changes: 7 additions & 0 deletions .changeset/large-points-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@ckb-ccc/spore": minor
"@ckb-ccc/shell": minor
"@ckb-ccc/ccc": minor
---

feat: export backend packages in @ckb-ccc/shell
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Follow the prompts to select your preferred framework template and start buildin

We design CCC for both front-end and back-end developers. You need only one package to fulfil all your needs:

- [NodeJS](https://www.npmjs.com/package/@ckb-ccc/core): `npm install @ckb-ccc/core`
- [NodeJS](https://www.npmjs.com/package/@ckb-ccc/shell): `npm install @ckb-ccc/shell`
- [Custom UI](https://www.npmjs.com/package/@ckb-ccc/ccc): `npm install @ckb-ccc/ccc`
- [Web Component](https://www.npmjs.com/package/@ckb-ccc/connector): `npm install @ckb-ccc/connector`
- [React](https://www.npmjs.com/package/@ckb-ccc/connector-react) ([Docs](https://docs.ckbccc.com/modules/_ckb_ccc_connector_react.html)): `npm install @ckb-ccc/connector-react`
Expand Down
2 changes: 1 addition & 1 deletion packages/ccc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"access": "public"
},
"dependencies": {
"@ckb-ccc/core": "workspace:*",
"@ckb-ccc/shell": "workspace:*",
"@ckb-ccc/eip6963": "workspace:*",
"@ckb-ccc/joy-id": "workspace:*",
"@ckb-ccc/nip07": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/ccc/src/advancedBarrel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from "@ckb-ccc/core/advancedBarrel";
export * from "@ckb-ccc/eip6963/advanced";
export * from "@ckb-ccc/nip07/advanced";
export * from "@ckb-ccc/okx/advanced";
export * from "@ckb-ccc/shell/advancedBarrel";
export * from "@ckb-ccc/uni-sat/advanced";
export * from "@ckb-ccc/utxo-global/advanced";
export * from "@ckb-ccc/xverse/advanced";
2 changes: 1 addition & 1 deletion packages/ccc/src/barrel.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export * from "@ckb-ccc/core/barrel";
export * from "@ckb-ccc/eip6963";
export * from "@ckb-ccc/joy-id";
export * from "@ckb-ccc/nip07";
export * from "@ckb-ccc/okx";
export * from "@ckb-ccc/rei";
export * from "@ckb-ccc/shell/barrel";
export * from "@ckb-ccc/uni-sat";
export * from "@ckb-ccc/utxo-global";
export * from "@ckb-ccc/xverse";
Expand Down
2 changes: 1 addition & 1 deletion packages/ccc/src/signersController.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ccc } from "@ckb-ccc/core";
import { Eip6963 } from "@ckb-ccc/eip6963";
import { JoyId } from "@ckb-ccc/joy-id";
import { Nip07 } from "@ckb-ccc/nip07";
import { Okx } from "@ckb-ccc/okx";
import { Rei } from "@ckb-ccc/rei";
import { ccc } from "@ckb-ccc/shell";
import { UniSat } from "@ckb-ccc/uni-sat";
import { UtxoGlobal } from "@ckb-ccc/utxo-global";
import { Xverse } from "@ckb-ccc/xverse";
Expand Down
4 changes: 1 addition & 3 deletions packages/demo/src/app/connected/(tools)/TransferUdt/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Textarea } from "@/src/components/Textarea";
import { useGetExplorerLink } from "@/src/utils";
import { useApp } from "@/src/context";
import { ButtonsPanel } from "@/src/components/ButtonsPanel";
import { Udt } from "@ckb-ccc/udt";

export default function TransferUdt() {
const { client } = ccc.useCcc();
Expand Down Expand Up @@ -84,8 +83,7 @@ export default function TransferUdt() {
.split("\n")
.map((addr) => ccc.Address.fromString(addr, signer.client)),
);

const udt = new Udt(
const udt = new ccc.udt.Udt(
{
txHash: udtTxHash,
index: udtIndex,
Expand Down
4 changes: 0 additions & 4 deletions packages/playground/src/app/execute/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ccc } from "@ckb-ccc/connector-react";
import * as cccLib from "@ckb-ccc/ccc";
import * as cccSporeLib from "@ckb-ccc/spore";
import * as cccAdvancedLib from "@ckb-ccc/ccc/advanced";
import * as cccSporeAdvancedLib from "@ckb-ccc/spore/advanced";
import { ReactNode } from "react";
import ts from "typescript";
import { vlqDecode } from "./vlq";
Expand Down Expand Up @@ -60,8 +58,6 @@ export async function execute(
"@ckb-ccc/core/advanced": cccAdvancedLib,
"@ckb-ccc/ccc": cccLib,
"@ckb-ccc/ccc/advanced": cccAdvancedLib,
"@ckb-ccc/spore": cccSporeLib,
"@ckb-ccc/spore/advanced": cccSporeAdvancedLib,
"@ckb-ccc/playground": {
render: async (tx: ccc.Transaction | unknown) => {
if (!(tx instanceof ccc.Transaction)) {
Expand Down
21 changes: 21 additions & 0 deletions packages/shell/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules/
misc/

*test.js
*test.ts
*test.d.ts
*test.d.ts.map
*spec.js
*spec.ts
*spec.d.ts
*spec.d.ts.map

tsconfig.json
tsconfig.*.json
eslint.config.mjs
.prettierrc
.prettierignore

tsconfig.tsbuildinfo
tsconfig.*.tsbuildinfo
.github/
13 changes: 13 additions & 0 deletions packages/shell/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules/

dist/
dist.commonjs/

.npmignore
.prettierrc
tsconfig.json
eslint.config.mjs
.prettierrc

tsconfig.tsbuildinfo
.github/
5 changes: 5 additions & 0 deletions packages/shell/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": false,
"trailingComma": "all",
"plugins": ["prettier-plugin-organize-imports"]
}
41 changes: 41 additions & 0 deletions packages/shell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<p align="center">
<a href="https://app.ckbccc.com/">
<img alt="Logo" src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/logoAndText.svg" style="height: 8rem; max-width: 90%; padding: 0.5rem 0;" />
</a>
</p>

<h1 align="center" style="font-size: 64px;">
CCC Shell
</h1>

<p align="center">
<a href="https://www.npmjs.com/package/@ckb-ccc/shell"><img
alt="NPM Version" src="https://img.shields.io/npm/v/%40ckb-ccc%2Fshell"
/></a>
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/ckb-devrel/ccc" />
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ckb-devrel/ccc/master" />
<img alt="GitHub branch check runs" src="https://img.shields.io/github/check-runs/ckb-devrel/ccc/master" />
<a href="https://live.ckbccc.com/"><img
alt="Playground" src="https://img.shields.io/website?url=https%3A%2F%2Flive.ckbccc.com%2F&label=Playground"
/></a>
<a href="https://app.ckbccc.com/"><img
alt="App" src="https://img.shields.io/website?url=https%3A%2F%2Fapp.ckbccc.com%2F&label=App"
/></a>
<a href="https://docs.ckbccc.com/"><img
alt="Docs" src="https://img.shields.io/website?url=https%3A%2F%2Fdocs.ckbccc.com%2F&label=Docs"
/></a>
</p>

<p align="center">
CCC - CKBers' Codebase is a one-stop solution for your CKB JS/TS ecosystem development.
<br />
Empower yourself with CCC to discover the unlimited potential of CKB.
<br />
Interoperate with wallets from different chain ecosystems.
<br />
Fully enabling CKB's Turing completeness and cryptographic freedom power.
</p>

<h3 align="center">
Read more about CCC on <a href="https://docs.ckbccc.com">our website</a> or <a href="https://github.com/ckb-devrel/ccc">GitHub Repo</a>.
</h3>
45 changes: 45 additions & 0 deletions packages/shell/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// @ts-check

import eslint from "@eslint/js";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier";
import tseslint from "typescript-eslint";

import { dirname } from "path";
import { fileURLToPath } from "url";

export default tseslint.config({
files: ["**/*.ts"],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
],
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"@typescript-eslint/unbound-method": ["error", { ignoreStatic: true }],
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/require-await": "off",
"no-empty": "off",
"prefer-const": [
"error",
{ ignoreReadBeforeAssign: true, destructuring: "all" },
],
},
plugins: { prettier: eslintPluginPrettierRecommended },
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: dirname(fileURLToPath(import.meta.url)),
},
},
});
3 changes: 3 additions & 0 deletions packages/shell/misc/basedirs/dist.commonjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
3 changes: 3 additions & 0 deletions packages/shell/misc/basedirs/dist/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
64 changes: 64 additions & 0 deletions packages/shell/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@ckb-ccc/shell",
"version": "1.0.7",
"description": "Backend Shell of CCC - CKBer's Codebase. Common Chains Connector.",
"author": "Hanssen0 <[email protected]>",
"license": "MIT",
"private": false,
"homepage": "https://github.com/ckb-devrel/ccc",
"repository": {
"type": "git",
"url": "git://github.com/ckb-devrel/ccc.git"
},
"sideEffects": false,
"main": "dist.commonjs/index.js",
"module": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist.commonjs/index.js",
"default": "./dist.commonjs/index.js"
},
"./barrel": {
"import": "./dist/barrel.js",
"require": "./dist.commonjs/barrel.js",
"default": "./dist.commonjs/barrel.js"
},
"./advancedBarrel": {
"import": "./dist/advancedBarrel.js",
"require": "./dist.commonjs/advancedBarrel.js",
"default": "./dist.commonjs/advancedBarrel.js"
},
"./advanced": {
"import": "./dist/advanced.js",
"require": "./dist.commonjs/advanced.js",
"default": "./dist.commonjs/advanced.js"
}
},
"scripts": {
"build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
"lint": "eslint ./src",
"format": "prettier --write . && eslint --fix ./src"
},
"devDependencies": {
"@eslint/js": "^9.1.1",
"copyfiles": "^2.4.1",
"eslint": "^9.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"rimraf": "^5.0.5",
"typescript": "^5.4.5",
"typescript-eslint": "^7.7.0"
},
"publishConfig": {
"access": "public"
},
"dependencies": {
"@ckb-ccc/core": "workspace:*",
"@ckb-ccc/spore": "workspace:*",
"@ckb-ccc/udt": "workspace:*",
"@ckb-ccc/ssri": "workspace:*"
}
}
2 changes: 2 additions & 0 deletions packages/shell/src/advanced.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./advancedBarrel.js";
export * as cccA from "./advancedBarrel.js";
2 changes: 2 additions & 0 deletions packages/shell/src/advancedBarrel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "@ckb-ccc/core/advancedBarrel";
export { sporeA } from "@ckb-ccc/spore/advanced";
4 changes: 4 additions & 0 deletions packages/shell/src/barrel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from "@ckb-ccc/core/barrel";
export { spore } from "@ckb-ccc/spore";
export { ssri } from "@ckb-ccc/ssri";
export { udt } from "@ckb-ccc/udt";
2 changes: 2 additions & 0 deletions packages/shell/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./barrel.js";
export * as ccc from "./barrel.js";
22 changes: 22 additions & 0 deletions packages/shell/tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"target": "es2020",
"incremental": true,
"allowJs": true,
"importHelpers": false,
"declaration": true,
"declarationMap": true,
"experimentalDecorators": true,
"useDefineForClassFields": false,
"esModuleInterop": true,
"strict": true,
"noImplicitAny": true,
"strictBindCallApply": true,
"strictNullChecks": true,
"alwaysStrict": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"skipLibCheck": true
},
"include": ["src/**/*"]
}
8 changes: 8 additions & 0 deletions packages/shell/tsconfig.commonjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "./dist.commonjs"
}
}
8 changes: 8 additions & 0 deletions packages/shell/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"outDir": "./dist",
}
}
6 changes: 6 additions & 0 deletions packages/shell/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["./src/index.ts", "./src/advanced.ts"],
"extends": ["../../typedoc.base.json"],
"name": "@ckb-ccc shell"
}
10 changes: 10 additions & 0 deletions packages/spore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,20 @@
"require": "./dist.commonjs/index.js",
"default": "./dist.commonjs/index.js"
},
"./barrel": {
"import": "./dist/barrel.js",
"require": "./dist.commonjs/barrel.js",
"default": "./dist.commonjs/barrel.js"
},
"./advanced": {
"import": "./dist/advanced.js",
"require": "./dist.commonjs/advanced.js",
"default": "./dist.commonjs/advanced.js"
},
"./advancedBarrel": {
"import": "./dist/advancedBarrel.js",
"require": "./dist.commonjs/advancedBarrel.js",
"default": "./dist.commonjs/advancedBarrel.js"
}
},
"scripts": {
Expand Down
6 changes: 2 additions & 4 deletions packages/spore/src/advanced.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export * from "./cobuild/index.js";
export * from "./codec/index.js";
export * from "./predefined/advanced.js";
export * from "./spore/advanced.js";
export * from "./advancedBarrel.js";
export * as sporeA from "./advancedBarrel.js";
4 changes: 4 additions & 0 deletions packages/spore/src/advancedBarrel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from "./cobuild/index.js";
export * from "./codec/index.js";
export * from "./predefined/advanced.js";
export * from "./spore/advanced.js";
4 changes: 4 additions & 0 deletions packages/spore/src/barrel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from "./cluster/index.js";
export * as dob from "./dob/index.js";
export * from "./predefined/index.js";
export * from "./spore/index.js";
Loading

0 comments on commit 0b908aa

Please sign in to comment.