npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coderoad

v1.0.11

Published

codebase viewer based on dependence analysis

Downloads

325

Readme

CodeRoad

中文 | English

Background

When you want to read the source code of Vue or other excellent open source projects, or when you have just joined a team and have to familiarize yourself with the complex project codebase as soon as possible, you must feel very headache. Because one of the files (modules) always depends on other files (dependencies), or is depended by other files(dependents), a huge network is formed between the modules, which makes people very confused. CodeRoad visualizes the dependence relationship based on dependency analysis, giving you a clearer and more intuitive understanding of the structure of the codebase. Just like seeing "coderoad -- the road of code",

Preview

Click here to see live demo

Description

  • The whole interface is divided into left and right parts. On the left it's a tree graph generated according to the project directory structure, and each leaf is forced to align. Dependencies are represented by arrows between the leaves. On the right it's the content of the selected file, which is readable only.
  • Each file has four possible states, represented by four colors.
    • Orange: Has dependencies. No dependents. Usually the entry file of the project.
    • Green: Has dependencies. Has dependents. Most files will be this state.
    • Purple: No dependencies. Has dependents. Usually the utils.
    • White: No dependencies. No dependents. Usually some configuration files or others. All folders are white.
  • There are four control options, the functions are:
    • Toggle the editor.
    • Toggle the dependence type. show dependencies or show dependents
    • Lock starter file. If unlocked, clicking on a file switches to dependence graph starting with that file. If locked, when clicking on other files, the dependence graph will not be switched, only the contents of the editor will be switched.
    • Adjusting Dependence Depth.
  • Currently supported file types: .js,.jsx,.ts,.tsx,.vue

Installation

npm install -g coderoad

or with yarn

yarn global add coderoad

Usage

Just run the command in the project directory.

cd <dir>
coderoad

You can also specify the project path manually.

coderoad -d <dir>

Exclude some directories.

coderoad -x <ecludeDir1>,<exlcudeDir2>

Specify the alias config path.

coderoad -a <path-to-alias-config>

Take Vue project as an example. (It comes with alias configuration located in ./scripts/alias.js)

cd <path-to-vue>
coderoad -d src -a scripts/alias.js

Cli

| Parameter | Description | | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | -d,--dir | Specify the project path | | -x,--exclude | Exclude some directory and file. The following patterns are excluded by default: node_modules, __tests__, dist and items begining with .. | | -a,--alias | Specify the alias config path. | | -p,--port | Specify the server port,Default3450 |

Example of alias config.

const path = require('path')

module.exports = {
  vue: path.resolve(__dirname, 'src/platforms/web/entry-runtime-with-compiler')
}