Skip to content

Commit 35f93ba

Browse files
authored
Merge pull request #2772 from input-output-hk/chore/ddw-596-webpack-5-upgrade
[DDW-596] webpack 5 upgrade
2 parents 18c3f64 + 38e13cc commit 35f93ba

File tree

269 files changed

+23568
-27413
lines changed

Some content is hidden

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

269 files changed

+23568
-27413
lines changed

.babelrc

Lines changed: 0 additions & 30 deletions
This file was deleted.

.buildkite/pipeline.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@ env:
22
ARTIFACT_BUCKET: s3://ci-output-sink
33
steps:
44
- label: 'daedalus-x86_64-darwin'
5-
command: 'scripts/build-installer-unix.sh--nix-2.5 --build-id $BUILDKITE_BUILD_NUMBER'
5+
command: 'scripts/with-nix-2.5.sh scripts/build-installer-unix.sh --build-id $BUILDKITE_BUILD_NUMBER'
66
env:
77
NIX_SSL_CERT_FILE: /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
88
agents:
99
queue: daedalus
1010
system: x86_64-darwin
1111
- label: 'daedalus-aarch64-darwin'
12-
command: 'scripts/build-installer-unix.sh--nix-2.5 --build-id $BUILDKITE_BUILD_NUMBER'
12+
command: 'scripts/with-nix-2.5.sh scripts/build-installer-unix.sh --build-id $BUILDKITE_BUILD_NUMBER'
1313
env:
1414
NIX_SSL_CERT_FILE: /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt
1515
UPLOAD_DIR_OVERRIDE: UNSAFE-internal-build
1616
agents:
1717
queue: daedalus
1818
system: aarch64-darwin
1919
- label: 'daedalus-x86_64-linux-nix'
20-
command: 'scripts/build-installer-nix.sh $BUILDKITE_BUILD_NUMBER'
20+
command: 'scripts/with-nix-2.5.sh scripts/build-installer-nix.sh $BUILDKITE_BUILD_NUMBER'
2121
agents:
2222
system: x86_64-linux
2323
- label: 'daedalus-x86_64-windows-nix'
24-
command: 'scripts/build-cross-windows.sh $BUILDKITE_BUILD_NUMBER'
24+
command: 'scripts/with-nix-2.5.sh scripts/build-cross-windows.sh $BUILDKITE_BUILD_NUMBER'
2525
agents:
2626
system: x86_64-linux
2727

.eslintrc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
"plugin:@typescript-eslint/recommended",
1111
"plugin:react/recommended",
1212
"prettier",
13-
"prettier/babel",
14-
"prettier/@typescript-eslint",
15-
"prettier/react",
1613
"plugin:jest/recommended"
1714
],
1815
"env": {
@@ -22,9 +19,11 @@
2219
"jest": true
2320
},
2421
"rules": {
22+
"arrow-body-style": 0,
2523
"class-methods-use-this": 0,
2624
"consistent-return": "warn",
2725
"@typescript-eslint/generic-spacing": 0,
26+
"@typescript-eslint/space-after-type-colon": 0,
2827
"jsx-a11y/alt-text": 0,
2928
"lines-between-class-members": 0,
3029
"global-require": 0,
@@ -60,6 +59,7 @@
6059
"react/destructuring-assignment": 0,
6160
"react/display-name": 0,
6261
"react/jsx-curly-brace-presence": 0,
62+
"react/jsx-curly-newline": 0,
6363
"react/jsx-filename-extension": 0,
6464
"react/jsx-fragments": 0,
6565
"react/jsx-no-bind": "warn",
@@ -76,22 +76,28 @@
7676
"@typescript-eslint/no-empty-function": 1,
7777
"@typescript-eslint/ban-types": 1,
7878
"import/no-unresolved": 1,
79-
"@typescript-eslint/no-var-requires": 1,
79+
"@typescript-eslint/no-var-requires": 0,
8080
"camelcase": 1,
8181
"no-empty": 1,
8282
"@typescript-eslint/no-explicit-any": 1,
8383
"no-shadow": 1,
8484
"react/no-did-update-set-state": 1,
8585
"react/sort-comp": 0,
8686
"react/state-in-constructor": 0,
87-
"react/static-property-placement": 0
87+
"react/static-property-placement": 0,
88+
"react/jsx-no-useless-fragment": 0,
89+
"prefer-regex-literals": 0,
90+
"no-unused-vars": "warn",
91+
"react/no-unused-class-component-methods": "warn",
92+
"react/no-unstable-nested-components": "warn",
93+
"no-promise-executor-return": "warn",
94+
"default-param-last": "warn"
8895
},
8996
"plugins": ["@typescript-eslint", "import", "promise", "react", "jest"],
9097
"globals": {
9198
"API": true,
9299
"API_VERSION": true,
93100
"NETWORK": true,
94-
"MOBX_DEV_TOOLS": true,
95101
"BUILD_NUMBER": true,
96102
"Process": true // TODO: remove after fix
97103
},

