|
| 1 | +<!-- |
| 2 | +SPDX-FileCopyrightText: Facebook, Inc. and its affiliates |
| 3 | +SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com> |
| 4 | +
|
| 5 | +SPDX-License-Identifier: CC0-1.0 |
| 6 | +--> |
| 7 | + |
| 8 | +# Contributing |
| 9 | + |
| 10 | +Contributions are very welcome. The following will provide some helpful guidelines. |
| 11 | + |
| 12 | +## How to contribute |
| 13 | + |
| 14 | +### Commits |
| 15 | + |
| 16 | +Commit messages should be clear and fully elaborate the context and the reason of a change. |
| 17 | +If your commit refers to an issue, please post-fix it with the issue number, e.g. |
| 18 | + |
| 19 | +``` |
| 20 | +Issue: #123 |
| 21 | +``` |
| 22 | + |
| 23 | +Furthermore, commits should be signed off according to the [DCO](DCO.md). |
| 24 | + |
| 25 | +### Pull Requests |
| 26 | + |
| 27 | +If your Pull Request resolves an issue, please add a respective line to the end, like |
| 28 | + |
| 29 | +``` |
| 30 | +Resolves #123 |
| 31 | +``` |
| 32 | + |
| 33 | +## Developer's guide |
| 34 | + |
| 35 | +OpossumUI is an Electron app written in TypeScript. |
| 36 | +The frontend uses React (where functional components are used whenever possible) with Redux for state management. |
| 37 | + |
| 38 | +All useful scripts are listed in the package.json and can be run through `yarn` and can be called after cloning the repository and installing all dependencies. |
| 39 | +To start the app based on the current state of the code, including automatic updates after changes to the frontend, execute: |
| 40 | + |
| 41 | +``` |
| 42 | +yarn start |
| 43 | +``` |
| 44 | + |
| 45 | +Unit tests are provided for all features, aided by integration tests when helpful. The testing framework is jest + react |
| 46 | +testing library. They can be run locally by executing: |
| 47 | + |
| 48 | +``` |
| 49 | +yarn test |
| 50 | +``` |
| 51 | + |
| 52 | +Prettier is used as a code formatter. |
| 53 | + |
| 54 | +### Requirements |
| 55 | + |
| 56 | +The following software is required for working on the repository: |
| 57 | + |
| 58 | +- a Unix-based OS, |
| 59 | +- [git](https://git-scm.com/), |
| 60 | +- [node.js](https://nodejs.org/) 14+, |
| 61 | +- [yarn](https://yarnpkg.com/en/), |
| 62 | +- [reuse.software](https://reuse.software/) (to check that copyright information is provided), |
| 63 | +- [wine](https://www.winehq.org/) (only to build the Windows version). |
| 64 | + |
| 65 | +### How to build the project |
| 66 | + |
| 67 | +See the [user's quick start guide](README.md#user_quick_start_guide). |
| 68 | + |
| 69 | +### <a id="file_formats"></a> File formats |
| 70 | + |
| 71 | +JSON schemas for both the [input](src/ElectronBackend/input/OpossumInputFileSchema.json) |
| 72 | +and [output](src/ElectronBackend/input/OpossumOutputFileSchema.json) files are available. Example files can be found |
| 73 | +under [example files](example-files/). |
| 74 | + |
| 75 | +#### Input file |
| 76 | + |
| 77 | +It has to be generated through external tools and provided to the app. Contains 5 main fields: |
| 78 | + |
| 79 | +- `metadata`: contains some project-level information, |
| 80 | +- `resources`: defines the file tree, |
| 81 | +- `externalAttributions`: contains all attributions which are provided as signals (preselected signals will be |
| 82 | + automatically used by the app to create attributions in the output file), |
| 83 | +- `resourcesToAttributions`: links attributions to file paths, |
| 84 | +- `frequentlicenses`: A list of licenses that can be selected in a dropdown when the user enters a license name. |
| 85 | + |
| 86 | +There are additional fields which are optional: |
| 87 | + |
| 88 | +- `attributionBreakpoints`: a list of folder paths where attribution inference stops, e.g. `node_modules`." |
| 89 | +- `filesWithChildren`: a list of folders that are treated as files. This can be used to attach another file tree to files like `package.json`, usually also setting an attribution breakpoint. |
| 90 | +- `baseUrlsForSources`: a map from paths to the respective base url. The base url should contain a {path} placeholder. E.g. `"baseUrlsForSources": { |
| 91 | + "/": "https://github.com/opossum-tool/opossumUI/blob/main/{path}" |
| 92 | + }` |
| 93 | + |
| 94 | +#### Output file |
| 95 | + |
| 96 | +Contains 4 main fields: |
| 97 | + |
| 98 | +- `metadata`: contains some project-level information, |
| 99 | +- `manualAttributions`: contains all attributions created by the user or preselected, |
| 100 | +- `resourcesToAttributions`: links attributions to file paths, |
| 101 | +- `resolvedExternalAttributions`: used to store which signal attributions have been resolved, as they are hidden in the |
| 102 | + UI. |
0 commit comments