removeWatermarkForGoJs.js 960 B

1234567891011121314151617181920212223242526272829303132
  1. const fs = require("fs");
  2. const path = require("path");
  3. const filePaths = [
  4. "./node_modules/gojs/release/go.js",
  5. "./node_modules/gojs/release/go-module.js",
  6. ]
  7. filePaths.map(filePath => {
  8. const file = path.join(__dirname, filePath);
  9. fs.readFile(file, "utf8", function (err, data) {
  10. if (err) throw err;
  11. let content = data.replace("String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f",
  12. `String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);
  13. if (
  14. /GoJS \d\.\d evaluation/.test(f) ||
  15. /© 1998-\d{4} Northwoods Software/.test(f) ||
  16. "Not for distribution or production use" === f ||
  17. "gojs.net" === f
  18. ) {
  19. return "";
  20. } else {
  21. return f;
  22. }
  23. `
  24. );
  25. fs.writeFile(file, content, "utf8", (err) => {
  26. if (err) throw err;
  27. console.log('remove gojs watermark success done!!');
  28. });
  29. });
  30. })