Compare commits

...

20 Commits

Author SHA1 Message Date
642914539a 1.0.24 2019-10-14 12:59:26 +02:00
faf7a774c5 fix(core): update 2019-10-14 12:59:25 +02:00
e05a24b39b 1.0.23 2019-10-14 09:46:11 +02:00
019cc4937c fix(core): update 2019-10-14 09:46:10 +02:00
bd69ae1b4f 1.0.22 2019-10-14 09:31:28 +02:00
4a40c37be2 fix(core): update 2019-10-14 09:31:28 +02:00
f4ea7f0d0a 1.0.21 2019-09-23 16:26:38 +02:00
50eff3fbd5 fix(core): update 2019-09-23 16:26:38 +02:00
68fb3ed643 1.0.20 2019-07-23 18:13:48 +02:00
c9bfbadbf6 fix(core): update 2019-07-23 18:13:48 +02:00
b06005b949 1.0.19 2019-05-28 12:11:54 +02:00
5e4b42a920 fix(core): update 2019-05-28 12:11:53 +02:00
066401c474 1.0.18 2019-05-28 12:11:11 +02:00
972681834f fix(core): update 2019-05-28 12:11:11 +02:00
44b81bb478 1.0.17 2019-05-28 11:32:39 +02:00
e1eb88e298 fix(core): update 2019-05-28 11:32:38 +02:00
50da9a5ce7 1.0.16 2019-05-27 16:11:11 +02:00
a2fd6998ee fix(core): update 2019-05-27 16:11:10 +02:00
d5908d4bc6 1.0.15 2019-05-27 15:50:10 +02:00
a34b77f469 fix(core): update 2019-05-27 15:50:10 +02:00
10 changed files with 470 additions and 490 deletions

View File

@ -1,5 +1,5 @@
# gitzone standard # gitzone ci_default
image: hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
@ -38,19 +38,7 @@ snyk:
# test stage # test stage
# ==================== # ====================
testLTS: testStable:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
stage: test stage: test
script: script:
- npmci npm prepare - npmci npm prepare
@ -60,6 +48,18 @@ testSTABLE:
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- priv
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv - notpriv
release: release:
@ -78,19 +78,11 @@ release:
# ==================== # ====================
codequality: codequality:
stage: metadata stage: metadata
image: docker:stable
allow_failure: true allow_failure: true
services:
- docker:stable-dind
script: script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - npmci command npm install -g tslint typescript
- docker run - npmci npm install
--env SOURCE_CODE="$PWD" - npmci command "tslint -c tslint.json ./ts/**/*.ts"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags: tags:
- docker - docker
- priv - priv
@ -106,13 +98,15 @@ trigger:
- notpriv - notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-dbase:npmci
services:
- docker:stable-dind
stage: metadata stage: metadata
script: script:
- npmci command npm install -g typedoc typescript - npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare - npmci npm prepare
- npmci npm install - npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/ - npmci command tsdoc
tags: tags:
- docker - docker
- notpriv - notpriv

7
assets/tsconfig.json Normal file
View File

@ -0,0 +1,7 @@
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"esModuleInterop": true
}
}

751
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tsdoc", "name": "@gitzone/tsdoc",
"version": "1.0.14", "version": "1.0.24",
"private": false, "private": false,
"description": "a tool for better documentation", "description": "a tool for better documentation",
"main": "dist/index.js", "main": "dist/index.js",
@ -13,25 +13,35 @@
"scripts": { "scripts": {
"test": "(tstest test/) && (node ./cli.ts.js) && rm -rf public/", "test": "(tstest test/) && (node ./cli.ts.js) && rm -rf public/",
"build": "(tsbuild)", "build": "(tsbuild)",
"buildMkdocs": "(cd mkdocs/originalrepo && docker rmi -f mkdocs && docker build -t mkdocs .)",
"format": "(gitzone format)" "format": "(gitzone format)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.0.22", "@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.21", "@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.0.7", "@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.0.2", "@types/node": "^12.7.12",
"tslint": "^5.11.0", "tslint": "^5.20.0",
"tslint-config-prettier": "^1.15.0" "tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/early": "^3.0.3", "@pushrocks/early": "^3.0.3",
"@pushrocks/smartcli": "^3.0.7", "@pushrocks/smartcli": "^3.0.7",
"@pushrocks/smartfile": "^7.0.2", "@pushrocks/smartfile": "^7.0.6",
"@pushrocks/smartlog": "^2.0.19", "@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartlog-destination-local": "^7.0.5", "@pushrocks/smartlog-destination-local": "^8.0.2",
"@pushrocks/smartshell": "^2.0.17", "@pushrocks/smartshell": "^2.0.25",
"typedoc": "^0.14.2", "typedoc": "^0.15.0",
"typescript": "^3.4.5" "typescript": "^3.6.4"
} },
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"dist_ts_web/*",
"assets/*",
"cli.js",
"npmextra.json",
"readme.md"
]
} }

View File

