Dependency Management
Relevant source files
The following files were used as context for generating this wiki page:
Dependency management in the FOSSBilling branding project centers on a Node.js environment to handle asset optimization and generation. The project uses a minimal set of development dependencies to transform SVG masters into various raster formats and optimized vector files.
The system relies on the Node.js runtime to execute TypeScript scripts directly without a separate compilation step. This approach simplifies the development workflow by using the built-in capabilities of modern Node.js versions.
Runtime Environment
The project requires Node.js version 24 or newer. This specific version requirement ensures availability of modern APIs used in the asset generation scripts, such as node:fs/promises and node:util.
Sources: package.json:11-13, README.md:46-48
TypeScript Integration
TypeScript is used for type safety and code structure. The project is configured as a native ECMAScript Module (ESM). The tsconfig.json file defines the environment as ES2023 and uses the NodeNext module resolution strategy to match the Node.js runtime behavior.
This diagram shows the relationship between the Node.js runtime, the TypeScript scripts, and the primary external libraries.
Sources: package.json:20, tsconfig.json:2-12
Core Dependencies
All external libraries are classified as devDependencies because they are only required during the asset generation process and are not needed for consuming the final branding assets.
| Dependency | Purpose | Implementation Detail |
|---|---|---|
sharp | High-performance image processing | Used to render SVGs to PNG, ICO, and Apple Touch icons. |
svgo | SVG optimization | Optimizes SVG masters by removing metadata and editor data. |
typescript | Static type checking | Provides the tsc compiler for the typecheck script. |
@types/node | Type definitions | Provides type information for built-in Node.js modules. |
Sources: package.json:14-19, scripts/generate-assets.ts:114-115
Asset Pipeline Flow
The dependency lifecycle starts with npm ci to install the exact versions defined in the lockfile. The generate script then orchestrates the external libraries to process source files.
The flow of the asset generation script and its interaction with primary dependencies.
Sources: scripts/generate-assets.ts:88-125, package.json:5-7
Configuration Management
Dependencies are controlled through several configuration files that define how the libraries behave during execution:
- svgo.config.ts: Defines an explicit allowlist of plugins for the
svgolibrary to ensure non-destructive optimization. - export.config.json: Configures the sizes and paths used by the
sharplibrary during rendering. - package.json: Defines the entry points and executable scripts for the project.
Sources: scripts/svgo.config.ts:5-20, export.config.json:1-21, package.json:1-21
External Asset Dependencies
The project includes the Manrope font as a local dependency. This font is distributed under the SIL Open Font License (OFL) 1.1. While not an npm dependency, it is required by the create-preview.ts script to generate labels in the branding preview image.
Sources: source/fonts/Manrope/OFL.txt:1-10, scripts/create-preview.ts:7-9
The dependency structure ensures that the branding project remains lightweight, focusing only on the tools necessary to maintain and export high-quality visual assets.