CartoDB / analytics-toolbox-core

A set of UDFs and Procedures to extend BigQuery, Snowflake, Redshift, Postgres and Databricks with Spatial Analytics capabilities
Other
190 stars 43 forks source link

test: fix h3 bundle in sf #515

Closed Jesus89 closed 5 months ago

Jesus89 commented 5 months ago

context https://github.com/CartoDB/analytics-toolbox-core/pull/514#issuecomment-2202637216

Problem

Recently, without any change from our side, a specific bundle h3_polyfill can not be properly generated:

/home/runner/work/analytics-toolbox-core/analytics-toolbox-core/clouds/snowflake/libraries/javascript/libs/h3_polyfill.js → build/h3_polyfill.js...
(!) Missing shims for Node.js built-ins
Creating a browser bundle that depends on "util". You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node
Created bundle h3_polyfill.js: 172.17 kB → 50.83 kB (gzip)
(!) Missing global variable name
Use output.globals to specify browser global variable names corresponding to external modules
util (guessing 'require$$0$2')
created build/h3_polyfill.js in 4.6s

I have traced the problem to this library:

booleanIntersects -> booleanDisjoint -> lineIntersect -> `import rbush from "geojson-rbush";` 

This library is used in @turf/line-intersect 6.3.0 and has the following dependency rule:

"@turf/bbox": "*",

This bad rule will always install the latest version. And this is what happened because less than a month ago, a new version of turf 7.0.0 was released: https://github.com/Turfjs/turf/releases/tag/v7.0.0. This version has removed the dependency with geojson-rbush, but this affects existing installations using turf 6.x.

Solution

Fix turf resolution to "@turf/bbox": "6.5.0" in our package.