forked from um/web
Add fix-compatibility npm command
This commit is contained in:
parent
37c60caa06
commit
e78118b4d0
@ -15,6 +15,7 @@ steps:
|
|||||||
- name: build
|
- name: build
|
||||||
image: node:lts
|
image: node:lts
|
||||||
commands:
|
commands:
|
||||||
|
- npm run fix-compatibility
|
||||||
- npm run build
|
- npm run build
|
||||||
- tar -czf legacy.tar.gz -C ./dist .
|
- tar -czf legacy.tar.gz -C ./dist .
|
||||||
- npm run build -- --modern
|
- npm run build -- --modern
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
"build": "vue-cli-service build"
|
"build": "vue-cli-service build",
|
||||||
|
"fix-compatibility": "node ./src/fix-compatibility.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"browser-id3-writer": "^4.4.0",
|
"browser-id3-writer": "^4.4.0",
|
||||||
|
@ -5,16 +5,21 @@
|
|||||||
// now manually edit the dependency files
|
// now manually edit the dependency files
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const filePath = "../node_modules/file-type/core.js";
|
const filePath = "./node_modules/file-type/core.js";
|
||||||
const regReplace = /{\s*([a-zA-Z0-9:,\s]*),\s*\.\.\.([a-zA-Z0-9]*)\s*};/m;
|
const regReplace = /{\s*([a-zA-Z0-9:,\s]*),\s*\.\.\.([a-zA-Z0-9]*)\s*};/m;
|
||||||
if (fs.existsSync(filePath)) {
|
if (fs.existsSync(filePath)) {
|
||||||
|
console.log("File Found!");
|
||||||
let data = fs.readFileSync(filePath).toString();
|
let data = fs.readFileSync(filePath).toString();
|
||||||
const regResult = regReplace.exec(data);
|
const regResult = regReplace.exec(data);
|
||||||
if (regResult != null) {
|
if (regResult != null) {
|
||||||
data = data.replace(regResult[0],
|
data = data.replace(regResult[0],
|
||||||
"Object.assign({ " + regResult[1] + " }, " + regResult[2] + ");"
|
"Object.assign({ " + regResult[1] + " }, " + regResult[2] + ");"
|
||||||
);
|
);
|
||||||
}
|
|
||||||
fs.writeFileSync(filePath, data);
|
fs.writeFileSync(filePath, data);
|
||||||
console.log("Object rest spread in file-type fixed!")
|
console.log("Object rest spread in file-type fixed!");
|
||||||
|
} else {
|
||||||
|
console.log("No fix needed.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("File Not Found!");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user