Skip to content

Commit 104497d

Browse files
committed
Merged analyzer and viewer repositories
1 parent cec8559 commit 104497d

36 files changed

+1349
-79
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
.idea/workspace.xml
55
.nyc_output/
66
coverage/
7+
dist/
78
node_modules/
89
src/**/*.js*
10+
src/structure-view/data/
911
test/resources/ts/**/*.js*
1012
test/*.js*
11-
test/result/
13+
output/
1214
npm-debug.log

.idea/inspectionProfiles/Project_Default.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jsLibraryMappings.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jsLinters/tslint.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/module_structure.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/module_structure_analyzer.xml

-9
This file was deleted.

.idea/runConfigurations/module_structure_analyzer_test.xml .idea/runConfigurations/module_structure_test.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/typescript-compiler.xml

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/watcherTasks.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<a href="https://travis-ci.org/rfruesmer/module-structure-analyzer"><img alt="Build Status" src="https://travis-ci.org/rfruesmer/module-structure-analyzer.svg?branch=master"></a>
22
<a href="https://codecov.io/gh/rfruesmer/module-structure-analyzer"><img alt="Coverage Status" src="https://codecov.io/gh/rfruesmer/module-structure-analyzer/master.svg"></a>
33

4-
# module-structure
4+
# module-structure-analyzer
55

6-
Generates levelized structure data for ECMAScript/TypeScript modules.
6+
Inspired by <a href="http://structure101.com/">Structure101</a>, module-structure generates and displays a levelized structure map for
7+
ECMAScript/TypeScript modules.
78

8-
The output can be displayed in browser using module-structure-viewer.
9+
## License
10+
11+
MIT

bin/module-structure.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#! /usr/bin/env node
2+
3+
const ApplicationModule = require("../dist/lib/application");
4+
5+
let theApp = new ApplicationModule.Application();
6+
theApp.run();

conf/helpers.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var path = require('path');
2+
var _root = path.resolve(__dirname, '..');
3+
function root(args) {
4+
args = Array.prototype.slice.call(arguments, 0);
5+
return path.join.apply(path, [_root].concat(args));
6+
}
7+
exports.root = root;

conf/tsconfig.prod.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "commonjs",
5+
"moduleResolution": "node",
6+
"sourceMap": false,
7+
"removeComments": true,
8+
"experimentalDecorators": true,
9+
"noImplicitReturns": true,
10+
"typeRoots": [
11+
"../node_modules/@types"
12+
],
13+
"types": [
14+
"jquery",
15+
"node",
16+
"snapsvg"
17+
]
18+
},
19+
"include": [
20+
"../src/**/*"
21+
],
22+
"exclude": [
23+
"../node_modules/*"
24+
]
25+
}

tslint.json conf/tslint.json

File renamed without changes.

conf/webpack.common.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
var webpack = require("webpack");
2+
var HtmlWebpackPlugin = require("html-webpack-plugin");
3+
var ExtractTextPlugin = require("extract-text-webpack-plugin");
4+
var helpers = require("./helpers");
5+
var path = require("path");
6+
7+
module.exports = {
8+
entry: {
9+
"vendor": "./src/structure-view/vendor.ts",
10+
"app": "./src/structure-view/main.ts"
11+
},
12+
13+
resolve: {
14+
extensions: ["", ".js", ".ts"]
15+
},
16+
17+
module: {
18+
loaders: [
19+
{
20+
test: /\.ts$/,
21+
loaders: ["awesome-typescript-loader"]
22+
},
23+
{
24+
test: /\.html$/,
25+
loader: "html"
26+
},
27+
{
28+
test: /\.(png|jpe?g|gif|woff|woff2|ttf|eot|ico)$/,
29+
loader: "file?name=assets/[name].[hash].[ext]"
30+
},
31+
{
32+
test: /\.svg/,
33+
loader: "file?name=assets/[name].[ext]"
34+
},
35+
{
36+
test: /\.css$/,
37+
exclude: helpers.root("src", "app"),
38+
loader: ExtractTextPlugin.extract("style", "css?sourceMap")
39+
},
40+
{
41+
test: /\.css$/,
42+
include: helpers.root("src", "app"),
43+
loader: "raw"
44+
},
45+
{
46+
test: /\.scss$/,
47+
loaders: ["style", "css", "sass"]
48+
}
49+
]
50+
},
51+
52+
plugins: [
53+
new webpack.optimize.CommonsChunkPlugin({
54+
name: ["app", "vendor"]
55+
}),
56+
57+
new HtmlWebpackPlugin({
58+
template: "src/structure-view/index.html"
59+
})
60+
]
61+
};

conf/webpack.dev.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const webpackMerge = require("webpack-merge");
2+
const ExtractTextPlugin = require("extract-text-webpack-plugin");
3+
const commonConfig = require("./webpack.common.js");
4+
const helpers = require("./helpers");
5+
6+
module.exports = webpackMerge(commonConfig, {
7+
devtool: "source-map",
8+
9+
output: {
10+
path: helpers.root("dist/web-app"),
11+
publicPath: "http://localhost:8080/",
12+
filename: "[name].js",
13+
chunkFilename: "[id].chunk.js"
14+
},
15+
16+
plugins: [
17+
new ExtractTextPlugin("[name].css")
18+
],
19+
20+
module: {
21+
loaders: [
22+
{
23+
test: /module-structure\.json/,
24+
loaders: ["file?name=[name].[ext]"]
25+
}
26+
]
27+
},
28+
29+
devServer: {
30+
historyApiFallback: true,
31+
stats: {colors: true},
32+
hot: true,
33+
inline: true,
34+
progress: true
35+
}
36+
});

