@nocobase/build 2.1.0-beta.2 → 2.1.0-beta.21
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/build.js +258 -70
- package/lib/buildClient.js +113 -53
- package/lib/buildDeclaration.js +17 -2
- package/lib/buildPlugin.js +79 -47
- package/lib/constant.js +15 -3
- package/lib/index.d.ts +2 -3
- package/lib/injectPublicPathPlugin.js +109 -0
- package/lib/utils/buildPluginUtils.js +1 -1
- package/lib/utils/getDepsConfig.js +1 -1
- package/lib/utils/getPackages.js +48 -0
- package/lib/utils/utils.js +123 -1
- package/package.json +8 -6
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/build.js
CHANGED
|
@@ -28,12 +28,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var build_exports = {};
|
|
29
29
|
__export(build_exports, {
|
|
30
30
|
build: () => build,
|
|
31
|
-
buildPackage: () => buildPackage,
|
|
32
31
|
buildPackages: () => buildPackages
|
|
33
32
|
});
|
|
34
33
|
module.exports = __toCommonJS(build_exports);
|
|
35
34
|
var import_chalk = __toESM(require("chalk"));
|
|
36
|
-
var import_execa = __toESM(require("execa"));
|
|
37
35
|
var import_path = __toESM(require("path"));
|
|
38
36
|
var import_buildCjs = require("./buildCjs");
|
|
39
37
|
var import_buildClient = require("./buildClient");
|
|
@@ -46,107 +44,297 @@ var import_utils = require("./utils");
|
|
|
46
44
|
var import_addlicense = require("./utils/addlicense");
|
|
47
45
|
var import_getPackages = require("./utils/getPackages");
|
|
48
46
|
const BUILD_ERROR = "build-error";
|
|
47
|
+
const DEFAULT_LAYER_CONCURRENCY = 2;
|
|
48
|
+
const DEFAULT_PLUGIN_LAYER_CONCURRENCY = 1;
|
|
49
|
+
const ENABLE_BUILD_PROFILE = process.env.BUILD_PROFILE === "true";
|
|
49
50
|
async function build(pkgs) {
|
|
51
|
+
const profile = ENABLE_BUILD_PROFILE ? (0, import_utils.createBuildProfileCollector)() : null;
|
|
52
|
+
const buildStart = (0, import_utils.nowMs)();
|
|
50
53
|
const isDev = process.argv.includes("--development");
|
|
51
54
|
process.env.NODE_ENV = isDev ? "development" : "production";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
try {
|
|
56
|
+
let packages = (0, import_getPackages.getPackages)(pkgs);
|
|
57
|
+
const cachePkg = (0, import_utils.readFromCache)(BUILD_ERROR);
|
|
58
|
+
if (process.argv.includes("--retry") && cachePkg?.pkg) {
|
|
59
|
+
packages = packages.slice(packages.findIndex((item) => item.name === cachePkg.pkg));
|
|
60
|
+
}
|
|
61
|
+
const cliPackages = packages.find((item) => item.name === "@nocobase/cli");
|
|
62
|
+
if (cliPackages) {
|
|
63
|
+
const log = (0, import_utils.getPkgLog)(cliPackages.name);
|
|
64
|
+
log('running package script "build" (clean + tsc)');
|
|
65
|
+
await (0, import_utils.runScript)(["build"], cliPackages.location);
|
|
66
|
+
if (packages.length === 1) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (packages.length === 0) {
|
|
71
|
+
let msg = "";
|
|
72
|
+
if (pkgs.length) {
|
|
73
|
+
msg = `'${pkgs.join(", ")}' did not match any packages`;
|
|
74
|
+
} else {
|
|
75
|
+
msg = "No package matched";
|
|
76
|
+
}
|
|
77
|
+
console.warn(import_chalk.default.yellow(`[@nocobase/build]: ${msg}`));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const pluginPackages = (0, import_constant.getPluginPackages)(packages);
|
|
81
|
+
const cjsPackages = (0, import_constant.getCjsPackages)(packages);
|
|
82
|
+
const presetsPackages = (0, import_constant.getPresetsPackages)(packages);
|
|
83
|
+
await buildPackages(cjsPackages, "lib", import_buildCjs.buildCjs, {
|
|
84
|
+
sourceConcurrency: DEFAULT_LAYER_CONCURRENCY,
|
|
85
|
+
declarationConcurrency: 1,
|
|
86
|
+
stageName: "core cjs",
|
|
87
|
+
profile
|
|
88
|
+
});
|
|
89
|
+
const clientCore = packages.find((item) => item.location === import_constant.CORE_CLIENT);
|
|
90
|
+
if (clientCore) {
|
|
91
|
+
await buildSinglePackage(clientCore, "es", import_buildClient.buildClient, {
|
|
92
|
+
stageName: "core client",
|
|
93
|
+
profile
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const esmPackages = packages.filter((pkg) => import_constant.ESM_PACKAGES.includes(pkg.name));
|
|
97
|
+
await buildPackages(esmPackages, "lib", import_buildCjs.buildCjs, {
|
|
98
|
+
sourceConcurrency: DEFAULT_LAYER_CONCURRENCY,
|
|
99
|
+
declarationConcurrency: 1,
|
|
100
|
+
stageName: "esm cjs",
|
|
101
|
+
profile
|
|
102
|
+
});
|
|
103
|
+
await buildPackages(esmPackages, "es", import_buildEsm.buildEsm, {
|
|
104
|
+
sourceConcurrency: DEFAULT_LAYER_CONCURRENCY,
|
|
105
|
+
declarationConcurrency: 1,
|
|
106
|
+
stageName: "esm",
|
|
107
|
+
profile
|
|
108
|
+
});
|
|
109
|
+
await buildPackages(pluginPackages, "dist", import_buildPlugin.buildPlugin, {
|
|
110
|
+
sourceConcurrency: DEFAULT_PLUGIN_LAYER_CONCURRENCY,
|
|
111
|
+
declarationConcurrency: 1,
|
|
112
|
+
stageName: "plugins",
|
|
113
|
+
profile
|
|
114
|
+
});
|
|
115
|
+
await buildPackages(presetsPackages, "lib", import_buildCjs.buildCjs, {
|
|
116
|
+
sourceConcurrency: DEFAULT_LAYER_CONCURRENCY,
|
|
117
|
+
declarationConcurrency: 1,
|
|
118
|
+
stageName: "presets",
|
|
119
|
+
profile
|
|
120
|
+
});
|
|
121
|
+
const appClient = packages.find((item) => item.location === import_constant.CORE_APP);
|
|
122
|
+
if (appClient) {
|
|
123
|
+
await (0, import_utils.runProfiledStage)(profile, "app shell", async () => {
|
|
124
|
+
await (0, import_utils.runScript)(["rsbuild", "build", "--config", import_path.default.join(import_constant.CORE_APP, "client", "rsbuild.config.ts")], import_constant.ROOT_PATH, {
|
|
125
|
+
APP_ROOT: import_path.default.join(import_constant.CORE_APP, "client"),
|
|
126
|
+
ANALYZE: process.env.BUILD_ANALYZE === "true" ? "1" : void 0
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
(0, import_utils.writeToCache)(BUILD_ERROR, {});
|
|
131
|
+
} finally {
|
|
132
|
+
if (profile) {
|
|
133
|
+
(0, import_utils.printBuildProfile)(profile, (0, import_utils.nowMs)() - buildStart);
|
|
134
|
+
}
|
|
56
135
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
136
|
+
}
|
|
137
|
+
async function buildPackages(packages, targetDir, doBuildPackage, options = {}) {
|
|
138
|
+
const {
|
|
139
|
+
sourceConcurrency = DEFAULT_LAYER_CONCURRENCY,
|
|
140
|
+
declarationConcurrency = 1,
|
|
141
|
+
stageName = "packages",
|
|
142
|
+
profile = null
|
|
143
|
+
} = options;
|
|
144
|
+
const layers = (0, import_getPackages.groupPackagesByTopoLevel)(packages);
|
|
145
|
+
const shouldRunDeclaration = !process.argv.includes("--no-dts") && !process.argv.includes("--only-tar");
|
|
146
|
+
await (0, import_utils.runProfiledStage)(profile, `${stageName} source`, async () => {
|
|
147
|
+
for (let index = 0; index < layers.length; index++) {
|
|
148
|
+
const layer = layers[index];
|
|
149
|
+
console.log(import_chalk.default.cyan(`[@nocobase/build]: ${stageName} source layer ${index + 1}/${layers.length} (${layer.length} packages)`));
|
|
150
|
+
const layerStart = (0, import_utils.nowMs)();
|
|
151
|
+
await (0, import_utils.runWithConcurrency)(layer, sourceConcurrency, async (pkg) => {
|
|
152
|
+
await buildPackageSourceLifecycle(pkg, targetDir, doBuildPackage, profile);
|
|
153
|
+
});
|
|
154
|
+
const layerDurationMs = (0, import_utils.nowMs)() - layerStart;
|
|
155
|
+
if (profile) {
|
|
156
|
+
profile.layers.push({
|
|
157
|
+
stageName: `${stageName} source`,
|
|
158
|
+
layerIndex: index + 1,
|
|
159
|
+
layerCount: layers.length,
|
|
160
|
+
packageCount: layer.length,
|
|
161
|
+
durationMs: layerDurationMs
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (ENABLE_BUILD_PROFILE) {
|
|
165
|
+
console.log(import_chalk.default.gray(`[@nocobase/build]: ${stageName} source layer ${index + 1}/${layers.length} finished in ${(0, import_utils.formatDuration)(layerDurationMs)}`));
|
|
166
|
+
}
|
|
63
167
|
}
|
|
64
|
-
|
|
168
|
+
});
|
|
169
|
+
if (!shouldRunDeclaration) {
|
|
65
170
|
return;
|
|
66
171
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
172
|
+
await (0, import_utils.runProfiledStage)(profile, `${stageName} declaration`, async () => {
|
|
173
|
+
for (let index = 0; index < layers.length; index++) {
|
|
174
|
+
const layer = layers[index];
|
|
175
|
+
console.log(import_chalk.default.cyan(`[@nocobase/build]: ${stageName} declaration layer ${index + 1}/${layers.length} (${layer.length} packages)`));
|
|
176
|
+
const layerStart = (0, import_utils.nowMs)();
|
|
177
|
+
await (0, import_utils.runWithConcurrency)(layer, declarationConcurrency, async (pkg) => {
|
|
178
|
+
await buildPackageDeclarationLifecycle(pkg, targetDir, profile);
|
|
179
|
+
});
|
|
180
|
+
const layerDurationMs = (0, import_utils.nowMs)() - layerStart;
|
|
181
|
+
if (profile) {
|
|
182
|
+
profile.layers.push({
|
|
183
|
+
stageName: `${stageName} declaration`,
|
|
184
|
+
layerIndex: index + 1,
|
|
185
|
+
layerCount: layers.length,
|
|
186
|
+
packageCount: layer.length,
|
|
187
|
+
durationMs: layerDurationMs
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
if (ENABLE_BUILD_PROFILE) {
|
|
191
|
+
console.log(import_chalk.default.gray(`[@nocobase/build]: ${stageName} declaration layer ${index + 1}/${layers.length} finished in ${(0, import_utils.formatDuration)(layerDurationMs)}`));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
88
195
|
}
|
|
89
|
-
async function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
await
|
|
196
|
+
async function buildSinglePackage(pkg, targetDir, doBuildPackage, options) {
|
|
197
|
+
const { stageName, profile = null } = options;
|
|
198
|
+
await (0, import_utils.runProfiledStage)(profile, `${stageName} source`, async () => {
|
|
199
|
+
await buildPackageSourceLifecycle(pkg, targetDir, doBuildPackage, profile);
|
|
200
|
+
});
|
|
201
|
+
if (process.argv.includes("--no-dts") || process.argv.includes("--only-tar")) {
|
|
202
|
+
return;
|
|
93
203
|
}
|
|
204
|
+
await (0, import_utils.runProfiledStage)(profile, `${stageName} declaration`, async () => {
|
|
205
|
+
await buildPackageDeclarationLifecycle(pkg, targetDir, profile);
|
|
206
|
+
});
|
|
94
207
|
}
|
|
95
|
-
async function
|
|
208
|
+
async function buildPackageSourceLifecycle(pkg, targetDir, doBuildPackage, profile = null) {
|
|
96
209
|
const sourcemap = process.argv.includes("--sourcemap");
|
|
97
|
-
const noDeclaration = process.argv.includes("--no-dts");
|
|
98
210
|
const hasTar = process.argv.includes("--tar");
|
|
99
211
|
const onlyTar = process.argv.includes("--only-tar");
|
|
100
212
|
const log = (0, import_utils.getPkgLog)(pkg.name);
|
|
101
213
|
const packageJson = (0, import_utils.getPackageJson)(pkg.location);
|
|
102
214
|
if (onlyTar) {
|
|
215
|
+
const packageStart2 = (0, import_utils.nowMs)();
|
|
103
216
|
await (0, import_tarPlugin.tarPlugin)(pkg.location, log);
|
|
217
|
+
if (profile) {
|
|
218
|
+
profile.packages.push({
|
|
219
|
+
name: pkg.name,
|
|
220
|
+
targetDir,
|
|
221
|
+
kind: "source",
|
|
222
|
+
durationMs: (0, import_utils.nowMs)() - packageStart2,
|
|
223
|
+
status: "success",
|
|
224
|
+
phases: { tar: (0, import_utils.nowMs)() - packageStart2 }
|
|
225
|
+
});
|
|
226
|
+
}
|
|
104
227
|
return;
|
|
105
228
|
}
|
|
106
229
|
log(`${import_chalk.default.bold((0, import_utils.toUnixPath)(pkg.location.replace(import_constant.PACKAGES_PATH, "").slice(1)))} build start`);
|
|
107
230
|
const userConfig = (0, import_utils.getUserConfig)(pkg.location);
|
|
231
|
+
const packageStart = (0, import_utils.nowMs)();
|
|
232
|
+
const phaseDurations = {};
|
|
233
|
+
let status = "success";
|
|
234
|
+
const runPhase = async (phaseName, task) => {
|
|
235
|
+
const phaseStart = (0, import_utils.nowMs)();
|
|
236
|
+
await task();
|
|
237
|
+
phaseDurations[phaseName] = (phaseDurations[phaseName] || 0) + ((0, import_utils.nowMs)() - phaseStart);
|
|
238
|
+
};
|
|
108
239
|
if (packageJson?.scripts?.prebuild) {
|
|
109
240
|
log("prebuild");
|
|
110
|
-
await
|
|
111
|
-
|
|
241
|
+
await runPhase("prebuild", async () => {
|
|
242
|
+
await (0, import_utils.runScript)(["prebuild"], pkg.location);
|
|
243
|
+
await packageJson.prebuild(pkg.location);
|
|
244
|
+
});
|
|
112
245
|
}
|
|
113
246
|
if (userConfig.beforeBuild) {
|
|
114
247
|
log("beforeBuild");
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (!noDeclaration) {
|
|
119
|
-
log("build declaration");
|
|
120
|
-
await (0, import_buildDeclaration.buildDeclaration)(pkg.location, targetDir);
|
|
121
|
-
}
|
|
122
|
-
if (packageJson?.scripts?.postbuild) {
|
|
123
|
-
log("postbuild");
|
|
124
|
-
await runScript(["postbuild"], pkg.location);
|
|
125
|
-
}
|
|
126
|
-
if (userConfig.afterBuild) {
|
|
127
|
-
log("afterBuild");
|
|
128
|
-
await userConfig.afterBuild(log);
|
|
248
|
+
await runPhase("beforeBuild", async () => {
|
|
249
|
+
await userConfig.beforeBuild(log);
|
|
250
|
+
});
|
|
129
251
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
252
|
+
try {
|
|
253
|
+
await runPhase("build", async () => {
|
|
254
|
+
await doBuildPackage(pkg.location, userConfig, sourcemap, log);
|
|
255
|
+
});
|
|
256
|
+
if (packageJson?.scripts?.postbuild) {
|
|
257
|
+
log("postbuild");
|
|
258
|
+
await runPhase("postbuild", async () => {
|
|
259
|
+
await (0, import_utils.runScript)(["postbuild"], pkg.location);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
if (userConfig.afterBuild) {
|
|
263
|
+
log("afterBuild");
|
|
264
|
+
await runPhase("afterBuild", async () => {
|
|
265
|
+
await userConfig.afterBuild(log);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
await runPhase("addLicense", async () => {
|
|
269
|
+
await (0, import_addlicense.addLicense)(import_path.default.join(pkg.location, targetDir), log);
|
|
270
|
+
});
|
|
271
|
+
if (hasTar) {
|
|
272
|
+
await runPhase("tar", async () => {
|
|
273
|
+
await (0, import_tarPlugin.tarPlugin)(pkg.location, log);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
} catch (error) {
|
|
277
|
+
status = "failed";
|
|
278
|
+
(0, import_utils.writeToCache)(BUILD_ERROR, { pkg: pkg.name });
|
|
279
|
+
throw error;
|
|
280
|
+
} finally {
|
|
281
|
+
if (profile) {
|
|
282
|
+
profile.packages.push({
|
|
283
|
+
name: pkg.name,
|
|
284
|
+
targetDir,
|
|
285
|
+
kind: "source",
|
|
286
|
+
durationMs: (0, import_utils.nowMs)() - packageStart,
|
|
287
|
+
status,
|
|
288
|
+
phases: phaseDurations
|
|
289
|
+
});
|
|
290
|
+
if (ENABLE_BUILD_PROFILE) {
|
|
291
|
+
const summary = Object.entries(phaseDurations).sort((a, b) => b[1] - a[1]).map(([name, duration]) => `${name}=${(0, import_utils.formatDuration)(duration)}`).join(", ");
|
|
292
|
+
console.log(
|
|
293
|
+
import_chalk.default.gray(
|
|
294
|
+
`[@nocobase/build:profile] ${pkg.name} ${status} in ${(0, import_utils.formatDuration)((0, import_utils.nowMs)() - packageStart)}${summary ? ` (${summary})` : ""}`
|
|
295
|
+
)
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
133
299
|
}
|
|
134
300
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
301
|
+
async function buildPackageDeclarationLifecycle(pkg, targetDir, profile = null) {
|
|
302
|
+
const log = (0, import_utils.getPkgLog)(pkg.name);
|
|
303
|
+
const packageStart = (0, import_utils.nowMs)();
|
|
304
|
+
const phaseDurations = {};
|
|
305
|
+
let status = "success";
|
|
306
|
+
try {
|
|
307
|
+
log("build declaration");
|
|
308
|
+
const phaseStart = (0, import_utils.nowMs)();
|
|
309
|
+
await (0, import_buildDeclaration.buildDeclaration)(pkg.location, targetDir);
|
|
310
|
+
phaseDurations.declaration = (0, import_utils.nowMs)() - phaseStart;
|
|
311
|
+
} catch (error) {
|
|
312
|
+
status = "failed";
|
|
313
|
+
(0, import_utils.writeToCache)(BUILD_ERROR, { pkg: pkg.name });
|
|
314
|
+
throw error;
|
|
315
|
+
} finally {
|
|
316
|
+
if (profile) {
|
|
317
|
+
profile.packages.push({
|
|
318
|
+
name: pkg.name,
|
|
319
|
+
targetDir,
|
|
320
|
+
kind: "declaration",
|
|
321
|
+
durationMs: (0, import_utils.nowMs)() - packageStart,
|
|
322
|
+
status,
|
|
323
|
+
phases: phaseDurations
|
|
324
|
+
});
|
|
325
|
+
if (ENABLE_BUILD_PROFILE) {
|
|
326
|
+
const summary = Object.entries(phaseDurations).sort((a, b) => b[1] - a[1]).map(([name, duration]) => `${name}=${(0, import_utils.formatDuration)(duration)}`).join(", ");
|
|
327
|
+
console.log(
|
|
328
|
+
import_chalk.default.gray(
|
|
329
|
+
`[@nocobase/build:profile] ${pkg.name} declaration ${status} in ${(0, import_utils.formatDuration)((0, import_utils.nowMs)() - packageStart)}${summary ? ` (${summary})` : ""}`
|
|
330
|
+
)
|
|
331
|
+
);
|
|
332
|
+
}
|
|
144
333
|
}
|
|
145
|
-
}
|
|
334
|
+
}
|
|
146
335
|
}
|
|
147
336
|
// Annotate the CommonJS export names for ESM import in node:
|
|
148
337
|
0 && (module.exports = {
|
|
149
338
|
build,
|
|
150
|
-
buildPackage,
|
|
151
339
|
buildPackages
|
|
152
340
|
});
|