Skip to content

Commit

Permalink
Merge pull request #23 from L-Qun/main
Browse files Browse the repository at this point in the history
Create a rush-dep-graph-plugin Rush plugin to display the dependency graph.
  • Loading branch information
octogonz authored Dec 16, 2024
2 parents 60a73d2 + 21369c4 commit c56773a
Show file tree
Hide file tree
Showing 24 changed files with 679 additions and 8 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,13 @@ Git LFS was commonly used to managed large files/binary files in your git reposi

The rush subspace is a new feature that intends to move common projects into 1 workspace. Teams that want to take advantage of this feature need to manually migrate these projects. This script automates most of these required steps to speed up the migration process.

[More](./rush-plugins/rush-migrate-subspace-plugin/README.md)
[More](./rush-plugins/rush-migrate-subspace-plugin/README.md)

# rush-dep-graph-plugin

[![npm](https://img.shields.io/npm/dt/rush-dep-graph-plugin.svg?style=flat-square)](https://www.npmjs.com/package/rush-dep-graph-plugin)
[![npm](https://img.shields.io/npm/dw/rush-dep-graph-plugin.svg?style=flat-square)](https://www.npmjs.com/package/rush-dep-graph-plugin)

Are you struggling with the complex dependencies between packages? This plugin helps you visualize the dependency relationships between packages.

[More](./rush-plugins/rush-dep-graph-plugin/README.md)
10 changes: 10 additions & 0 deletions common/changes/rush-dep-graph-plugin/main_2024-12-16-07-22.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "rush-dep-graph-plugin",
"comment": "Create a `rush-dep-graph-plugin` Rush plugin to display the dependency graph.",
"type": "minor"
}
],
"packageName": "rush-dep-graph-plugin"
}
83 changes: 76 additions & 7 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
extends: [
'@rushstack/eslint-config/profile/node-trusted-tool',
'@rushstack/eslint-config/mixins/friendly-locals'
],
parserOptions: { tsconfigRootDir: __dirname },
ignorePatterns: ['node_modules/', 'lib/', 'jest.config.js'],
rules: {
'@typescript-eslint/no-explicit-any': 'off'
}
};
1 change: 1 addition & 0 deletions rush-plugins/rush-dep-graph-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/
35 changes: 35 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# THIS IS A STANDARD TEMPLATE FOR .npmignore FILES IN THIS REPO.

# Ignore all files by default, to avoid accidentally publishing unintended files.
*

# Use negative patterns to bring back the specific things we want to publish.
!/bin/**
!/lib/**
!/lib-*/**
!/dist/**

!CHANGELOG.md
!CHANGELOG.json
!heft-plugin.json
!rush-plugin-manifest.json
!ThirdPartyNotice.txt

# Ignore certain patterns that should not get published.
/dist/*.stats.*
/lib/**/test/
/lib-*/**/test/
*.test.js

# NOTE: These don't need to be specified, because NPM includes them automatically.
#
# package.json
# README.md
# LICENSE

# ---------------------------------------------------------------------------
# DO NOT MODIFY ABOVE THIS LINE! Add any project-specific overrides below.
# ---------------------------------------------------------------------------

!/includes/**
!command-line.json
21 changes: 21 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) TikTok Pte. Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
25 changes: 25 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# rush-dep-graph-plugin

A Rush plugin that displays the dependency graph.

# Prerequisite

Rush.js >= 5.83.2


# Quick Start

1. Enabling this rush plugin

Please follow the [official doc](https://rushjs.io/pages/maintainer/using_rush_plugins/) to enable this plugin in your repo.

2. Running `dep-graph` command

```
Usage: rush dep-graph [OPTIONS]
Options:
-t, --to <PROJECT_NAME> Select the packages that depend on specific project.
-f, --from <PROJECT_NAME> Select the package that is dependent on specific package.
--filter <PROJECT_NAME> Select the packages based on a custom filter criteria, such as specific keywords in the package name.
```
39 changes: 39 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/command-line.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json",
"commands": [
{
"name": "dep-graph",
"commandKind": "global",
"summary": "Display the dependency graph of the specified package.",
"description": "Display the dependency graph of the specified package.",
"shellCommand": "ts-node common/autoinstallers/dep-graph/src/index.ts",
"autoinstallerName": "dep-graph",
"safeForSimultaneousRushProcesses": true
}
],
"parameters": [
{
"parameterKind": "string",
"argumentName": "PROJECT_NAME",
"description": "Select the packages that depend on specific project.",
"longName": "--to",
"shortName": "-t",
"associatedCommands": ["dep-graph"]
},
{
"parameterKind": "string",
"argumentName": "PROJECT_NAME",
"description": "Select the package that is dependent on specific package.",
"longName": "--from",
"shortName": "-f",
"associatedCommands": ["dep-graph"]
},
{
"parameterKind": "string",
"argumentName": "PROJECT_NAME",
"description": "Select the packages based on a custom filter criteria, such as specific keywords in the package name.",
"longName": "--filter",
"associatedCommands": ["dep-graph"]
}
]
}
7 changes: 7 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",

"rigPackageName": "@rushstack/heft-node-rig"
}
5 changes: 5 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/lint-staged.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-env es6 */
const config = {
'*': "echo 'good job'"
};
module.exports = config;
48 changes: 48 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "rush-dep-graph-plugin",
"version": "0.0.1",
"description": "A Rush plugin that displays the dependency graph.",
"keywords": [
"rush",
"plugin",
"command",
"dependency graph"
],
"homepage": "https://github.com/tiktok/rush-plugins#readme",
"repository": {
"type": "git",
"url": "https://github.com/tiktok/rush-plugins",
"directory": "rush-plugins/rush-dep-graph-plugin"
},
"license": "MIT",
"main": "lib/index.js",
"scripts": {
"build": "heft build --clean",
"build:watch": "heft build --watch",
"prepublishOnly": "npm run build",
"test": "heft test"
},
"dependencies": {
"@rushstack/node-core-library": "3.62.0",
"@rushstack/rush-sdk": "^5.139.0",
"@rushstack/terminal": "~0.14.2",
"archy": "^1.0.0",
"chalk": "4.1.2",
"commander": "~9.4.0",
"execa": "~5.1.1",
"fs-extra": "~10.1.0",
"minimatch": "~5.1.1",
"ora": "5.4.1"
},
"devDependencies": {
"@rushstack/eslint-config": "3.3.4",
"@rushstack/heft": "0.61.0",
"@rushstack/heft-node-rig": "2.2.25",
"@types/archy": "^0.0.36",
"@types/fs-extra": "~9.0.13",
"@types/heft-jest": "1.0.1",
"@types/minimatch": "~5.1.2",
"@types/node": "18.17.15",
"typescript": "~5.0.4"
}
}
10 changes: 10 additions & 0 deletions rush-plugins/rush-dep-graph-plugin/rush-plugin-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush-plugin-manifest.schema.json",
"plugins": [
{
"pluginName": "dep-graph",
"description": "Display the dependency graph of the specified package.",
"commandLineJsonFilePath": "command-line.json"
}
]
}
Loading

0 comments on commit c56773a

Please sign in to comment.