Skip to content

Commit 019f20a

Browse files
AnnaOparevaannaOparevaAlexander Smolyakov
authored
Add doc about migrate tasks to node10 (#15464)
* add doc * fix quoters Co-authored-by: annaOpareva <[email protected]> Co-authored-by: Alexander Smolyakov <[email protected]>
1 parent a8c83bf commit 019f20a

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

docs/migrateNode10.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Table of content
2+
- [Upgrading Tasks to Node 10](#upgrading-tasks-to-node-10)
3+
- [Common packages dependent on `azure-pipeline-task-lib`](#common-packages-dependent-on-azure-pipeline-task-lib)
4+
- [List of known dependency issues](#list-of-known-dependency-issues)
5+
- [`fs` module](#fs-module)
6+
7+
# Upgrading Tasks to Node 10
8+
9+
1. Upgrade `typescript` to `4.0.2` version and fix type errors. Add the following snippet to the `package.json`:
10+
11+
```json
12+
"devDependencies": {
13+
"typescript": "^4.0.0"
14+
}
15+
```
16+
17+
2. Replace typings with @types
18+
* Delete `typings` folders and `typings.json` files
19+
* Add @types packages to `package.json` dependencies.
20+
21+
```json
22+
"dependencies": {
23+
"@types/node": "^10.17.0",
24+
"@types/mocha": "^5.2.7",
25+
"@types/uuid": "^8.3.0"
26+
...
27+
}
28+
```
29+
3. Upgrade `azure-pipelines-task-lib` to `^3.1.7` in package.json dependencies.
30+
31+
4. Change execution handlers in `task.json` from `Node` to `Node10`
32+
* **Note**: _the `target` property should be the main file targetted for the task to execute._
33+
34+
<table>
35+
<tr>
36+
<th>From</th>
37+
<th>To</th>
38+
</tr>
39+
<tr>
40+
<td>
41+
42+
```json
43+
"execution": {
44+
"Node": {
45+
"target": "bash.js",
46+
"argumentFormat": ""
47+
}
48+
```
49+
50+
</td>
51+
<td>
52+
53+
```json
54+
"execution": {
55+
"Node10": {
56+
"target": "bash.js",
57+
"argumentFormat": ""
58+
}
59+
```
60+
61+
</td>
62+
</tr>
63+
</table>
64+
65+
5. Upgrade any additional dependencies that may be incompatible with Node 10.
66+
An example is the `sync-request` package, which needs to be upgraded to the latest version from v3.0.1
67+
See some additional [dependency issues](#list-of-known-dependency-issues) below.
68+
69+
6. Thoroughly test tasks with unit tests and on an actual agent. The build agent now supports Node 10, so testing can be done on live versions of Azure DevOps.
70+
71+
7. Bumping the minimum agent version is not required, as the server will enforce a minimum version for pipelines containing Node 10 tasks.
72+
73+
## Common packages dependent on `azure-pipeline-task-lib`
74+
75+
Use the latest major version of a "common package" at `common-npm-packages` folder, which depends on the `azure-pipelines-task-lib` package with `^3.1.7` version.
76+
77+
The task-lib package uses some shared (e.g. global object) resources to operate so it may cause unexpected errors in cases when more than one version of the package is installed for a task. It happens in the case of a child package's task-lib dependency has a different version than a task's `task-lib` has.
78+
79+
If you are planning to move some common package to common-npm-packages directory - please note that you need to update all necessary paths in this package ([example of such path](https://github.com/microsoft/azure-pipelines-tasks/blob/master/common-npm-packages/packaging-common/Tests/MockHelper.ts#L44))
80+
81+
# List of known dependency issues
82+
83+
## `fs` module
84+
85+
The following `fs` functions all have incompatibilities. In addition, any other `fs` usage should probably face extra strict scrutiny.
86+
- fs.appendFile
87+
- fs.chmod
88+
- fs.chown
89+
- fs.close
90+
- fs.fchmod
91+
- fs.fchown
92+
- fs.fdatasync
93+
- fs.fstat
94+
- fs.fsync
95+
- fs.ftruncate
96+
- fs.futimes
97+
- fs.lchmod
98+
- fs.lchown
99+
- fs.link
100+
- fs.lstat
101+
- fs.mkdir
102+
- fs.mkdtemp
103+
- fs.readdir
104+
- fs.readFile
105+
- fs.readlink
106+
- fs.realpath
107+
- fs.rename
108+
- fs.rmdir
109+
- fs.stat
110+
- fs.truncate
111+
- fs.unlink
112+
- fs.utimes
113+
- fs.write
114+
- fs.writeFile

0 commit comments

Comments
 (0)