monarch-initiative / phenogrid

The phenogrid widget
13 stars 14 forks source link

Upgrades to Gulp 4, Modifies Module Default Export #282

Closed falquaddoomi closed 3 years ago

falquaddoomi commented 3 years ago

This PR fixes three issues:

  1. building the package with recent versions of node fails
  2. the Phenogrid object is not a default module export
  3. the package lacks a postcss config that monarch-ui requires

Issue 1. Building the package

Gulp 3.x appears to rely on functionality in older versions of node and produces the following message if you try to build the package on a more recent version (e.g., v15.13.0):

fs.js:51
} = primordials;
    ^

ReferenceError: primordials is not defined
    at fs.js:51:5
    at req_ (/Users/faisala/Checkouts/chai/tislab-migration/monarch/phenogrid/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/Users/faisala/Checkouts/chai/tislab-migration/monarch/phenogrid/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/Users/faisala/Checkouts/chai/tislab-migration/monarch/phenogrid/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)

This PR upgrades gulp to 4.0.2, upgrades related gulp libraries, and adapts the gulp config for 4.x, which resolves the above error.

Issues 2, 3. Exporting Phenogrid and Including it in Monarch-UI

It also exports the Phenogrid object from js/phenogrid.js, so a reference to it can be obtained in external code using require().

The PR also adds a dummy postcss config, so that monarch-ui doesn't complain about it missing.