
Security News
PyPI Expands Trusted Publishing to GitLab Self-Managed as Adoption Passes 25 Percent
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads
@callstack/react-native-legal-shared
Advanced tools
npm install @callstack/react-native-legal-shared
You can use @callstack/react-native-legal-shared programmatically in your Node.js applications. Here's a basic example of how to use it:
import {
generateAboutLibrariesNPMOutput,
generateLicensePlistNPMOutput,
scanDependencies,
Types,
} from '@callstack/react-native-legal-shared';
import * as md from 'ts-markdown-builder';
// apart from dependencies, also include devDependencies, but only from the root package.json;
// also, include all transitive dependencies & optional dependencies
const optionsFactory: Types.ScanPackageOptionsFactory = ({ isRoot }) => ({
includeDevDependencies: isRoot,
includeTransitiveDependencies: true,
includeOptionalDependencies: true,
});
// scan dependencies of a package
const licenses = scanDependencies(packageJsonPath, optionsFactory);
// generate AboutLibraries-compatible JSON metadata
const aboutLibrariesCompatibleReport = generateAboutLibrariesNPMOutput(licenses);
// generate LicensePlist-compatible metadata
const licensePlistReport = generateLicensePlistNPMOutput(licenses, iosProjectPath);
// generate a Markdown report
const markdownString = md
.joinBlocks(
Object.entries(licenses)
.flatMap(([packageKey, { name: packageName, version, author, content, description, file, type, url }]) => [
md.heading(packageName, { level: 2 }),
'\n',
`Version: ${version}<br/>\n`,
url ? `URL: ${url}<br/>\n` : '',
author ? `Author: ${author}<br/>\n\n` : '',
content ?? '',
'\n',
description ? `Description: ${description}\n` : '',
file ? `\nFile: ${file}\n` : '',
type ? `Type: ${type}` : '',
'\n',
md.horizontalRule,
])
.join('\n'),
)
.toString();
The API documentation is published under: https://callstackincubator.github.io/react-native-legal/api/.
This package is consumed by other packages in the monorepo by its build outputs, so everytime it is modified, you need to rebuild the package. This can be done once by running yarn build, or by running yarn dev to run tsc in watch mode. All this is described in the Contributing Guide.
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.