Skip to content

Commit f814f3d

Browse files
committed
Upgrade NodeJS to v18.12.1, bump gulp to v4, replace node-sass with sass
This commit upgrades NodeJS to v18.12.1 LTS and bumps gulp to v4.0.0. bower has been updated to v1.8.14 which patches the arbitrary file write security vulnerability: https://snyk.io/blog/severe-security-vulnerability-in-bowers-zip-archive-extraction/ node-sass (which is now deprecated) has been replaced with 'sass'. gulp4-run-sequence is being used instead of 'run-sequence' as the latter does't work quite well with gulp v4. GitHub Actions workflows have also been updated to use Ubuntu 22.04 instead of Ubuntu 18.04.
1 parent 4175ff3 commit f814f3d

File tree

7 files changed

+16893
-1719
lines changed

7 files changed

+16893
-1719
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ on:
77
jobs:
88
build:
99
name: Build UI
10-
runs-on: ubuntu-18.04
10+
runs-on: ubuntu-22.04
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414
- name: Setup node
15-
uses: actions/setup-node@v1
15+
uses: actions/setup-node@v3
1616
with:
17-
node-version: 10
17+
node-version: 18.12.1
1818
- name: Packaging
1919
run: |
20-
npm install bower@~1.8.4 -g
20+
npm install bower@~1.8.14 -g
2121
bower install
22-
npm install gulp@~3.8.8 -g
22+
npm install gulp@~4.0.0 -g
2323
npm install
2424
gulp dist
2525
mv es-dist clusternode-web

.github/workflows/nightly.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ on:
55
jobs:
66
package:
77
name: Package UI
8-
runs-on: ubuntu-18.04
8+
runs-on: ubuntu-22.04
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@v3
1212
- name: Setup node
13-
uses: actions/setup-node@v1
13+
uses: actions/setup-node@v3
1414
with:
15-
node-version: 10
15+
node-version: 18.12.1
1616
- name: Lookup or create release
1717
uses: EventStore/Automations/lookup-or-create-release@master
1818
id: release
@@ -21,9 +21,9 @@ jobs:
2121
build-type: nightly
2222
- name: Packaging
2323
run: |
24-
npm install bower@~1.8.4 -g
24+
npm install bower@~1.8.14 -g
2525
bower install
26-
npm install gulp@~3.8.8 -g
26+
npm install gulp@~4.0.0 -g
2727
npm install
2828
gulp dist
2929
mv es-dist clusternode-web

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ on:
66
jobs:
77
package:
88
name: Package OSS UI
9-
runs-on: ubuntu-18.04
9+
runs-on: ubuntu-22.04
1010
steps:
1111
- name: Checkout
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
1313
- name: Get the version
1414
id: get_version
1515
run: echo ::set-output name=version::${GITHUB_REF:15}
1616
- name: Setup node
17-
uses: actions/setup-node@v1
17+
uses: actions/setup-node@v3
1818
with:
19-
node-version: 10
19+
node-version: 18.12.1
2020
- name: Lookup or create release
2121
uses: EventStore/Automations/lookup-or-create-release@master
2222
id: release
@@ -26,9 +26,9 @@ jobs:
2626
version: oss-v${{ steps.get_version.outputs.version }}
2727
- name: Packaging
2828
run: |
29-
npm install bower@~1.8.4 -g
29+
npm install bower@~1.8.14 -g
3030
bower install --allow-root
31-
npm install gulp@~3.8.8 -g
31+
npm install gulp@~4.0.0 -g
3232
npm install
3333
gulp dist
3434
mv es-dist clusternode-web

README.md

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,59 @@ The user interface for Event Store. This is included as a submodule in the main
66

77
Currently there are two ways to run the UI:
88

