fuels-ts icon indicating copy to clipboard operation
fuels-ts copied to clipboard

CDNJS not updating to our latest version

Open petertonysmith94 opened this issue 1 year ago • 14 comments

Summary

We currently have fuels in CDNJS which is lagging being our actual version (see investigation).

As we publish preview versions to NPM, CDNJS struggles to keep up with the backlog of versions. The proposed solution is to switch over to autoupdate from GItHub release assets.

Solution

  • Upload our distribution to GitHub releases assets.
  • Once released, alter CDNJS package to autoupdate from GitHub, rather than NPM.
    • https://github.com/cdnjs/packages/blob/master/packages/f/fuels.json

petertonysmith94 avatar May 27 '24 06:05 petertonysmith94

@petertonysmith94 It seems the problem is happening because their last update sync happened on May 14: Screenshot 2024-05-27 at 12 53 57

0.86.0 got released on the same date: Screenshot 2024-05-27 at 12 53 15

So I reckon their update/sync happened just before our release.

Torres-ssf avatar May 27 '24 15:05 Torres-ssf

@Torres-ssf the history for the last sync looks off to me, it appears to occur multiple times daily and then just stop.

It appears the sync their end is failing.

It also appears that it's now onto 0.87.0.

petertonysmith94 avatar May 28 '24 11:05 petertonysmith94

@Torres-ssf the history for the last sync looks off to me, it appears to occur multiple times daily and then just stop.

It appears the sync their end is failing.

It also appears that it's now onto 0.87.0.

@petertonysmith94 You're right. This sync timestamp appears unrelated to their updates.

But the fact that they have just released 0.87.0 is an indication that the problem is not on our side.

Torres-ssf avatar May 28 '24 11:05 Torres-ssf

@Torres-ssf I suppose for me, they're churning though a lot of redundant releases (therefore not picking up our "official" releases). If their throughput can't keep up with all our published releases, I believe it is our problem.

petertonysmith94 avatar May 28 '24 12:05 petertonysmith94

I get it @petertonysmith94, makes sense. It is worth investigating.

Torres-ssf avatar May 28 '24 14:05 Torres-ssf

I have a hunch that this issue will be alleviated once we disable publishing on every E2E test (#2489).

petertonysmith94 avatar Jun 21 '24 09:06 petertonysmith94

I have a hunch that this issue will be alleviated once we disable publishing on every E2E test (#2489).

@petertonysmith94 How come?

Torres-ssf avatar Jun 21 '24 12:06 Torres-ssf

I have a hunch that this issue will be alleviated once we disable publishing on every E2E test (#2489).

@petertonysmith94 How come?

@Torres-ssf my hunch was wrong.

I grabbed the processing times from the CDN logs and cross referenced with our GitHub releases times. Although the publishing on every E2E test did have a significant impact - it appears that we were always lagging in our synchronisation (from release on GitHub to syncing with CDNJS).

image

I would say a good solution would be to add our distribution files to the GitHub release, and set the autoupdate for CDNJS to GitHub. This would minimise the amount of "noise" that the CDNJS worker has to churn through before getting to our official release - therefore reducing the sync time.

Anyone have any thoughts?

petertonysmith94 avatar Jun 21 '24 13:06 petertonysmith94

@arboleya Would be good to get your 2 cents on the above proposal?

TLDR:

  • Add our distributed package to the GitHub release
  • Set CDNJS to auto update from NPM to GitHub

petertonysmith94 avatar Jun 26 '24 16:06 petertonysmith94

Sounds like a plan.

arboleya avatar Jun 27 '24 10:06 arboleya

Found an undocumented ignoreVersions argument with the autoupdate feature (will add this to our CDNJS config):

  • https://github.com/cdnjs/packages/blob/3b586a540b9689bae47547236ba3e4da9ffbc8f2/packages/r/react.json#L36

Planning on rolling this out with the following:

  • https://github.com/FuelLabs/fuels-ts/issues/1728

Two birds one stone :)

petertonysmith94 avatar Jul 12 '24 16:07 petertonysmith94

Awesome!

arboleya avatar Jul 13 '24 10:07 arboleya

Blocked until release of:

  • https://github.com/FuelLabs/fuels-ts/pull/2762

Then:

  • Make to changes CDNJS configuration file (fuels.json):
    {
      ...,
      "autoupdate": {
        "source": "npm",
        "target": "fuels",
        "fileMap": [
          {
            "basePath": "dist",
            "files": ["browser.mjs", "browser.min.mjs"]
          }
        ],
        "ignoreVersions": [
          "0.0.0-*"
        ]
      },
      ...,
    }
    
    (Add minified bundle (browser.min.mjs) and ignoreVersions)

petertonysmith94 avatar Jul 16 '24 13:07 petertonysmith94

PR is in review

  • https://github.com/cdnjs/packages/pull/1852

petertonysmith94 avatar Jul 18 '24 14:07 petertonysmith94

Will make this as complete as CDNJS configuration has now been merged:

  • https://github.com/cdnjs/packages/pull/1852

We should monitor the release of https://github.com/FuelLabs/fuels-ts/pull/2863 to ensure the sync occurs without delay.

petertonysmith94 avatar Aug 05 '24 09:08 petertonysmith94