Hi all,working on updating of Ruby on Rails to version 8.1, I need a help with bundled JS. The issues is that originally, rubygem-actiontext used to bundle Trix editor. We treated it as a bundled dependency:
https://src.fedoraproject.org/rpms/rubygem-actiontext/blob/daaba35292a1a7d6845e2ce8c65298f2263ffc4a/f/rubygem-actiontext.spec#_53and the functionality was (presumably) covered by the actiontext test suite. However, upstream has decided to split Trix into independent gem. The gem is now part of the Trix code base:
https://github.com/basecamp/trix/tree/main/action_text-trixand it is more or less just empty shell containing 500 kB Rollup compiled Trix JS. The question is how much I should care about?
In ideal world, I should create nodejs-trix package, there should also be js- subpackage and possibly also webassets package, because ultimately Trix will be used in browser. But that all seems to be a lot of hustle for something which I am afraid will (likely) be used by (only) rubygem-actiontext. So what is the right balance?
It is clear that I have to create the rubygem-action_text-trix package. 1) And I could still treat the Trix there as a bundled JS.2) I can create at minimum the nodejs-trix (see attachment), which actually allows to execute the upstream test suite.
3) Maybe the nodejs-trix could be subpackage of rubygem-action_text-trix.4) Only the relevant Node.js package bits can be used to make sure the license / .js are correct and test suite executed without even creating the nodejs- subpackage at all.
Any thoughts? Does e.g. anybody see any usage of Trix beyond Ruby on Rails? BTW I suspect that in the future, Trix might be replaced by Lexxy in Rails: https://dev.37signals.com/announcing-lexxy-a-new-rich-text-editor-for-rails/ https://github.com/basecamp/lexxy/ Thanks Vít
%global npm_name trix
Name: nodejs-%{npm_name}
Version: 2.1.17
Release: 1%{?dist}
Summary: A rich text editor for everyday writing
# MIT: trix
# (MPL-2.0 OR Apache-2.0): dompurify
License: MIT AND (MPL-2.0 OR Apache-2.0)
URL: https://github.com/basecamp/trix
# nodejs-packaging-bundler trix
Source0: https://registry.npmjs.org/%{npm_name}/-/%{npm_name}-%{version}.tgz
Source1: %{npm_name}-%{version}-nm-prod.tgz
Source2: %{npm_name}-%{version}-nm-dev.tgz
Source3: %{npm_name}-%{version}-bundled-licenses.txt
# Configuration file for web-test-runner. This for example makes sure that the
# QUnit is properly loaded.
Source4: https://github.com/basecamp/trix/raw/refs/heads/main/web-test-runner.config.mjs
# Instead of Playwright, use Chromium directly.
Patch0: nodejs-trix-2.1.17-Directly-use-Chromium-instead-of-Playwright.patch
BuildArch: noarch
ExclusiveArch: %{nodejs_arches} noarch
Requires: nodejs
BuildRequires: nodejs-devel
BuildRequires: chromium
%description
%{summary}.
%prep
%setup -q -n package -a 1 -b 2
cp %{SOURCE3} .
mkdir -p node_modules
( cd node_modules
ln -s ../node_modules_prod/* .
)
%build
#nothing to do
%install
mkdir -p %{buildroot}%{nodejs_sitelib}/%{npm_name}
cp -pr package.json dist/ \
%{buildroot}%{nodejs_sitelib}/%{npm_name}
# Copy over bundled nodejs modules
cp -pr node_modules node_modules_prod \
%{buildroot}%{nodejs_sitelib}/%{npm_name}
%check
( cd %{builddir}
# Get rid of bundled Rollup 4+ which requires native extension. This prevents
# `Error: Cannot find module @rollup/rollup-linux-x64-gnu.` error and will
# likely work as long as the unbundled version is < 4.
rm -rf node_modules_dev/\@web/test-runner/node_modules
# Node.js expands symlinks to relpath which causes: `Error: Cannot find
# module '@web/test-runner-core' error. This symlink help the
# `web-test-runner` to find its `node_modules`. `NODE_PATH` could be used
# alternatively.
ln -s node_modules_dev node_modules
)
( cd node_modules
# Use `find` which can skip already existing links.
find ../../node_modules_dev/ -maxdepth 1 -exec ln -s {} . \;
( cd .bin
ln -s ../../../node_modules_dev/.bin/* .
)
)
cp -a %{SOURCE4} .
cat %{PATCH0} | patch -p1
# Run tests
node_modules/.bin/web-test-runner
%files
%doc README.md
%license LICENSE %{npm_name}-%{version}-bundled-licenses.txt
%{nodejs_sitelib}/%{npm_name}
%changelog
OpenPGP_signature.asc
Description: OpenPGP digital signature
-- _______________________________________________ devel mailing list -- [email protected] To unsubscribe send an email to [email protected] Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/[email protected] Do not reply to spam, report it: https://forge.fedoraproject.org/infra/tickets/issues/new
