@gravity-ui/app-builder 0.35.2-beta.1 → 0.37.0
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/README.md
CHANGED
|
@@ -156,7 +156,7 @@ All server settings are used only in dev mode:
|
|
|
156
156
|
|
|
157
157
|
- `port` (`number | true`) — specify port that server listens. The port will be used to
|
|
158
158
|
pass through requests from the client to the server. If set to `true`, the port will be selected automatically.
|
|
159
|
-
The server is started with the command `APP_PORT=${port} node dist/
|
|
159
|
+
The server is started with the command `APP_PORT=${port} node dist/${outputPath}/index.js --port ${port}`.
|
|
160
160
|
- `watch` (`string[]`) — by default `app-builder` monitors only `src/server` directory.
|
|
161
161
|
If you need to watch other directories, specify them here.
|
|
162
162
|
- `watchThrottle` (`number`) — use to add an extra throttle, or delay restarting.
|
|
@@ -164,6 +164,8 @@ All server settings are used only in dev mode:
|
|
|
164
164
|
If specified `true`, try to listen on `9229`.
|
|
165
165
|
- `compiler` (`'typescript' | 'swc'`) — choose TypeScript compiler for server code compilation.
|
|
166
166
|
Default is `'typescript'`. Set to `'swc'` for faster compilation with SWC.
|
|
167
|
+
- `outputPath` (`string`) — custom output path for compiled server code relative to `dist` directory.
|
|
168
|
+
Default: `server`. Use this when your `server` entrypoint changed from `dist/server` to a different location (e.g., `package/src/server` for path `dist/package/src/server` in monorepo setups).
|
|
167
169
|
|
|
168
170
|
### Client
|
|
169
171
|
|
|
@@ -27,14 +27,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.default = default_1;
|
|
30
|
-
const path = __importStar(require("node:path"));
|
|
31
30
|
const fs = __importStar(require("node:fs"));
|
|
32
31
|
const nodemon_1 = __importDefault(require("nodemon"));
|
|
33
32
|
const signal_exit_1 = require("signal-exit");
|
|
34
33
|
const rimraf_1 = require("rimraf");
|
|
35
34
|
const utils_1 = require("../../common/utils");
|
|
36
35
|
const logger_1 = __importDefault(require("../../common/logger"));
|
|
37
|
-
const paths_1 = __importDefault(require("../../common/paths"));
|
|
38
36
|
async function default_1(config) {
|
|
39
37
|
process.env.NODE_ENV = 'development';
|
|
40
38
|
const shouldCompileClient = (0, utils_1.shouldCompileTarget)(config.target, 'client');
|
|
@@ -55,7 +53,7 @@ async function default_1(config) {
|
|
|
55
53
|
let clientCompiled = !shouldCompileClient;
|
|
56
54
|
let serverCompiled = !shouldCompileServer;
|
|
57
55
|
let needToStartNodemon = shouldCompileServer;
|
|
58
|
-
const serverPath =
|
|
56
|
+
const serverPath = config.server.outputPath;
|
|
59
57
|
const { inspect, inspectBrk } = config.server;
|
|
60
58
|
const startNodemon = () => {
|
|
61
59
|
if (needToStartNodemon && serverCompiled && clientCompiled) {
|
|
@@ -1,33 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.watchServerCompilation = watchServerCompilation;
|
|
30
|
-
const path = __importStar(require("node:path"));
|
|
31
7
|
const rimraf_1 = require("rimraf");
|
|
32
8
|
const controllable_script_1 = require("../../common/child-process/controllable-script");
|
|
33
9
|
const paths_1 = __importDefault(require("../../common/paths"));
|
|
@@ -79,7 +55,7 @@ watch(
|
|
|
79
55
|
);`;
|
|
80
56
|
}
|
|
81
57
|
async function watchServerCompilation(config) {
|
|
82
|
-
const serverPath =
|
|
58
|
+
const serverPath = config.server.outputPath;
|
|
83
59
|
rimraf_1.rimraf.sync(serverPath);
|
|
84
60
|
const build = new controllable_script_1.ControllableScript(config.server.compiler === 'swc'
|
|
85
61
|
? createSWCBuildScript(config)
|
package/dist/common/config.js
CHANGED
|
@@ -33,6 +33,7 @@ const cosmiconfig_1 = require("cosmiconfig");
|
|
|
33
33
|
const cosmiconfig_typescript_loader_1 = require("cosmiconfig-typescript-loader");
|
|
34
34
|
const common_tags_1 = require("common-tags");
|
|
35
35
|
const models_1 = require("./models");
|
|
36
|
+
const paths_1 = __importDefault(require("./paths"));
|
|
36
37
|
const utils_1 = require("./utils");
|
|
37
38
|
const logger_1 = __importDefault(require("./logger"));
|
|
38
39
|
function splitPaths(paths) {
|
|
@@ -163,6 +164,7 @@ async function normalizeConfig(userConfig, mode) {
|
|
|
163
164
|
inspect: undefined,
|
|
164
165
|
inspectBrk: undefined,
|
|
165
166
|
compiler: serverConfig.compiler || 'typescript',
|
|
167
|
+
outputPath: path.resolve(paths_1.default.appDist, serverConfig.outputPath ? serverConfig.outputPath : 'server'),
|
|
166
168
|
};
|
|
167
169
|
if (mode === 'dev') {
|
|
168
170
|
if (serverConfig.port === true) {
|
|
@@ -367,6 +367,13 @@ export interface ServerConfig {
|
|
|
367
367
|
additionalPaths?: string[];
|
|
368
368
|
exclude?: string | string[];
|
|
369
369
|
};
|
|
370
|
+
/**
|
|
371
|
+
* Custom output path for compiled server code.
|
|
372
|
+
* Can be only relative to dist path.
|
|
373
|
+
* @default 'server'
|
|
374
|
+
* @example 'package/src/server'
|
|
375
|
+
*/
|
|
376
|
+
outputPath?: string;
|
|
370
377
|
}
|
|
371
378
|
export interface ServiceConfig {
|
|
372
379
|
target?: 'client' | 'server';
|
|
@@ -424,12 +431,13 @@ export type NormalizedClientConfig = Omit<ClientConfig, 'publicPathPrefix' | 'pu
|
|
|
424
431
|
}) => SwcConfig | Promise<SwcConfig>;
|
|
425
432
|
reactRefresh: NonNullable<ClientConfig['reactRefresh']>;
|
|
426
433
|
};
|
|
427
|
-
export type NormalizedServerConfig = Omit<ServerConfig, 'port' | 'inspect' | 'inspectBrk' | 'compiler'> & {
|
|
434
|
+
export type NormalizedServerConfig = Omit<ServerConfig, 'port' | 'inspect' | 'inspectBrk' | 'compiler' | 'outputPath'> & {
|
|
428
435
|
port?: number;
|
|
429
436
|
verbose?: boolean;
|
|
430
437
|
inspect?: number;
|
|
431
438
|
inspectBrk?: number;
|
|
432
439
|
compiler: ServerCompiler;
|
|
440
|
+
outputPath: string;
|
|
433
441
|
};
|
|
434
442
|
export type NormalizedServiceConfig = Omit<ServiceConfig, 'client' | 'server'> & {
|
|
435
443
|
client: NormalizedClientConfig;
|
package/package.json
CHANGED