Skip to content

Commit 0ea1cf9

Browse files
authored
feat: visualize and analyze commands (#79)
* chore: fix eslint problem with tsconfig.json referencing expo config in root workspace * feat: implemented license-kit-visualizer Next project * feat: charts & analysis for license-kit-visualizer, dev server in license-kit CLI * feat!: update API to account for multiple possible parent packages at once, simplify type names * chore: ignore build dirs for docs and visualizer in eslint to speed it up * feat: streaming reports from server & SSE reload on lockfile changes * chore!: @callstack/licenses to support both browser & node targets, move around files * chore: updated license-kit README * feat: license-kit CLI analyze command * feat: visualizer latex formula display, better layout, fixed charts * feat: finished visualizer UI * chore: format files * fix: classify unknown license literal for visualizer needs as UNKNOWN license category * feat: finished Charts accordion tab * docs: fix diff * fix: permissiveness score * chore: script for running built license-kit CLI * feat: graph render loading indicator, auto-center graph when rendered * fix: do not warn about unknown license in the root package; pre nested in p * feat: construction of package inclusion trait up to the root project for custom selected roots * feat: display information about the hovered package * chore: migrated to a newer version of prettier * fix: properly add connections to handle multi-parent packages * feat: disclaimer & help * feat: summarization of graph shape with Summarization API (in-browser language model) * fix: floor permissiveness score in CLI mode * fix: remove obsolete options from visualize command * docs: updated documentation * chore: updated CLI package description in package.json * chore: license attribution in visualizer project, extracted MarkdownBlock component * fix(test): adjust buffer size for integration tests * feat: optimize buildDependencyGraph memory usage * chore: changes after CR * feat: replace score with description of graph state findings * chore: replace moment with date-fns * chore: fix typo in help message * chore: fix lefthook lint commands * feat: check if Summarizer API is available in the browser * chore: update notes in tool
1 parent 719497d commit 0ea1cf9

104 files changed

Lines changed: 7598 additions & 775 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,18 @@
22
const config = {
33
root: true,
44
extends: ['@callstack'],
5-
ignorePatterns: ['node_modules/', '**/node_modules/', 'lib/', '**/lib/', 'build/', '**/build/', 'docs/**'],
5+
ignorePatterns: [
6+
'node_modules/',
7+
'**/node_modules/',
8+
'lib/',
9+
'**/lib/',
10+
'build/',
11+
'**/build/',
12+
'visualizer-build/',
13+
'doc_build',
14+
'docs/**',
15+
'packages/visualizer/',
16+
],
617
rules: {
718
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
819
'@typescript-eslint/consistent-type-imports': ['error'],

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
.DS_Store
44

55
# VSCode
6-
.vscode/
6+
.vscode/*
7+
!.vscode/settings.json
78

89
# Yarn
910
node_modules/

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"eslint.workingDirectories": [{ "mode": "auto" }],
3+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
4+
}

commitlint.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { UserConfig } from '@commitlint/types';
2+
3+
const Configuration: UserConfig = {
4+
extends: ['@commitlint/config-conventional'],
5+
};
6+
7+
export default Configuration;

docs/docs/docs/react-native.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ If you are using Expo, you need to add the config plugin to your `app.json` or `
2727
```diff
2828
{
2929
"expo": {
30-
++ "plugins": ["react-native-legal"]
30+
+ "plugins": ["react-native-legal"]
3131
}
3232
}
3333
```

docs/docs/docs/standalone-cli.mdx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 3
33
---
44

5-
import { PackageManagerTabs, Badge } from '@theme';
5+
import { Badge, PackageManagerTabs } from '@theme';
66

77
# Standalone CLI (Node.js)
88

@@ -96,6 +96,35 @@ Generates a licenses report in the specified format. The output can be written t
9696
| `--format [type]` | Output format, one of: `'json'`, `'about-json'` (AboutLibraries-compatible), `'text'`, `'markdown'` | `'json'` |
9797
| `--output [path]` | Where to write the output - either `'stdout'` or a path to an output file | `'stdout'` |
9898

99+
#### Command: `analyze`
100+
101+
Scan licenses & report the insights: summary, top license types, optionally unknowns & breakdown of licenses by different features.
102+
103+
| Flag / Option | Description | Default |
104+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
105+
| `--root [path]` | Path to the root of your project. | Current working directory |
106+
| `--list-unknown` | List unknown licenses. | `false` |
107+
| `--show-breakdown` | Show breakdown of licenses by category and type. | `false` |
108+
| `--tm, --transitive-deps-mode [mode]` | Controls, which transitive dependencies are included: <ul><li>`'all'`</li> <li>`'from-external-only'` (only transitive dependencies of direct dependencies specified by non-workspace:... specifiers)</li> <li>`'from-workspace-only'` (only direct dependencies of direct dependencies specified by `workspace:` specifier)</li> <li>`'none'`</li></ul> | `'all'` |
109+
| `--dm, --dev-deps-mode [mode]` | <ul><li>`'root-only'` (only direct devDependencies from the scanned project's root package.json)</li> <li>`'none'`</li></ul> | `'root-only'` |
110+
| `--od`, `--include-optional-deps [bool]` | Whether to include `optionalDependencies` in the scan; other flags apply. | `true` |
111+
| `-h`, `--help` | Display help for command. ||
112+
113+
#### Command: `visualize`
114+
115+
Launches a local server providing a web license graph visualizer & analyzer app: summarizes the dependency graph state, shows an interactive graph of licenses with possibility to select a subgraph, provides browser built-in AI-turbocharged summary of the dependency graph.
116+
117+
| Flag / Option | Description | Default |
118+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
119+
| `--port [port]` | Port on which to launch the app. | `8094` |
120+
| `--h, --host [host]` | Host on which to launch the app. | `"localhost"` |
121+
| `--a, --auto-open [open]` | Automatically open the app in the browser after launching. | `true` |
122+
| `--root [path]` | Path to the root of your project. | `"."` |
123+
| `--tm, --transitive-deps-mode [mode]` | Controls, which transitive dependencies are included: <ul><li>`'all'`</li> <li>`'from-external-only'` (only transitive dependencies of direct dependencies specified by non-workspace:... specifiers)</li> <li>`'from-workspace-only'` (only direct dependencies of direct dependencies specified by `workspace:` specifier)</li> <li>`'none'`</li></ul> | `'all'` |
124+
| `--dm, --dev-deps-mode [mode]` | <ul><li>`'root-only'` (only direct devDependencies from the scanned project's root package.json)</li> <li>`'none'`</li></ul> | `'root-only'` |
125+
| `--od`, `--include-optional-deps [bool]` | Whether to include `optionalDependencies` in the scan; other flags apply. | `true` |
126+
| `-h`, `--help` | Display help for command. ||
127+
99128
#### Command: `help`
100129

101130
Displays help, listing the available commands.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: "[Android] Accept Chrome T & C - Use without an account variant"
1+
name: '[Android] Accept Chrome T & C - Use without an account variant'
22
appId: com.android.chrome
33
---
44
- tapOn:
5-
label: Accept Chrome T & C
6-
text: "Accept & continue"
5+
label: Accept Chrome T & C
6+
text: 'Accept & continue'
77
- tapOn:
8-
label: "Turn off Chrome sync"
9-
text: "No thanks"
8+
label: 'Turn off Chrome sync'
9+
text: 'No thanks'
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: "[Android] Accept Chrome T & C - Accept and Continue variant"
1+
name: '[Android] Accept Chrome T & C - Accept and Continue variant'
22
appId: com.android.chrome
33
---
44
- tapOn:
5-
label: Dismiss Chrome sign in
6-
text: "Use without an account"
5+
label: Dismiss Chrome sign in
6+
text: 'Use without an account'
77
- tapOn:
8-
label: "Dismiss Chrome notifications"
9-
id: "com.android.chrome:id/negative_button"
8+
label: 'Dismiss Chrome notifications'
9+
id: 'com.android.chrome:id/negative_button'

examples/bare-example/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
22
* @format
33
*/
4-
54
import { AppRegistry } from 'react-native';
65

76
import App from './App';

examples/node-example/__tests__/report.spec.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ async function runReportCommandForJsonOutput(args: string[] = []) {
3939
const command = `yarn workspace license-kit-node-example report${args ? ` ${args.join(' ')}` : ''}`;
4040

4141
const output = await new Promise<string>((resolve) => {
42-
child_process.exec(command, (_, stdout) => {
43-
resolve(stdout);
44-
});
42+
child_process.exec(
43+
command,
44+
{
45+
maxBuffer: 1024 * 1024 * 100, // 100MB
46+
},
47+
(_, stdout) => {
48+
resolve(stdout);
49+
},
50+
);
4551
});
4652

4753
return JSON.parse(output);

0 commit comments

Comments
 (0)