@ -21,6 +21,6 @@ a tool for better documentation
For further information read the linked docs at the top of this readme. For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com) [![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@ -31,7 +31,7 @@ export class MkDocs {
// Instance // Instance
public typedocDirectory: string; public typedocDirectory: string;
constructor(dirPathArg) { constructor(dirPathArg: string) {
this.typedocDirectory = dirPathArg; this.typedocDirectory = dirPathArg;
} }
@ -45,18 +45,14 @@ export class MkDocs {
await this.update(); await this.update();
await this.smartshellInstance.exec(`rm -rf public/`); await this.smartshellInstance.exec(`rm -rf public/`);
await this.smartshellInstance.exec( await this.smartshellInstance.exec(
`docker run --rm -p 8000:8000 -v ${ `docker run --rm -p 8000:8000 -v ${paths.cwd}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs build`
paths.cwd
}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs build`
); );
} }
public async serve() { public async serve() {
await this.update(); await this.update();
await this.smartshellInstance.exec( await this.smartshellInstance.exec(
`docker run --rm -p 8000:8000 -v ${ `docker run --rm -p 8000:8000 -v ${paths.cwd}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs`
paths.cwd
}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs`
); );
} }

62
ts/tsdoc.classes.tsdoc.ts Normal file
View File

@ -0,0 +1,62 @@
import * as plugins from './tsdoc.plugins';
import { MkDocs } from './tsdoc.classes.mkdocs';
import { TypeDoc } from './tsdoc.classes.typedoc';
import { logger } from './tsdoc.logging';
export type TDirectoryType = 'mkdocs' | 'typedoc';
export class TsDoc {
public smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash'
});
public mkdocs: MkDocs;
public typedoc: TypeDoc;
public cwd: string;
public cwdDirType: TDirectoryType;
constructor(cwdArg: string) {
this.cwd = cwdArg;
this.mkdocs = new MkDocs(this.cwd);
this.typedoc = new TypeDoc(this.cwd);
}
public async buildDirectory() {
await this.detectDirectoryType();
if (this.cwdDirType === 'mkdocs') {
await this.mkdocs.compile();
} else if (this.cwdDirType === 'typedoc') {
await this.typedoc.compile();
}
await this.runAdditionalTasks();
}
private async detectDirectoryType () {
logger.log('warn', `Auto detecting environment!`);
switch (true) {
case await TypeDoc.isTypeDocDir(this.cwd):
logger.log('ok', `Detected TypeDoc compliant directory at ${this.cwd}`);
this.cwdDirType = 'typedoc';
break;
case await MkDocs.isMkDocsDir(this.cwd):
logger.log('ok', `Detected MkDocs compliant directory at ${this.cwd}`);
this.cwdDirType = 'mkdocs';
break;
default:
logger.log('error', `Cannot determine docs format at ${this.cwd}`);
}
}
/**
* runs additional tasks from package.json
*/
public async runAdditionalTasks() {
const packageJson = plugins.smartfile.fs.toObjectSync(plugins.path.join(this.cwd, 'package.json'));
if (packageJson.scripts.tsdoc) {
await this.smartshellInstance.exec('npm run tsdoc');
}
}
}

View File

@ -22,8 +22,12 @@ export class TypeDoc {
} }
public async compile() { public async compile() {
let tsDir: 'ts' | 'ts_web';
plugins.smartfile.fs.isDirectory(plugins.path.join(this.typedocDirectory, 'ts')) ? tsDir = 'ts' : null;
plugins.smartfile.fs.isDirectory(plugins.path.join(this.typedocDirectory, 'ts_web')) ? tsDir = 'ts_web' : null;
await this.smartshellInstance.exec( await this.smartshellInstance.exec(
`typedoc --module "commonjs" --target "ES2016" --out public/ ts/` `typedoc --tsconfig ${paths.tsconfigFile} --out public/ ${tsDir}`
); );
} }
} }

View File

@ -4,32 +4,24 @@ import { logger } from './tsdoc.logging';
import { TypeDoc } from './tsdoc.classes.typedoc'; import { TypeDoc } from './tsdoc.classes.typedoc';
import { MkDocs } from './tsdoc.classes.mkdocs'; import { MkDocs } from './tsdoc.classes.mkdocs';
import { TsDoc } from './tsdoc.classes.tsdoc';
export const run = async () => { export const run = async () => {
const tsdocCli = new plugins.smartcli.Smartcli(); const tsdocCli = new plugins.smartcli.Smartcli();
tsdocCli.addCommand('typedoc').subscribe(async argvArg => {
const typeDocInstance = new TypeDoc(paths.cwd); tsdocCli.standardTask().subscribe(async argvArg => {
await typeDocInstance.compile(); const tsdoc = new TsDoc(paths.cwd);
await tsdoc.buildDirectory();
}); });
tsdocCli.addCommand('mkdocs').subscribe(async argvArg => { tsdocCli.addCommand('mkdocs').subscribe(async argvArg => {
await MkDocs.handleCommand(argvArg); await MkDocs.handleCommand(argvArg);
}); });
tsdocCli.standardTask().subscribe(async argvArg => { tsdocCli.addCommand('test').subscribe(argvArg => {
logger.log('warn', `Auto detecting environment!`); process.on('exit', async () => {
switch (true) { await plugins.smartfile.fs.remove(paths.publicDir);
case await TypeDoc.isTypeDocDir(paths.cwd): });
logger.log('ok', `Detected TypeDoc compliant directory at ${paths.cwd}`);
tsdocCli.trigger('typedoc');
break;
case await MkDocs.isMkDocsDir(paths.cwd):
logger.log('ok', `Detected MkDocs compliant directory at ${paths.cwd}`);
tsdocCli.trigger('mkdocs');
break;
default:
logger.log('error', `Cannot determine docs format at ${paths.cwd}`);
}
}); });
tsdocCli.startParse(); tsdocCli.startParse();

View File

@ -1,5 +1,11 @@
import * as plugins from './tsdoc.plugins'; import * as plugins from './tsdoc.plugins';
// dirs
export const packageDir = plugins.path.join(__dirname, '../'); export const packageDir = plugins.path.join(__dirname, '../');
export const cwd = process.cwd(); export const cwd = process.cwd();
export const binDir = plugins.path.join(packageDir, './node_modules/.bin'); export const binDir = plugins.path.join(packageDir, './node_modules/.bin');
export const assetsDir = plugins.path.join(packageDir, './assets');
export const publicDir = plugins.path.join(packageDir, './public');
// files
export const tsconfigFile = plugins.path.join(assetsDir, './tsconfig.json');