Skip to content

Commit c45896f

Browse files
committed
refactor(frontend): make building icons process as one-time requirement
1 parent 544ed5b commit c45896f

File tree

15 files changed

+113800
-9427
lines changed

15 files changed

+113800
-9427
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ LICENSE*
4646

4747
# Frontend
4848
!frontend/dist/
49+
!frontend/packages/icons/dist/
4950

5051
# RivetKit packages (need pre-built dist for screenshot generation)
5152
!rivetkit-typescript/packages/*/dist/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pnpm-debug.log*
2626
# TypeScript
2727
*.tsbuildinfo
2828
dist/
29+
!frontend/packages/icons/dist/
2930

3031
# IDE
3132
.vscode/

frontend/packages/icons/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
src
1+
# Keep src/node_modules out of git (only used during vendoring)
2+
src/node_modules
3+
src/.npmrc
4+
src/package.json

frontend/packages/icons/LICENSE

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
RIVET ICONS - RESTRICTED USE LICENSE
2+
3+
Copyright (c) 2024 Rivet Gaming, Inc.
4+
5+
NOTICE: This package is licensed exclusively for use in Rivet products and services.
6+
7+
TERMS AND CONDITIONS:
8+
9+
1. PERMITTED USE: This package and its contents may only be used in products and
10+
services developed, operated, or officially endorsed by Rivet Gaming, Inc.
11+
12+
2. PROHIBITED USE: Any use of this package in third-party products, projects, or
13+
commercial applications is strictly prohibited.
14+
15+
3. FONT AWESOME PRO: This package includes icons from Font Awesome Pro, which are
16+
licensed to Rivet Gaming, Inc. for use in Rivet products only. These icons may
17+
not be extracted, redistributed, or used outside of Rivet products under any
18+
circumstances.
19+
20+
4. NO WARRANTY: This package is provided "as is", without warranty of any kind,
21+
express or implied, including but not limited to the warranties of merchantability,
22+
fitness for a particular purpose and noninfringement.
23+
24+
5. LIABILITY: In no event shall Rivet Gaming, Inc. be liable for any claim, damages
25+
or other liability arising from the use of this package.
26+
27+
6. THIRD-PARTY USE: If you wish to use Font Awesome Pro icons in your own projects,
28+
you must obtain your own license from Font Awesome: https://fontawesome.com/plans
29+
30+
For questions regarding licensing, please contact: [email protected]
31+
32+
VIOLATION of these terms may constitute infringement of intellectual property rights
33+
and Font Awesome's Terms of Service.

frontend/packages/icons/README.md

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,63 @@
99
<a href="https://rivet.gg/discord"><img src="https://img.shields.io/discord/822914074136018994"></a>
1010
</p>
1111

12+
## ⚠️ Legal Notice
13+
14+
**This package is licensed exclusively for use in Rivet products and services.** Using this package in any other product, project, or commercial application is strictly prohibited and may constitute a violation of Font Awesome's Terms of Service and intellectual property rights.
15+
16+
This package includes icons from Font Awesome Pro, which are licensed to Rivet for use in Rivet products only. If you wish to use Font Awesome Pro icons in your own projects, you must obtain your own license from [Font Awesome](https://fontawesome.com/plans).
17+
1218
## Motivation
1319

14-
Rivet Icons are a set of SVG icons that are used in Rivet products. This package is built on top of great Font Awesome icons. Some icons used in our products are from the premium Font Awesome icon set. We've created a package that lets you use premium icons without having to buy a Font Awesome license. This is achieved by swapping premium icons with a simple rectangle.
20+
Rivet Icons are a set of SVG icons that are used in Rivet products. This package is built on top of great Font Awesome icons. Some icons used in our products are from the premium Font Awesome icon set. We've created a package that lets you use premium icons without having to buy a Font Awesome license.
21+
22+
All icons (including Pro icons) are pre-generated and committed to the repository, so this package works out-of-the-box with **no Font Awesome token required** for end users.
1523

1624

1725
## Contributing
1826

1927
### Prerequisites
2028

21-
Obtain a Font Awesome Pro license and set the `FONTAWESOME_PACKAGE_TOKEN` environment variable to your Font Awesome Pro token. This is required to download the premium icons.
29+
**For maintainers only:** Obtain a Font Awesome Pro license and set the `FONTAWESOME_PACKAGE_TOKEN` environment variable to your Font Awesome Pro token. This is only required when vendoring new icons.
2230

2331
### Adding new icons
2432

25-
1. Modify `generateManifest.js` to include new icons.
26-
2. Run `./scripts/generateManifest.js` to generate a new `manifest.json` file.
27-
- If you're getting an error: `Could not find package @fortawesome/pro-solid-svg-icons`,
28-
3. Commit the changes to the `manifest.json` file.
29-
4. Run `pnpm rebuild @rivet-gg/icons` to generate a new icon set with the new icons.
33+
1. Ensure you have a `FONTAWESOME_PACKAGE_TOKEN` environment variable set
34+
2. Modify [scripts/generateManifest.js](scripts/generateManifest.js) to include new icons
35+
3. Run `./scripts/generateManifest.js` to generate a new `manifest.json` file
36+
- If you're getting an error about missing packages, run `pnpm install` in the `src` folder first
37+
4. Run `pnpm vendor` to generate icon files:
38+
- `src/index.gen.js`
39+
- `src/index.gen.ts`
40+
- `dist/index.js`
41+
5. Commit all changes including the generated files
3042

3143
## Troubleshooting
3244

33-
### Icons not showing, or icons are rectangles
45+
### Icons not showing up
46+
47+
All icons (including Font Awesome Pro icons) are pre-generated and committed to this repository. If icons aren't showing:
48+
49+
1. Make sure you have the peer dependencies installed:
50+
- `@fortawesome/fontawesome-svg-core`
51+
- `@fortawesome/free-solid-svg-icons`
52+
- `@fortawesome/free-brands-svg-icons`
53+
- `@fortawesome/react-fontawesome`
54+
- `react` and `react-dom`
55+
56+
2. Check that you're importing icons correctly:
57+
```tsx
58+
import { Icon, faCheckCircle } from "@rivet-gg/icons";
59+
60+
<Icon icon={faCheckCircle} />
61+
```
3462

35-
Some icons used in the open-source Rivet products are part of the premium Font Awesome icon set. We can't share those icons publicly, without violating FA's Terms Of Service. By default, after adding this package to any project, a post install script generates an icon set with all premium icons replaced with simple rectangles. So, you can reference premium icons, but you won't see them. To be able to see premium icons, make sure an environment variable `FONTAWESOME_PACKAGE_TOKEN` is set when running `pnpm install`. You can re-generate our icon set by running `pnpm rebuild @rivet-gg/icons` if your dependencies are already installed.
63+
3. If the problem persists, contact us on [Discord](https://rivet.gg/discord)
3664

37-
### Can't start/build project
38-
The description of these kinds of errors may vary. This package heavily depends on postinstall scripts from pnpm/npm. Make sure you didn't disable them accidentally. Turn on post-installation script support and run `pnpm install` or `pnpm rebuild @rivet-gg/icons` again. If there is still a problem, please contact us on [Discord](https://rivet.gg/discord").
65+
### For Maintainers: `Could not find package @fortawesome/pro-solid-svg-icons`
3966

67+
This error occurs when running the vendor script without access to Font Awesome Pro packages. Make sure:
4068

41-
### `Could not find package @fortawesome/pro-solid-svg-icons` when generating manifest
42-
Make sure you have installed pro icons. If you're getting an error, you can try to install them manually by running `pnpm add @fortawesome/pro-solid-svg-icons`, or run `pnpm install` in `src` folder. Finally run `./scripts/generateManifest.js` again.
69+
1. `FONTAWESOME_PACKAGE_TOKEN` environment variable is set
70+
2. Run `pnpm install` in the `src` folder to install FA Pro packages
71+
3. Run `pnpm vendor` again

0 commit comments

Comments
 (0)