Skip to content

Commit f72c483

Browse files
committed
first commit %42
0 parents  commit f72c483

14 files changed

Lines changed: 2215 additions & 0 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
3+
{
4+
"name": "Node.js & TypeScript",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/typescript-node",
7+
"mounts": [
8+
"source=ickb-${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume",
9+
"source=ickb-${localWorkspaceFolderBasename}-dist,target=${containerWorkspaceFolder}/dist,type=volume",
10+
"source=pnpm-cache,target=${containerWorkspaceFolder}/.pnpm-store,type=volume"
11+
],
12+
// Features to add to the dev container. More info: https://containers.dev/features.
13+
// "features": {},
14+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15+
// "forwardPorts": [],
16+
// Use 'postCreateCommand' to run commands after the container is created.
17+
"postCreateCommand": "sudo chown node -R . && npm install -g pnpm@latest && pnpm install",
18+
// Configure tool-specific properties.
19+
// "customizations": {},
20+
"remoteUser": "node",
21+
"customizations": {
22+
// Configure properties specific to VS Code.
23+
"vscode": {
24+
// Set *default* container specific settings.json values on container create.
25+
"settings": {
26+
"eslint.validate": [
27+
"json",
28+
"javascript",
29+
"javascriptreact",
30+
"typescript",
31+
"typescriptreact"
32+
]
33+
},
34+
"extensions": [
35+
"streetsidesoftware.code-spell-checker",
36+
"dbaeumer.vscode-eslint",
37+
"esbenp.prettier-vscode",
38+
"yoavbls.pretty-ts-errors",
39+
"davidanson.vscode-markdownlint",
40+
"github.vscode-github-actions"
41+
]
42+
}
43+
}
44+
}

.github/workflows/check.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Lint and build
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repo
12+
uses: actions/checkout@v4
13+
14+
- name: Install pnpm
15+
uses: pnpm/action-setup@v4
16+
with:
17+
version: 10
18+
run_install: false
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "lts/*"
24+
registry-url: "https://registry.npmjs.org"
25+
cache: "pnpm"
26+
27+
- name: Install dependencies
28+
run: pnpm install
29+
30+
- name: Build project
31+
run: pnpm build
32+
33+
- name: Lint project
34+
run: pnpm lint

