77 Commits

Author SHA1 Message Date
Bogdan Lyashenko
7d910a0f75 1.7.0 2019-08-06 20:31:37 +02:00
Bogdan Lyashenko
ab74f6426e 1.6.18 2019-08-06 20:26:39 +02:00
Bogdan Lyashenko
390bb8ff67 fix: left margin for svg 2019-08-06 20:26:30 +02:00
Bogdan Lyashenko
fcd108f9e7 fix: readme 2019-08-06 20:10:33 +02:00
Bogdan Lyashenko
dd2c6ee3d2 1.6.17 2019-08-06 20:08:17 +02:00
Bogdan Lyashenko
9917425cc8 fix: config file support 2019-08-06 20:07:45 +02:00
Bohdan Liashenko
3f54ca11a1 Merge pull request #85 from idoo/feature/config
WIP: feat: added codecrumbs.config
2019-08-06 19:05:41 +02:00
Bohdan Liashenko
e059f800d6 Merge branch 'master' into feature/config 2019-08-06 19:04:40 +02:00
Bogdan Lyashenko
f2dec10c05 feat: add extra persist list 2019-08-06 18:57:37 +02:00
Ivan Verevkin
d8117eac7d feat: added codecrumbs.config 2019-08-06 15:26:09 +02:00
Ivan Verevkin
354514818c feat: added codecrumbs.config 2019-08-06 13:48:29 +02:00
Ivan Verevkin
4ac814be93 feat: added codecrumbs.config 2019-08-06 12:20:52 +02:00
Ivan Verevkin
2f7387a67f feat: added codecrumbs.config 2019-08-06 11:59:06 +02:00
Bogdan Lyashenko
1cf779c5a6 test: test 2019-08-04 12:43:03 +02:00
Bogdan Lyashenko
64c9a75d92 test: test 2019-08-04 12:37:05 +02:00
Bogdan Lyashenko
5a8c4e6a9b 1.6.16 2019-08-04 12:20:57 +02:00
Bogdan Lyashenko
2fd728b5e8 feat: add tree diagram content id 2019-08-04 12:20:51 +02:00
Bogdan Lyashenko
9bda1672d5 1.6.15 2019-08-03 21:15:48 +02:00
Bogdan Lyashenko
101eade38f feat: v update info 2019-08-03 21:15:41 +02:00
Bogdan Lyashenko
6a1c8bcd75 1.6.14 2019-08-03 20:36:43 +02:00
Bogdan Lyashenko
c49a09e721 feat: add debug mode flag 2019-08-03 20:36:35 +02:00
Bogdan Lyashenko
d526ded04b chore: add hint about cc group 2019-08-03 19:36:01 +02:00
Ivan Verevkin
06344bee72 feat: added codecrumbs.config 2019-08-02 18:18:08 +02:00
Bogdan Lyashenko
f9f67ff9ea 1.6.13 2019-08-01 20:16:49 +02:00
Bogdan Lyashenko
9e519166d5 fix: flow without steps 2019-08-01 20:16:43 +02:00
Bogdan Lyashenko
1b649bbe96 1.6.12 2019-08-01 19:50:40 +02:00
Bogdan Lyashenko
9ed305c08b fix: unique keys for react lists 2019-08-01 19:50:32 +02:00
Bogdan Lyashenko
dfebfa20a2 fix: layout calc 2019-08-01 19:11:11 +02:00
Bogdan Lyashenko
564c81362e fix: geometry calc 2019-07-30 21:16:40 +02:00
Bogdan Lyashenko
d938ea3ef1 1.6.11 2019-07-28 11:23:57 +02:00
Bogdan Lyashenko
beceb476d9 feat: extend store 2019-07-28 11:23:21 +02:00
Bogdan Lyashenko
ca882e4568 1.6.10 2019-07-27 20:04:13 +02:00
Bogdan Lyashenko
227c626c3a fix: layout 2019-07-27 20:03:38 +02:00
Bogdan Lyashenko
c3606e3c3e fix: border for single space 2019-07-27 19:22:36 +02:00
Bogdan Lyashenko
ae9ffccf65 chore: js2flowchart update 2019-07-27 10:44:09 +02:00
Ivan Verevkin
897dcb8c3b feat: added codecrumbs.config 2019-07-26 14:18:51 +02:00
Bogdan Lyashenko
38e1fdeeda 1.6.9 2019-07-25 20:08:15 +02:00
Bogdan Lyashenko
c94e587675 fix: padding for geometry 2019-07-25 20:07:10 +02:00
Bohdan Liashenko
5354dad9fe Merge pull request #80 from idoo/chore/refactor-codecrumbs
chore: import only getCrumbs
2019-07-25 20:02:29 +02:00
Bohdan Liashenko
cbbab432e4 Merge pull request #81 from idoo/chore/upgrade-madge
chore: upgraded madge
2019-07-25 19:58:05 +02:00
Bogdan Lyashenko
e21ab82729 1.6.8 2019-07-25 19:37:38 +02:00
Bogdan Lyashenko
987a98732a fix: downgrade http-server to v0.9.0 2019-07-25 19:36:41 +02:00
Ivan Verevkin
3ddfda80ed chore: upgraded madge 2019-07-23 17:29:03 +02:00
Ivan Verevkin
3e5da523ce chore: import only getCrumbs 2019-07-23 14:00:05 +02:00
Bohdan Liashenko
6f6625d3db Merge pull request #79 from idoo/feature/lua
feat: added Lua support
2019-07-23 11:00:34 +02:00
Ivan Verevkin
e9b4331d60 Merge branch 'master' into feature/lua 2019-07-22 16:20:40 +02:00
Ivan Verevkin
b7e5b70df7 feat: added Lua support 2019-07-22 16:18:17 +02:00
Bogdan Lyashenko
ec04a20b8d 1.6.7 2019-07-20 11:15:27 +02:00
Bohdan Liashenko
7b51b8db72 Merge pull request #75 from idoo/feature/reason
feat: added OCaml support
2019-07-20 11:05:24 +02:00
Bogdan Lyashenko
fddb08554d fix: refactoring clean up 2019-07-20 10:52:55 +02:00
Ivan Verevkin
14116c24b8 Merge branch 'master' into feature/reason 2019-07-19 16:28:19 +02:00
Ivan Verevkin
9307cf6259 feat: added OCaml support 2019-07-19 16:24:29 +02:00
Bohdan Liashenko
39de752084 Merge pull request #72 from idoo/feature/perl
feature: added perl language
2019-07-18 16:51:59 +02:00
Bohdan Liashenko
d50783bb7f Merge pull request #74 from idoo/chore/refactor
refactor project source files
2019-07-18 16:50:53 +02:00
Ivan Verevkin
2f22563d8d chore: refactor project source 2019-07-18 15:36:04 +02:00
Bohdan Liashenko
a0c7c134d3 Update README.md 2019-07-17 16:29:02 +02:00
Ivan Verevkin
e8d08572c6 feature: added perl language 2019-07-17 14:52:30 +02:00
Bogdan Lyashenko
0191bde3e6 1.6.6 2019-07-16 21:07:55 +02:00
Bogdan Lyashenko
5c738d8f4d chore: build 2019-07-16 21:07:51 +02:00
Bogdan Lyashenko
6ca8817108 chore: build 2019-07-16 21:07:27 +02:00
Bogdan Lyashenko
b9f5c0b40e chore: add 0x to readme 2019-07-16 19:49:53 +02:00
Bogdan Lyashenko
c89cfec0c8 1.6.5 2019-07-16 19:41:54 +02:00
Bohdan Liashenko
85840a9fa6 Merge pull request #71 from idoo/chore/editorconfig
Added basic editorconfig
2019-07-16 16:23:13 +02:00
Bohdan Liashenko
a9ff99d48e Merge pull request #70 from idoo/feature/refactor
chore: extracted languages extensions and refactor code
2019-07-16 16:21:26 +02:00
Ivan Verevkin
160fdaef88 chore: added basic editorconfig 2019-07-16 16:11:08 +02:00
Ivan Verevkin
c020a739c4 chore: extracted languages extensions and refactor code 2019-07-16 16:06:44 +02:00
Ivan Verevkin
3b6e34fed8 Merge branch 'master' into feature/refactor 2019-07-16 15:45:17 +02:00
Ivan Verevkin
e4d09f118d chore: extracted languages extensions and refactor code 2019-07-16 15:42:35 +02:00
Bohdan Liashenko
662adb7bda Merge pull request #69 from idoo/feature/go
feat: added Go support
2019-07-15 15:37:59 +02:00
Ivan Verevkin
9c479f4462 feat: added Go support 2019-07-15 15:36:45 +02:00
Bogdan Lyashenko
447da26e16 1.6.4 2019-07-14 20:24:21 +02:00
Bogdan Lyashenko
9878e59a1b feat: expand codeblock on hover 2019-07-14 20:24:11 +02:00
Bogdan Lyashenko
af0530c764 1.6.3 2019-07-14 13:31:31 +02:00
Bogdan Lyashenko
30067567ab fix: layout geometry calc 2019-07-14 13:31:10 +02:00
Bogdan Lyashenko
501509f4df fix: fade in animations 2019-07-14 11:03:31 +02:00
Bogdan Lyashenko
b0edfdc976 fix: readme 2019-07-09 20:44:22 +02:00
Bogdan Lyashenko
4745ed2242 fix: readme 2019-07-09 20:42:54 +02:00
98 changed files with 685 additions and 400 deletions

