Skip to content

Commit 008a13c

Browse files
committed
chore: upgrade tasks to node 20
Signed-off-by: lstocchi <[email protected]>
1 parent d225d12 commit 008a13c

File tree

18 files changed

+4423
-3154
lines changed

18 files changed

+4423
-3154
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"guard-for-in": 2,
6161
"import/no-unresolved": ["error"],
6262
"import/no-duplicates": ["error"],
63+
"import/first": "off",
6364
"import/prefer-default-export": 0,
6465
"max-nested-callbacks": [1, 4],
6566
"max-classes-per-file": [0],

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
node: [ '16', '14', '10' ]
20+
node: [ '20', '16' ]
2121
name: Node ${{ matrix.node }}
2222

2323
steps:
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup Node.js environment
4040
uses: actions/setup-node@v3
4141
with:
42-
node-version: '10.x'
42+
node-version: '20.x'
4343
- run: npm run setup
4444
- run: npm install
4545
- run: npm run build
@@ -53,7 +53,7 @@ jobs:
5353
- name: Setup Node.js environment
5454
uses: actions/setup-node@v3
5555
with:
56-
node-version: '10.x'
56+
node-version: '20.x'
5757
- run: npm run setup
5858
- run: npm install
5959
- run: npm run build

package-lock.json

Lines changed: 4344 additions & 3067 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"docs": "markserv .",
2020
"pretest": "npm run compile",
2121
"watch": "tsc -watch -p ./",
22-
"lint": "node_modules/.bin/eslint . --ext .ts --quiet",
22+
"lint": "npx eslint . --ext .ts --quiet",
2323
"test": "ts-mocha -p tsconfig.json test/*.test.ts --timeout 5000 ${MOCHA_TAG}",
2424
"test:report": "npm run test -- --reporter mocha-simple-html-reporter --reporter-options output=out/test-report.html",
2525
"test:report:ci": "npm run test -- --reporter mocha-junit-reporter --reporter-options mochaFile=out/test-report.xml",
2626
"prettier:base": "prettier --parser typescript --single-quote",
2727
"prettier:check": "npm run prettier:base -- --list-different \"src/*.ts\" \"test/*.ts\"",
2828
"prettier:write": "npm run prettier:base -- --write \"**/**/*.ts\"",
2929
"copy-node-modules": "for i in `ls tasks` ; do copy-node-modules . tasks/$i; done",
30-
"copy-utils-file": "cp src/oc-utils.json out/src/",
30+
"copy-utils-file": "npx shx mkdir -p out/src && cp src/oc-utils.json out/src/",
3131
"copy-task-utils": "for i in `ls tasks` ; do cp -r src/oc-utils.json tasks/$i/lib/; done",
3232
"copy-task-lib": "for i in `ls tasks` ; do cp -r out/src/. tasks/$i/lib/; done",
3333
"bump-task-version": "for i in `ls tasks` ; do TASK=$(cat tasks/$i/task.json | json -e 'this.version.Patch++'); echo \"$TASK\" > tasks/$i/task.json; done",
@@ -57,32 +57,32 @@
5757
},
5858
"homepage": "https://github.com/redhat-developer/openshift-vsts#readme",
5959
"dependencies": {
60-
"@types/q": "^1.5.1",
61-
"@types/valid-url": "^1.0.2",
62-
"adm-zip": "^0.4.13",
63-
"argv-split": "^2.0.1",
64-
"azure-pipelines-task-lib": "^3.1.7",
65-
"azure-pipelines-tool-lib": "^1.3.2",
60+
"@types/q": "^1.5.8",
61+
"@types/valid-url": "^1.0.7",
62+
"adm-zip": "^0.5.16",
63+
"argv-split": "^3.2.1",
64+
"azure-pipelines-task-lib": "^5.0.0",
65+
"azure-pipelines-tool-lib": "^2.0.8",
6666
"decompress": "^4.2.1",
6767
"decompress-tar": "^4.1.1",
6868
"decompress-targz": "^4.1.1",
69-
"del-cli": "^5.0.0",
70-
"node-fetch": "^2.6.7",
69+
"del-cli": "^6.0.0",
70+
"node-fetch": "^3.3.2",
7171
"q": "^1.5.1",
72-
"semver": "^7.1.3",
72+
"semver": "^7.7.1",
7373
"substituter": "^1.3.0",
7474
"valid-url": "^1.0.9"
7575
},
7676
"devDependencies": {
7777
"@types/chai": "^4.1.6",
78-
"@types/glob": "^7.1.1",
79-
"@types/mocha": "^5.2.7",
80-
"@types/node": "^12.12.7",
81-
"@types/sinon": "^7.0.13",
82-
"@types/uuid": "^8.3.0",
78+
"@types/glob": "^8.1.0",
79+
"@types/mocha": "^10.0.10",
80+
"@types/node": "^20.3.1",
81+
"@types/sinon": "^17.0.3",
82+
"@types/uuid": "^10.0.0",
8383
"@typescript-eslint/eslint-plugin": "^2.16.0",
8484
"@typescript-eslint/parser": "^2.16.0",
85-
"chai": "^4.2.0",
85+
"chai": "4.5.0",
8686
"chai-fs": "^2.0.0",
8787
"commit-message-validator": "^0.1.6",
8888
"copy-node-modules": "^1.0.4",
@@ -91,19 +91,20 @@
9191
"eslint-config-prettier": "^6.7.0",
9292
"eslint-import-resolver-typescript": "^2.0.0",
9393
"eslint-plugin-header": "^3.0.0",
94-
"eslint-plugin-import": "2.18.2",
94+
"eslint-plugin-import": "2.22.1",
9595
"eslint-plugin-json": "^2.0.1",
9696
"eslint-plugin-prettier": "^3.1.1",
9797
"istanbul": "^0.4.5",
98-
"mocha": "^6.0",
98+
"mocha": "^7.0",
9999
"mocha-jenkins-reporter": "^0.4.8",
100-
"mocha-junit-reporter": "^1.18.0",
101-
"mocha-simple-html-reporter": "^1.1.0",
102-
"prettier": "^1.14.3",
100+
"mocha-junit-reporter": "^2.2.1",
101+
"mocha-simple-html-reporter": "^2.0.0",
102+
"prettier": "^3.5.1",
103103
"remap-istanbul": "^0.13.0",
104-
"sinon": "^7.4.2",
105-
"ts-mocha": "^6.0",
106-
"ts-node": "^7.0.1",
107-
"typescript": "^4.0.2"
104+
"shx": "^0.3.4",
105+
"sinon": "^19.0.2",
106+
"ts-mocha": "^10.1.0",
107+
"ts-node": "^10.9.2",
108+
"typescript": "^5.7.3"
108109
}
109110
}

