Skip to content

Commit a8592f2

Browse files
authored
Merge pull request #3230 from devspace-sh/ui-dep-updates-and-migrations
UI dep updates and migrations
2 parents 863832f + b9fdade commit a8592f2

64 files changed

Lines changed: 3815 additions & 3113 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/assets.go

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

dist/npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
"node-fetch": "^2.6.7"
2525
},
2626
"license": "Apache-2.0"
27-
}
27+
}

ui/config/jest/typescriptTransform.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
'use strict';
44

5-
const tsJestPreprocessor = require('ts-jest/preprocessor');
5+
const path = require('path');
6+
const typescript = require('typescript');
67

7-
module.exports = tsJestPreprocessor;
8+
const configPath = path.resolve(__dirname, '../../tsconfig.test.json');
9+
const { config } = typescript.readConfigFile(configPath, typescript.sys.readFile);
10+
const parsedConfig = typescript.parseJsonConfigFileContent(config, typescript.sys, path.dirname(configPath));
11+
12+
module.exports = {
13+
process(src, filename) {
14+
const result = typescript.transpileModule(src, {
15+
compilerOptions: {
16+
...parsedConfig.options,
17+
sourceMap: false,
18+
},
19+
fileName: filename,
20+
});
21+
22+
return {
23+
code: result.outputText,
24+
};
25+
},
26+
};

ui/config/webpack.config.dev.js

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ const publicPath = '/';
2121
const publicUrl = '';
2222
// Get environment variables to inject into our app.
2323
const env = getClientEnvironment(publicUrl);
24+
const getSassLoader = (options = {}) => ({
25+
loader: require.resolve('sass-loader'),
26+
options: {
27+
...options,
28+
sassOptions: {
29+
...(options.sassOptions || {}),
30+
silenceDeprecations: ['legacy-js-api'],
31+
},
32+
},
33+
});
2434

2535
// This is the development configuration.
2636
// It is focused on developer experience and fast rebuilds.
@@ -88,6 +98,13 @@ module.exports = {
8898
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
8999
'react-native': 'react-native-web',
90100
},
101+
fallback: {
102+
dgram: false,
103+
fs: false,
104+
net: false,
105+
tls: false,
106+
child_process: false,
107+
},
91108
plugins: [
92109
// Prevents users from importing files from outside of src/ (or node_modules/).
93110
// This often causes confusion because we only process files within src/ with babel.
@@ -150,7 +167,7 @@ module.exports = {
150167
},
151168
{
152169
test: /\.module\.s(a|c)ss$/,
153-
loader: [
170+
use: [
154171
require.resolve('style-loader'),
155172
// isDevelopment ? 'style-loader' : MiniCssExtractPlugin.loader,
156173
{
@@ -164,10 +181,9 @@ module.exports = {
164181
},
165182
},
166183
{
167-
loader: require.resolve('sass-loader'),
168-
options: {
184+
...getSassLoader({
169185
sourceMap: true,
170-
},
186+
}),
171187
},
172188
],
173189
},
@@ -177,7 +193,7 @@ module.exports = {
177193
use: [
178194
'style-loader', // creates style nodes from JS strings
179195
'css-loader', // translates CSS into CommonJS
180-
'sass-loader', // compiles Sass to CSS, using Node Sass by default
196+
getSassLoader(), // compiles Sass to CSS
181197
],
182198
},
183199
// "postcss" loader applies autoprefixer to our CSS.
@@ -217,20 +233,18 @@ module.exports = {
217233
},
218234
],
219235
},
220-
// "file" loader makes sure those assets get served by WebpackDevServer.
236+
// Webpack 5 asset modules emit files directly without file-loader.
221237
// When you `import` an asset, you get its (virtual) filename.
222238
// In production, they would get copied to the `build` folder.
223-
// This loader doesn't use a "test" so it will catch all modules
224-
// that fall through the other loaders.
225239
{
226240
// Exclude `js` files to keep "css" loader working as it injects
227-
// its runtime that would otherwise processed through "file" loader.
241+
// its runtime that would otherwise be processed through the asset rule.
228242
// Also exclude `html` and `json` extensions so they get processed
229-
// by webpacks internal loaders.
243+
// by webpack's internal loaders.
230244
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
231-
loader: require.resolve('file-loader'),
232-
options: {
233-
name: 'static/media/[name].[hash:8].[ext]',
245+
type: 'asset/resource',
246+
generator: {
247+
filename: 'static/media/[name].[hash:8][ext]',
234248
},
235249
},
236250
],
@@ -266,7 +280,10 @@ module.exports = {
266280
// solution that requires the user to opt into importing specific locales.
267281
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
268282
// You can remove this if you don't use Moment.js:
269-
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
283+
new webpack.IgnorePlugin({
284+
resourceRegExp: /^\.\/locale$/,
285+
contextRegExp: /moment$/,
286+
}),
270287
// Perform type checking and linting in a separate process to speed up compilation
271288
new ForkTsCheckerWebpackPlugin({
272289
async: false,
@@ -275,15 +292,6 @@ module.exports = {
275292
tslint: paths.appTsLint,
276293
}),
277294
],
278-
// Some libraries import Node modules but don't use them in the browser.
279-
// Tell Webpack to provide empty mocks for them so importing them works.
280-
node: {
281-
dgram: 'empty',
282-
fs: 'empty',
283-
net: 'empty',
284-
tls: 'empty',
285-
child_process: 'empty',
286-
},
287295
// Turn off performance hints during development because we don't do any
288296
// splitting or minification in interest of speed. These warnings become
289297
// cumbersome.

0 commit comments

Comments
 (0)