.github/workflows/chromatic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup Node.js
1919
uses: actions/setup-node@v2
2020
with:
21-
node-version: "14"
21+
node-version: "16"
2222
- name: Install dependencies
2323
run: yarn
2424
- name: Publish to Chromatic

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ build/Release
3131
# Dependency directory
3232
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
3333
node_modules
34+
/node_modules.*
3435

3536
# OSX
3637
.DS_Store
@@ -46,6 +47,9 @@ installers/config.yaml
4647
installers/icons/electron.icns
4748
installers/installer-config.json
4849
installers/topology.yaml
50+
installers/csl-daedalus/
51+
installers/delegation.cert
52+
installers/signing.key
4953

5054
# temporary certs for daedalus dev
5155
tls/client

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
!features/
77
!storybook/
88
!hardware-wallet-tests/
9+
!tests/
910

1011
# Now we ignore all files
1112
*.*

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
### Chores
1717

18+
- Upgraded webpack to version 5 ([PR 2772](https://github.com/input-output-hk/daedalus/pull/2772))
19+
- Bumped vulnerable dependencies versions ([PR 2943](https://github.com/input-output-hk/daedalus/pull/2943))
1820
- Added support for Trezor firmware 2.5.1 ([PR 2991](https://github.com/input-output-hk/daedalus/pull/2991))
1921
- Added steps on how to link with `react-polymorph` and other external UI libraries ([PR 2948](https://github.com/input-output-hk/daedalus/pull/2948))
2022
- Published selfnode installers for all 3 platforms ([PR 2971](https://github.com/input-output-hk/daedalus/pull/2971))

declaration.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import { IpcRenderer } from 'electron';
2+
import type { request as httpRequest } from 'http';
3+
import type { request as httpsRequest, globalAgent } from 'https';
4+
import { Environment } from './source/common/types/environment.types';
5+
16
declare module '*.svg' {
27
const content: any;
38
export default content;
@@ -22,6 +27,15 @@ type Daedalus = {
2227
};
2328
};
2429

30+
interface Http {
31+
request: httpRequest;
32+
}
33+
34+
interface Https {
35+
request: httpsRequest;
36+
Agent: globalAgent;
37+
}
38+
2539
export type $ElementType<
2640
T extends { [P in K & any]: any },
2741
K extends keyof T | number
@@ -39,7 +53,18 @@ declare global {
3953
WALLET_COUNT: number;
4054
}
4155
}
56+
/* eslint-disable no-var, vars-on-top */
4257
var daedalus: Daedalus;
58+
var environment: Environment;
59+
var http: Http;
60+
var https: Https;
61+
var legacyStateDir: string;
62+
var isFlight: boolean;
63+
var ipcRenderer: Pick<
64+
IpcRenderer,
65+
'on' | 'once' | 'send' | 'removeListener' | 'removeAllListeners'
66+
>;
67+
/* eslint-enable no-var, vars-on-top */
4368
}
4469

4570
export {};

gulpfile.js

Lines changed: 3 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,5 @@
11
const gulp = require('gulp');
2-
const webpack = require('webpack');
3-
const webpackStream = require('webpack-stream');
42
const shell = require('gulp-shell');
5-
const electronConnect = require('electron-connect');
6-
const mainWebpackConfig = require('./source/main/webpack.config');
7-
const rendererWebpackConfig = require('./source/renderer/webpack.config');
8-
9-
// Setup electron-connect server to start the app in development mode
10-
let electronServer;
11-
const electronServerAgs = ['--inspect=9229'];
12-
// Gulp input sources for main and renderer compilation
13-
const mainInputSource = () => gulp.src('source/main/index.ts');
14-
const rendererInputSource = () => gulp.src('source/renderer/index.ts');
15-
// Webpack watch configs
16-
const mainWebpackWatchConfig = Object.assign({}, mainWebpackConfig, {
17-
watch: true,
18-
});
19-
const rendererWebpackWatchConfig = Object.assign({}, rendererWebpackConfig, {
20-
watch: true,
21-
});
22-
// Gulp output destinations for main and renderer compilation
23-
const mainOutputDestination = () => gulp.dest('dist/main');
24-
const rendererOutputDestination = () => gulp.dest('dist/renderer');
25-
26-
/**
27-
* Creates an electron-connect server instance that enables
28-
* us to control our app (restarting / reloading)
29-
* @param env - electron app environment
30-
* @param args - additional spawn options
31-
*/
32-
const createElectronServer = (env, args = []) => {
33-
electronServer = electronConnect.server.create({
34-
spawnOpt: {
35-
env: Object.assign({}, process.env, env),
36-
args,
37-
},
38-
});
39-
};
40-
41-
const buildMain = () => () =>
42-
mainInputSource()
43-
.pipe(webpackStream(mainWebpackConfig, webpack))
44-
.pipe(mainOutputDestination());
45-
46-
const buildMainWatch = () => (done) =>
47-
mainInputSource()
48-
.pipe(
49-
webpackStream(mainWebpackWatchConfig, webpack, () => {
50-
// Restart app every time after main script has been re-compiled
51-
electronServer.restart(electronServerAgs);
52-
done();
53-
})
54-
)
55-
.pipe(mainOutputDestination());
56-
57-
const buildRenderer = () => () =>
58-
rendererInputSource()
59-
.pipe(webpackStream(rendererWebpackConfig, webpack))
60-
.pipe(rendererOutputDestination());
61-
62-
const buildRendererWatch = () => (done) =>
63-
rendererInputSource()
64-
.pipe(
65-
webpackStream(rendererWebpackWatchConfig, webpack, () => {
66-
if (electronServer) {
67-
// Reload app every time after renderer script has been re-compiled
68-
electronServer.reload();
69-
}
70-
done();
71-
})
72-
)
73-
.pipe(rendererOutputDestination());
74-
75-
gulp.task(
76-
'clear:cache',
77-
shell.task('rimraf ./node_modules/.cache && rimraf .cache-loader')
78-
);
79-
80-
gulp.task('clean:dist', shell.task('rimraf ./dist'));
81-
82-
gulp.task('server:start', (done) => {
83-
electronServer.start(electronServerAgs);
84-
done();
85-
});
86-
87-
gulp.task('server:create:dev', (done) => {
88-
createElectronServer({
89-
NODE_ENV: process.env.NODE_ENV,
90-
XCURSOR_PATH: '/usr/share/icons' || 'development',
91-
});
92-
done();
93-
});
94-
95-
gulp.task('server:create:debug', (done) => {
96-
createElectronServer({
97-
NODE_ENV: process.env.NODE_ENV,
98-
XCURSOR_PATH: '/usr/share/icons' || 'development',
99-
});
100-
done();
101-
});
102-
103-
gulp.task('build:main', buildMain());
104-
105-
gulp.task('build:main:watch', buildMainWatch());
106-
107-
gulp.task('build:renderer:html', () =>
108-
gulp.src('source/renderer/index.html').pipe(gulp.dest('dist/renderer/'))
109-
);
110-
111-
gulp.task('build:renderer:assets', buildRenderer());
112-
113-
gulp.task(
114-
'build:renderer',
115-
gulp.series('build:renderer:html', 'build:renderer:assets')
116-
);
117-
118-
gulp.task('build:renderer:watch', buildRendererWatch());
119-
120-
gulp.task('build', gulp.series('clean:dist', 'build:main', 'build:renderer'));
1213

1224
gulp.task('prepare:themes:utils', () =>
1235
gulp
@@ -169,20 +51,7 @@ gulp.task(
16951
)
17052
);
17153

172-
gulp.task('typedef:sass', shell.task('yarn typedef:sass --watch'));
173-
174-
gulp.task(
175-
'build:watch',
176-
gulp.series(
177-
'clean:dist',
178-
'server:create:dev',
179-
'build:renderer:html',
180-
process.argv.includes('--disable-electron-reload')
181-
? 'build:main'
182-
: 'build:main:watch',
183-
'build:renderer:watch'
184-
)
185-
);
54+
gulp.task('clean:dist', shell.task('rimraf ./dist'));
18655

18756
gulp.task('build:themes', gulp.series('clean:dist', 'prepare:themes'));
18857

@@ -193,33 +62,6 @@ gulp.task(
19362
)
19463
);
19564

196-
gulp.task('test:e2e:watch', gulp.series('build:watch', 'test:e2e:nodemon'));
197-
198-
gulp.task('purge:translations', shell.task('rimraf ./translations/messages'));
199-
200-
gulp.task('electron:inspector', shell.task('yarn electron:inspector'));
201-
202-
gulp.task(
203-
'start',
204-
shell.task(
205-
`cross-env NODE_ENV=${process.env.NODE_ENV || 'production'} electron ./`
206-
)
207-
);
208-
209-
gulp.task(
210-
'dev',
211-
gulp.parallel(
212-
gulp.series('server:create:dev', 'build:watch', 'server:start'),
213-
gulp.series('typedef:sass')
214-
)
215-
);
65+
gulp.task('e2e:watch', gulp.series('clean:dist', shell.task('yarn dev')));
21666

217-
gulp.task(
218-
'debug',
219-
gulp.series(
220-
'server:create:debug',
221-
'build:watch',
222-
'server:start',
223-
'electron:inspector'
224-
)
225-
);
67+
gulp.task('test:e2e:watch', gulp.series('e2e:watch', 'test:e2e:nodemon'));

0 commit comments

Comments
 (0)