Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency tree generation #1104

Open
wheresrhys opened this issue May 4, 2023 · 0 comments
Open

Dependency tree generation #1104

wheresrhys opened this issue May 4, 2023 · 0 comments

Comments

@wheresrhys
Copy link
Contributor

wheresrhys commented May 4, 2023

I wrote this little script to generate a mermaidjs representation of the dependency tree (using the state machine setting as that maps well to a dependency tree)

import fs from 'fs'
const componentNames = fs.readdirSync('./components')

const packages = componentNames.flatMap(component =>
		Object.keys(JSON.parse(fs.readFileSync(`./components/${component}/package.json`, 'utf8')).peerDependencies || {})
			.filter(name => name.startsWith('@financial-times/o-'))
			.map(name => name.replace('@financial-times/', ''))
			.map(dep => ([component.replace(/-/g, '_'), dep.replace(/-/g, '_')]) )
			.map(([comp, dep]) => `    ${comp} --> ${dep}`)
).join('\n')

console.log(`stateDiagram-v2
${packages}`)

Here is an SVG https://mermaid.ink/svg/eyJjb2RlIjoic3RhdGVEaWFncmFtLXYyXG4gICAgZnRfY29uY2VwdF9idXR0b24gLS0-IG9fbm9ybWFsaXNlXG4gICAgZnRfY29uY2VwdF9idXR0b24gLS0-IG9fdHlwb2dyYXBoeVxuICAgIGdfYXVkaW8gLS0-IG9faWNvbnNcbiAgICBuX25vdGlmaWNhdGlvbiAtLT4gb19jb2xvcnNcbiAgICBuX25vdGlmaWNhdGlvbiAtLT4gb190eXBvZ3JhcGh5XG4gICAgb19hdWRpbyAtLT4gb191dGlsc1xuICAgIG9fYXV0b2NvbXBsZXRlIC0tPiBvX2JyYW5kXG4gICAgb19hdXRvY29tcGxldGUgLS0-IG9fY29sb3JzXG4gICAgb19hdXRvY29tcGxldGUgLS0-IG9fZ3JpZFxuICAgIG9fYXV0b2NvbXBsZXRlIC0tPiBvX2ljb25zXG4gICAgb19hdXRvY29tcGxldGUgLS0-IG9fbG9hZGluZ1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GFjaW5nXG4gICAgb192aWRlbyAtLT4gb19jb2xvcnNcbiAgICBvX3ZpZGVvIC0tPiBvX2ljb25zXG4gICAgb192aWRlbyAtLT4gb19sb2FkaW5nXG4gICAgb192aWRlbyAtLT4gb19ub3JtYWxpc2VcbiAgICBvX3ZpZGVvIC0tPiBvX3R5cG9ncmFwaHlcbiAgICBvX3ZpZGVvIC0tPiBvX3ZpZXdwb3J0XG4gICAgb192aWV3cG9ydCAtLT4gb191dGlsc1xuICAgIG9fdmlzdWFsX2VmZmVjdHMgLS0-IG9fY29sb3JzIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifSwidXBkYXRlRWRpdG9yIjpmYWxzZX0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant