Skip to content

Commit 04f8202

Browse files
committed
Add example for the analysis of a Typescript project.
1 parent dcef6bf commit 04f8202

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

COMMANDS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
- [Setup Neo4j Graph Database](#setup-neo4j-graph-database)
2323
- [Start Neo4j Graph Database](#start-neo4j-graph-database)
2424
- [Setup jQAssistant Java Code Analyzer](#setup-jqassistant-java-code-analyzer)
25-
- [Download Maven Artifacts to Analyze](#download-maven-artifacts-to-analyze)
25+
- [Download Maven Artifacts to analyze](#download-maven-artifacts-to-analyze)
2626
- [Reset the database and scan the java artifacts](#reset-the-database-and-scan-the-java-artifacts)
2727
- [Database Queries](#database-queries)
2828
- [Cypher Shell](#cypher-shell)
@@ -52,7 +52,8 @@ To run all analysis steps simple execute the following command:
5252
./../../scripts/analysis/analyze.sh
5353
```
5454

55-
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps.
55+
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps for a Java Project.
56+
👉 See [scripts/examples/analyzeReactRouter.sh](./scripts/examples/analyzeReactRouter.sh) as an example script that combines all the above steps for a Typescript Project.
5657
👉 See [Code Structure Analysis Pipeline](./.github/workflows/java-code-analysis.yml) on how to do this within a GitHub Actions Workflow.
5758

5859
### Command Line Options

GETTING_STARTED.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,6 @@ Please read through the [Prerequisites](./README.md#hammer_and_wrench-prerequisi
8080

8181
Then open your browser and login to your [local Neo4j Web UI](http://localhost:7474/browser) with "neo4j" as user and the initial password you've chosen.
8282
83-
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps.
83+
👉 See [scripts/examples/analyzeAxonFramework.sh](./scripts/examples/analyzeAxonFramework.sh) as an example script that combines all the above steps for a Java Project.
84+
👉 See [scripts/examples/analyzeReactRouter.sh](./scripts/examples/analyzeReactRouter.sh) as an example script that combines all the above steps for a Typescript Project.
8485
👉 See [Code Structure Analysis Pipeline](./.github/workflows/java-code-analysis.yml) on how to do this within a GitHub Actions Workflow.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
# This is an example for the analysis of a the Typescript project "react-router".
4+
# It includes the creation of the temporary directory, the working directory, the artifacts download and the analysis itself.
5+
6+
# Note: The first (and only) parameter is the version of "react-router" to analyze.
7+
# Note: This script is meant to be started in the root directory of this repository.
8+
9+
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
10+
set -o errexit -o pipefail
11+
12+
# Read the first input argument containing the version of the artifacts
13+
if [ "$#" -ne 1 ]; then
14+
echo "analyzerReactRouter Error: Usage: $0 <version>" >&2
15+
exit 1
16+
fi
17+
projectVersion=$1
18+
19+
# Check if environment variable is set
20+
if [ -z "${NEO4J_INITIAL_PASSWORD}" ]; then
21+
echo "analyzerReactRouter: Error: Requires environment variable NEO4J_INITIAL_PASSWORD to be set first. Use 'export NEO4J_INITIAL_PASSWORD=<your-own-password>'."
22+
exit 1
23+
fi
24+
25+
# Create the temporary directory for all analysis projects.
26+
mkdir -p ./temp
27+
cd ./temp
28+
29+
# Create the working directory for this specific analysis.
30+
mkdir -p "./react-router-${projectVersion}"
31+
cd "./react-router-${projectVersion}"
32+
33+
# Create the artifacts directory that will contain the code to be analyzed.
34+
mkdir -p ./artifacts
35+
36+
# Download AxonFramework artifacts (jar files) from Maven
37+
./../../scripts/downloader/downloadReactRouter.sh "${projectVersion}"
38+
39+
# Start the analysis
40+
./../../scripts/analysis/analyze.sh

0 commit comments

Comments
 (0)