src/config-map-task.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
* Copyright (c) Red Hat, Inc. All rights reserved.
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
5-
import { RunnerHandler } from './oc-exec';
6-
import { InstallHandler } from './oc-install';
7-
import * as auth from './oc-auth';
8-
import { ConfigMap } from './config-map';
9-
import { BinaryVersion, convertStringToBinaryVersion, FindBinaryStatus, getAgentOsName, getReason } from './utils/exec_helper';
10-
115
import task = require('azure-pipelines-task-lib/task');
6+
import { RunnerHandler } from './oc-exec.ts';
7+
import { InstallHandler } from './oc-install.ts';
8+
import * as auth from './oc-auth.ts';
9+
import { ConfigMap } from './config-map.ts';
10+
import { BinaryVersion, convertStringToBinaryVersion, FindBinaryStatus, getAgentOsName, getReason } from './utils/exec_helper.ts';
1211

1312
async function run(): Promise<void> {
1413
const version = task.getInput('version');

src/oc-auth.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
55
import * as fs from 'fs';
6-
import { RunnerHandler } from './oc-exec';
6+
import path = require('path');
7+
8+
import task = require('azure-pipelines-task-lib/task');
9+
import tl = require('azure-pipelines-task-lib/task');
710
import {
811
BASIC_AUTHENTICATION,
912
NO_AUTHENTICATION,
1013
TOKEN_AUTHENTICATION,
1114
RUNTIME_CONFIGURATION_OPTION,
12-
} from './constants';
13-
14-
import task = require('azure-pipelines-task-lib/task');
15-
import tl = require('azure-pipelines-task-lib/task');
16-
import path = require('path');
15+
} from './constants.ts';
16+
import { RunnerHandler } from './oc-exec.ts';
1717

