@nocobase/build 2.1.0-alpha.1 → 2.1.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -661
- package/README.md +79 -10
- package/lib/buildClient.js +113 -53
- package/lib/buildDeclaration.js +67 -23
- package/lib/buildPlugin.js +176 -63
- package/lib/constant.js +6 -2
- package/lib/index.d.ts +2 -3
- package/lib/injectPublicPathPlugin.js +88 -0
- package/lib/utils/utils.js +1 -1
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# NocoBase
|
|
2
2
|
|
|
3
3
|
<video width="100%" controls>
|
|
4
|
-
|
|
4
|
+
<source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
|
|
5
5
|
</video>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
9
|
+
<a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability-first, open-source no-code platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
12
|
## What is NocoBase
|
|
9
13
|
|
|
10
|
-
NocoBase is
|
|
11
|
-
|
|
14
|
+
NocoBase is the most extensible AI-powered no-code platform.
|
|
15
|
+
Total control. Infinite extensibility. AI collaboration.
|
|
16
|
+
Enable your team to adapt quickly and cut costs dramatically.
|
|
17
|
+
No years of development. No millions wasted.
|
|
18
|
+
Deploy NocoBase in minutes — and take control of everything.
|
|
12
19
|
|
|
13
20
|
Homepage:
|
|
14
|
-
https://www.nocobase.com/
|
|
21
|
+
https://www.nocobase.com/
|
|
15
22
|
|
|
16
23
|
Online Demo:
|
|
17
24
|
https://demo.nocobase.com/new
|
|
@@ -19,12 +26,74 @@ https://demo.nocobase.com/new
|
|
|
19
26
|
Documents:
|
|
20
27
|
https://docs.nocobase.com/
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
https://
|
|
29
|
+
Forum:
|
|
30
|
+
https://forum.nocobase.com/
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
https://www.nocobase.com/en/
|
|
32
|
+
Use Cases:
|
|
33
|
+
https://www.nocobase.com/en/blog/tags/customer-stories
|
|
27
34
|
|
|
35
|
+
## Release Notes
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
|
|
38
|
+
|
|
39
|
+
## Distinctive features
|
|
40
|
+
|
|
41
|
+
### 1. Data model-driven, not form/table–driven
|
|
42
|
+
|
|
43
|
+
Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
|
|
44
|
+
|
|
45
|
+
- UI and data structure are fully decoupled
|
|
46
|
+
- Multiple blocks and actions can be created for the same table or record in any quantity or form
|
|
47
|
+
- Supports the main database, external databases, and third-party APIs as data sources
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
### 2. AI employees, integrated into your business systems
|
|
52
|
+
Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
|
|
53
|
+
|
|
54
|
+
- Define AI employees for roles such as translator, analyst, researcher, or assistant
|
|
55
|
+
- Seamless AI–human collaboration in interfaces and workflows
|
|
56
|
+
- Ensure AI usage is secure, transparent, and customizable for your business needs
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
### 3. What you see is what you get, incredibly easy to use
|
|
61
|
+
|
|
62
|
+
While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
|
|
63
|
+
|
|
64
|
+
- One-click switch between usage mode and configuration mode
|
|
65
|
+
- Pages serve as a canvas to arrange blocks and actions, similar to Notion
|
|
66
|
+
- Configuration mode is designed for ordinary users, not just programmers
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
### 4. Everything is a plugin, designed for extension
|
|
71
|
+
Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
|
|
72
|
+
|
|
73
|
+
- All functionalities are plugins, similar to WordPress
|
|
74
|
+
- Plugins are ready to use upon installation
|
|
75
|
+
- Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
NocoBase supports three installation methods:
|
|
82
|
+
|
|
83
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
|
|
84
|
+
|
|
85
|
+
Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
|
|
86
|
+
|
|
87
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
|
|
88
|
+
|
|
89
|
+
The business code of the project is completely independent and supports low-code development.
|
|
90
|
+
|
|
91
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
|
|
92
|
+
|
|
93
|
+
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
|
|
94
|
+
|
|
95
|
+
## How NocoBase works
|
|
96
|
+
|
|
97
|
+
<video width="100%" controls>
|
|
98
|
+
<source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
|
|
99
|
+
</video>
|
package/lib/buildClient.js
CHANGED
|
@@ -31,13 +31,14 @@ __export(buildClient_exports, {
|
|
|
31
31
|
buildLocale: () => buildLocale
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(buildClient_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_core = require("@rsbuild/core");
|
|
35
|
+
var import_plugin_less = require("@rsbuild/plugin-less");
|
|
36
|
+
var import_plugin_react = require("@rsbuild/plugin-react");
|
|
37
|
+
var import_plugin_svgr = require("@rsbuild/plugin-svgr");
|
|
35
38
|
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
39
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
40
|
var import_path = __toESM(require("path"));
|
|
38
41
|
var import_tsup = require("tsup");
|
|
39
|
-
var import_vite = require("vite");
|
|
40
|
-
var import_vite_plugin_lib_inject_css = require("vite-plugin-lib-inject-css");
|
|
41
42
|
var import_constant = require("./constant");
|
|
42
43
|
var import_utils = require("./utils");
|
|
43
44
|
async function buildClient(cwd, userConfig, sourcemap = false, log) {
|
|
@@ -45,7 +46,7 @@ async function buildClient(cwd, userConfig, sourcemap = false, log) {
|
|
|
45
46
|
const cwdWin = cwd.replaceAll(/\\/g, "/");
|
|
46
47
|
const cwdUnix = cwd.replaceAll(/\//g, "\\");
|
|
47
48
|
const external = function(id) {
|
|
48
|
-
if (id.startsWith(".") || id.startsWith(cwdUnix) || id.startsWith(cwdWin)) {
|
|
49
|
+
if (!id || import_path.default.isAbsolute(id) || id.startsWith(".") || id.startsWith(cwdUnix) || id.startsWith(cwdWin)) {
|
|
49
50
|
return false;
|
|
50
51
|
}
|
|
51
52
|
return true;
|
|
@@ -54,35 +55,12 @@ async function buildClient(cwd, userConfig, sourcemap = false, log) {
|
|
|
54
55
|
await buildClientLib(cwd, userConfig, sourcemap, external, log);
|
|
55
56
|
await buildLocale(cwd, userConfig, log);
|
|
56
57
|
}
|
|
57
|
-
function buildClientEsm(cwd, userConfig, sourcemap, external, log) {
|
|
58
|
+
async function buildClientEsm(cwd, userConfig, sourcemap, external, log) {
|
|
58
59
|
log("build client esm");
|
|
59
60
|
const entry = import_path.default.join(cwd, "src/index.ts").replaceAll(/\\/g, "/");
|
|
60
61
|
const outDir = import_path.default.resolve(cwd, "es");
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
mode: process.env.NODE_ENV || "production",
|
|
64
|
-
define: (0, import_utils.getEnvDefine)(),
|
|
65
|
-
build: {
|
|
66
|
-
minify: process.env.NODE_ENV === "production",
|
|
67
|
-
outDir,
|
|
68
|
-
cssCodeSplit: true,
|
|
69
|
-
emptyOutDir: true,
|
|
70
|
-
sourcemap,
|
|
71
|
-
lib: {
|
|
72
|
-
entry,
|
|
73
|
-
formats: ["es"],
|
|
74
|
-
fileName: "index"
|
|
75
|
-
},
|
|
76
|
-
target: ["es2015", "edge88", "firefox78", "chrome87", "safari14"],
|
|
77
|
-
rollupOptions: {
|
|
78
|
-
cache: true,
|
|
79
|
-
treeshake: true,
|
|
80
|
-
external
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
plugins: [(0, import_plugin_react.default)(), (0, import_vite_plugin_lib_inject_css.libInjectCss)()]
|
|
84
|
-
})
|
|
85
|
-
);
|
|
62
|
+
await buildClientWithRsbuild(cwd, userConfig, sourcemap, external, entry, outDir, "esm");
|
|
63
|
+
await injectEntryStyleReference(import_path.default.join(outDir, "index.mjs"), 'import "./index.css";');
|
|
86
64
|
}
|
|
87
65
|
async function buildClientLib(cwd, userConfig, sourcemap, external, log) {
|
|
88
66
|
log("build client lib");
|
|
@@ -91,32 +69,114 @@ async function buildClientLib(cwd, userConfig, sourcemap, external, log) {
|
|
|
91
69
|
const entry = import_path.default.join(esDir, "index.ts");
|
|
92
70
|
import_fs_extra.default.removeSync(entry);
|
|
93
71
|
import_fs_extra.default.linkSync(import_path.default.join(cwd, "es/index.mjs"), entry);
|
|
94
|
-
|
|
95
|
-
userConfig
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
72
|
+
try {
|
|
73
|
+
await buildClientWithRsbuild(cwd, userConfig, sourcemap, external, entry, outDir, "cjs");
|
|
74
|
+
} finally {
|
|
75
|
+
import_fs_extra.default.removeSync(entry);
|
|
76
|
+
}
|
|
77
|
+
await injectEntryStyleReference(import_path.default.join(outDir, "index.js"), 'require("./index.css");');
|
|
78
|
+
}
|
|
79
|
+
async function buildClientWithRsbuild(cwd, userConfig, sourcemap, external, entry, outDir, format) {
|
|
80
|
+
const config = createClientRsbuildConfig(cwd, entry, outDir, sourcemap, external, format);
|
|
81
|
+
const rsbuild = await (0, import_core.createRsbuild)({
|
|
82
|
+
cwd,
|
|
83
|
+
config: userConfig.modifyRsbuildConfig?.(config) ?? config
|
|
84
|
+
});
|
|
85
|
+
const result = await rsbuild.build();
|
|
86
|
+
await result.close();
|
|
87
|
+
}
|
|
88
|
+
function createClientRsbuildConfig(cwd, entry, outDir, sourcemap, external, format) {
|
|
89
|
+
return {
|
|
90
|
+
plugins: [(0, import_plugin_react.pluginReact)(), (0, import_plugin_less.pluginLess)(), (0, import_plugin_svgr.pluginSvgr)()],
|
|
91
|
+
source: {
|
|
92
|
+
entry: {
|
|
93
|
+
index: {
|
|
94
|
+
import: entry,
|
|
95
|
+
html: false
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
tsconfigPath: import_path.default.join(cwd, "tsconfig.json"),
|
|
99
|
+
define: (0, import_utils.getEnvDefine)(),
|
|
100
|
+
decorators: {
|
|
101
|
+
version: "legacy"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
output: {
|
|
105
|
+
target: "web",
|
|
106
|
+
distPath: {
|
|
107
|
+
root: outDir,
|
|
108
|
+
js: ".",
|
|
109
|
+
jsAsync: ".",
|
|
110
|
+
css: ".",
|
|
111
|
+
cssAsync: ".",
|
|
112
|
+
svg: ".",
|
|
113
|
+
font: ".",
|
|
114
|
+
image: ".",
|
|
115
|
+
media: ".",
|
|
116
|
+
assets: "."
|
|
99
117
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
filename: {
|
|
119
|
+
js: format === "esm" ? "[name].mjs" : "[name].js",
|
|
120
|
+
css: "[name].css",
|
|
121
|
+
svg: "[name][ext][query]",
|
|
122
|
+
font: "[name][ext][query]",
|
|
123
|
+
image: "[name][ext][query]",
|
|
124
|
+
media: "[name][ext][query]",
|
|
125
|
+
assets: "[name][ext][query]"
|
|
126
|
+
},
|
|
127
|
+
cleanDistPath: true,
|
|
128
|
+
sourceMap: sourcemap,
|
|
129
|
+
minify: process.env.NODE_ENV === "production",
|
|
130
|
+
emitCss: true,
|
|
131
|
+
externals: [
|
|
132
|
+
function({ request }, callback) {
|
|
133
|
+
if (request && external(request)) {
|
|
134
|
+
return callback(null, true);
|
|
135
|
+
}
|
|
136
|
+
callback();
|
|
111
137
|
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
performance: {
|
|
141
|
+
chunkSplit: {
|
|
142
|
+
strategy: "all-in-one"
|
|
112
143
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
144
|
+
},
|
|
145
|
+
tools: {
|
|
146
|
+
rspack(config) {
|
|
147
|
+
config.output = config.output || {};
|
|
148
|
+
config.output.asyncChunks = false;
|
|
149
|
+
if (format === "esm") {
|
|
150
|
+
config.output.library = { type: "module" };
|
|
151
|
+
config.output.module = true;
|
|
152
|
+
config.output.chunkFormat = "module";
|
|
153
|
+
config.output.chunkLoading = "import";
|
|
154
|
+
config.output.workerChunkLoading = "import";
|
|
155
|
+
config.experiments = {
|
|
156
|
+
...config.experiments,
|
|
157
|
+
outputModule: true
|
|
158
|
+
};
|
|
159
|
+
config.externalsType = "module-import";
|
|
160
|
+
} else {
|
|
161
|
+
config.output.library = { type: "commonjs-static" };
|
|
162
|
+
}
|
|
163
|
+
config.performance = false;
|
|
164
|
+
config.stats = "errors-warnings";
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
async function injectEntryStyleReference(entryFile, styleReference) {
|
|
170
|
+
const cssFile = import_path.default.join(import_path.default.dirname(entryFile), "index.css");
|
|
171
|
+
if (!import_fs_extra.default.existsSync(entryFile) || !import_fs_extra.default.existsSync(cssFile)) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const content = await import_fs_extra.default.readFile(entryFile, "utf8");
|
|
175
|
+
if (content.startsWith(styleReference)) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
await import_fs_extra.default.writeFile(entryFile, `${styleReference}
|
|
179
|
+
${content}`);
|
|
120
180
|
}
|
|
121
181
|
function buildLocale(cwd, userConfig, log) {
|
|
122
182
|
log("build client locale");
|
package/lib/buildDeclaration.js
CHANGED
|
@@ -30,32 +30,76 @@ __export(buildDeclaration_exports, {
|
|
|
30
30
|
buildDeclaration: () => buildDeclaration
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(buildDeclaration_exports);
|
|
33
|
-
var
|
|
34
|
-
var import_gulp_typescript = __toESM(require("gulp-typescript"));
|
|
33
|
+
var import_fast_glob = __toESM(require("fast-glob"));
|
|
35
34
|
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_typescript = __toESM(require("typescript"));
|
|
36
36
|
var import_constant = require("./constant");
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
const INCLUDE_PATTERNS = ["**/*.{ts,tsx}"];
|
|
38
|
+
const EXCLUDE_PATTERNS = [
|
|
39
|
+
"**/fixtures{,/**}",
|
|
40
|
+
"**/demos{,/**}",
|
|
41
|
+
"**/__test__{,/**}",
|
|
42
|
+
"**/__tests__{,/**}",
|
|
43
|
+
"**/__benchmarks__{,/**}",
|
|
44
|
+
"**/__e2e__{,/**}",
|
|
45
|
+
"**/*.mdx",
|
|
46
|
+
"**/*.md",
|
|
47
|
+
"**/*.+(test|e2e|spec).+(js|jsx|ts|tsx)",
|
|
48
|
+
"**/tsconfig{,.*}.json",
|
|
49
|
+
".umi{,-production,-test}{,/**}"
|
|
50
|
+
];
|
|
51
|
+
const diagnosticHost = {
|
|
52
|
+
getCurrentDirectory: () => process.cwd(),
|
|
53
|
+
getCanonicalFileName: (fileName) => import_typescript.default.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
|
|
54
|
+
getNewLine: () => import_typescript.default.sys.newLine
|
|
55
|
+
};
|
|
56
|
+
function loadCompilerOptions() {
|
|
57
|
+
const configPath = import_path.default.join(import_constant.ROOT_PATH, "tsconfig.json");
|
|
58
|
+
const configFile = import_typescript.default.readConfigFile(configPath, import_typescript.default.sys.readFile);
|
|
59
|
+
if (configFile.error) {
|
|
60
|
+
throw new Error(import_typescript.default.formatDiagnosticsWithColorAndContext([configFile.error], diagnosticHost));
|
|
61
|
+
}
|
|
62
|
+
const parsedConfig = import_typescript.default.parseJsonConfigFileContent(
|
|
63
|
+
configFile.config,
|
|
64
|
+
import_typescript.default.sys,
|
|
65
|
+
import_path.default.dirname(configPath),
|
|
66
|
+
void 0,
|
|
67
|
+
configPath
|
|
68
|
+
);
|
|
69
|
+
const options = {
|
|
70
|
+
...parsedConfig.options
|
|
71
|
+
};
|
|
72
|
+
delete options.paths;
|
|
73
|
+
return options;
|
|
74
|
+
}
|
|
75
|
+
const buildDeclaration = async (cwd, targetDir) => {
|
|
76
|
+
const srcPath = import_path.default.join(cwd, "src");
|
|
77
|
+
const targetPath = import_path.default.join(cwd, targetDir);
|
|
78
|
+
const files = await (0, import_fast_glob.default)(INCLUDE_PATTERNS, {
|
|
79
|
+
cwd: srcPath,
|
|
80
|
+
ignore: EXCLUDE_PATTERNS,
|
|
81
|
+
absolute: true,
|
|
82
|
+
dot: true
|
|
58
83
|
});
|
|
84
|
+
if (!files.length) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const compilerOptions = {
|
|
88
|
+
...loadCompilerOptions(),
|
|
89
|
+
declaration: true,
|
|
90
|
+
emitDeclarationOnly: true,
|
|
91
|
+
declarationDir: targetPath,
|
|
92
|
+
outDir: targetPath,
|
|
93
|
+
rootDir: srcPath
|
|
94
|
+
};
|
|
95
|
+
const program = import_typescript.default.createProgram(files, compilerOptions);
|
|
96
|
+
const emitResult = program.emit(void 0, void 0, void 0, true);
|
|
97
|
+
const diagnostics = import_typescript.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
98
|
+
if (diagnostics.length) {
|
|
99
|
+
const details = import_typescript.default.formatDiagnosticsWithColorAndContext(diagnostics, diagnosticHost);
|
|
100
|
+
throw new Error(`Failed to build declarations for ${cwd}
|
|
101
|
+
${details}`);
|
|
102
|
+
}
|
|
59
103
|
};
|
|
60
104
|
// Annotate the CommonJS export names for ESM import in node:
|
|
61
105
|
0 && (module.exports = {
|