codecharta-visualization 0.0.0-staging-405c5df

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/Dockerfile +3 -0
  2. package/LICENSE.md +26 -0
  3. package/README.md +174 -0
  4. package/cli.js +7 -0
  5. package/conf/jestE2E-preset.js +4 -0
  6. package/conf/jestE2E.config.json +23 -0
  7. package/conf/jestUnit.config.json +22 -0
  8. package/conf/setupJestUnit.ts +8 -0
  9. package/conf/webpack.config.js +14 -0
  10. package/dist/webpack/3rdpartylicenses.txt +1614 -0
  11. package/dist/webpack/8.da720221a801950e.js +1 -0
  12. package/dist/webpack/codeCharta/assets/area_icon_for_3D_print.svg +1 -0
  13. package/dist/webpack/codeCharta/assets/codecharta_logo.svg +1 -0
  14. package/dist/webpack/codeCharta/assets/color_icon_for_3D_print.svg +1 -0
  15. package/dist/webpack/codeCharta/assets/empty.png +0 -0
  16. package/dist/webpack/codeCharta/assets/favicon.ico +0 -0
  17. package/dist/webpack/codeCharta/assets/flatten.png +0 -0
  18. package/dist/webpack/codeCharta/assets/gameObjectsFile.json +75 -0
  19. package/dist/webpack/codeCharta/assets/height_icon_for_3D_print.svg +1 -0
  20. package/dist/webpack/codeCharta/assets/helvetiker_regular.typeface.json +1281 -0
  21. package/dist/webpack/codeCharta/assets/icon.icns +0 -0
  22. package/dist/webpack/codeCharta/assets/icon.ico +0 -0
  23. package/dist/webpack/codeCharta/assets/icon.png +0 -0
  24. package/dist/webpack/codeCharta/assets/logo.png +0 -0
  25. package/dist/webpack/codeCharta/assets/mw_logo.svg +16 -0
  26. package/dist/webpack/codeCharta/assets/mw_logo_min.svg +1 -0
  27. package/dist/webpack/codeCharta/assets/mw_logo_text.svg +49 -0
  28. package/dist/webpack/codeCharta/assets/output.cc.json.gz +0 -0
  29. package/dist/webpack/codeCharta/assets/sample1.cc.json +97 -0
  30. package/dist/webpack/codeCharta/assets/sample2.cc.json +46 -0
  31. package/dist/webpack/codeCharta/assets/sample3.cc.json +40 -0
  32. package/dist/webpack/codeCharta/assets/sample4.cc.json +45 -0
  33. package/dist/webpack/codeCharta/assets/scenarios.json +50 -0
  34. package/dist/webpack/fontawesome-webfont.2b13baa7dd4f54c9.eot +0 -0
  35. package/dist/webpack/fontawesome-webfont.8a7cb27d142e3e19.ttf +0 -0
  36. package/dist/webpack/fontawesome-webfont.cf011583fb81df9f.woff +0 -0
  37. package/dist/webpack/fontawesome-webfont.da909aa098b0ee2d.svg +2671 -0
  38. package/dist/webpack/fontawesome-webfont.e9955780856cf8aa.woff2 +0 -0
  39. package/dist/webpack/index.html +14 -0
  40. package/dist/webpack/main.f76ad714831966e8.js +1 -0
  41. package/dist/webpack/main.js +52 -0
  42. package/dist/webpack/material-icons-outlined.78a93b2079680a08.woff +0 -0
  43. package/dist/webpack/material-icons-outlined.f86cb7b0aa53f0fe.woff2 +0 -0
  44. package/dist/webpack/material-icons-round.92dc7ca2f4c591e7.woff +0 -0
  45. package/dist/webpack/material-icons-round.b10ec9db5b7fbc74.woff2 +0 -0
  46. package/dist/webpack/material-icons-sharp.3885863ee4746422.woff2 +0 -0
  47. package/dist/webpack/material-icons-sharp.a71cb2bf66c604de.woff +0 -0
  48. package/dist/webpack/material-icons-two-tone.588d63134de807a7.woff +0 -0
  49. package/dist/webpack/material-icons-two-tone.675bd578bd14533e.woff2 +0 -0
  50. package/dist/webpack/material-icons.4ad034d2c499d9b6.woff +0 -0
  51. package/dist/webpack/material-icons.59322316b3fd6063.woff2 +0 -0
  52. package/dist/webpack/package.json +135 -0
  53. package/dist/webpack/polyfills.e5f920f87e8a16c9.js +1 -0
  54. package/dist/webpack/runtime.20cbc7d19c78eb7a.js +1 -0
  55. package/dist/webpack/styles.022313b73eac05ed.css +4 -0
  56. package/package.json +139 -0
  57. package/tsconfig.json +32 -0
