Skip to content

Commit 2768435

Browse files
Upgrade MavenV4 to NodeJS 16 (#17013)
* Task and tests upgraded to Node 16 * Fixed task version
1 parent 754767c commit 2768435

File tree

7 files changed

+155
-26
lines changed

7 files changed

+155
-26
lines changed

Tasks/MavenV4/Tests/L0RestoreOriginalPomXml.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const originalPomXmlContents = 'original pom.xml contents';
105105

106106
const fsClone = Object.assign({}, fs);
107107
Object.assign(fsClone, {
108-
readFileSync(filename: string, encoding: string): string {
108+
readFileSync(filename: string, encoding: BufferEncoding ): string {
109109
if (filename === 'pom.xml' && encoding === 'utf8') {
110110
console.log('Reading original pom.xml');
111111
return originalPomXmlContents;

Tasks/MavenV4/make.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"rm": [
3+
{
4+
"items": [
5+
"node_modules/azure-pipelines-tasks-codeanalysis-common/node_modules/azure-pipelines-task-lib",
6+
"node_modules/azure-pipelines-tasks-codeanalysis-common/node_modules/azure-pipeline-tool-lib",
7+
"node_modules/azure-pipelines-tasks-codecoverage-tools/node_modules/azure-pipelines-task-lib",
8+
"node_modules/azure-pipelines-tasks-codecoverage-tools/node_modules/azure-pipeline-tool-lib",
9+
"node_modules/azure-pipelines-tasks-java-common/node_modules/azure-pipelines-task-lib",
10+
"node_modules/azure-pipelines-tasks-java-common/node_modules/azure-pipeline-tool-lib",
11+
"node_modules/azure-pipelines-tasks-packaging-common-v3/node_modules/azure-pipelines-task-lib",
12+
"node_modules/azure-pipelines-tasks-packaging-common-v3/node_modules/azure-pipeline-tool-lib"
13+
],
14+
"options": "-Rf"
15+
}
16+
]
17+
}

Tasks/MavenV4/package-lock.json

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

Tasks/MavenV4/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"dependencies": {
1111
"@types/jsdom": "^16.2.14",
1212
"@types/mocha": "^5.2.7",
13-
"@types/node": "^10.17.0",
14-
"azure-pipelines-task-lib": "^3.1.2",
13+
"@types/node": "^16.11.39",
14+
"azure-pipelines-task-lib": "^4.0.0-preview",
1515
"azure-pipelines-tasks-codeanalysis-common": "2.0.3",
1616
"azure-pipelines-tasks-codecoverage-tools": "3.210.0",
1717
"azure-pipelines-tasks-java-common": "2.198.1",

Tasks/MavenV4/task.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 4,
20-
"Minor": 210,
20+
"Minor": 212,
2121
"Patch": 0
2222
},
2323
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
@@ -471,6 +471,10 @@
471471
"Node10": {
472472
"target": "maventask.js",
473473
"argumentFormat": ""
474+
},
475+
"Node16": {
476+
"target": "maventask.js",
477+
"argumentFormat": ""
474478
}
475479
},
476480
"messages": {

Tasks/MavenV4/task.loc.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"author": "Microsoft Corporation",
1818
"version": {
1919
"Major": 4,
20-
"Minor": 210,
21-
"Patch": 0
20+
"Minor": 212,
21+
"Patch": 1
2222
},
2323
"releaseNotes": "ms-resource:loc.releaseNotes",
2424
"demands": [
@@ -471,6 +471,10 @@
471471
"Node10": {
472472
"target": "maventask.js",
473473
"argumentFormat": ""
474+
},
475+
"Node16": {
476+
"target": "maventask.js",
477+
"argumentFormat": ""
474478
}
475479
},
476480
"messages": {

Tasks/MavenV4/utils/fileUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as shelljs from 'shelljs';
99
* @param encoding - encoding of the file. Default is "utf-8"
1010
* @returns string representation of the content
1111
*/
12-
export async function readFile(filePath: string, encoding?: string): Promise<string> {
12+
export async function readFile(filePath: string, encoding?: BufferEncoding): Promise<string> {
1313
try {
1414
tl.debug(`Reading file at path: ${filePath}`);
1515
return new Promise<string>((resolve, reject) =>
@@ -33,7 +33,7 @@ export async function readFile(filePath: string, encoding?: string): Promise<str
3333
* @param fileContent - Content of the file to write
3434
* @param encoding - Encoding for the file content
3535
*/
36-
export function writeFile(filePath: string, fileContent: string, encoding?: string): void {
36+
export function writeFile(filePath: string, fileContent: string, encoding?: BufferEncoding): void {
3737
try {
3838
const dirname = path.dirname(filePath);
3939
if (!fs.existsSync(dirname)) {

0 commit comments

Comments
 (0)