Skip to content

Commit

Permalink
chore: use patch-package instead of keeping google script in repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed May 15, 2024
1 parent ff46625 commit dce822a
Show file tree
Hide file tree
Showing 5 changed files with 417 additions and 52,751 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
],
"license": "BSD-3-Clause",
"dependencies": {
"@google/earthengine": "^0.1.402",
"@mapbox/sphericalmercator": "^1.2.0",
"@turf/area": "^6.5.0",
"@turf/bbox": "^6.5.0",
Expand Down Expand Up @@ -49,6 +50,8 @@
"husky": "^8.0.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^27.5.1",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"rimraf": "^5.0.1"
},
"scripts": {
Expand All @@ -58,6 +61,7 @@
"build:modules": "BABEL_ENV=modules babel src --out-dir ./build/es --copy-files --verbose",
"build": "NODE_ENV=production yarn clean && yarn build:commonjs && yarn build:modules",
"watch": "NODE_ENV=development yarn clean && concurrently -n watch-cjs,watch-es \"yarn build:commonjs --watch\" \"yarn build:modules --watch\"",
"postinstall": "patch-package",
"test": "jest src/*"
},
"husky": {
Expand Down
20 changes: 20 additions & 0 deletions patches/@google+earthengine+0.1.402.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/node_modules/@google/earthengine/build/browser.js b/node_modules/@google/earthengine/build/browser.js
index 1513223..18b6d65 100644
--- a/node_modules/@google/earthengine/build/browser.js
+++ b/node_modules/@google/earthengine/build/browser.js
@@ -26821,6 +26821,12 @@ ee.data.Profiler.Format.JSON = new ee.data.Profiler.Format("json");
goog.global.EXPORTED_FN_INFO = exportedFnInfo;
})();

-goog.global = window;
-goog.Timer.defaultTimerObject = window;
-module.exports = ee;
+// goog.global = window;
+// goog.Timer.defaultTimerObject = window;
+// module.exports = ee;
+
+// https://github.com/google/earthengine-api/pull/173
+// This change is to support running this script in a web worker,
+// which doesn't have access to the window object
+goog.Timer.defaultTimerObject = self
+module.exports = goog.global.ee = ee
Loading

0 comments on commit dce822a

Please sign in to comment.