atomiks / tippyjs

Tooltip, popover, dropdown, and menu library
https://atomiks.github.io/tippyjs/
MIT License
11.91k stars 518 forks source link

Include /dist folder in release using GitHub build actions #1020

Open jrockowitz opened 2 years ago

jrockowitz commented 2 years ago

Problem

/dist folder is not included in the release archive.

The /dist folder was understandably removed.

GitHub repos shouldn't include a dist folder. Distribution is via npm and the unpkg CDN.

Originally posted by @atomiks in https://github.com/atomiks/tippyjs/issues/310#issuecomment-427296604

Solution

Include /dist folder in release using GitHub build actions.

This could be easily solved by automation on Github now using releases+actions and would make life of developers a lot easier in cases where you just need the dists!

https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/managing-releases-in-a-repository https://github.com/marketplace/actions/github-action-build

From my perspective it would be most useful if releases https://github.com/atomiks/tippyjs/releases/ contained the result of npm build?

Originally posted by @JPustkuchen in https://github.com/atomiks/tippyjs/issues/310#issuecomment-730239129

jrockowitz commented 2 years ago

I hope it is okay to restart this discussion as a feature request.

I am running into this issue because I am maintaining the Webform module for the Drupal community, which is using PHP/Composer. To support as many people/organizations as possible, I can't assume everyone has npm. To support Drupal's CSS/JS aggregation via PHP, sites would ideally download a copy of the TippyJS release with a /dist folder.

I am not well-versed in GitHub build actions, but if you are okay with this feature request, maybe someone can pitch in to help.

atomiks commented 2 years ago

Just checked a popular JS library and it looks like they are including a zip file with each release under "Assets". A PR that adds this to releases is welcome!

https://github.com/chartjs/Chart.js/blob/a5b46a859c6398618ec4787222b35bdd09b9f834/.github/workflows/release.yml#L51-L61

Would also be good to automate the whole release process as well when this gets added with Rolling Versions

hudri commented 2 years ago

The issue with the missing /dist folder just hit me too. Also coming from PHP & Composer, we deliberately keep NodeJS out of our toolchain.

So far we had a workaround using a custom repo for NPM packages and some additional composer plugins to get our JS libs to their correct asset location, but this approach always was both slow and unreliable (repo outdated, naming collisions, package type declaration,...).

hudri commented 2 years ago

A note for people looking for a download including the dist folder: We are now using registry.npmjs.org instead of github.

E.g. in our composer.json for PHP/Drupal we now use

{
    repositories: [
        {
            "type": "package",
            "package": {
                "name": "atomiks/tippyjs",
                "version": "6.3.7",
                "type": "drupal-library",
                "dist": {
                    "url": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz",
                    "type": "tar"
                }
            }
        }
}

You can get this url using npm view [package name] dist.tarball, with package name being @tippy.js.

Or, in the browser, on the project page on jsdelivr.net, on top of the page, right side of the title, hover over the download icon.

nmz787-intel commented 2 years ago

Since I don't use any frameworks, I just downloaded the built version from the CDN links to popper and tippy, found in the examples on the docs page:

https://unpkg.com/@popperjs/core@2
https://unpkg.com/tippy.js@6