Skip to content

Commit

Permalink
Adding online documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Desmaisons committed Sep 3, 2018
1 parent 99fce73 commit e6bf759
Show file tree
Hide file tree
Showing 23 changed files with 6,813 additions and 3 deletions.
29 changes: 29 additions & 0 deletions build/buildDoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// https://github.com/shelljs/shelljs
require('./check-versions')()
require('shelljs/global')
env.NODE_ENV = 'documentation'

var path = require('path')
var config = require('../config')
var ora = require('ora')
var webpack = require('webpack')
var webpackConfig = require('./webpack.doc.conf')

var spinner = ora('building for documentation...')
spinner.start()

var assetsPath = path.join(config.doc.assetsRoot, config.doc.assetsSubDirectory)
rm('-rf', assetsPath)
mkdir('-p', assetsPath)

webpack(webpackConfig, function (err, stats) {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n')
})
4 changes: 3 additions & 1 deletion build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin')
exports.assetsPath = function (_path) {
var assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
: process.env.NODE_ENV === 'documentation'
? config.doc.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}

Expand Down
50 changes: 50 additions & 0 deletions build/webpack.doc.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
var config = require('../config')
var webpack = require('webpack')
var merge = require('webpack-merge')
var utils = require('./utils')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin')

// add hot-reload related code to entry chunks
module.exports = merge(baseWebpackConfig, {
entry: {
tree: ['./build/dev-client'].concat('./example/tree/main.js'),
hierarchicalEdgeBundling: ['./build/dev-client'].concat('./example/hierarchicalEdgeBundling/main.js')
},
module: {
loaders: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
},
output: {
path: config.doc.assetsRoot,
publicPath: config.doc.assetsPublicPath,
filename: "../docs/[name]_bundle.js"
},
// eval-source-map is faster for development
devtool: '#eval-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': config.dev.env
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: '../docs/tree.html',
template: './example/tree/index.html',
chunks: ['tree'],
autoInject: true
}),
new HtmlWebpackPlugin({
filename: '../docs/hierarchicalEdgeBundling.html',
template: './example/hierarchicalEdgeBundling/index.html',
chunks: ['hierarchicalEdgeBundling'],
}),
new HtmlWebpackPlugin({
filename: '../docs/index.html',
template: './example/index.html',
chunks: [],
})
]
})
14 changes: 14 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ module.exports = {
productionGzip: false,
productionGzipExtensions: ['js', 'css']
},
doc: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../docs/index.html'),
assetsRoot: path.resolve(__dirname, '../docs'),
assetsSubDirectory: '../docs/', //img and fonts
assetsPublicPath: './',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css']
},
dev: {
env: require('./dev.env'),
port: 9090,
Expand Down
Binary file added docs/fonts/fontawesome-webfont.674f50d.eot
Binary file not shown.
Binary file added docs/fonts/fontawesome-webfont.af7ae50.woff2
Binary file not shown.
Binary file added docs/fonts/fontawesome-webfont.b06871f.ttf
Binary file not shown.
Binary file added docs/fonts/fontawesome-webfont.fee66e7.woff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions docs/hierarchicalEdgeBundling.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>hierarchicalEdgeBundling</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="text/javascript" src="./../docs/hierarchicalEdgeBundling_bundle.js"></script></body>
</html>
Loading

0 comments on commit e6bf759

Please sign in to comment.