1818
export interface OpenShiftEndpoint {
1919
/** URL to the OpenShiftServer */

src/oc-condition.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
55
import { IExecSyncResult } from 'azure-pipelines-task-lib/toolrunner';
6-
import { ConditionStatus } from './utils/exec_helper';
7-
import { RunnerHandler } from './oc-exec';
6+
import { ConditionStatus } from './utils/exec_helper.ts';
7+
import { RunnerHandler } from './oc-exec.ts';
88

99
export class ConditionHandler {
1010

@@ -68,10 +68,6 @@ export class ConditionHandler {
6868
return status;
6969
}
7070

71-
static async sleep(ms: number):Promise<NodeJS.Timeout> {
72-
return new Promise(resolve => setTimeout(resolve, ms));
73-
}
74-
7571
static getConditionCommandListener(resource: string): string {
7672
return `get ${resource} -o name --watch=true`;
7773
}

src/oc-conditional-exec-task.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
* Copyright (c) Red Hat, Inc. All rights reserved.
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
5-
import { RunnerHandler } from './oc-exec';
6-
import { InstallHandler } from './oc-install';
7-
import * as auth from './oc-auth';
8-
import { BinaryVersion, convertStringToBinaryVersion, FindBinaryStatus, getReason, ConditionStatus, isFailed, isTimedOut, getAgentOsName } from './utils/exec_helper';
9-
import { ConditionHandler } from './oc-condition';
10-
115
import task = require('azure-pipelines-task-lib/task');
6+
import { RunnerHandler } from './oc-exec.ts';
7+
import { InstallHandler } from './oc-install.ts';
8+
import * as auth from './oc-auth.ts';
9+
import { BinaryVersion, convertStringToBinaryVersion, FindBinaryStatus, getReason, ConditionStatus, isFailed, isTimedOut, getAgentOsName } from './utils/exec_helper.ts';
10+
import { ConditionHandler } from './oc-condition.ts';
1211

1312
async function run(): Promise<void> {
1413
const version = task.getInput('version');

src/oc-exec-task.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
* Copyright (c) Red Hat, Inc. All rights reserved.
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
5-
import { RunnerHandler } from './oc-exec';
6-
import { InstallHandler } from './oc-install';
7-
import * as auth from './oc-auth';
8-
import { BinaryVersion, convertStringToBinaryVersion, FindBinaryStatus, getAgentOsName, getReason } from './utils/exec_helper';
9-
105
import task = require('azure-pipelines-task-lib/task');
6+
import { RunnerHandler } from './oc-exec.ts';
7+
import { InstallHandler } from './oc-install.ts';
8+
import * as auth from './oc-auth.ts';
9+
import { BinaryVersion, convertStringToBinaryVersion, FindBinaryStatus, getAgentOsName, getReason } from './utils/exec_helper.ts';
1110

1211
async function run(): Promise<void> {
1312
const version = task.getInput('version');

src/oc-install.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import * as fs from 'fs';
66
import { ToolRunner, IExecSyncResult } from 'azure-pipelines-task-lib/toolrunner';
77
import * as toolLib from 'azure-pipelines-tool-lib/tool';
88
import * as semver from 'semver';
9-
import { RunnerHandler } from './oc-exec';
10-
import { LINUXV3, MACOSXV3, WINV3, LINUXV4, MACOSXV4, WINV4, OC_TAR_GZ, OC_ZIP, LATEST, ZIP, TAR_GZ } from './constants';
11-
import { unzipArchive } from './utils/zip_helper';
12-
import { BinaryVersion, FindBinaryStatus } from './utils/exec_helper';
13-
149
import tl = require('azure-pipelines-task-lib/task');
1510
import path = require('path');
16-
import fetch = require('node-fetch');
11+
import { RunnerHandler } from './oc-exec.ts';
12+
import { LINUXV3, MACOSXV3, WINV3, LINUXV4, MACOSXV4, WINV4, OC_TAR_GZ, OC_ZIP, LATEST, ZIP, TAR_GZ } from './constants.ts';
13+
import { unzipArchive } from './utils/zip_helper.ts';
14+
import { BinaryVersion, FindBinaryStatus } from './utils/exec_helper.ts';
1715

1816
export class InstallHandler {
1917
/**
@@ -268,6 +266,7 @@ export class InstallHandler {
268266
let url = InstallHandler.ocBundleURL(version.value, osType, false);
269267
let findURLofLatest = !url;
270268
if (url) {
269+
const { default: fetch } = await import('node-fetch'); // Dynamic import
271270
// check if url is valid otherwise take the latest stable oc cli for this version
272271
const response = await fetch(url, { method: 'HEAD' });
273272
findURLofLatest = !response.ok;

0 commit comments

Comments
 (0)