
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
react-to-uml
Advanced tools
Visualize your react components tree with uml diagram
It is appropriate to your project if it uses babel and webpack.
npm i react-to-uml
// webpack.base.ts
import { makePlugins } from 'react-to-uml';
const rootPath = process.cwd();
const packagesPaths = new RegExp(rootPath + '/(packages)');
const entryFileName = rootPath + '/packages/app/client.js';
const gatheredComponentsFileName = `${rootPath}/build/assets/gatheredComponentsByFileName.json`;
const outUmlFileName = `${rootPath}/build/assets/treeComponentsUML.json`;
const { babelPlugin, webpackPlugin } = makePlugins({
packagesPaths,
entryFileName,
gatheredComponentsFileName,
outUmlFileName,
});
export default {
entry: './packages/app/client.js',
plugins: [new HtmlWebpackPlugin({ template: './public/index.html' }), webpackPlugin],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'build'),
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '...'],
},
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
plugins: [babelPlugin],
presets: [
['@babel/preset-typescript'],
['@babel/preset-react', { runtime: 'automatic' }],
['@babel/preset-env'],
],
},
},
},
],
},
} as Configuration;
java -Xmx2G -jar plantuml-1.2023.11.jar ./build/assets/treeComponentsUML.uml -tsvg -verbose -t4
(more CLI params here)by default ['jsx', 'js', 'tsx', 'ts']
- files in which library will looking for the jsx
by default false
- grouping your components by root dir, e.g. for monorepo with packages root dir it will group it like in the picture below
by default 4
- to adjust your zoom of view, components with a count of repetitive more than this param will be removed from the diagram.
To turn on extra logs in this library use --debug
with your build script.
npm run build --debug
Once you gathered the data from your code base, just imagine what you could do in the next step. This library right now just organizes the process of traverse, so it is possible to add logic into the library and gather extra data on the way like:
FAQs
Visualize your react components tree with uml diagram
The npm package react-to-uml receives a total of 0 weekly downloads. As such, react-to-uml popularity was classified as not popular.
We found that react-to-uml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.