diff --git a/.drone.yml b/.drone.yml index 55ce8bc..66e7384 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,6 +15,7 @@ steps: - name: build image: node:lts commands: + - npm run fix-compatibility - npm run build - tar -czf legacy.tar.gz -C ./dist . - npm run build -- --modern diff --git a/package.json b/package.json index 4d332f6..597d08b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "private": true, "scripts": { "serve": "vue-cli-service serve", - "build": "vue-cli-service build" + "build": "vue-cli-service build", + "fix-compatibility": "node ./src/fix-compatibility.js" }, "dependencies": { "browser-id3-writer": "^4.4.0", diff --git a/src/fix-compatibility.js b/src/fix-compatibility.js index 159555d..888fc29 100644 --- a/src/fix-compatibility.js +++ b/src/fix-compatibility.js @@ -5,16 +5,21 @@ // now manually edit the dependency files 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; if (fs.existsSync(filePath)) { + console.log("File Found!"); let data = fs.readFileSync(filePath).toString(); const regResult = regReplace.exec(data); if (regResult != null) { data = data.replace(regResult[0], "Object.assign({ " + regResult[1] + " }, " + regResult[2] + ");" ); + fs.writeFileSync(filePath, data); + console.log("Object rest spread in file-type fixed!"); + } else { + console.log("No fix needed."); } - fs.writeFileSync(filePath, data); - console.log("Object rest spread in file-type fixed!") +} else { + console.log("File Not Found!"); }