Browse Source

maintenance: remove fix-compatibility.js

(cherry picked from commit af20e8a6970ec7f08799389ac9ce897d1cc822e0)
20230320
MengYX 3 years ago
parent
commit
60ea6239eb
No known key found for this signature in database GPG Key ID: E63F9C7303E8F604
  1. 4
      .github/workflows/build.yml
  2. 4
      .github/workflows/release-build.yml
  3. 1
      package.json
  4. 25
      src/fix-compatibility.js

4
.github/workflows/build.yml

@ -43,9 +43,7 @@ jobs:
node-version: "14" node-version: "14"
- name: Install Dependencies - name: Install Dependencies
run: | run: npm ci
npm ci
npm run fix-compatibility
- name: Build - name: Build
env: env:

4
.github/workflows/release-build.yml

@ -17,9 +17,7 @@ jobs:
node-version: "14" node-version: "14"
- name: Install Dependencies - name: Install Dependencies
run: | run: npm ci
npm ci
npm run fix-compatibility
- name: Build Legacy - name: Build Legacy
env: env:

1
package.json

@ -14,7 +14,6 @@
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"test": "jest", "test": "jest",
"fix-compatibility": "node ./src/fix-compatibility.js",
"make-extension": "node ./make-extension.js" "make-extension": "node ./make-extension.js"
}, },
"dependencies": { "dependencies": {

25
src/fix-compatibility.js

@ -1,25 +0,0 @@
//TODO: Use other method to fix this
// !! Only Temporary Solution
// it seems like that @babel/plugin-proposal-object-rest-spread not working
// to fix up the compatibility for Edge 18 and some older Chromium
// now manually edit the dependency files
const fs = require('fs');
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.");
}
} else {
console.log("File Not Found!");
}
Loading…
Cancel
Save