.github/workflows/publish.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish to NPM if not already present
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: 10
23+
run_install: false
24+
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: "lts/*"
29+
registry-url: "https://registry.npmjs.org"
30+
cache: "pnpm"
31+
32+
- name: Install dependencies
33+
run: pnpm install
34+
35+
- name: Build project
36+
run: pnpm build
37+
38+
- name: Publish to NPM if not already present
39+
run: |
40+
PACKAGE_NAME=$(node -p "require('./package.json').name")
41+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
42+
43+
if pnpm info ${PACKAGE_NAME}@${PACKAGE_VERSION} > /dev/null 2>&1; then
44+
echo "Version ${PACKAGE_VERSION} of ${PACKAGE_NAME} is already published, nothing to do."
45+
else
46+
pnpm publish --provenance --access public
47+
fi
48+
env:
49+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Logs
2+
log_*.json
3+
logs
4+
*.log
5+
npm-debug.log*
6+
yarn-debug.log*
7+
yarn-error.log*
8+
pnpm-debug.log*
9+
lerna-debug.log*
10+
11+
# Artifacts
12+
node_modules
13+
dist
14+
dist-ssr
15+
*.local
16+
.pnpm-store
17+
18+
# Editor directories and files
19+
.vscode/*
20+
!.vscode/extensions.json
21+
.idea
22+
.DS_Store
23+
*.suo
24+
*.ntvs*
25+
*.njsproj
26+
*.sln
27+
*.sw?

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": []
3+
}

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
MIT License
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# iCKB/template
2+
3+
iCKB template built on top of CCC to manage iCKB Typescript libraries boilerplate.
4+
5+
Use `./sync.sh` to create or update boilerplate in repositories.
6+
7+
Note: `./sync.sh` doesn't clean up old boilerplate files.
8+
9+
## Dependencies
10+
11+
```mermaid
12+
graph TD;
13+
A["@ickb/utils"] --> B["@ckb-ccc/core"];
14+
C["@ickb/dao"] --> A;
15+
C --> B;
16+
D["@ickb/core"] --> A;
17+
D --> C;
18+
E["@ickb/order"] --> A;
19+
E --> B;
20+
F["@ickb/sdk"] --> A;
21+
F --> B;
22+
F --> C;
23+
F --> D;
24+
F --> E;
25+
G["@ickb/template"] --> A;
26+
G --> B;
27+
G --> C;
28+
G --> D;
29+
G --> E;
30+
G --> F
31+
32+
click A "https://github.com/ickb/utils" "Go to @ickb/utils"
33+
click B "https://github.com/ckb-devrel/ccc/tree/master/packages/core" "Go to @ckb-ccc/core"
34+
click C "https://github.com/ickb/dao" "Go to @ickb/dao"
35+
click D "https://github.com/ickb/core" "Go to @ickb/core"
36+
click E "https://github.com/ickb/order" "Go to @ickb/order"
37+
click F "https://github.com/ickb/sdk" "Go to @ickb/sdk"
38+
click G "https://github.com/ickb/template" "Go to @ickb/template"
39+
```
40+
41+
## Epoch Semantic Versioning
42+
43+
This repository follows [Epoch Semantic Versioning](https://antfu.me/posts/epoch-semver). In short ESV aims to provide a more nuanced and effective way to communicate software changes, allowing for better user understanding and smoother upgrades.
44+
45+
## Licensing
46+
47+
This source code, crafted with care by [Phroi](https://phroi.com/), is freely available on [GitHub](https://github.com/ickb/template) and it is released under the [MIT License](./LICENSE).

eslint.config.mjs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// @ts-check
2+
3+
// Created following https://typescript-eslint.io/
4+
5+
import eslint from "@eslint/js";
6+
import tseslint from "typescript-eslint";
7+
8+
export default tseslint.config(
9+
{
10+
ignores: ["dist/**", "eslint.config.mjs"],
11+
rules: {
12+
"@typescript-eslint/explicit-function-return-type": "error",
13+
},
14+
},
15+
eslint.configs.recommended,
16+
tseslint.configs.strictTypeChecked,
17+
tseslint.configs.stylisticTypeChecked,
18+
{
19+
languageOptions: {
20+
parserOptions: {
21+
projectService: true,
22+
},
23+
},
24+
}
25+
);

package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@ickb/template",
3+
"version": "0.0.0",
4+
"description": "iCKB template built on top of CCC",
5+
"author": "phroi",
6+
"license": "MIT",
7+
"private": false,
8+
"homepage": "https://github.com/ickb/template",
9+
"repository": {
10+
"type": "git",
11+
"url": "git://github.com/ickb/template.git"
12+
},
13+
"sideEffects": false,
14+
"main": "dist/cjs/index.js",
15+
"module": "dist/esm/index.js",
16+
"types": "dist/esm/index.d.ts",
17+
"scripts": {
18+
"build": "pnpm run build:esm && pnpm run build:cjs && node dist/cjs/index.js",
19+
"build:esm": "tsc",
20+
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
21+
"lint": "eslint ./src",
22+
"up2lint": "rm pnpm-lock.yaml && pnpm up && pnpm build && pnpm lint"
23+
},
24+
"files": [
25+
"/dist",
26+
"/src"
27+
],
28+
"publishConfig": {
29+
"access": "public",
30+
"provenance": true
31+
},
32+
"devDependencies": {
33+
"@eslint/js": "^9.28.0",
34+
"eslint": "^9.28.0",
35+
"prettier": "^3.5.3",
36+
"typescript": "^5.8.3",
37+
"typescript-eslint": "^8.34.0"
38+
},
39+
"dependencies": {
40+
"@ckb-ccc/core": "^1.9.0",
41+
"@ickb/core": "^1000.0.72",
42+
"@ickb/dao": "^1000.0.72",
43+
"@ickb/order": "^1000.0.75",
44+
"@ickb/sdk": "^1000.0.71",
45+
"@ickb/utils": "^1000.0.72"
46+
}
47+
}

0 commit comments

Comments
 (0)