@gravity-ui/app-builder 0.42.0 → 0.43.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
File without changes
package/dist/cli.js CHANGED
File without changes
@@ -1,4 +1,4 @@
1
1
  import WebpackDevServer from 'webpack-dev-server';
2
2
  import { RspackDevServer } from '@rspack/dev-server';
3
3
  import type { NormalizedServiceConfig } from '../../common/models';
4
- export declare function watchClientCompilation(config: NormalizedServiceConfig, onManifestReady: () => void): Promise<WebpackDevServer<import("express").Application, import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>> | RspackDevServer<import("express").Application, import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>>>;
4
+ export declare function watchClientCompilation(config: NormalizedServiceConfig, onManifestReady: () => void): Promise<WebpackDevServer | RspackDevServer>;
@@ -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...');
@@ -87,6 +87,7 @@ class ControllableScript {
87
87
  // Ref: https://nodejs.org/api/child_process.html#child_process_subprocess_send_message_sendhandle_options_callback
88
88
  });
89
89
  }
90
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
91
  }
91
92
  catch (err) {
92
93
  // Ignore error if process has crashed or already quit.
@@ -34,6 +34,7 @@ function randomChars(howMany) {
34
34
  // make sure that we do not fail because we ran out of entropy
35
35
  try {
36
36
  rnd = crypto.randomBytes(howMany);
37
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
38
  }
38
39
  catch (e) {
39
40
  // eslint-disable-next-line security/detect-pseudoRandomBytes
@@ -54,6 +55,7 @@ function tmpNameSync(tmpDir, retries = 3) {
54
55
  const name = generateTmpName(tmpDir);
55
56
  try {
56
57
  fs.statSync(name);
58
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
57
59
  }
58
60
  catch (e) {
59
61
  return name;
@@ -1,8 +1,3 @@
1
- declare const _default: (api: object, options: Record<string, any> | null | undefined, dirname: string) => {
2
- visitor: {
3
- ImportDeclaration(this: import("@babel/core").PluginPass, path: import("@babel/traverse").NodePath<import("@babel/types").ImportDeclaration>): void;
4
- ExportNamedDeclaration(this: import("@babel/core").PluginPass, path: import("@babel/traverse").NodePath<import("@babel/types").ExportNamedDeclaration>): void;
5
- CallExpression(this: import("@babel/core").PluginPass, path: import("@babel/traverse").NodePath<import("@babel/types").CallExpression>): void;
6
- };
7
- };
1
+ import type { PluginObj } from '@babel/core';
2
+ declare const _default: (api: object, options: Record<string, any> | null | undefined, dirname: string) => PluginObj<import("@babel/core").PluginPass>;
8
3
  export default _default;
@@ -7,6 +7,6 @@ export interface GetSwcOptionsParams {
7
7
  publicPath: string;
8
8
  }
9
9
  export declare function getSwcOptions({ projectPath, filename, additionalPaths, exclude, publicPath, }: GetSwcOptionsParams): {
10
- swcOptions: import("@swc/types").Options;
10
+ swcOptions: import("@swc/core").Options;
11
11
  directoriesToCompile: string[];
12
12
  };
@@ -74,6 +74,7 @@ function readPackagesNames(dirName) {
74
74
  return fs.readdirSync(path.join(dirName, module)).map(function (scopedMod) {
75
75
  return module + '/' + scopedMod;
76
76
  });
77
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
77
78
  }
78
79
  catch (e) {
79
80
  return [module];
@@ -83,6 +84,7 @@ function readPackagesNames(dirName) {
83
84
  })
84
85
  .flat()
85
86
  .filter((v) => v !== undefined);
87
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
86
88
  }
87
89
  catch (e) {
88
90
  return [];
@@ -44,6 +44,7 @@ function createCli(argv) {
44
44
  .alias('v', 'version');
45
45
  try {
46
46
  cli.version('version', 'Show the version of the app-builder CLI package in the current project', getVersionInfo());
47
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
48
  }
48
49
  catch (e) {
49
50
  // ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -43,20 +43,6 @@
43
43
  "url": "https://github.com/gravity-ui/app-builder/issues"
44
44
  },
45
45
  "homepage": "https://github.com/gravity-ui/app-builder#readme",
46
- "scripts": {
47
- "prepare": "husky",
48
- "lint": "run-p lint:*",
49
- "lint:js": "eslint --ext .js,.ts --report-unused-disable-directives .",
50
- "lint:other": "npm run prettier -- --check",
51
- "prettier": "prettier '**/*.{md,yaml,yml,json}'",
52
- "typecheck": "tsc --noEmit",
53
- "test": "jest",
54
- "watch": "tsc -p tsconfig.production.json --watch",
55
- "build": "npm run build:clean && npm run build:compile",
56
- "build:compile": "tsc -p tsconfig.production.json",
57
- "build:clean": "rimraf dist",
58
- "prepublishOnly": "npm run build"
59
- },
60
46
  "dependencies": {
61
47
  "@aws-sdk/client-s3": "^3.353.0",
62
48
  "@babel/core": "^7.26.0",
@@ -151,15 +137,18 @@
151
137
  "yargs": "^17.7.2"
152
138
  },
153
139
  "devDependencies": {
140
+ "@babel/types": "^7.29.0",
154
141
  "@commitlint/cli": "^19.5.0",
155
142
  "@commitlint/config-conventional": "^19.5.0",
156
143
  "@gravity-ui/eslint-config": "^3.2.0",
157
144
  "@gravity-ui/prettier-config": "^1.1.0",
158
145
  "@gravity-ui/tsconfig": "^1.0.0",
159
146
  "@sentry/webpack-plugin": "^2.7.1",
147
+ "@types/babel__core": "^7.20.5",
160
148
  "@types/babel__helper-plugin-utils": "^7.10.3",
161
149
  "@types/circular-dependency-plugin": "^5.0.8",
162
150
  "@types/common-tags": "^1.8.4",
151
+ "@types/express": "^5.0.6",
163
152
  "@types/fs-extra": "^11.0.4",
164
153
  "@types/jest": "^29.5.2",
165
154
  "@types/mime-types": "^2.1.4",
@@ -205,5 +194,18 @@
205
194
  "*.{md,yaml,yml,json}": [
206
195
  "prettier --write"
207
196
  ]
197
+ },
198
+ "scripts": {
199
+ "install:global": "npm install -g pnpm@10.17.1",
200
+ "lint": "run-p lint:*",
201
+ "lint:js": "eslint --ext .js,.ts --report-unused-disable-directives .",
202
+ "lint:other": "pnpm run prettier --check",
203
+ "prettier": "prettier '**/*.{md,yaml,yml,json}'",
204
+ "typecheck": "tsc --noEmit",
205
+ "test": "jest",
206
+ "watch": "tsc -p tsconfig.production.json --watch",
207
+ "build": "pnpm run build:clean && pnpm run build:compile",
208
+ "build:compile": "tsc -p tsconfig.production.json",
209
+ "build:clean": "rimraf dist"
208
210
  }
209
- }
211
+ }