@gravity-ui/app-builder 0.42.0-beta.3 → 0.42.1

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.
@@ -154,6 +154,16 @@ async function buildDevServer(config) {
154
154
  if (!listenOn) {
155
155
  options.ipc = path.resolve((0, utils_1.getAppRunPath)(config), 'client.sock');
156
156
  }
157
+ // Remove stale socket file from a previous process to avoid EADDRINUSE error
158
+ // when restarting the dev server while the old process is still running.
159
+ if (options.ipc && typeof options.ipc === 'string') {
160
+ try {
161
+ fs.unlinkSync(options.ipc);
162
+ }
163
+ catch {
164
+ // ignore if file doesn't exist
165
+ }
166
+ }
157
167
  const proxy = options.proxy || [];
158
168
  if (config.client.lazyCompilation && bundler !== 'rspack') {
159
169
  proxy.push({
@@ -189,12 +199,7 @@ async function buildDevServer(config) {
189
199
  else {
190
200
  server = new webpack_dev_server_1.default(options, compiler);
191
201
  }
192
- try {
193
- await server.start();
194
- }
195
- catch (e) {
196
- logger.logError(`Cannot start ${bundler} dev server`, e);
197
- }
202
+ await server.start();
198
203
  if (options.ipc && typeof options.ipc === 'string') {
199
204
  fs.chmod(options.ipc, 0o666, (e) => logger.logError('', e));
200
205
  }
@@ -93,11 +93,18 @@ async function default_1(config) {
93
93
  let clientCompilation;
94
94
  if (shouldCompileClient) {
95
95
  const { watchClientCompilation } = await import('./client.js');
96
- clientCompilation = await watchClientCompilation(config, () => {
97
- logger_1.default.success('Manifest was compiled successfully');
98
- clientCompiled = true;
99
- startNodemon();
100
- });
96
+ try {
97
+ clientCompilation = await watchClientCompilation(config, () => {
98
+ logger_1.default.success('Manifest was compiled successfully');
99
+ clientCompiled = true;
100
+ startNodemon();
101
+ });
102
+ }
103
+ catch (e) {
104
+ logger_1.default.logError('Failed to start client dev server', e);
105
+ await serverCompilation?.stop('SIGTERM');
106
+ process.exit(1);
107
+ }
101
108
  }
102
109
  process.on('SIGINT', async () => {
103
110
  logger_1.default.success('\nCleaning up...');
@@ -52,6 +52,7 @@ function compile(ts, { projectPath, configFileName = 'tsconfig.json', logger })
52
52
  }
53
53
  }
54
54
  if (hasErrors(allDiagnostics)) {
55
+ allDiagnostics.forEach(reportDiagnostic);
55
56
  logger.error(`Error compile, elapsed time ${(0, pretty_time_1.elapsedTime)(start)}`);
56
57
  process.exit(1);
57
58
  }
@@ -4,6 +4,10 @@ exports.watch = watch;
4
4
  const transformers_1 = require("./transformers");
5
5
  const utils_1 = require("./utils");
6
6
  const diagnostic_1 = require("./diagnostic");
7
+ /** @see https://github.com/microsoft/TypeScript/blob/9059e5bda0bb603ae6b41eca09dcd2a071af45fd/src/compiler/diagnosticMessages.json#L5400-L5403 */
8
+ const COMPILATION_COMPLETE_WITH_ERROR = 6193;
9
+ /** @see https://github.com/microsoft/TypeScript/blob/9059e5bda0bb603ae6b41eca09dcd2a071af45fd/src/compiler/diagnosticMessages.json#L5404-L5407 */
10
+ const COMPILATION_COMPLETE_WITH_N_ERRORS = 6194;
7
11
  function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap, }) {
8
12
  logger.message('Start compilation in watch mode');
9
13
  logger.message(`Typescript v${ts.version}`);
@@ -65,7 +69,8 @@ function watch(ts, projectPath, { logger, onAfterFilesEmitted, enableSourceMap,
65
69
  if (diagnostic.messageText) {
66
70
  logger.message(ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine));
67
71
  }
68
- if (diagnostic.code === 6194 || diagnostic.code === 6193) {
72
+ if (diagnostic.code === COMPILATION_COMPLETE_WITH_ERROR ||
73
+ diagnostic.code === COMPILATION_COMPLETE_WITH_N_ERRORS) {
69
74
  onAfterFilesEmitted?.();
70
75
  }
71
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.42.0-beta.3",
3
+ "version": "0.42.1",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",