package/Dockerfile ADDED
@@ -0,0 +1,3 @@
1
+ FROM nginx:1.27.2-alpine
2
+
3
+ COPY ./dist/webpack /usr/share/nginx/html
package/LICENSE.md ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2024, MaibornWolff GmbH
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ - Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ - Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ - Neither the name of nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
+ POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,174 @@
1
+ # CodeCharta Visualization
2
+
3
+ [![Quality Gate Status For Visualization](https://sonarcloud.io/api/project_badges/measure?project=maibornwolff-gmbh_codecharta_visualization&metric=alert_status)](https://sonarcloud.io/project/overview?id=maibornwolff-gmbh_codecharta_visualization)
4
+
5
+ > CodeCharta by [MaibornWolff](https://www.maibornwolff.de)
6
+
7
+ ## Jump to Section
8
+
9
+ - [Installation](#installation)
10
+ - [Development Tasks](#tasks)
11
+ - [Testing](#testing)
12
+ - [JSON structure](#json-structure)
13
+ - [License](LICENSE.md)
14
+
15
+ # Installation
16
+
17
+ You can start with **Codecharta Visualization** on multiple ways:
18
+
19
+ - Installation as a [npm package](#npm-package) (Recommended for users)
20
+ - Run an operating system specific [standalone](#run-a-standalone)
21
+ - Build it yourself from the github [repository](#build-it-yourself) (Development)
22
+ - Use [docker-compose](https://maibornwolff.github.io/codecharta/docs/docker-containers/) to run this with other needed tools like a Sonar instance or analyzing tools of codecharta-analysis.
23
+ - Use our [Dockerfile](#run-in-docker-container) to run the visualization in a container
24
+ - Try out the [online version](https://maibornwolff.github.io/codecharta/visualization/app/index.html?file=codecharta.cc.json&file=codecharta_analysis.cc.json)
25
+
26
+ > Be aware, that if you are on Apple Silicon, you may run into problems with the standalone and build versions
27
+
28
+ ## NPM Package
29
+
30
+ > Make sure you have [Node.js](https://nodejs.org/en/download) (version >=20) installed <br>
31
+ > For reference: [Codecharta-Visualization on NPM](https://www.npmjs.com/package/codecharta-visualization)
32
+
33
+ ```bash
34
+ # Install the package globally via npm
35
+ $ npm i -g codecharta-visualization
36
+ # Run it anywhere (you might need administrative rights/sudo)
37
+ # You might need to restart your terminal
38
+ $ codecharta-visualization
39
+ ```
40
+
41
+ ## Run a standalone
42
+
43
+ - Download the correct standalone version for your OS from the [latest release page](https://github.com/MaibornWolff/codecharta/releases) under 'Assets'
44
+ - Extract & run the application
45
+
46
+ ### MacOS
47
+
48
+ > If you get an error on MacOS because of a missing license, try this [apple support article](https://support.apple.com/en-gb/guide/mac-help/mh40616/12.0/mac/12.0) <br>
49
+ > You may be required to give the application executable rights
50
+
51
+ > If you are using an M1 or similar (arm64) architectures you might need to do additional steps, because the OS might flag the executable as damaged, if it is downloaded and from an unverified developer:
52
+
53
+ - Remove the 'downloaded' attributes from the OS:
54
+ `$ xattr -cr codecharta-visualization.app/`
55
+
56
+ ## Build it yourself
57
+
58
+ > To clone and run this application, you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (version >=20) installed
59
+
60
+ > (Windows) For some tasks the Git bash utilities are required
61
+
62
+ ```bash
63
+ # Clone the CodeCharta repo
64
+ $ git clone https://github.com/MaibornWolff/codecharta.git
65
+ # Navigate to Visualization
66
+ $ cd codecharta/visualization
67
+ # Installation.
68
+ $ npm install
69
+ # Run the development server
70
+ $ npm run dev
71
+ # Upload any .cc.json!
72
+ ```
73
+
74
+ ### Tasks
75
+
76
+ After cloning the repository and running the `npm` installation as described above, you can use the other available commands and tasks inside the visualization project. You can check all tasks and their functionality inside the `package.json` section `scripts`.
77
+
78
+ #### Build
79
+
80
+ Build the project in `dist/webpack`. The produced files are required if you want to [package](#package) the application or [start](#start) the standalone version.
81
+
82
+ > Additional files are copied inside the webpack, which are required to execute the electron standalone via npm (run) start.
83
+ > Note that the `build` command requires unix tools on path, so on Windows add them to it or use the bash shell
84
+
85
+ ```bash
86
+ # Make sure you are still inside the visualization project
87
+ $ cd visualization
88
+ # Build the webpack without serving it
89
+ $ npm run build
90
+ # The webpack is inside the dist/webpack/ folder, which you can serve as a web application
91
+ ```
92
+
93
+ #### Package
94
+
95
+ **Package** the electron application to produce the standalone versions for Windows, Linux and MacOS for distribution and testing. The different versions are inside the `dist/applications` folder.
96
+
97
+ > Make sure to run the [build](#build) task beforehand <br>
98
+ > This process might require administrative rights/sudo depending on the OS <br>
99
+ > For UNIX-based systems you probably need to install [Wine](https://www.winehq.org/) to package the Windows application <br>
100
+ > The MacOS version usually can't be packaged while using Windows
101
+
102
+ ```bash
103
+ $ npm run package
104
+ # If you only want to produce the standalone version for your current OS/arch combo use package:local
105
+ $ npm run package:local
106
+ ```
107
+
108
+ > For each application there will be a `.zip` file inside the `dist/packages` folder. Zipping is part of the `npm run package` process. You can check the scripts inside `script/app*.js` for details.
109
+
110
+ #### Dev
111
+
112
+ ```bash
113
+ # Build the webpack and serve it under localhost:3000
114
+ $ npm run dev
115
+ # This server listens to file changes
116
+ ```
117
+
118
+ #### Start
119
+
120
+ > Make sure to run [build](#build) beforehand
121
+
122
+ ```bash
123
+ # Start the electron application
124
+ $ npm run start
125
+ ```
126
+
127
+ <hr>
128
+
129
+ ### Testing
130
+
131
+ To run tests check out the following **tasks**:
132
+
133
+ #### Unit
134
+
135
+ Run unit tests in `app/` and generate a coverage report in `dist/coverage/`.
136
+
137
+ ```bash
138
+ # Executes test with reduced CPU usage to avoid memory problems
139
+ $ npm run test
140
+ # To run the tests in watch mode, use
141
+ $ npm run test:auto
142
+ # To run as many tests in parallel as possible
143
+ $ npm run test:ci
144
+ ```
145
+
146
+ #### E2E
147
+
148
+ Run end-to-end tests
149
+
150
+ ```bash
151
+ # Make sure to stop the dev-webserver before continuing
152
+ # Create an up-to-date build
153
+ $ npm run build
154
+ # Start the e2e tests
155
+ $ npm run e2e
156
+ # To run the tests in watch mode, use
157
+ $ npm run e2e:auto
158
+ ```
159
+
160
+ > To follow/watch the steps the e2e test is performing, deactivate headless mode in `jest-puppeteer.config.js` (and maybe set the `slowMo` parameter)
161
+
162
+ ## Run in Docker container
163
+
164
+ You can use this via docker compose or as a standalone container. This section will deal with how to use the visualization as a standalone container. For information on how to use this with docker compose, please check out [Docker Getting Started](https://maibornwolff.github.io/codecharta/docs/docker-containers/)
165
+ We assume that you already installed docker, if not, you have to do that before!
166
+
167
+ To containerize the visualization, please follow the below listed steps.
168
+
169
+ - Start the docker container: `docker run -d -p 9000:80 codecharta/codecharta-visualization`. This detaches the container and exposes port 80 on the container and port 9000 on the host.
170
+ - Open `localhost:9000` in your browser and you can already use the visualization, upload `cc.json` files and play around!
171
+
172
+ ## Code Style
173
+
174
+ Please check out the [DEV_START_GUIDE](../DEV_START_GUIDE.md).
package/cli.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+
3
+ const shell = require("shelljs")
4
+ const sanitized_dir = __dirname.replace('"', "")
5
+ const silent = process.platform === ("win32" || "win64") ? ">nul 2>&1" : "2>/dev/null"
6
+
7
+ shell.exec(`npm run --prefix "${sanitized_dir}" start ${silent}`)
@@ -0,0 +1,4 @@
1
+ const tsPreset = require("ts-jest/jest-preset")
2
+ const puppeteerPreset = require("jest-puppeteer/jest-preset")
3
+
4
+ module.exports = Object.assign(tsPreset, puppeteerPreset)
@@ -0,0 +1,23 @@
1
+ {
2
+ "collectCoverage": true,
3
+ "rootDir": "./../",
4
+ "coverageDirectory": "<rootDir>/dist/coverage",
5
+ "collectCoverageFrom": ["<rootDir>/app/**/*.ts", "!**/node_modules/**"],
6
+ "coveragePathIgnorePatterns": ["\\.(spec|e2e|po)\\.ts$", "<rootDir>/app/puppeteer.helper.ts"],
7
+ "transform": {
8
+ "\\.(ts|tsx)$": [
9
+ "ts-jest",
10
+ {
11
+ "tsconfig": "tsconfig.spec.json"
12
+ }
13
+ ],
14
+ "^.+\\.md$": "<rootDir>/app/codeCharta/util/testUtils/markdown-transformer.js"
15
+ },
16
+ "transformIgnorePatterns": ["/node_modules/(?!(three|ngx-color/fesm2020))"],
17
+ "roots": ["<rootDir>/app"],
18
+ "testMatch": ["**/*.e2e.ts"],
19
+ "moduleFileExtensions": ["js", "json", "ts", "mjs"],
20
+ "moduleDirectories": ["node_modules", "<rootDir>/app"],
21
+ "preset": "./conf/jestE2E-preset.js",
22
+ "testTimeout": 60000
23
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "collectCoverage": true,
3
+ "rootDir": "./../",
4
+ "coverageDirectory": "<rootDir>/dist/coverage",
5
+ "collectCoverageFrom": ["<rootDir>/app/**/*.ts", "!**/node_modules/**"],
6
+ "coveragePathIgnorePatterns": ["\\.(spec|e2e|po)\\.ts$", "<rootDir>/app/puppeteer.helper.ts"],
7
+ "preset": "jest-preset-angular",
8
+ "transform": {
9
+ "\\.glsl$": "<rootDir>/mocks/fileTransformer.js"
10
+ },
11
+ "transformIgnorePatterns": ["/node_modules/(?!(three|ngx-color/fesm2020|.*\\.mjs$))"],
12
+ "moduleNameMapper": {
13
+ "\\CHANGELOG.(md)$": "<rootDir>/mocks/changelogMock.js",
14
+ "^d3$": "<rootDir>/node_modules/d3/dist/d3.min.js"
15
+ },
16
+ "roots": ["<rootDir>/app"],
17
+ "moduleFileExtensions": ["js", "json", "ts", "mjs"],
18
+ "moduleDirectories": ["node_modules", "<rootDir>/app"],
19
+ "setupFiles": ["<rootDir>/mocks/localStorageMock.js"],
20
+ "setupFilesAfterEnv": ["<rootDir>/conf/setupJestUnit.ts", "jest-canvas-mock"],
21
+ "testEnvironment": "jsdom"
22
+ }
@@ -0,0 +1,8 @@
1
+ import "jest-preset-angular/setup-jest"
2
+
3
+ const numberToLocaleString = Number.prototype.toLocaleString
4
+ Number.prototype.toLocaleString = function (locale = "en-US") {
5
+ return numberToLocaleString.call(this, locale)
6
+ }
7
+
8
+ window["__TEST_ENVIRONMENT__"] = true
@@ -0,0 +1,14 @@
1
+ module.exports = config => {
2
+ config.module.rules.push(
3
+ {
4
+ test: /\.glsl$/,
5
+ use: ["webpack-glsl-loader"]
6
+ },
7
+ {
8
+ test: /\.md$/,
9
+ type: "asset/source"
10
+ }
11
+ )
12
+
13
+ return config
14
+ }