Re-evaluate restangular lodash compatibility - tooling upgrade

Issue #410 closed
Brian Lewis repo owner created an issue

For review at a future point, incompatibility between lodash latest versions and restangular:

https://github.com/mgonto/restangular/issues/1298

This is the impetus for tooling upgrade to typescript 3.4; lodash 4.x

Comments (5)

  1. Brian Lewis reporter

    Restangular 1.6.1 is now compatible with lodash 4 - so we may as well go up to lodash 4 now. Restangular 1.6.1 was introduced 15 8 2018.

    Note however that some methods used in dashboards need to be changed becuase they are no longer available; specifically

    _.contains use _.includes

    _.pluck use _.map

    _.unique use _.uniq

    _.pairs use _.toPairs

    _.max may need to use _.maxBy

    _.zipObject form with one argument becomes _.fromPairs

    _.clone for deep clone use _.cloneDeep

    for further info take a look at

    https://github.com/lodash/lodash/wiki/Changelog#compatibility-warnings

    Also we need a new .d.ts for lodash when making this upgrade

  2. Brian Lewis reporter

    Lodash .d.ts for 4.x.x is easiest to deliver from npm

    npm install @types/lodash

    This .d.ts however requires typescript 2.8 to compile

    So a number of changes need to occur together:

    -- code rectification for lodash 4

    -- upgrade bower to lodash 4

    -- use npm to load @types/lodash

    -- upgrade to typescript 2.8 ++

  3. Brian Lewis reporter

    Instructions on typescript upgrade

    Get the latest from here:

    https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.typescript-341-vs2017

    and install.

    For best results - pull the latest pineapples build (including the typescript 3.4 upgrade) to your machine with VS closed. Then, when you open VS, it should run the package.json upgrades (installing typescript 3.4 compiler in Pineapples.Clinet) and the bower upgrades (installing lodash 4.x)

    Note that in VS2017, this automatic restore is controlled by options

    Capture.PNG

    Check the output Window for bower/npm output to see that lodash got updated by bower. You can checck in

    bower_components/lodash/lodash.js that you are looking at version 4.17.11

    Capture.PNG

    Check that node_modules\@types\lodash folder has been created in Pineapples.Client

    The do a full _build_deploy to ensure

    • project compiles correclty, in particular, lodash.d.ts is found

    • this new lodash executable is pushed to the distribution

  4. Log in to comment