-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmigrationRules.js
More file actions
31 lines (29 loc) · 838 Bytes
/
migrationRules.js
File metadata and controls
31 lines (29 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// #Migration see https://github.com/mrdoob/three.js/wiki/Migration-Guide
const initalVersion = "116"; // fairygui启动时的three版本
const currentVersion = "134"; // 项目工程使用的three版本
const rules = {
"123": [
{
type: "string",
pattern: ".inverse()",
replacement: ".invert()"
},
{
type: "regex",
pattern: ".getInverse\\(([^]+?)\\);",
replacement: ".copy($1).invert();"
}
]
};
const getMigrationRules = (version, rules) => {
let rule = [];
if (+currentVersion > +initalVersion) {
for (let key in rules) {
if (+key >= +version) {
rule.push(...rules[key]);
}
}
}
return rule;
}
module.exports = getMigrationRules(currentVersion, rules);