conf/webpack.prod.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const webpack = require("webpack");
2+
const webpackMerge = require("webpack-merge");
3+
const ExtractTextPlugin = require("extract-text-webpack-plugin");
4+
const commonConfig = require("./webpack.common.js");
5+
const helpers = require("./helpers");
6+
7+
const ENV = process.env.NODE_ENV = process.env.ENV = "production";
8+
9+
module.exports = webpackMerge(commonConfig, {
10+
output: {
11+
path: helpers.root("dist/web-app"),
12+
publicPath: "",
13+
filename: "[name].[hash].js",
14+
chunkFilename: "[id].[hash].chunk.js"
15+
},
16+
17+
htmlLoader: {
18+
minimize: false // workaround for ng2
19+
},
20+
21+
module: {
22+
loaders: [
23+
{
24+
test: /\.ts$/,
25+
loaders: ["awesome-typescript-loader?configFileName=conf/tsconfig.prod.json"]
26+
}
27+
]
28+
},
29+
30+
plugins: [
31+
new webpack.NoErrorsPlugin(),
32+
new webpack.optimize.DedupePlugin(),
33+
new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
34+
mangle: {
35+
keep_fnames: true
36+
}
37+
}),
38+
new ExtractTextPlugin("[name].[hash].css"),
39+
new webpack.DefinePlugin({
40+
"process.env": {
41+
"ENV": JSON.stringify(ENV)
42+
}
43+
})
44+
]
45+
});

package.json

+46-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
{
2-
"name": "module-structure-analyzer",
3-
"version": "0.0.1",
4-
"description": "Generates levelized structure data for ECMAScript/TypeScript modules.",
2+
"name": "module-structure",
3+
"version": "0.1.0",
4+
"description": "Generates and displays a levelized structure map for ECMAScript/TypeScript modules.",
55
"main": "index.js",
6+
"bin": {
7+
"module-structure": "bin/module-structure.js"
8+
},
69
"scripts": {
7-
"start": "node src/index.js",
8-
"build": "tsc",
9-
"pretest": "tsc -p .",
10+
"build-dev": "tsc -p .",
11+
"build-prod": "npm run clean-js && npm run test && npm run clean-dist && npm run build-prod-lib && npm run build-prod-webapp",
12+
"build-prod-lib": "npm run tsc-prod-lib && cpx package.json dist",
13+
"build-prod-webapp": "webpack --config conf/webpack.prod.js --progress --profile --bail",
14+
"clean-dist": "rimraf dist/",
15+
"clean-js": "rimraf src/**/*.js*",
16+
"pretest": "npm run build-dev && npm run tslint",
17+
"posttest": "nyc report --reporter=json && codecov -f coverage/*.json",
18+
"start-dev-server": "webpack-dev-server --config conf/webpack.dev.js --hot --inline --progress --port 8080",
19+
"start-prod-server": "http-server dist/web-app -o http://localhost:8080?data=module-structure.json",
1020
"test": "nyc mocha",
11-
"posttest": "nyc report --reporter=json && codecov -f coverage/*.json"
21+
"tsc-prod-lib": "tsc -p conf/tsconfig.prod.json --outDir dist/lib",
22+
"tslint": "tslint -c conf/tslint.json --project ."
1223
},
1324
"repository": {
1425
"type": "git",
@@ -32,20 +43,47 @@
3243
"devDependencies": {
3344
"@types/babylon": "^6.7.15",
3445
"@types/chai": "^3.4.34",
46+
"@types/jquery": "^2.0.34",
3547
"@types/node": "^6.0.54",
48+
"@types/snapsvg": "^0.4.27",
49+
"awesome-typescript-loader": "^3.0.0-beta.17",
3650
"chai": "^3.5.0",
3751
"codecov": "^1.0.1",
52+
"cpx": "^1.5.0",
53+
"css-loader": "^0.26.1",
54+
"extract-text-webpack-plugin": "^1.0.1",
55+
"file-loader": "^0.9.0",
56+
"html-loader": "^0.4.4",
57+
"html-webpack-plugin": "^2.24.1",
3858
"mocha": "^3.2.0",
3959
"mocha-typescript": "^1.0.15",
4060
"nyc": "^10.0.0",
41-
"rimraf": "^2.5.4"
61+
"raw-loader": "^0.5.1",
62+
"rimraf": "^2.5.4",
63+
"script-loader": "^0.7.0",
64+
"source-map-loader": "^0.1.5",
65+
"style-loader": "^0.13.1",
66+
"ts-loader": "^1.3.3",
67+
"typescript": "^2.1.4",
68+
"webpack": "^1.14.0",
69+
"webpack-dev-server": "^1.16.2",
70+
"webpack-merge": "^2.0.0"
4271
},
4372
"dependencies": {
73+
"agstopwatch": "^1.1.0",
4474
"babylon": "^6.14.1",
75+
"colors": "^1.1.2",
4576
"command-line-args": "^3.0.5",
4677
"command-line-usage": "^3.0.8",
78+
"get-installed-path": "^2.0.3",
79+
"http-server": "^0.9.0",
80+
"install": "^0.8.4",
81+
"jquery": "^3.1.1",
82+
"npm": "^4.0.5",
83+
"opener": "^1.4.2",
4784
"preconditions": "^2.2.0",
4885
"read-each-line-sync": "^1.0.4",
86+
"snapsvg": "^0.4.0",
4987
"typescript": "^2.1.4"
5088
}
5189
}

0 commit comments

Comments
 (0)