Skip to content

Commit b9e3673

Browse files
committed
feat: openblocks app view support module api
1 parent 3e61eef commit b9e3673

Some content is hidden

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

60 files changed

+1671
-608
lines changed

client/README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
1-
# Openblocks
1+
# Openblocks' frontend
22

3-
Openblocks frontend app
3+
## How to contribute
44

5-
## Start development
5+
### Start a local backend server
6+
7+
#### Use prebuilt docker image
8+
9+
Simply run below command to start a backend server.
10+
11+
```bash
12+
docker run -d --name openblocks -p 3000:3000 -v "$PWD/stacks:/openblocks-stacks" openblocksdev/openblocks-ce
13+
```
14+
15+
For more information, view our doc https://docs.openblocks.dev/self-hosting
16+
17+
#### Build Docker image from source
18+
19+
1. Check out source code and change to source dir.
20+
2. Use the command below to build Docker image :
621

722
```bash
8-
yarn install
23+
docker build -f ./deploy/docker/Dockerfile -t openblocks-dev .
24+
```
25+
26+
3. Start
927

10-
API_PROXY_TARGET={backend-api-addr} yarn start
28+
```bash
29+
docker run -d --name openblocks-dev -p 3000:3000 -v "$PWD/stacks:/openblocks-stacks" openblocks-dev
1130
```
31+
32+
### Start develop
33+
34+
1. Check out source code.
35+
2. Change to client dir in the repository root via cd client.
36+
3. Run yarn to install dependencies: .
37+
4. Start dev server: `API_PROXY_TARGET=http://localhost:3000 yarn start`.
38+
5. After dev server starts successfully, it will be automatically opened in the default browser.
39+
40+
### Before submitting a pull request
41+
42+
In addition, before submitting a pull request, please make sure the following is done:
43+
44+
1. If you’ve fixed a bug or added code that should be tested and add unit test suite.
45+
2. Run `yarn test` and ensure all test suites pass.
46+
3. If you add new dependency, use yarn workspace openblocks some-package to make sure yarn.lock is also updated.

client/config/test/jest.setup-after-env.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,11 @@ window.resizeTo = function resizeTo(width, height) {
1313
outerHeight: height,
1414
}).dispatchEvent(new this.Event("resize"));
1515
};
16+
17+
window.ResizeObserver = function () {
18+
return {
19+
observe: () => {},
20+
unobserve: () => {},
21+
disconnect: () => {},
22+
};
23+
};

client/packages/create-openblocks-comps/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { spawn } from "node:child_process";
55
import { writeFileSync, existsSync } from "node:fs";
66
import chalk from "chalk";
77
import { createCommand } from "commander";
8-
import { readJson } from "openblocks-dev-utils/util.js";
8+
import { readJson, currentDirName } from "openblocks-dev-utils/util.js";
99

10-
const pkg = readJson("./package.json");
10+
const currentDir = currentDirName(import.meta.url);
11+
const pkg = readJson(path.resolve(currentDir, "./package.json"));
1112

1213
const isUsingYarn = (process.env.npm_config_user_agent || "").indexOf("yarn") === 0;
1314
const cliPackageName = "openblocks-cli";
@@ -104,6 +105,7 @@ async function createProject(projectName, options) {
104105
if (force) {
105106
fs.emptyDirSync(root);
106107
} else {
108+
console.log();
107109
console.error(`${root} is not empty`);
108110
process.exit(1);
109111
}

client/packages/create-openblocks-comps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-openblocks-comps",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"bin": "./index.js",
55
"type": "module",
66
"dependencies": {

client/packages/openblocks-cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "openblocks-cli",
33
"description": "CLI tool used to start build publish openblocks components",
4-
"version": "0.0.4",
4+
"version": "0.0.5",
55
"bin": "./index.js",
66
"type": "module",
77
"exports": {
@@ -25,6 +25,7 @@
2525
"file-loader": "^6.2.0",
2626
"fs-extra": "^10.1.0",
2727
"html-webpack-plugin": "^5.5.0",
28+
"openblocks-dev-utils": "workspace:^",
2829
"react-json-view": "^1.21.3",
2930
"vite": "^3.2.3"
3031
},

0 commit comments

Comments
 (0)