Skip to content

Commit 508beda

Browse files
committed
chore: open source blocklet server
0 parents  commit 508beda

3,752 files changed

Lines changed: 759664 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/node_modules/

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# For more information about the properties used in
2+
# this file, please see the EditorConfig documentation:
3+
# http://editorconfig.org/
4+
#
5+
# Sensible EditorConfig defaults
6+
# https://gist.github.com/matijs/662bf45dd4ec37b3a068
7+
root = true
8+
9+
[*]
10+
charset = utf-8
11+
end_of_line = lf
12+
indent_size = 2
13+
indent_style = space
14+
insert_final_newline = true
15+
trim_trailing_whitespace = true
16+
17+
# Make sure package.json always uses 2 spaces to indent
18+
[{package.json}]
19+
indent_size = 2
20+
indent_style = space
21+
22+
[{makefile, Makefile}]
23+
indent_style = tab

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
jest.js
2+
jest.config.js
3+
tools/patches
4+
core/client/src/*.d.ts
5+
core/schema/lib/index.js
6+
core/store/dist
7+
core/state/tests/assets

.eslintrc.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = {
2+
plugins: ['sonarjs', 'monorepo-cop'],
3+
extends: ['@arcblock/eslint-config', 'plugin:monorepo-cop/recommended'],
4+
parserOptions: {
5+
ecmaVersion: 2022,
6+
},
7+
rules: {
8+
// @see: https://github.com/SonarSource/eslint-plugin-sonarjs#rules
9+
'sonarjs/no-redundant-jump': 'error',
10+
'sonarjs/prefer-single-boolean-return': 'error',
11+
'no-use-before-define': ['error', 'nofunc'],
12+
'import/prefer-default-export': 'off',
13+
'import/no-unresolved': ['error', { ignore: ['^bun:'] }],
14+
'react/require-default-props': [
15+
'error',
16+
{
17+
functions: 'defaultArguments',
18+
forbidDefaultForRequired: false,
19+
},
20+
],
21+
},
22+
overrides: [
23+
{
24+
files: ['core/state/**'],
25+
rules: {
26+
'no-promise-executor-return': 'off',
27+
'default-param-last': 'off',
28+
'no-continue': 'off',
29+
},
30+
},
31+
],
32+
};

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 所有文本文件使用 LF 换行符,且自动识别文本类型
2+
* text=auto eol=lf
3+
4+
# Ensure all *.db files are treated as binary
5+
*.db binary
6+
**/*.db binary
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: e2e-docker-tests
2+
env:
3+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
4+
CACHE_VERSION: 20260130
5+
E2E_ENABLE_VIDEO: false
6+
CYPRESS_INSTALL_BINARY: '15.5.0'
7+
on:
8+
push:
9+
branches:
10+
- master
11+
12+
jobs:
13+
e2e-docker-test:
14+
timeout-minutes: 35
15+
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 1
22+
23+
- name: Install Bun
24+
run: curl -fsSL https://bun.sh/install | bash
25+
26+
- name: Use Node.js v22
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
30+
31+
- name: Install Nginx with stream module
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install -y nginx-extras dnsutils
35+
sudo nginx -t
36+
sudo setcap 'cap_net_bind_service=+ep' $(which nginx)
37+
nginx -V
38+
39+
- name: Cache Cypress binary
40+
uses: actions/cache@v4
41+
with:
42+
path: ~/.cache/Cypress
43+
key: ${{ runner.os }}-cypress-${{env.CACHE_VERSION}}-${{ hashFiles('**/package.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-cypress-${{env.CACHE_VERSION}}
46+
47+
- name: Test Docker is available
48+
run: |
49+
echo "Checking Docker availability..."
50+
docker ps || echo "❌ Docker is not available (might not be installed or permission denied)"
51+
52+
- name: Cache node_modules
53+
id: cache-node-modules
54+
uses: actions/cache@v4
55+
with:
56+
path: |
57+
node_modules
58+
**/node_modules
59+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/bun.lock') }}
60+
restore-keys: |
61+
${{ runner.os }}-node_modules-
62+
63+
- name: Install dependencies
64+
run: make github-init
65+
66+
- name: Build
67+
run: |
68+
make build
69+
git checkout .
70+
71+
- name: Install Cypress
72+
run: cd core/webapp && npm run cypress-install
73+
74+
- name: Install cross-env
75+
run: npm install -g cross-env
76+
77+
- name: Install nyc
78+
run: npm install -g nyc
79+
80+
- uses: browser-actions/setup-chrome@v1
81+
- run: chrome --version
82+
83+
- name: Run e2e tests
84+
uses: cypress-io/github-action@v6
85+
with:
86+
record: ${{ secrets.CYPRESS_TOKEN != '' }}
87+
install: false
88+
browser: chrome
89+
command: npm run e2e:docker
90+
working-directory: ./
91+
env:
92+
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_TOKEN || '' }}
93+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94+
95+
- name: Upload cypress screenshots
96+
if: failure()
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: cypress-screenshots
100+
path: '**/cypress/screenshots/**'
101+
retention-days: 3
102+
103+
- name: Upload cypress videos
104+
if: failure()
105+
uses: actions/upload-artifact@v4
106+
with:
107+
name: cypress-videos
108+
path: '**/cypress/videos/**'
109+
retention-days: 1

.github/workflows/e2e-tests.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: e2e-tests
2+
env:
3+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
4+
CACHE_VERSION: 20260130
5+
E2E_ENABLE_VIDEO: false
6+
CYPRESS_INSTALL_BINARY: '15.5.0'
7+
on:
8+
push:
9+
branches:
10+
- master
11+
12+
jobs:
13+
e2e-test:
14+
timeout-minutes: 35
15+
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 1
22+
23+
- name: Install Bun
24+
run: curl -fsSL https://bun.sh/install | bash
25+
26+
- name: Use Node.js v22
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
30+
31+
- name: Install Nginx with stream module
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install -y nginx-extras dnsutils
35+
sudo nginx -t
36+
sudo setcap 'cap_net_bind_service=+ep' $(which nginx)
37+
nginx -V
38+
39+
- name: Cache Cypress binary
40+
uses: actions/cache@v4
41+
with:
42+
path: ~/.cache/Cypress
43+
key: ${{ runner.os }}-cypress-${{env.CACHE_VERSION}}-${{ hashFiles('**/package.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-cypress-${{env.CACHE_VERSION}}
46+
47+
- name: Test Docker is available
48+
run: |
49+
echo "Checking Docker availability..."
50+
docker ps || echo "❌ Docker is not available (might not be installed or permission denied)"
51+
52+
- name: Cache node_modules
53+
id: cache-node-modules
54+
uses: actions/cache@v4
55+
with:
56+
path: |
57+
node_modules
58+
**/node_modules
59+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/bun.lock') }}
60+
restore-keys: |
61+
${{ runner.os }}-node_modules-
62+
63+
- name: Install dependencies
64+
run: make github-init
65+
66+
- name: Build
67+
run: |
68+
make build
69+
git checkout .
70+
71+
- name: Install Cypress
72+
run: cd core/webapp && npm run cypress-install
73+
74+
- name: Install cross-env
75+
run: npm install -g cross-env
76+
77+
- name: Install nyc
78+
run: npm install -g nyc
79+
80+
- uses: browser-actions/setup-chrome@v1
81+
- run: chrome --version
82+
83+
- name: Set CLUSTER ENV
84+
run: |
85+
echo "ABT_NODE_DAEMON_CLUSTER_SIZE=2" >> $GITHUB_ENV
86+
echo "ABT_NODE_MAX_CLUSTER_SIZE=2" >> $GITHUB_ENV
87+
88+
- name: Run e2e tests
89+
uses: cypress-io/github-action@v6
90+
with:
91+
record: ${{ secrets.CYPRESS_TOKEN != '' }}
92+
install: false
93+
browser: chrome
94+
command: npm run e2e
95+
working-directory: ./
96+
env:
97+
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_TOKEN || '' }}
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
100+
- name: Upload cypress screenshots
101+
if: failure()
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: cypress-screenshots
105+
path: '**/cypress/screenshots/**'
106+
retention-days: 3
107+
108+
- name: Upload cypress videos
109+
if: failure()
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: cypress-videos
113+
path: '**/cypress/videos/**'
114+
retention-days: 1

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 30
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- uses: oven-sh/setup-bun@v2
17+
with:
18+
bun-version: latest
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
24+
- name: Cache node_modules
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
node_modules
29+
**/node_modules
30+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/bun.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-node_modules-
33+
34+
- name: Install dependencies
35+
run: make github-init
36+
37+
- name: Build
38+
run: make build
39+
40+
- name: Publish to npm
41+
run: |
42+
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
43+
npx lerna publish from-git --yes
44+
env:
45+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
46+
GIT_AUTHOR_NAME: github-actions[bot]
47+
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
48+
GIT_COMMITTER_NAME: github-actions[bot]
49+
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com

0 commit comments

Comments
 (0)