Skip to content

Commit 2dd79c2

Browse files
committed
separate docs from dist
1 parent ce2aa08 commit 2dd79c2

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ Thumbs.db
2323
# Dist #
2424
/dist
2525

26+
# Docs #
27+
/docs
28+
2629
# Cordova #
2730
cordova/plugins
2831
cordova/platforms

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Cordova takes the ```www``` folder source to create the Cordova app. This ```www
199199
So make sure you run for example ```npm run build``` first before runing/buildinga Cordova app.
200200

201201
### Typedocs
202-
The typedoc is generated into ```dist/docs``` and can be served with ```npm run server:docs```.
202+
The typedoc is generated with command ```npm run build:docs``` into directoy ```dist/docs``` and can be served with ```npm run server:docs```.
203203

204204

205205
# ToDo's

config/config-typedoc.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ const TypedocWebpackPlugin = require('typedoc-webpack-plugin');
88
/**
99
* Typedoc config
1010
*/
11-
const configTypedoc = function () {
11+
const configTypedoc = function (options) {
12+
if (!options.run) {
13+
return {};
14+
}
15+
1216
return {
1317
plugins: [
1418
new TypedocWebpackPlugin({
19+
out: options.output,
1520
target: 'es6',
1621
disableOutputCheck: true
17-
}, ['./typings', './typings_custom', './src/app'])
22+
}, options.inputs)
1823
]
19-
};
24+
};
2025
};
2126
module.exports = configTypedoc;

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"test": "cross-env NODE_ENV=test TS_NODE_PROJECT=tsconfig.tsnode.json TS_NODE_FAST=true ts-node ./node_modules/karma/bin/karma start test/karma.conf.js",
99
"clean": "npm cache clean && rimraf node_modules test/coverage dist",
1010
"clean:dist": "rimraf dist",
11+
"clean:docs": "rimraf docs",
1112
"preclean:install": "npm run clean",
1213
"clean:install": "npm set progress=false && npm install",
1314
"preclean:start": "npm run clean",
@@ -22,12 +23,14 @@
2223
"build:dev": "cross-env NODE_ENV=development npm run webpack -- --progress --profile",
2324
"prebuild:prod": "npm run clean:dist",
2425
"build:prod": "cross-env NODE_ENV=production npm run webpack -- --progress --profile",
26+
"prebuild:docs": "npm run clean:docs && npm run clean:dist",
27+
"build:docs": "cross-env NODE_ENV=development npm run webpack -- --progress --profile --env.docs=true",
2528
"start": "npm run server:dev",
2629
"server": "npm run server:dev",
2730
"server:dev": "cross-env NODE_ENV=development npm run webpack-dev-server --inline --progress --profile --watch",
2831
"server:dev:hmr": "npm run server:dev -- --hot",
2932
"server:prod": "http-server dist --cors",
30-
"server:docs": "http-server dist/docs --cors",
33+
"server:docs": "http-server docs --cors",
3134
"lint": "lint:app && lint:test",
3235
"lint:app": "tslint -c ./tslint.json './src/app/**/*.ts'",
3336
"lint:test": "tslint -c ./tslint.json './test/unit/**/*.ts'",

webpack.config.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ module.exports = function (envArguments) {
1515
const pkg = require(path.join(process.cwd(), 'package.json'));
1616
let PLATFORM = 'web';
1717
let TARGET = ENV;
18+
let DOCS = false;
1819
if (envArguments) {
1920
PLATFORM = envArguments.platform || PLATFORM;
2021
TARGET = envArguments.target || TARGET;
22+
DOCS = envArguments.docs || DOCS;
2123
}
2224
console.log('');
2325
console.log(chalk.yellow('➜') + ' ' + chalk.white('NODE_ENV: ') + chalk.green.bold(ENV));
@@ -33,6 +35,7 @@ module.exports = function (envArguments) {
3335
const rootDir = path.resolve();
3436
const srcDir = path.resolve('src/app');
3537
const outDir = path.resolve('dist');
38+
const outDirDocs = path.resolve('docs');
3639
const faviconPath = 'src/assets/images/favicon.ico';
3740

3841
// context to fill the index file
@@ -176,6 +179,16 @@ module.exports = function (envArguments) {
176179
}
177180
};
178181

182+
const typedocsOptions = {
183+
run: DOCS,
184+
output: outDirDocs,
185+
inputs: [
186+
path.join(rootDir, 'typings'),
187+
path.join(rootDir, 'typings_custom'),
188+
srcDir
189+
]
190+
};
191+
179192
// advanced configuration:
180193
switch (ENV) {
181194
/**
@@ -266,7 +279,7 @@ module.exports = function (envArguments) {
266279
require('./config/config-globals.js')(),
267280
require('./config/config-favicon.js')(configFavicon),
268281
require('./config/config-notifier.js')(configNotifier),
269-
require('./config/config-typedoc.js')(),
282+
require('./config/config-typedoc.js')(typedocsOptions),
270283
require('./config/config-loader-options.js')(WebpackOptionLoader().initalConfig, WebpackOptionLoader().extraction)
271284
);
272285
break;

0 commit comments

Comments
 (0)