8
.editorconfig Normal file
View File

@@ -0,0 +1,8 @@
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

4
.gitignore vendored
View File

@@ -3,7 +3,7 @@ node_modules
# Build directories
src/public/dist/local/bundle/
src/public/dist/standalone-build/
build/
# example for dev
# example-project
@@ -12,4 +12,4 @@ src/public/dist/standalone-build/
.idea
.DS_STORE
yarn.lock
yarn.lock

View File

@@ -19,36 +19,40 @@
</h3>
## What
> **Have you ever got lost in a big or unknown codebase?** This tool will help you to solve that. Also, it will increase your development speed and give more knowledge about your application architecture.
> **Have you ever got lost in a big or unknown codebase?** This tool will help you to solve that. Also, it will increase your development speed and give more knowledge about your application architecture.
>
>**How it works?** You run `codecrumbs` command for a codebase, it analyzes source code and builds its visual representation. Write down a codecrumb-comment and codebase state will be reflected by visual client in browser on the fly.
>**How it works?** You run `codecrumbs` command for a codebase, it analyzes source code and builds its visual representation. Write down a codecrumb-comment and codebase state will be reflected by visual client in browser on the fly.
>
> Check out [my talk at React-Finland](https://www.youtube.com/watch?v=S_1-1jzLxm4) for more details.
>
>-[@bliashenko](https://twitter.com/bliashenko)
>-[@bliashenko](https://twitter.com/bliashenko)
## Demo
Check out the example of [**standalone version running here**](https://codecrumbs.io/#showcase=todo-react-redux).
<img src="/docs/main-ui-3.png" width="100%"/>
## Get started
### Install and run
>Pre-condition: update/install `NodeJS` version to be >= *8.11.1*
>Pre-condition: update/install `NodeJS` version to be >= *8.11.1*
1) Install ```codecrumbs``` globally (```yarn global add codecrumbs```)
2) Run ```codecrumbs -d project-src-dir -e project-src-dir/index.js```. Change parameters to match your project:```-d``` is *directory with source code*, ```-e``` is *entry point file* .
3) Go to [http://localhost:2018](http://localhost:2018/#) in the browser to check it out.
### CLI
Parameter | Description | Example
--- | --- | ---
```-d```, ```--dir``` | Relative path to project source code directory | ```-d src```
```-e```, ```--entry``` | Relative path to project source entry point file (must be inside ```dir```) | ```-e src/app.js```
```-x```, ```--excludeDir``` | Relative path(or paths separated by ```,```) to directories for exclusion | ```-x src/doc,src/thirdparty```
```-i```, ```--ideCmd``` | command to open file in IDE from bash (default 'webstorm') | ```-i code```
```-p```, ```--port``` | Port for Codecrumbs client (optional, default *2018*) | ```-p 2019```
```-n```, ```--projectName``` | Project name alias (optional, default same as ```-d``` value) | ```-n my-hello-world```
### Configuration
Run codecrumbs with CLI params or specify static config file `codecrumbs.config.js` (see example [here](/example-project/codecrumbs.config.js))
CLI | Config file | Description | Example
--- | --- | --- | ---
```d``` | ```projectDir``` | Relative path to project source code directory | ```-d src```
```e``` | ```entryPoint``` | Relative path to project source entry point file (must be inside ```dir```) | ```-e src/app.js```
```x``` | ```excludeDir``` | Relative path(or paths separated by ```,```) to directories for exclusion | ```-x src/doc,src/thirdparty```
```i``` | ```ideCmd``` | command to open file in IDE from bash (default 'webstorm') | ```-i code```
```p``` | ```clientPort``` | Port for Codecrumbs client (optional, default *2018*) | ```-p 2019```
```n``` | ```projectNameAlias``` | Project name alias (optional, default same as ```-d``` value) | ```-n my-hello-world```
```C``` | - | Path to codecrumbs.config.js (optional, by default will try to find the file in PWD) | ```-C config/codecrumbs.config.js```
```D``` | ```debugModeEnabled``` | Enable debug mode for logs (optional, default is ```false```) | ```-D```
## Features
### Breadcrumbs and trails
@@ -61,43 +65,46 @@ UI explained:
- select connection between two steps (code for two codecrumbs will be opened in "Sidebar" under "Crumbs" tab)
- set other options in dropdowns to configure behaviour of the diagram (show code blocks, details, etc.)
**How to get there?**
**How to get there?**
Leave breadcrumb in code by writing down a comment: ```//cc:[parameters;]```.
```cc``` (stands for "CodeCrumb") is a prefix which used by the parser; check example of parameters in the table below:
```cc``` (stands for "CodeCrumb") is a prefix which used by the parser; check example of parameters in the table below:
Example | Description | Use case
--- | --- | ---
```//cc:remember place``` | simple breadcrumb, ```remember place``` is a title of our first breadcrumb | Mark an important place to not forget where it was
```//cc:here is bug;well, seems like a bug in logic``` | simple breadcrumb, ```well, seems like a bug in logic``` is details for breadcrumb, separated by ```;``` | Add extra information, will be rendered in popups
```//cc:signin#3;enable route``` | trail of breadcrumbs,```signin``` is the **trail ID**, ```#3``` is order **number of step**, ```enable route``` is a title describing the step. | A sequence of codecrumbs, use to describe some data flow (e.g. user login, or form submit, etc.).
```//cc:signin#1;firebase sign in;+2;do call to firebase with credentials``` | trail of breadcrumbs,```+2``` is number of lines to highlight, separated by ```;``` | Use number of lines to highlight the code related to breadcrumb
```//cc:signin#1;firebase sign in;+2;do call to firebase with credentials``` | trail of breadcrumbs,```+2``` is number of lines to highlight, separated by ```;``` | Use number of lines to highlight the code related to breadcrumb
> Note: current version supports single line comments only.
> Note: current version supports single line comments only.
> Hint: you can use trail id without step number (e.g. ```//cc:groupname#;test```) just to group breadcrumbs, you always can add step numbers later when you know the correct order.
### Multi-codebase integration
You might be interested to study connections between several codebases (sub-modules), codecrumbs supports that.
Simply start codecrumbs multiple times (once for each codebase), it all **will be synced in one picture** inside the browser tab. To control a diagram UI - select it by clicking on it.
E.g. for client-server application, go to the source directory for your server code and run `codecrumbs -e your-server-src/index.py -d your-server-src`, same for client `codecrumbs -e src-client/index.js -d src-client`.
> **Note:** codebases can be located wherever you want (**no** need to have them like mono-repo, etc.), simply run `codecrumbs` for directory you need.
E.g. for client-server application, go to the source directory for your server code and run `codecrumbs -e your-server-src/index.py -d your-server-src`, same for client `codecrumbs -e src-client/index.js -d src-client`.
> **Note:** codebases can be located wherever you want (**no** need to have them like mono-repo, etc.), simply run `codecrumbs` for directory you need.
<img src="/docs/multi-codebase-cc-2.png" width="100%"/>
### Multi-language support
Current version supports next programming languages:
Current version supports next programming languages:
- `C#`
- `C++`
- `Fortran`
- `Go`
- `Haskell`
- `Java`
- `JavaScript`
- `TypeScript`
- `Kotlin`
- `PHP`
- `Python`
- `Ruby`
- `PHP`
- `Java`
- `Kotlin`
- `C++`
- `C#`
- `Fortran`
- `Haskell`
- `TypeScript`
Please file an issue to support other language you would like to have.
@@ -108,7 +115,7 @@ You can take a snapshot of application state at any point of time and share it w
<img src="/docs/upload-feature-2.gif" width="100%"/>
### Dependencies
> Note: In current version only [JavaScript, TypeScript] offer this feature
> Note: In current version only [JavaScript, TypeScript] offer this feature
<img src="/docs/dep-ui-2.png" width="100%"/>
@@ -118,7 +125,7 @@ UI explained:
- select connection between modules (all involved files will be opened in "Sidebar", so you can see “what is imported” and “its implementation”)
### Flowchart
> Note: In current version only JavaScript offers this feature
> Note: In current version only JavaScript offers this feature
<img src="/docs/flow-ui.png" width="100%"/>
@@ -134,7 +141,7 @@ Navigate from browser to your code editor simply by clicking ```Command+click```
## Case studies
The tool (codecrumbs) allows us to learn, document and explain a codebase much faster. Also, with *Download & Upload* feature it becomes super easy to collect and share your "investigation results".
The ultimate goal is to have many case studies hosting at [https://codecrumbs.io](https://codecrumbs.io/). **The library of projects "explained with codecrumbs", the place for collaborative learning**. More features around that coming soon, stay tuned.
The ultimate goal is to have many case studies hosting at [https://codecrumbs.io](https://codecrumbs.io/). **The library of projects "explained with codecrumbs", the place for collaborative learning**. More features around that coming soon, stay tuned.
## Support
Any support is very much appreciated! 👍 😘 ❤️
@@ -144,7 +151,14 @@ Please, consider [making financial donation](https://opencollective.com/codecrum
<a href="https://opencollective.com/codecrumbs/donate" target="_blank">
<img src="https://opencollective.com/codecrumbs/donate/button@2x.png?color=blue" width=300 />
</a>
</a>
#### Sponsors
Development supported by [0+X](https://0x.se)
<a href="https://0x.se" target="_blank">
<img src="https://avatars0.githubusercontent.com/u/16350669?s=200&v=4" width=100 />
</a>
#### Backers
<a href="https://opencollective.com/codecrumbs/backer/0/website" target="_blank"><img src="https://opencollective.com/codecrumbs/backer/0/avatar.svg"></a>
@@ -161,5 +175,5 @@ yarn && yarn start
## WIP
Next features are developing:
- **eject codecrumbs** - ability to remove all "breadcrumbs" from source code in "one click"
- **data transferring between cc trail steps**
- **VS Code extension** - some neat features right inside the code editor. Checkout [the repo here](https://github.com/Bogdan-Lyashenko/vs-code-codecrumbs).
- **data transferring between cc trail steps**
- **VS Code extension** - some neat features right inside the code editor. Checkout [the repo here](https://github.com/Bogdan-Lyashenko/vs-code-codecrumbs).

View File

@@ -1,12 +1,17 @@
#!/usr/bin/env node
const path = require('path');
const program = require('commander');
const colors = require('colors');
const _ = require('lodash');
const showUpdatesInfo = require('./updatesInfo');
const server = require('../src/server');
showUpdatesInfo();
program
.option('-e, --entry [entryFile]', 'Specify path to entry point file. E.g. `src/app.js`')
.option('-e, --entry [entryPoint]', 'Specify path to entry point file. E.g. `src/app.js`')
.option('-d, --dir [projectDir]', 'Specify path to project source code directory. E.g. `src`', '')
.option(
'-w, --webpack [webpackConfigFile]',
@@ -20,27 +25,33 @@ program
.option('-i, --ideCmd [ideCmd]', 'IDE command to open file')
.option('-x, --excludeDir [excludeDirectories]', 'Exclude directories')
.option('-n, --projectName [projectNameAlias]', 'Project name alias')
.option('-C, --configFile [pathToConfigFile]', 'Path to codecrumbs.config.js')
.option('-D, --debugModeEnabled [debugModeEnabled]', 'Enable debug mode for logs.')
.parse(process.argv);
if (!program.entry || !program.dir) {
const pathToConfigFile = program.configFile || 'codecrumbs.config.js';
const configFileExists = server.checkIfPathExists(pathToConfigFile);
if ((!program.entry || !program.dir) && !configFileExists) {
console.log(
colors.magenta(
'Please specify `entry` and `dir` params. E.g. `codecrumbs -e src/app.js -d src`'
'Please specify `entryPoint` and `projectDir` params (e.g. `codecrumbs -e src/app.js -d src`). Or use `-C codecrumbs.config.js` instead.'
)
);
process.exit();
}
server.setup(
{
projectNameAlias: program.projectName,
entryPoint: program.entry,
projectDir: program.dir,
webpackConfigPath: program.webpack,
tsConfigPath: program.tsconfig,
clientPort: program.port,
excludeDir: program.excludeDir,
ideCmd: program.ideCmd
},
{ isDev: false }
);
const configFromFile = configFileExists ? require(path.resolve(pathToConfigFile)) : {};
const configFromCLI = {
projectNameAlias: program.projectName,
entryPoint: program.entry,
projectDir: program.dir,
webpackConfigPath: program.webpack,
tsConfigPath: program.tsconfig,
clientPort: program.port,
excludeDir: program.excludeDir,
ideCmd: program.ideCmd,
debugModeEnabled: program.debugModeEnabled
};
server.setup(_.merge(configFromCLI, configFromFile), { isDev: false });

20
cli/updatesInfo.js Normal file
View File

@@ -0,0 +1,20 @@
const colors = require('colors');
const exec = require('child_process').exec;
module.exports = () => {
try {
exec('npm outdated codecrumbs').stdout.on('data', function(data) {
const list = data
.split(' ')
.filter(v => !!v)
.map(v => v.trim());
const latestVersion = list[list.length - 2];
console.log(
colors.cyan.underline(
`There is new version of codecrumbs (${latestVersion}) available! Please update to have all latest features and improvements!`
)
);
});
} catch (e) {}
};

View File

Before

Width:  |  Height:  |  Size: 5.1 MiB

After

Width:  |  Height:  |  Size: 5.1 MiB

View File

@@ -0,0 +1,7 @@
module.exports = {
entryPoint: 'example-project/src-client/index.js',
projectDir: 'example-project/src-client',
clientPort: 1234,
projectNameAlias: 'example-project-for-client',
debugModeEnabled: true
};

View File

@@ -0,0 +1,7 @@
package main
import "fmt"
// cc:main function
func main() {
fmt.Println("hello world")
}

View File

@@ -0,0 +1,2 @@
-- hello world program
print ("Hello World!")

View File

@@ -0,0 +1,2 @@
/* cc:main function */
let hello = () => "Hello, World!";

View File

@@ -0,0 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
# cc: main function.
print "Hello, World!\n";

View File

@@ -1,3 +1,3 @@
# cc:main function
puts 'Hello, world!'
puts 'Hello, world!'

View File

@@ -1,6 +1,6 @@
{
"name": "codecrumbs",
"version": "1.6.2",
"version": "1.7.0",
"author": "Bohdan Liashenko",
"license": "BSD-3-Clause",
"repository": {
@@ -13,9 +13,10 @@
"server:two": "node src/index.dev.js two",
"client-dev": "cd src/public && webpack --config webpack.dev.js --progress --colors --watch --env dev",
"server-dev": "nodemon src/index.dev.js",
"server:cli": "node cli/index.cli.js -e example-project/src-client/index.js -d example-project/src-client/",
"server-debug": "nodemon --inspect src/index.dev.js",
"clean": "rm -rf src/public/dist/standalone-build",
"babel-compile-standalone": "babel src/public/js -d src/public/dist/standalone-build --config-file ./src/public/babel.config.js --copy-files",
"clean": "rm -rf build",
"babel-compile-standalone": "babel src/public/js -d build --config-file ./src/public/babel.config.js --copy-files",
"webpack-compile-local": "cd src/public && webpack --config webpack.local.js --progress",
"build": "yarn clean && yarn babel-compile-standalone && yarn webpack-compile-local",
"pretty": "prettier --write \"./src/public/js/**/*.js\""
@@ -35,11 +36,11 @@
"d3-flextree": "^2.1.1",
"directory-tree": "^2.1.0",
"file-saver": "^2.0.0",
"http-server": "^0.11.1",
"js2flowchart": "^1.1.7",
"http-server": "0.9.0",
"js2flowchart": "1.3.2",
"lodash": "^4.17.10",
"lodash.debounce": "^4.0.8",
"madge": "^3.3.0",
"madge": "^3.4.4",
"portscanner": "^2.2.0",
"react": "^16.7.0",
"react-dom": "^16.7.0",
@@ -56,6 +57,7 @@
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-class-properties": "^7.5.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.1.0",

View File

@@ -5,7 +5,8 @@ const namespaceOne = {
projectDir: `example-project/src-client`,
entryPoint: `example-project/src-client/index.js`,
webpackConfigPath: `example-project/webpack.config.js`,
clientPort: 2018
clientPort: 2018,
debugModeEnabled: true
};
const namespaceTwo = {

View File

@@ -20,6 +20,7 @@ module.exports = function(app) {
['import', { libraryName: 'antd', libraryDirectory: 'es', style: 'css' }],
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-class-properties',
[
'transform-define',
{

View File

@@ -22,9 +22,7 @@ const ExplorerBar = React.lazy(() =>
import(/* webpackChunkName: "explorer-bar" */ './components/explorerBar/ExplorerBarContainer')
);
const Footer = React.lazy(() =>
import(/* webpackChunkName: "explorer-bar" */ './components/footer')
);
const Footer = React.lazy(() => import(/* webpackChunkName: "footer" */ './components/footer'));
import './App.less';
@@ -61,6 +59,9 @@ const App = (props = {}) => {
<Suspense fallback={null}>
<SideBar />
</Suspense>
{props.extraLayout.appBodyBottom && (
<props.extraLayout.appBodyBottom.Component {...props} />
)}
</div>
<footer className="footer">

View File

@@ -1,7 +1,7 @@
import React from 'react';
import Tree from 'antd/es/tree'
import 'antd/es/tree/style'
import Tree from 'antd/es/tree';
import 'antd/es/tree/style';
import { FILE_NODE_TYPE } from '../../../core/constants';
import './ExplorerBar.less';

View File

@@ -28,6 +28,7 @@ export default class extends React.Component {
this.codeRef.scrollTo(0, (lines[0][0] - 1) * (lineHeight || LINE_HEIGHT) + PADDING_TOP - 2);
}
componentDidUpdate(prevProps) {
// TODO: don\t do it each time (check real changes)
this.fixScroll();
}
componentDidMount() {

View File

@@ -1,10 +1,10 @@
import React from 'react';
import { connect } from 'react-redux';
import Collapse from 'antd/es/collapse'
import 'antd/es/collapse/style'
import Alert from 'antd/es/alert'
import 'antd/es/alert/style'
import Collapse from 'antd/es/collapse';
import 'antd/es/collapse/style';
import Alert from 'antd/es/alert';
import 'antd/es/alert/style';
import { NO_TRAIL_FLOW } from '../../../../shared-constants';
import { getCodeCrumbsUserChoice } from '../../../../core/dataBus/selectors';
@@ -34,7 +34,7 @@ const CrumbsTab = props => {
header={`[${typeof stepFile.step !== 'undefined' ? stepFile.step : '*'}] ${
stepFile.file.path
}`}
key={i}
key={stepFile.crumbNodeLines.join(',')}
>
<Code
language={language}

View File

@@ -1,12 +1,16 @@
import React from 'react';
import { connect } from 'react-redux';
import Collapse from 'antd/es/collapse'
import 'antd/es/collapse/style'
import Alert from 'antd/es/alert'
import 'antd/es/alert/style'
import Collapse from 'antd/es/collapse';
import 'antd/es/collapse/style';
import Alert from 'antd/es/alert';
import 'antd/es/alert/style';
import { getSource, getSourceUserChoice, getDependenciesUserChoice } from '../../../../core/dataBus/selectors';
import {
getSource,
getSourceUserChoice,
getDependenciesUserChoice
} from '../../../../core/dataBus/selectors';
import Code from '../Code';
import {

View File

@@ -1,9 +1,9 @@
import React from 'react';
import Alert from 'antd/es/alert'
import 'antd/es/alert/style'
import Spin from 'antd/es/spin'
import 'antd/es/spin/style'
import Alert from 'antd/es/alert';
import 'antd/es/alert/style';
import Spin from 'antd/es/spin';
import 'antd/es/spin/style';
import './index.less';

View File

@@ -1,11 +1,11 @@
import React, { Suspense } from 'react';
import Tabs from 'antd/es/tabs'
import 'antd/es/tabs/style'
import Skeleton from 'antd/es/skeleton'
import 'antd/es/skeleton/style'
import Alert from 'antd/es/alert'
import 'antd/es/alert/style'
import Tabs from 'antd/es/tabs';
import 'antd/es/tabs/style';
import Skeleton from 'antd/es/skeleton';
import 'antd/es/skeleton/style';
import Alert from 'antd/es/alert';
import 'antd/es/alert/style';
import { Copy } from '../../topBar/controls/Copy';

View File

@@ -1,7 +1,7 @@
import React from 'react';
import Icon from 'antd/es/icon'
import 'antd/es/icon/style'
import Icon from 'antd/es/icon';
import 'antd/es/icon/style';
import copy from 'copy-text-to-clipboard';

View File

@@ -1,12 +1,12 @@
import React from 'react';
import { connect } from 'react-redux';
import Menu from 'antd/es/menu'
import 'antd/es/menu/style'
import Dropdown from 'antd/es/dropdown'
import 'antd/es/dropdown/style'
import Button from 'antd/es/button'
import 'antd/es/button/style'
import Menu from 'antd/es/menu';
import 'antd/es/menu/style';
import Dropdown from 'antd/es/dropdown';
import 'antd/es/dropdown/style';
import Button from 'antd/es/button';
import 'antd/es/button/style';
import { NO_TRAIL_FLOW } from '../../../../core/constants';
import { selectCodeCrumbedFlow } from '../../../../core/dataBus/actions';

View File

@@ -1,16 +1,16 @@
import React from 'react';
import { connect } from 'react-redux';
import Menu from 'antd/es/menu'
import 'antd/es/menu/style'
import Dropdown from 'antd/es/dropdown'
import 'antd/es/dropdown/style'
import Icon from 'antd/es/icon'
import 'antd/es/icon/style'
import Button from 'antd/es/button'
import 'antd/es/button/style'
import Upload from 'antd/es/upload'
import 'antd/es/upload/style'
import Menu from 'antd/es/menu';
import 'antd/es/menu/style';
import Dropdown from 'antd/es/dropdown';
import 'antd/es/dropdown/style';
import Icon from 'antd/es/icon';
import 'antd/es/icon/style';
import Button from 'antd/es/button';
import 'antd/es/button/style';
import Upload from 'antd/es/upload';
import 'antd/es/upload/style';
import { downloadStore, uploadStore } from '../../../../core/dataBus/actions';
import './index.less';

View File

@@ -1,13 +1,13 @@
import React from 'react';
import Switch from 'antd/es/switch'
import 'antd/es/switch/style'
import Menu from 'antd/es/menu'
import 'antd/es/menu/style'
import Dropdown from 'antd/es/dropdown'
import 'antd/es/dropdown/style'
import Icon from 'antd/es/icon'
import 'antd/es/icon/style'
import Switch from 'antd/es/switch';
import 'antd/es/switch/style';
import Menu from 'antd/es/menu';
import 'antd/es/menu/style';
import Dropdown from 'antd/es/dropdown';
import 'antd/es/dropdown/style';
import Icon from 'antd/es/icon';
import 'antd/es/icon/style';
import { VIEW_TYPES } from '../../../../../core/controlsBus/constants';
import './ViewSwitch.less';

View File

@@ -6,7 +6,11 @@ import { getProjectMetadata } from '../../../../core/dataBus/selectors';
import { CONTROLS_KEYS } from '../../../../core/controlsBus/constants';
import { toggleSwitch, fireButtonAction } from '../../../../core/controlsBus/actions';
import { getSwitches, getCheckedState, getDisabledState } from '../../../../core/controlsBus/selectors';
import {
getSwitches,
getCheckedState,
getDisabledState
} from '../../../../core/controlsBus/selectors';
import ViewSwitchList from './List/ViewSwitchList';

View File

@@ -1,8 +1,8 @@
import React from 'react';
import { connect } from 'react-redux';
import Button from 'antd/es/button'
import 'antd/es/button/style'
import Button from 'antd/es/button';
import 'antd/es/button/style';
const ButtonGroup = Button.Group;

View File

@@ -1,10 +1,10 @@
import React from 'react';
import { connect } from 'react-redux';
import Icon from 'antd/es/icon'
import 'antd/es/icon/style'
import Breadcrumb from 'antd/es/breadcrumb'
import 'antd/es/breadcrumb/style'
import Icon from 'antd/es/icon';
import 'antd/es/icon/style';
import Breadcrumb from 'antd/es/breadcrumb';
import 'antd/es/breadcrumb/style';
import { FILE_NODE_TYPE } from '../../../core/constants/index';
import { Copy } from '../controls/Copy/index';

View File

@@ -1,6 +1,8 @@
.TreeDiagramsContainer {
overflow: auto;
width: 100%;
margin-top: 20px;
margin-left: 10px;
}
.MainLoader {
@@ -10,4 +12,4 @@
padding: 250px;
margin-top: 60px;
width: 100%;
}
}

View File

@@ -24,6 +24,7 @@ const TreeDiagramsContainer = ({ namespacesList, activeNamespace }) => {
);
}
// TODO: use ref for TreeDiagram container (on mount set it to store)
return (
<div className={'TreeDiagramsContainer'}>
{namespacesList.map(namespace => (

View File

@@ -22,7 +22,7 @@
}
.Animation {
@extend .FadeIn;
&:extend(.FadeIn);
}
.DependenciesEdge {
@@ -35,7 +35,7 @@
}
.CodeCrumbEdge {
@extend .FadeIn;
&:extend(.FadeIn);
fill: none;
stroke: #8c8b8b;

View File

@@ -1,7 +1,7 @@
@import "../animcations.less";
.Animation {
@extend .FadeIn;
&:extend(.FadeIn);
}
.CursorPointer {

View File

@@ -13,6 +13,7 @@ export const CodeCrumbName = props => {
cover,
flow,
flowStep,
original,
selected,
onMouseOver,
onClick
@@ -73,7 +74,7 @@ export const CodeCrumbName = props => {
onClick={onClick}
className={'CodeCrumbName-flow'}
>
{flowStep}
{flowStep !== 0 ? flowStep : /#0/.test(original) ? 0 : '*'}
</text>
</React.Fragment>
)) ||

View File

@@ -1,10 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import { FOLDER_OPEN_STATE } from '../../../../core/constants';
import {
OpenFolder as OpenFolderIcon,
CloseFolder as CloseFolderIcon
} from '../Icons/Folder';
import { OpenFolder as OpenFolderIcon, CloseFolder as CloseFolderIcon } from '../Icons/Folder';
import './index.less';
import { SYMBOL_WIDTH } from '../constants';

View File

@@ -1,11 +1,11 @@
@import "../animcations.less";
.CodeCrumbNode {
@extend .FadeIn;
&:extend(.FadeIn);
}
.FileNode, .FolderNode {
@extend .FadeIn;
&:extend(.FadeIn);
cursor: pointer;
}

View File

@@ -1,10 +1,10 @@
import React from 'react';
import { connect } from 'react-redux';
import Upload from 'antd/es/upload'
import 'antd/es/upload/style'
import Icon from 'antd/es/icon'
import 'antd/es/icon/style'
import Upload from 'antd/es/upload';
import 'antd/es/upload/style';
import Icon from 'antd/es/icon';
import 'antd/es/icon/style';
import { uploadStore } from '../../../../core/dataBus/actions';
import './index.less';

View File

@@ -34,31 +34,59 @@ const DetailsComponent = props => {
);
};
const CodeComponent = props => {
const { position, crumbNodeLines, file, language, namespace } = props;
const { fileCode } = file.data;
const ccUnderlayPaddingH = 20;
class CodeComponent extends React.Component {
state = {};
return (
<div
className={'CcCodeContainer'}
style={{
left: position.x,
top: position.y
}}
>
<Suspense fallback={null}>
<Code
namespace={namespace}
language={language}
code={fileCode}
fontSize={10}
lineHeight={15}
crumbedLines={[crumbNodeLines]}
onMouseEnter = () => {
this.setState({ isExpanded: true });
};
onMouseLeave = () => {
this.setState({ isExpanded: false });
};
render() {
const { position, crumbNodeLines, file, language, namespace } = this.props;
const { fileCode } = file.data;
const { isExpanded } = this.state;
return (
<React.Fragment>
<div
className={classNames('CcCodeContainer', { CcCodeContainerExpanded: isExpanded })}
style={{
left: position.x,
top: position.y
}}
onMouseEnter={this.onMouseEnter}
onMouseLeave={this.onMouseLeave}
>
<Suspense fallback={null}>
<Code
namespace={namespace}
language={language}
code={fileCode}
fontSize={10}
lineHeight={15}
crumbedLines={[crumbNodeLines]}
/>
</Suspense>
</div>
<div
style={{
left: position.x - ccUnderlayPaddingH,
top: position.y
}}
className={classNames('CcCodeContainerUnderlay', {
CcCodeContainerUnderlayExpanded: isExpanded
})}
/>
</Suspense>
</div>
);
};
</React.Fragment>
);
}
}
const ExtraInfoSet = ({
detailsEnabled,

View File

@@ -12,10 +12,39 @@
border-top: 1px solid #754BC3;
}
@CcCodeContainerWidth: 650px;
.CcCodeContainer {
position: absolute;
border: 1px solid #e8e8e8;
width: 650px;
width: @CcCodeContainerWidth;
background: rgba(255,255,255,0.9);
height: 80px;
transition: height .1s;
overflow: hidden;
z-index: 1;
}
@CcCodeContainerExpandedHeight: 300px;
.CcCodeContainerExpanded {
height: @CcCodeContainerExpandedHeight;
transition: height .1s;
z-index: 9;
}
@ccUnderlayPaddingH: 20px;
.CcCodeContainerUnderlay {
width: (@CcCodeContainerWidth + 2 * @ccUnderlayPaddingH);
height: 0;
position: absolute;
background-color: rgba(255,255,255,0.3);
transition: height, background-color .1s;
}
@ccUnderlayPaddingV: 70px;
.CcCodeContainerUnderlayExpanded {
background-color: rgba(251,251,251,0.85);
width: (@CcCodeContainerWidth + 2 * @ccUnderlayPaddingH);
height: (@CcCodeContainerExpandedHeight + @ccUnderlayPaddingV);
transition: height, background-color .1s;
z-index: 2;
}

View File

@@ -1,9 +1,6 @@
import React from 'react';
import {
CodeCrumbedFlowEdge,
ExternalEdge
} from '../../../component/Edge/CodeCrumbEdge';
import { CodeCrumbedFlowEdge, ExternalEdge } from '../../../component/Edge/CodeCrumbEdge';
import { isCodeCrumbsEqual, getCcPosition } from './helpers';
export default props => {
@@ -30,7 +27,11 @@ export default props => {
if (!i) return null;
const fromItem = list[i - 1];
if (fromItem.namespace !== namespace && toItem.namespace !== namespace) {
if (
(fromItem.namespace !== namespace && toItem.namespace !== namespace) ||
fromItem.step === toItem.step
) {
return null;
}
@@ -41,7 +42,7 @@ export default props => {
});
const edgeBaseProps = {
key: `cc-external-edge-${fromItem.name}-${toItem.name}`,
key: `cc-external-edge-${fromItem.name}-${toItem.name}-${edgePoints[0].y}`,
sourcePosition: edgePoints[0],
targetPosition: edgePoints[1],
onClick: () => onFlowEdgeClick(fromItem, toItem, ccNamespacesKeys),

View File

@@ -40,7 +40,7 @@ const Tree = props => {
).x;
return (
<React.Fragment key={`code-crumb-${node.data.path}-${key}`}>
<React.Fragment key={`code-crumb-${key}-${nX}-${nY}`}>
{!codeCrumbsMinimize &&
node.children.map((crumb, i) => {
const [_, cY] = [crumb.y, crumb.x];
@@ -55,7 +55,9 @@ const Tree = props => {
const ccParams = crumbData.params;
return (
<React.Fragment key={`code-crumb-edge-${file.path}-${crumbData.name}`}>
<React.Fragment
key={`code-crumb-edge-${crumbData.name}-${crumbPosition.x}-${crumbPosition.y}`}
>
{!i && (
<PartEdge
sourcePosition={position}
@@ -84,6 +86,7 @@ const Tree = props => {
currentSelectedCrumbedFlowKey !== NO_TRAIL_FLOW
}
flowStep={ccParams.flowStep}
original={ccParams.original}
onClick={e => onCodeCrumbSelect(e, { fileNode: file, codeCrumb: crumbData })}
/>
</React.Fragment>

View File

@@ -7,7 +7,11 @@ import {
getCodeCrumbsUserChoice,
getNamespacesList
} from '../../../../../core/dataBus/selectors';
import { selectCodeCrumb, selectNodeToOpenInEditor, selectCcFlowEdge } from '../../../../../core/dataBus/actions';
import {
selectCodeCrumb,
selectNodeToOpenInEditor,
selectCcFlowEdge
} from '../../../../../core/dataBus/actions';
import { getCheckedState } from '../../../../../core/controlsBus/selectors';
import Tree from './Tree';

View File

@@ -1,10 +1,7 @@
import React from 'react';
import { connect } from 'react-redux';
import {
DependenciesEdge,
DependenciesArrow
} from '../../Edge/DepenenciesEdge';
import { DependenciesEdge, DependenciesArrow } from '../../Edge/DepenenciesEdge';
import { FileName } from '../../../component/Node/File';
import { selectDependencyEdge } from '../../../../../core/dataBus/actions';
import {
@@ -83,7 +80,7 @@ const DependenciesTree = props => {
const edge = (
<DependenciesEdge
key={`dep-edge-${importedNodePath}`}
key={`dep-edge-${importedNodePath}-${sourcePosition.x}-${targetPosition.x}`}
anyEdgeSelected={!!selectedDependencyEdgeNodes}
selected={selected}
groupName={groupName}
@@ -109,7 +106,7 @@ const DependenciesTree = props => {
const arrow = (
<DependenciesArrow
key={`dep-arrow-${importedNodePath}`}
key={`dep-arrow-${importedNodePath}-${groupName}`}
selected={arrowSelected}
groupName={groupName}
targetPosition={targetPosition}

View File

@@ -60,7 +60,7 @@ const SourceTree = props => {
const edge = (
<SourceEdge
key={`source-edge-${path}`}
key={`source-edge-${path}-${sourcePosition.x}-${sourcePosition.y}`}
targetPosition={position}
sourcePosition={sourcePosition}
disabled={sourceDimFolders}
@@ -77,7 +77,13 @@ const SourceTree = props => {
(type === FILE_NODE_TYPE &&
!(dependenciesDiagramOn && selectedNode.dependencies && selectedNode.dependencies[path]))
) {
sourceDotes.push(<Dot key={`dot-${path}`} position={position} selected={selected} />);
sourceDotes.push(
<Dot
key={`dot-${path}-${position.x}-${position.y}`}
position={position}
selected={selected}
/>
);
}
let nodeBasedOnType = null;

View File

@@ -1,7 +1,11 @@
import React from 'react';
import { connect } from 'react-redux';
import { selectNode, selectNodeToOpenInEditor, toggleFolder } from '../../../../../core/dataBus/actions';
import {
selectNode,
selectNodeToOpenInEditor,
toggleFolder
} from '../../../../../core/dataBus/actions';
import {
getSource,
getSourceLayout,

View File

@@ -15,11 +15,21 @@ import {
getNamespacesList
} from '../../../core/dataBus/selectors';
import { getCheckedState, getValuesState } from '../../../core/controlsBus/selectors';
import { selectDependencyEdge, selectCcFlowEdge } from '../../../core/dataBus/actions';
import {
selectDependencyEdge,
selectCcFlowEdge,
saveTreeDiagramContentId
} from '../../../core/dataBus/actions';
import { setActiveNamespace } from '../../../core/namespaceIntegration/actions';
import { gatherFlowStepsData, getMaxWidthForNs } from './Tree/CodeCrumbs/helpers';
class TreeDiagram extends React.Component {
componentDidUpdate(prevProps) {
if (!prevProps.layoutSize && this.props.layoutSize) {
this.props.saveContentId(this.treeDiagramContent.getAttribute('id'));
}
}
render() {
// TODO: fix diagramZoom
const {
@@ -50,7 +60,7 @@ class TreeDiagram extends React.Component {
});
return (
<div className={'TreeDiagram'}>
<div className={classNames('TreeDiagram', { border: multiple })}>
{multiple ? (
<p
className={classNames('namespaceTitle', {
@@ -60,35 +70,41 @@ class TreeDiagram extends React.Component {
{projectName}
</p>
) : null}
<svg
width={maxWidth || width}
height={height}
xmlns="http://www.w3.org/2000/svg"
shapeRendering="optimizeSpeed"
<div
id={`TreeDiagram-${namespace}-content`}
className={'content'}
ref={el => (this.treeDiagramContent = el)}
>
{sourceLayoutTree && (
<React.Fragment>
<UnderLayer width={maxWidth || width} height={height} onClick={onUnderLayerClick} />
<SourceTree
namespace={namespace}
shiftToCenterPoint={shiftToCenterPoint}
areaHeight={height}
sortedFlowSteps={sortedFlowSteps}
involvedNsData={involvedNsData}
ccShiftIndexMap={ccShiftIndexMap}
/>
</React.Fragment>
)}
</svg>
{codeCrumbsDiagramOn ? (
<CodeCrumbsExtraInfo
namespace={namespace}
shiftToCenterPoint={shiftToCenterPoint}
ccShiftIndexMap={ccShiftIndexMap}
sortedFlowSteps={sortedFlowSteps}
flowSteps={flowSteps}
/>
) : null}
<svg
width={maxWidth || width}
height={height}
xmlns="http://www.w3.org/2000/svg"
shapeRendering="optimizeSpeed"
>
{sourceLayoutTree && (
<React.Fragment>
<UnderLayer width={maxWidth || width} height={height} onClick={onUnderLayerClick} />
<SourceTree
namespace={namespace}
shiftToCenterPoint={shiftToCenterPoint}
areaHeight={height}
sortedFlowSteps={sortedFlowSteps}
involvedNsData={involvedNsData}
ccShiftIndexMap={ccShiftIndexMap}
/>
</React.Fragment>
)}
</svg>
{codeCrumbsDiagramOn ? (
<CodeCrumbsExtraInfo
namespace={namespace}
shiftToCenterPoint={shiftToCenterPoint}
ccShiftIndexMap={ccShiftIndexMap}
sortedFlowSteps={sortedFlowSteps}
flowSteps={flowSteps}
/>
) : null}
</div>
</div>
);
}
@@ -149,7 +165,8 @@ const mapDispatchToProps = (dispatch, props) => {
dispatch(setActiveNamespace(namespace));
dispatch(selectDependencyEdge(undefined, namespace));
dispatch(selectCcFlowEdge(undefined, namespace));
}
},
saveContentId: ref => dispatch(saveTreeDiagramContentId(ref, namespace))
};
};

View File

@@ -5,7 +5,10 @@
margin: 0;
padding: 0;
overflow-y: hidden;
border-bottom: 1px solid #ebedf0;
&.border {
border-bottom: 1px solid #ebedf0;
}
.namespaceTitle {
position: absolute;
@@ -22,7 +25,9 @@
}
}
svg {
display: block;
.content {
svg {
display: block;
}
}
}

View File

@@ -1,4 +1,5 @@
export {
CC_NODE_TYPE,
FILE_NODE_TYPE,
DIR_NODE_TYPE,
SOCKET_MESSAGE_TYPE,

View File

@@ -24,3 +24,8 @@ export const setZoom = payload => ({
type: ACTIONS.SET_ZOOM,
payload
});
export const setFullState = payload => ({
type: ACTIONS.SET_FULL_STATE,
payload
});

View File

@@ -339,3 +339,19 @@ export const setPredefinedState = predefinedState => dispatch => {
}, 100 * i);
});
};
export const saveTreeDiagramContentId = (payload, namespace) => ({
type: ACTIONS.SAVE_TREE_DIAGRAM_CONTENT_ID,
payload,
namespace
});
export const setFullState = payload => ({
type: ACTIONS.SET_FULL_STATE,
payload
});
export const setNamespaceState = payload => ({
type: ACTIONS.SET_NAMESPACE_STATE,
payload
});

View File

@@ -1,5 +1,7 @@
export const ACTIONS = {
SET_INITIAL_SOURCE_DATA: 'DATA_BUS.SET_INITIAL_SOURCE_DATA',
SET_FULL_STATE: 'DATA_BUS.SET_FULL_STATE',
SET_NAMESPACE_STATE: 'DATA_BUS.SET_NAMESPACE_STATE',
RESET_ALL: 'DATA_BUS.RESET_ALL',
SET_CHANGED_SOURCE_DATA: 'DATA_BUS.SET_CHANGED_SOURCE_DATA',
UPDATE_FILES_TREE_LAYOUT_NODES: 'DATA_BUS.UPDATE_FILES_TREE_LAYOUT_NODES',
@@ -14,5 +16,6 @@ export const ACTIONS = {
SET_DEPENDENCIES_ENTRY_POINT: 'DATA_BUS.SET_DEPENDENCIES_ENTRY_POINT',
SELECT_DEPENDENCY_EDGE: 'DATA_BUS.SELECT_DEPENDENCY_EDGE',
SELECT_CC_FLOW_EDGE: 'DATA_BUS.SELECT_CC_FLOW_EDGE',
UPDATE_FILES: 'DATA_BUS.UPDATE_FILES'
UPDATE_FILES: 'DATA_BUS.UPDATE_FILES',
SAVE_TREE_DIAGRAM_CONTENT_ID: 'DATA_BUS.SAVE_TREE_DIAGRAM_CONTENT_ID'
};

View File

@@ -195,6 +195,22 @@ export default (state = DefaultState, action) => {
}
});
case ACTIONS.SAVE_TREE_DIAGRAM_CONTENT_ID:
return mergeState({
treeDiagramContentId: action.payload
});
case ACTIONS.SET_FULL_STATE:
return {
...state,
...action.payload
};
case ACTIONS.SET_NAMESPACE_STATE:
return mergeState({
...action.payload
});
case ACTIONS.RESET_ALL:
return DefaultState;

View File

@@ -13,6 +13,11 @@ export const getProjectMetadata = createSelector([getNamespaceState], namespaceS
return { projectName, language, platformPathSeparator, fullFeaturesSupport };
});
export const getTreeDiagramContentId = createSelector([getNamespaceState], namespaceState => {
const { treeDiagramContentId } = namespaceState;
return { id: treeDiagramContentId };
});
export const getSource = createSelector([getNamespaceState], namespaceState => {
const { sourceTree, filesMap, foldersMap } = namespaceState;

View File

@@ -1,6 +1,6 @@
import { FILE_NODE_TYPE, DIR_NODE_TYPE } from '../../constants';
import { CC_NODE_TYPE } from '../../constants';
export const calculateLayoutProps = (list, padding = 100) => {
export const calculateLayoutProps = (list, padding = 120) => {
if (!list) {
return {
width: 0,
@@ -17,40 +17,46 @@ export const calculateLayoutProps = (list, padding = 100) => {
let maxCcWidth = 0;
list.each(node => {
const [x, nY] = [node.y, node.x];
const nX = x + node.ySize;
const [x, y] = [node.y, node.x];
const [xSize, ySize] = [node.ySize, node.xSize];
if (node.data.type !== FILE_NODE_TYPE && node.data.type !== DIR_NODE_TYPE) {
if (node.ySize > maxCcWidth) {
maxCcWidth = node.ySize;
// calc cc vertical line
if (node.data.type === CC_NODE_TYPE) {
if (xSize > maxCcWidth) {
maxCcWidth = xSize;
}
} else {
if (x + xSize > ccAlightPoint) {
ccAlightPoint = x + xSize;
}
return;
}
if (nX < minX) {
minX = nX;
if (x < minX) {
minX = x;
}
if (nY - node.xSize < minY) {
minY = nY - node.xSize;
if (y < minY) {
minY = y;
}
if (nX > maxX) {
maxX = nX;
ccAlightPoint = node.y + node.ySize;
if (x + xSize > maxX) {
maxX = x + xSize;
}
if (nY + node.xSize > maxY) {
maxY = nY + node.xSize;
if (y + ySize > maxY) {
maxY = y + ySize;
}
});
const yShift = Math.abs(Math.round(minY)) + 20;
const height = Math.round(Math.abs(maxY) + Math.abs(yShift)) + 5;
const width = Math.round(Math.abs(maxX + maxCcWidth) + Math.abs(minX) + 2 * padding);
return {
width: Math.round(Math.abs(maxX + maxCcWidth) + Math.abs(minX) + 2 * padding),
height: Math.round(Math.abs(maxY) + Math.abs(minY) + 3 * padding),
xShift: padding / 4,
yShift: Math.round(Math.abs(minY)) + padding,
xShift: 5,
width,
height,
yShift,
ccAlightPoint
};
};

View File

@@ -69,6 +69,8 @@ export const getTreeLayout = (
}, 0);
}
// TODO: calc properly, not 5000
// impossible to do in one loop
const LARGE_WIDTH_CC = 5000;
const widthSpace =
node.data.type !== DIR_NODE_TYPE && node.data.type !== FILE_NODE_TYPE

View File

@@ -4,3 +4,8 @@ export const setActiveNamespace = payload => ({
type: ACTIONS.SET_ACTIVE_NAMESPACE,
payload
});
export const setFullState = payload => ({
type: ACTIONS.SET_FULL_STATE,
payload
});

View File

@@ -1,4 +1,5 @@
export const ACTIONS = {
SET_ACTIVE_NAMESPACE: 'NAMESPACE_INTEGRATION.SET_ACTIVE_NAMESPACE',
SET_FULL_STATE: 'NAMESPACE_INTEGRATION.SET_FULL_STATE',
RESET_ALL: 'NAMESPACE_INTEGRATION.RESET_ALL'
};

View File

@@ -12,6 +12,12 @@ export default (state = DefaultState, action) => {
activeNamespace: action.payload
};
case ACTIONS.SET_FULL_STATE:
return {
...state,
...action.payload
};
case ACTIONS.RESET_ALL:
return DefaultState;

View File

@@ -9,13 +9,13 @@ import dataBus from '../dataBus/reducer';
import namespaceIntegration from '../namespaceIntegration/reducer';
import rootSaga from './sagas';
export default () => {
export default ({ extraReducers = {}, extraPersistWhiteList = [] } = {}) => {
const sagaMiddleware = createSagaMiddleware();
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const persistConfig = {
key: 'codecrumbs-config-storage',
whitelist: ['controlsBus'],
whitelist: ['controlsBus', ...extraPersistWhiteList],
storage
};
@@ -24,7 +24,8 @@ export default () => {
combineReducers({
controlsBus,
dataBus,
namespaceIntegration
namespaceIntegration,
...extraReducers
})
);

View File

@@ -6,13 +6,14 @@ import { PersistGate } from 'redux-persist/integration/react';
import App from './App';
import getStore from './core/store';
const extraLayout = {};
export default (options, mountNodeId) => {
const { store, persistor } = getStore();
ReactDOM.render(
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<App {...options} />
<App extraLayout={extraLayout} {...options} />
</PersistGate>
</Provider>,
document.getElementById(mountNodeId)

View File

@@ -1 +1 @@
export default { version: process.env.CODECRUMBS_VERSION }
export default { version: process.env.CODECRUMBS_VERSION };

View File

@@ -4,12 +4,21 @@ const { getLanguageParsers } = require('./language');
const parseFile = (
itemPath,
projectDir,
{ parseCodeCrumbs, parseImports, parseDependencies, attachCode, language, webpackConfigPath, tsConfigPath } = {}
{
parseCodeCrumbs,
parseImports,
parseDependencies,
attachCode,
language,
webpackConfigPath,
tsConfigPath
} = {}
) => {
const { codecrumbsParser, dependenciesParser } = getLanguageParsers(language);
return Promise.all([
parseDependencies && dependenciesParser.getDependencies(itemPath, projectDir, {webpackConfigPath, tsConfigPath}),
parseDependencies &&
dependenciesParser.getDependencies(itemPath, projectDir, { webpackConfigPath, tsConfigPath }),
file.read(itemPath, 'utf8')
]).then(([dependencies, code]) => {
const item = {
@@ -37,7 +46,7 @@ const parseFile = (
item.flows = undefined;
}
}
if (parseImports) {
const importedDependencies = dependenciesParser.getImports(code, itemPath);
if (importedDependencies.length) {

View File

@@ -1,7 +1,4 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const CPP_COMMENT_REGEX = /^([^\/\/]*)\/\/(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(CPP_COMMENT_REGEX));
const { getCrumbs } = require('../default/codecrumbs');
// replace with own implementation if needed
module.exports = {

View File

@@ -0,0 +1 @@
module.exports = /\.(cpp|c\+\+|cc|cp|cxx|h|h\+\+|hh|hpp|hxx|inc|inl|ino|ipp|re|tcc|tpp)$/;

View File

@@ -1,8 +1,4 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const CSHARP_COMMENT_REGEX = /^([^\/\/]*)\/\/(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(CSHARP_COMMENT_REGEX));
const { getCrumbs } = require('../default/codecrumbs');
// replace with own implementation if needed
module.exports = {
getCrumbs

View File

@@ -0,0 +1 @@
module.exports = /\.(cs|cake|cshtml|csx)$/;

View File

@@ -0,0 +1 @@
module.exports = /(.*?)/

View File

@@ -0,0 +1 @@
module.exports = /\.(f90|f|f03|f08|f77|f95|for|fpp)$/;

View File

@@ -0,0 +1,6 @@
const { getCrumbs } = require('../default/codecrumbs');
// replace with own implementation if needed
module.exports = {
getCrumbs
};

View File

@@ -0,0 +1,7 @@
const defaultDependencies = require('../default/dependencies');
// replace with own implementation if needed
module.exports = {
getImports: defaultDependencies.getImports,
getDependencies: defaultDependencies.getDependencies
};

View File

@@ -0,0 +1 @@
module.exports = /\.(go)$/;

View File

@@ -0,0 +1 @@
module.exports = /\.(hs|hsc)$/;

View File

@@ -1,110 +1,64 @@
// check extensions
// https://github.com/blakeembrey/language-map/blob/master/languages.json
// copy(`/\.(${extensions.map(i=>i.slice(1)).join('|')})$/`)
const LANGUAGES = [
'cpp',
'csharp',
'fortran',
'golang',
'haskell',
'java',
'javascript',
'kotlin',
'lua',
'ocaml',
'perl',
'php',
'python',
'ruby',
'typescript'
];
const getExtensions = parserName => require(`./${parserName}/extensions`);
const LANGUAGE_LIST = LANGUAGES.map(language => {
return {
language,
extensions: getExtensions(language)
};
});
const DEFAULT_PARSER = {
language: 'default',
extensions: getExtensions('default')
};
module.exports = {
detectLanguage: (entryPoint) => {
const list = [
{
language: 'cpp',
extensions: /\.(cpp|c\+\+|cc|cp|cxx|h|h\+\+|hh|hpp|hxx|inc|inl|ino|ipp|re|tcc|tpp)$/
},
{
language: 'csharp',
extensions: /\.(cs|cake|cshtml|csx)$/
},
{
language: 'fortran',
extensions: /\.(f90|f|f03|f08|f77|f95|for|fpp)$/
},
{
language: 'haskell',
extensions: /\.(hs|hsc)$/
},
{
language: 'java',
extensions: /\.(java|jsp)$/
},
{
language: 'javascript',
extensions: /\.(js|jsx|_js|bones|es|es6|frag|gs|jake|jsb|jscad|jsfl|jsm|jss|mjs|njs|pac|sjs|ssjs|vue|xsjs|xsjslib)$/
},
{
language: 'kotlin',
extensions: /\.(kt|ktm|kts)$/
},
{
language: 'php',
extensions: /\.(php|aw|ctp|fcgi|inc|php3|php4|php5|phps|phpt)$/
},
{
language: 'python',
extensions: /\.(py|bzl|cgi|fcgi|gyp|gypi|lmi|py3|pyde|pyi|pyp|pyt|pyw|rpy|spec|tac|wsgi|xpy)$/
},
{
language: 'ruby',
extensions: /\.(rb|builder|eye|fcgi|gemspec|god|jbuilder|mspec|pluginspec|podspec|rabl|rake|rbuild|rbw|rbx|ru|ruby|spec|thor|watchr)$/
},
{
language: 'typescript',
extensions: /\.(ts|tsx)$/
}
];
detectLanguage: entryPoint => {
const detection = LANGUAGE_LIST.find(language => {
return language.extensions.test(entryPoint);
});
const detection = list.find(item => item.extensions.test(entryPoint));
return detection ? detection : { language: 'default', extensions: /(.*?)/ };
return detection ? detection : DEFAULT_PARSER;
},
getLanguageParsers: (language = 'default') => {
const map = {
cpp: {
codecrumbsParser: require('./cpp/codecrumbs'),
dependenciesParser: require('./cpp/dependencies')
},
csharp: {
codecrumbsParser: require('./csharp/codecrumbs'),
dependenciesParser: require('./csharp/dependencies')
},
fortran: {
codecrumbsParser: require('./fortran/codecrumbs'),
dependenciesParser: require('./fortran/dependencies')
},
haskell: {
codecrumbsParser: require('./haskell/codecrumbs'),
dependenciesParser: require('./haskell/dependencies')
},
java: {
codecrumbsParser: require('./java/codecrumbs'),
dependenciesParser: require('./java/dependencies')
},
javascript: {
codecrumbsParser: require('./javascript/codecrumbs'),
dependenciesParser: require('./javascript/dependencies')
},
kotlin: {
codecrumbsParser: require('./kotlin/codecrumbs'),
dependenciesParser: require('./kotlin/dependencies')
},
php: {
codecrumbsParser: require('./php/codecrumbs'),
dependenciesParser: require('./php/dependencies')
},
python: {
codecrumbsParser: require('./python/codecrumbs'),
dependenciesParser: require('./python/dependencies')
},
ruby: {
codecrumbsParser: require('./ruby/codecrumbs'),
dependenciesParser: require('./ruby/dependencies')
},
typescript: {
codecrumbsParser: require('./typescript/codecrumbs'),
dependenciesParser: require('./typescript/dependencies')
},
default: {
codecrumbsParser: require('./default/codecrumbs'),
dependenciesParser: require('./default/dependencies')
}
};
return map[language] || map.default;
getLanguageParsers: (language = 'default') => {
return (
LANGUAGES.reduce((target, parser) => {
return target.set(parser, getPropertiesByParser(parser));
}, new Map()).get(language) || getPropertiesByParser('default')
);
}
};
const getPropertiesByParser = parser => {
if (typeof parser === 'string') {
return {
codecrumbsParser: require(`./${parser}/codecrumbs`),
dependenciesParser: require(`./${parser}/dependencies`)
};
} else {
throw 'Invalid parser name';
}
};

View File

@@ -1,7 +1,4 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const JAVA_COMMENT_REGEX = /^([^\/\/]*)\/\/(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(JAVA_COMMENT_REGEX));
const { getCrumbs } = require('../default/codecrumbs');
// replace with own implementation if needed
module.exports = {

View File

@@ -0,0 +1 @@
module.exports = /\.(java|jsp)$/;

View File

@@ -23,11 +23,9 @@ const getCrumbs = (fileCode, path) => {
}
};*/
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const JAVA_SCRIPT_COMMENT_REGEX = /^([^\/\/]*)\/\/(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(JAVA_SCRIPT_COMMENT_REGEX));
const { getCrumbs } = require('../default/codecrumbs');
// replace with own implementation if needed
module.exports = {
getCrumbs
};

View File

@@ -0,0 +1 @@
module.exports = /\.(js|jsx|_js|bones|es|es6|frag|gs|jake|jsb|jscad|jsfl|jsm|jss|mjs|njs|pac|sjs|ssjs|vue|xsjs|xsjslib)$/;

View File

@@ -1,7 +1,4 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const KOTLIN_COMMENT_REGEX = /^([^\/\/]*)\/\/(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(KOTLIN_COMMENT_REGEX));
const { getCrumbs } = require('../default/codecrumbs');
// replace with own implementation if needed
module.exports = {

View File

@@ -0,0 +1 @@
module.exports = /\.(kt|ktm|kts)$/;

View File

@@ -0,0 +1,9 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const LUA_COMMENT_REGEX = /^([^--]*)--(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(LUA_COMMENT_REGEX));
// replace with own implementation if needed
module.exports = {
getCrumbs
};

View File

@@ -0,0 +1,7 @@
const defaultDependencies = require('../default/dependencies');
// replace with own implementation if needed
module.exports = {
getImports: defaultDependencies.getImports,
getDependencies: defaultDependencies.getDependencies
};

View File

@@ -0,0 +1 @@
module.exports = /\.(lua|luac)$/;

View File

@@ -0,0 +1,10 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const OCAML_COMMENT_REGEX = /\/\*(.*?)\*\//;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(OCAML_COMMENT_REGEX));
// replace with own implementation if needed
module.exports = {
getCrumbs
};

View File

@@ -0,0 +1,7 @@
const defaultDependencies = require('../default/dependencies');
// replace with own implementation if needed
module.exports = {
getImports: defaultDependencies.getImports,
getDependencies: defaultDependencies.getDependencies
};

View File

@@ -0,0 +1 @@
module.exports = /\.(re|ml|rei|mli|cmxa)$/;

View File

@@ -0,0 +1,9 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const PERL_COMMENT_REGEX = /^([^#]*)#(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(PERL_COMMENT_REGEX));
// replace with own implementation if needed
module.exports = {
getCrumbs
};

View File

@@ -0,0 +1,7 @@
const defaultDependencies = require('../default/dependencies');
// replace with own implementation if needed
module.exports = {
getImports: defaultDependencies.getImports,
getDependencies: defaultDependencies.getDependencies
};

View File

@@ -0,0 +1 @@
module.exports = /\.(pl|al|cgi|fcgi|perl|ph|plx|pm|psgi|t|6pl|6pm|nqp|p6|p6l|p6m|pl|pl6|pm|pm6)$/;

View File

@@ -1,7 +1,4 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const PHP_COMMENT_REGEX = /^([^\/\/]*)\/\/(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(PHP_COMMENT_REGEX));
const { getCrumbs } = require('../default/codecrumbs');
// replace with own implementation if needed
module.exports = {

View File

@@ -0,0 +1 @@
module.exports = /\.(php|aw|ctp|fcgi|inc|php3|php4|php5|phps|phpt)$/;

View File

@@ -0,0 +1 @@
module.exports = /\.(py|bzl|cgi|fcgi|gyp|gypi|lmi|py3|pyde|pyi|pyp|pyt|pyw|rpy|spec|tac|wsgi|xpy)$/;

View File

@@ -0,0 +1 @@
module.exports = /\.(rb|builder|eye|fcgi|gemspec|god|jbuilder|mspec|pluginspec|podspec|rabl|rake|rbuild|rbw|rbx|ru|ruby|spec|thor|watchr)$/;

View File

@@ -1,7 +1,4 @@
const { setupGetCrumbs, setupGetCommentsFromCode } = require('../default/codecrumbs');
const TYPE_SCRIPT_COMMENT_REGEX = /^([^\/\/]*)\/\/(.*)$/;
const getCrumbs = setupGetCrumbs(setupGetCommentsFromCode(TYPE_SCRIPT_COMMENT_REGEX));
const { getCrumbs } = require('../default/codecrumbs');
// replace with own implementation if needed
module.exports = {

View File

@@ -0,0 +1 @@
module.exports = /\.(ts|tsx)$/;

View File

@@ -10,9 +10,6 @@ const mediator = require('./mediator');
const sourceWatcher = require('./source-watcher');
const setup = (options, devOptions) => {
logger.fun(`>\n> Codecrumbs magic begins!\n>`);
logger.info(`> started with options: ${JSON.stringify(options)}`);
const {
projectNameAlias,
projectDir,
@@ -21,9 +18,15 @@ const setup = (options, devOptions) => {
tsConfigPath,
clientPort,
excludeDir,
ideCmd
ideCmd,
debugModeEnabled
} = options;
logger.setDebugModeEnabled(debugModeEnabled);
logger.fun(`>\n> Codecrumbs magic begins!\n>`);
logger.info(`> started with options: ${JSON.stringify(options)}`);
const PORT_IN_USE = 'open';
const HOST = '127.0.0.1';
@@ -94,11 +97,11 @@ const alignPlatformPath = (p = '') =>
const validateProjectPath = (pDir, ePoint) => {
const paths = [];
if (!fs.existsSync(alignPlatformPath(pDir))) {
if (!checkIfPathExists(pDir)) {
paths.push(pDir);
}
if (!fs.existsSync(alignPlatformPath(ePoint))) {
if (!checkIfPathExists(ePoint)) {
paths.push(ePoint);
}
@@ -110,6 +113,9 @@ const validateProjectPath = (pDir, ePoint) => {
}
};
const checkIfPathExists = path => fs.existsSync(alignPlatformPath(path));
module.exports = {
checkIfPathExists,
setup
};

View File

@@ -5,6 +5,10 @@ const { SOCKET_MSG_MAX_SIZE } = require('./config');
const logger = require('./utils/logger');
const { SOCKET_MESSAGE_TYPE } = require('./shared-constants');
const connectedJSON = JSON.stringify({
type: SOCKET_MESSAGE_TYPE.CLIENT_CONNECTED
})
// instances should run on many ports but then send data to mediator and mediator to client
const run = ({ port, clientPort }) => {
const httpServer = http.createServer();
@@ -29,22 +33,10 @@ const run = ({ port, clientPort }) => {
if (isClient) {
clientInstance = connection;
logger.info('> browser client connected');
sendToSourceWatchers(
JSON.stringify({
type: SOCKET_MESSAGE_TYPE.CLIENT_CONNECTED
})
);
sendToSourceWatchers(connectedJSON);
} else {
sourceWatcherInstances.push(connection);
// if client already there just init watcher
if (clientInstance) {
connection.sendUTF(
JSON.stringify({
type: SOCKET_MESSAGE_TYPE.CLIENT_CONNECTED
})
);
}
initWatcherIfClientExist(clientInstance, connection)
}
connection.on('message', ({ utf8Data }) => {
@@ -61,6 +53,12 @@ const run = ({ port, clientPort }) => {
});
};
function initWatcherIfClientExist (client, connection) {
if (client) {
connection.sendUTF(connectedJSON)
}
}
module.exports = {
run
};

View File

@@ -3,7 +3,11 @@ const directoryTree = require('directory-tree');
const { traversal: treeTraversal } = require('../utils/tree');
const { DIR_NODE_TYPE } = require('../shared-constants');
const getProjectFiles = (projectDir, config = { extensions: /(.*?)/ }) => {
const DEFAULT_EXTENSION_REGEX = require('../code-parse/language/default/extensions')
const DEFAULT_CONFIG = { extensions: DEFAULT_EXTENSION_REGEX }
const NO_FILES_ERROR = 'There is not files found. Please check source dir and entry point configs.';
const getProjectFiles = (projectDir, config = DEFAULT_CONFIG) => {
const filesMap = {};
const foldersMap = {};
@@ -12,7 +16,7 @@ const getProjectFiles = (projectDir, config = { extensions: /(.*?)/ }) => {
});
if (!Object.keys(filesMap).length) {
throw new Error('There is not files found. Please check source dir and entry point configs.');
throw new Error(NO_FILES_ERROR);
}
treeTraversal(sourceTree, node => {

View File

@@ -1,6 +1,7 @@
const chalk = require('chalk');
const logAdapter = msg => console.log(msg);
let isDebugModeEnabled = false;
const logAdapter = (msg, force) => (isDebugModeEnabled || force) && console.log(msg);
module.exports = {
getText: e => {
@@ -13,6 +14,7 @@ module.exports = {
log: (...args) => logAdapter(chalk.blue.apply(chalk, args)),
info: (...args) => logAdapter(chalk.green.apply(chalk, args)),
warn: (...args) => logAdapter(chalk.yellow.apply(chalk, args)),
error: (...args) => logAdapter(chalk.red.apply(chalk, args)),
fun: (...args) => logAdapter(chalk.keyword('purple').apply(chalk, args))
error: (...args) => logAdapter(chalk.red.apply(chalk, args), true),
fun: (...args) => logAdapter(chalk.keyword('purple').apply(chalk, args), true),
setDebugModeEnabled: (debugModeEnabled) => isDebugModeEnabled = debugModeEnabled
};