9-
* Open `index.html` located int `src` folder in browser.
10-
* Execute `gulp connect` - this command [gulp-connect](https://github.com/avevlad/gulp-connect) run webserver with LiveReload (see dev section for info how to set up gulp if you are new to it) - `gulp connect` needs `gulp` to run, please see Dev information on how to install it.
9+
1. Open `index.html` located in the `src` folder in your browser.
10+
2. Execute `gulp connect`. The command [gulp-connect](https://github.com/avevlad/gulp-connect) runs a webserver with LiveReload (see dev section for info how to set up gulp if you are new to it). `gulp connect` needs `gulp-cli` to run, please see Dev information on how to install it properly.
1111

1212
## Dev
1313

1414
To start developing, make sure you have the following requirements:
1515

16-
#### 1. Install [node.js v10.20.1](https://nodejs.org/en/blog/release/v10.20.1/) **and** (Python 2.7)[https://www.python.org/download/releases/2.7/] if you haven't done that already.
16+
#### 1. Install [Node.js v18.12.1](https://nodejs.org/en/blog/release/v18.12.1/)
1717

18-
If you already have another version of node.js installed, `nvm` can be used to set node v10.20.1 as the active one:
18+
If you already have another version of Node.js installed, `nvm` can be used to both install and set Node.js v18.12.1 as the active one:
1919

2020
```
21-
nvm use 10.20.1
21+
nvm install 18.12.1
22+
nvm use 18.12.1
2223
```
2324

24-
nvm for Windows can be downloaded [here](https://github.com/coreybutler/nvm-windows/releases)
25-
nvm for Linux can be downloaded here [here](https://github.com/nvm-sh/nvm/releases)
25+
nvm for Windows can be downloaded [here](https://github.com/coreybutler/nvm-windows/releases).
2626

27-
After installing Python 2.7, make a copy of the executable `python.exe` found in `C:\Python27` with the name `python2.exe` so that there are 2 executables: `python.exe` and `python2.exe`. This is required otherwise the build script when running `npm install` in the steps below fails when it looks for these executables.
27+
nvm for Linux can be installed using the following [instructions](https://github.com/nvm-sh/nvm#installing-and-updating).
2828

29-
If you don't want to make copies of the python executable, there's a workaround. The commands below will configure `npm` to use the same `python.exe` executable when it looks for `python` and `python2`:
29+
#### 2. Ensure the minimum version of npm is v9.2.0
30+
31+
First, check your version of npm using `npm --version`. Install npm v9.2.0 only if your current version is below 9.2.0:
3032

3133
```
32-
npm config set python "C:\python27\python.exe"
33-
npm config set python2 "C:\python27\python.exe"
34+
npm install -g [email protected]
3435
```
3536

36-
Furthermore, make sure the path `C:\Python27\` has been added to the `PATH` variable. In Windows, this can be tested as follows from the **PowerShell**:
37-
````
38-
Get-Command python
39-
Get-Command python2
40-
````
37+
#### 3. Install [gulp-cli](https://github.com/gulpjs/gulp-cli) globally
38+
39+
Any global installation of `gulp` **should** be removed before installing `gulp-cli` to avoid conflicts. The latter will run the local installation of `gulp v4.0.0` which is already a devDependency in the project.
4140

42-
On Linux, this can be checked as follows:
43-
````
44-
which python
45-
which python2
46-
````
41+
```
42+
npm rm -g gulp
43+
npm install -g gulp-cli
44+
```
4745

48-
#### 2. Install [gulp.js](http://gulpjs.com/)
46+
#### 4. Install [bower v1.8.14](http://bower.io/) globally
4947

5048
```
51-
npm install -g gulp
49+
npm install -g [email protected]
5250
```
5351

54-
#### 3. Install all node packages in the project
52+
#### 5. Install all node packages in the project
5553

5654
```
55+
cd EventStore.UI
5756
npm install
5857
```
5958

60-
If you get MSBUILD, VS2017, or VC++ related errors, follow the steps below to install the missing dependencies:
59+
If `npm install` succeeds, go to **Step 6**.
60+
61+
If you get errors related to MSBUILD, VS2017, or VC++ on Windows, follow the steps below to install the missing dependencies:
6162

6263
1. Download Visual Studio Professional 2017 (version 15.9) (Trial) setup from [here](https://my.visualstudio.com/Downloads).
6364
2. When you run the setup, go to the **Individual components** tab, then use the search box at the top to select these components:
@@ -68,44 +69,39 @@ If you get MSBUILD, VS2017, or VC++ related errors, follow the steps below to in
6869
Note that other components might get added automatically; do not remove them.
6970
3. Click "Install", and then click on "Continue".
7071
4. Wait for setup to finish installing all the components and dependencies.
71-
5. Now run these commands in the EventStore.UI directory:
72+
5. Now run these commands in the `EventStore.UI` directory:
7273

7374
```
7475
npm clean-install
7576
npm install
7677
```
7778

78-
#### 4. Install [bower](http://bower.io/)
79-
80-
```
81-
npm install -g bower
82-
```
79+
#### 6. Install all bower packages in the project
8380

84-
to install bower components:
8581
```
8682
bower install
8783
```
8884

89-
If you get the error message *"bower.ps1 cannot be loaded because running scripts is disabled on this system"*, run the command below in **PowerShell**:
85+
If you get the error message *"bower.ps1 cannot be loaded because running scripts is disabled on this system"* on Windows, run the command below in **PowerShell**:
9086

9187
```
9288
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
9389
```
9490

9591
Then, run `bower install` again.
9692

97-
#### 5. gulp commands available
93+
#### 7. Available gulp commands
9894

9995
```
100-
// starts webserver with live reload
96+
// Starts webserver with live reload
10197
gulp connect
10298
103-
// execute jshint
99+
// Executes jshint
104100
gulp lint
105101
106-
// transforming html file tamples into anguler.js module
102+
// Transforms HTML file templates into Angular.js module
107103
gulp html
108104
109-
// building project - creating minified version of css, js etc.
105+
// Builds the project: Creates minified version of CSS, JS, etc.
110106
gulp dist
111107
```

gulpfile.js

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ var gulp = require('gulp'),
1414
rjs = require('gulp-requirejs'),
1515
htmlreplace = require('gulp-html-replace'),
1616
webserver = require('gulp-webserver'),
17-
sass = require('gulp-sass'),
18-
runSequence = require('run-sequence'),
17+
sass = require('gulp-sass')(require('sass')),
18+
runSequence = require('gulp4-run-sequence'),
1919
merge = require('merge-stream');
2020

2121
var paths = {
@@ -106,7 +106,7 @@ gulp.task('dist-min-css', function () {
106106
.pipe(gulp.dest('./es-dist/css/'));
107107
});
108108

109-
gulp.task('dist-min-images', function () {
109+
gulp.task('dist-min-images', async function () {
110110

111111
// minify images and copy
112112
gulp.src('./src/images/*')
@@ -124,15 +124,14 @@ gulp.task('dist-min-images', function () {
124124
use: [pngcrush()]
125125
}))
126126
.pipe(gulp.dest('./es-dist/'));
127-
128127
});
129128

130129
gulp.task('dist-copy-fonts', function () {
131130
return gulp.src('./src/fonts/**/*')
132131
.pipe(gulp.dest('./es-dist/fonts'));
133132
});
134133

135-
gulp.task('dist-js', function () {
134+
gulp.task('dist-js', async function () {
136135

137136
gulp.src('./src/bower_components/requirejs/*.js')
138137
.pipe(concat('requirejs.min.js'))
@@ -158,10 +157,9 @@ gulp.task('dist-js', function () {
158157
.pipe(wrap({ src: './config/ace_workaround.txt'}))
159158
.pipe(uglify())
160159
.pipe(gulp.dest('./es-dist/js/'));
161-
162160
});
163161

164-
gulp.task('dist', function() {
162+
gulp.task('dist', async function() {
165163
runSequence(
166164
['html', 'compile-sass'],
167165
['dist-min-css', 'dist-min-images', 'dist-js', 'dist-copy-fonts'],
@@ -252,17 +250,13 @@ gulp.task('lint', function() {
252250
gulp.task('dev', function () {
253251

254252
// whenever templates changes, re-run templates
255-
gulp.watch(paths.app.templatesSource, ['html']);
253+
gulp.watch(paths.app.templatesSource, gulp.series('html'));
256254
// whenever code changes, re-run js-hint
257-
gulp.watch(paths.all, ['lint']);
258-
259-
gulp.run('lint');
260-
//gulp.run('connect');
255+
gulp.watch(paths.all, gulp.series('lint'));
261256
});
262257

263258
gulp.task('watch-lint', function () {
264-
gulp.watch(paths.all, ['lint']);
265-
gulp.run('lint');
259+
gulp.watch(paths.all, gulp.series('lint'));
266260
});
267261

268262

@@ -286,4 +280,4 @@ gulp.task('connectDist', function() {
286280
}));
287281
});
288282

289-
gulp.task('default', ['dev']);
283+
gulp.task('default', gulp.series('dev'));

0 commit comments

Comments
 (0)