English Japanese
JavaScript Packaging Guidelines
JavaScript code used for the web needs special consideration to ensure that it meets the high standards expected of all code shipped by Fedora, while still being useful and complying with conventions already used on millions of websites. Additionally, certain libraries typically used on the web can also be useful in a server-side context (by nodejs or rubygem-execjs), so it's important to package JavaScript so it meets the standards required of locally executed code as well.
Please note that this section really only applies to JavaScript libraries intended for use on the web. Server-side JavaScript runtimes like Node.js xref:Node.js.adoc[have their own guidelines], and software like GNOME which embeds JavaScript for extensions have their own directories and policies as well.
Naming Guidelines
The name of a JavaScript library package MUST start with `+js-+` then the upstream name. For example: `+js-jquery+`.
To ensure the presence of the necessary RPM macros, all packages that provide JavaScript in `+%{_jsdir}+` MUST have:
BuildRequires: web-assets-devel
To ensure the availability of the necessary directories, all packages that provide JavaScript in `+%{_jsdir}+` MUST have:
Requires: web-assets-filesystem
JavaScript packages MUST NOT have Requires on any HTTP daemon-specific configuration package, such as `+web-assets-httpd+`, since they could be used by any HTTP daemon.
RPM Macros
|Macro |Normal Definition |Notes

|`+%{_jsdir}+` |`+%{_datadir}/javascript+` |The directory where JavaScript libraries are stored
Install Location
If a JavaScript library can be executed locally or consists purely of JavaScript code, it MUST be installed into a subdirectory of `+%{_jsdir}+`.
If a package contains JavaScript code, but is never useful outside the browser (e.g. if it is some sort of HTML user interface library) it may instead install to `+%{_assetdir}+`. For more information, see xref:Web_Assets.adoc[the Web Assets guidelines].
If a package contains JavaScript code that is only used as part of a web application, and it is not useful to any other applications whatsoever, it may continue to ship that code along with the application. However, that does not absolve it from complying with the rest of these guidelines.
If a package contains JavaScript code that is not useful on the web, but only in locally run software (e.g. xref:Node.js.adoc[Node.js] or GNOME shell extensions), it should use the appropriate directory for its runtime, not `+%{_jsdir}+`.