Skip to content

Commit 9baf2ce

Browse files
authored
Chore: improve sass warning suppression, add huly.utils and server to pmpm config overrides (#10078)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
1 parent b6741ce commit 9baf2ce

File tree

4 files changed

+66
-23
lines changed

4 files changed

+66
-23
lines changed

common/config/rush/pnpm-config.json

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,11 @@
199199
* PNPM documentation: https://pnpm.io/package_json#pnpmoverrides
200200
*/
201201
"globalOverrides": {
202-
// DEV: Uncomment the lines below to use local huly.core packages
202+
// DEV: Uncomment the lines below to use local huly.core, huly.server, and huly.utils packages
203203
// Then "rush update --full" to update the dependencies.
204-
// NOTE: It's configured to work if huly.core is placed adjacent to the platform. If you have it in a different location, you need to change the paths below.
204+
// NOTE: It's configured to work if huly.core, huly.server, and huly.utils are placed adjacent to the platform. If you have them in a different location, you need to change the paths below.
205205

206+
// huly.core packages:
206207
// "@hcengineering/account-client": "file:../../../huly.core/packages/account-client",
207208
// "@hcengineering/analytics": "file:../../../huly.core/packages/analytics",
208209
// "@hcengineering/analytics-service": "file:../../../huly.core/packages/analytics-service",
@@ -224,7 +225,30 @@
224225
// "@hcengineering/text-html": "file:../../../huly.core/packages/text-html",
225226
// "@hcengineering/text-markdown": "file:../../../huly.core/packages/text-markdown",
226227
// "@hcengineering/text-ydoc": "file:../../../huly.core/packages/text-ydoc",
227-
// "@hcengineering/token": "file:../../../huly.core/packages/token"
228+
// "@hcengineering/token": "file:../../../huly.core/packages/token",
229+
230+
// huly.server packages:
231+
// "@hcengineering/collaboration": "file:../../../huly.server/packages/collaboration",
232+
// "@hcengineering/datalake": "file:../../../huly.server/packages/datalake",
233+
// "@hcengineering/elastic": "file:../../../huly.server/packages/elastic",
234+
// "@hcengineering/hulylake": "file:../../../huly.server/packages/hulylake",
235+
// "@hcengineering/kafka": "file:../../../huly.server/packages/kafka",
236+
// "@hcengineering/middleware": "file:../../../huly.server/packages/middleware",
237+
// "@hcengineering/minio": "file:../../../huly.server/packages/minio",
238+
// "@hcengineering/mongo": "file:../../../huly.server/packages/mongo",
239+
// "@hcengineering/postgres": "file:../../../huly.server/packages/postgres",
240+
// "@hcengineering/s3": "file:../../../huly.server/packages/s3",
241+
// "@hcengineering/server": "file:../../../huly.server/packages/server",
242+
// "@hcengineering/server-client": "file:../../../huly.server/packages/client",
243+
// "@hcengineering/server-core": "file:../../../huly.server/packages/core",
244+
// "@hcengineering/server-storage": "file:../../../huly.server/packages/server-storage",
245+
246+
// huly.utils packages:
247+
// "@hcengineering/measurements": "file:../../../huly.utils/packages/measurements",
248+
// "@hcengineering/measurements-otlp": "file:../../../huly.utils/packages/measurements-otlp",
249+
// "@hcengineering/platform-rig": "file:../../../huly.utils/packages/platform-rig",
250+
// "@hcengineering/postgres-base": "file:../../../huly.utils/packages/postgres-base",
251+
// "@hcengineering/ui-test": "file:../../../huly.utils/packages/ui-test"
228252
},
229253

230254
/**

common/scripts/sass-quiet.js

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
11
// Wrapper around sass to suppress legacy-js-api deprecation warnings
22
// Should be removed when sass-preprocessor is upgraded to the version that works with modern sass api
3-
const sass = require('sass');
4-
5-
// Capture original stderr.write
6-
const originalStderrWrite = process.stderr.write.bind(process.stderr);
73

8-
// Override stderr.write to filter out sass deprecation warnings
9-
process.stderr.write = (chunk, encoding, callback) => {
10-
if (typeof chunk === 'string' && chunk.includes('DEPRECATION WARNING [legacy-js-api]')) {
11-
// Suppress the warning
12-
if (typeof encoding === 'function') {
13-
encoding();
14-
} else if (typeof callback === 'function') {
15-
callback();
4+
// Install the stderr filter globally as early as possible
5+
if (!process.stderr._originalWrite) {
6+
process.stderr._originalWrite = process.stderr.write;
7+
8+
process.stderr.write = function (chunk, encoding, callback) {
9+
const chunkStr = typeof chunk === 'string' ? chunk : (chunk?.toString?.() || '');
10+
11+
// Filter out sass legacy API deprecation warnings
12+
if (chunkStr.includes('Deprecation Warning [legacy-js-api]') ||
13+
chunkStr.includes('DEPRECATION WARNING [legacy-js-api]') ||
14+
chunkStr.includes('The legacy JS API is deprecated') ||
15+
chunkStr.includes('More info: https://sass-lang.com/d/legacy-js-api')) {
16+
// Suppress the warning - just call the callback
17+
if (typeof encoding === 'function') {
18+
encoding();
19+
} else if (typeof callback === 'function') {
20+
callback();
21+
}
22+
return true;
1623
}
17-
return true;
18-
}
19-
return originalStderrWrite(chunk, encoding, callback);
20-
};
24+
25+
return process.stderr._originalWrite.call(this, chunk, encoding, callback);
26+
};
27+
}
28+
29+
const sass = require('sass');
2130

2231
module.exports = sass;

desktop/webpack.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
// Copyright © 2023 Hardcore Engineering Inc.
33
//
44

5+
// Load sass-quiet FIRST to install stderr filter
6+
const sass = require('../common/scripts/sass-quiet.js')
7+
58
const Dotenv = require('dotenv-webpack')
69
const path = require('path')
710
const CompressionPlugin = require('compression-webpack-plugin')
811
const DefinePlugin = require('webpack').DefinePlugin
912
const HtmlWebpackPlugin = require('html-webpack-plugin')
1013
const CopyPlugin = require('copy-webpack-plugin')
11-
const sass = require('../common/scripts/sass-quiet.js')
1214

1315
const mode = process.env.NODE_ENV || 'development'
1416
const prod = mode === 'production'
@@ -190,7 +192,10 @@ module.exports = [
190192
hotReload: !prod,
191193
preprocess: require('svelte-preprocess')({
192194
postcss: true,
193-
sourceMap: true
195+
sourceMap: true,
196+
scss: {
197+
implementation: sass
198+
}
194199
}),
195200
hotOptions: {
196201
// Prevent preserving local component state

dev/prod/webpack.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
// limitations under the License.
1414
//
1515

16+
// Load sass-quiet FIRST to install stderr filter
17+
const sass = require('../../common/scripts/sass-quiet.js')
18+
1619
const Dotenv = require('dotenv-webpack')
1720
const path = require('path')
1821
const CompressionPlugin = require('compression-webpack-plugin')
1922
const DefinePlugin = require('webpack').DefinePlugin
2023
const HtmlWebpackPlugin = require('html-webpack-plugin')
2124
const { Configuration } = require('webpack')
22-
const sass = require('../../common/scripts/sass-quiet.js')
2325

2426
const mode = process.env.NODE_ENV || 'development'
2527
const prod = mode === 'production'
@@ -314,7 +316,10 @@ module.exports = [
314316
hotReload: !prod,
315317
preprocess: require('svelte-preprocess')({
316318
postcss: true,
317-
sourceMap: true
319+
sourceMap: true,
320+
scss: {
321+
implementation: sass
322+
}
318323
}),
319324
hotOptions: {
320325
// Prevent preserving local component state

0 commit comments

Comments
 (0)