Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
bd69ae1b4f | |||
4a40c37be2 | |||
f4ea7f0d0a | |||
50eff3fbd5 | |||
68fb3ed643 | |||
c9bfbadbf6 | |||
b06005b949 | |||
5e4b42a920 | |||
066401c474 | |||
972681834f | |||
44b81bb478 | |||
e1eb88e298 | |||
50da9a5ce7 | |||
a2fd6998ee | |||
d5908d4bc6 | |||
a34b77f469 | |||
027b4ca26f | |||
e9b8b3b6d9 | |||
8d2c9e8241 | |||
b78b0ef599 | |||
5a046a7667 | |||
b04f3be3db | |||
d441f5b489 | |||
38f3ccb364 | |||
0c7f50e3cc | |||
7937cc8898 | |||
1a7f33d22b | |||
ea9dfa0e0d | |||
755babdd75 | |||
4fa345d20e | |||
b8678cd808 | |||
4f25981183 | |||
81a5f87eb7 | |||
dd3c4860a0 | |||
4e1721e909 | |||
bd4ad32703 | |||
263f1de538 | |||
34a7eabb52 | |||
f92f63337d |
6
.gitignore
vendored
6
.gitignore
vendored
@ -8,13 +8,15 @@ pages/
|
||||
# installs
|
||||
node_modules/
|
||||
|
||||
# caches and builds
|
||||
# caches
|
||||
.yarn/
|
||||
.cache/
|
||||
.rpt2_cache
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
|
||||
# custom
|
||||
mkdocs/originalrepo
|
||||
|
@ -1,5 +1,5 @@
|
||||
# gitzone standard
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
@ -38,19 +38,7 @@ snyk:
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testLTS:
|
||||
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:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
@ -60,6 +48,18 @@ testSTABLE:
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- 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
|
||||
|
||||
release:
|
||||
@ -78,19 +78,11 @@ release:
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
image: docker:stable
|
||||
allow_failure: true
|
||||
services:
|
||||
- docker:stable-dind
|
||||
script:
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
--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]
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
tags:
|
||||
- docker
|
||||
- priv
|
||||
@ -106,13 +98,15 @@ trigger:
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
image: hosttoday/ht-docker-node:npmci
|
||||
image: hosttoday/ht-docker-dbase:npmci
|
||||
services:
|
||||
- docker:stable-dind
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npm install -g typedoc typescript @gitzone/tsdoc
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
13
.snyk
Normal file
13
.snyk
Normal file
@ -0,0 +1,13 @@
|
||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||
version: v1.13.5
|
||||
# ignores vulnerabilities until expiry date; change duration by modifying expiry date
|
||||
ignore:
|
||||
SNYK-JS-MARKED-174116:
|
||||
- typedoc > marked:
|
||||
reason: None given
|
||||
expires: '2019-06-13T06:50:33.594Z'
|
||||
'npm:shelljs:20140723':
|
||||
- typedoc > shelljs:
|
||||
reason: None given
|
||||
expires: '2019-06-13T06:50:33.594Z'
|
||||
patch: {}
|
7
assets/tsconfig.json
Normal file
7
assets/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2017",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true
|
||||
}
|
||||
}
|
3
cli.js
Normal file
3
cli.js
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
require('./dist/index');
|
4
cli.ts.js
Normal file
4
cli.ts.js
Normal file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
process.env.CLI_CALL = 'true';
|
||||
require('@gitzone/tsrun');
|
||||
require('./ts/index');
|
948
package-lock.json
generated
948
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
39
package.json
39
package.json
@ -1,28 +1,47 @@
|
||||
{
|
||||
"name": "@gitzone/tsdoc",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.22",
|
||||
"private": false,
|
||||
"description": "a tool for better documentation",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"tsdoc": "cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"test": "(tstest test/) && (node ./cli.ts.js) && rm -rf public/",
|
||||
"build": "(tsbuild)",
|
||||
"buildMkdocs": "(cd mkdocs/originalrepo && docker rmi -f mkdocs && docker build -t mkdocs .)",
|
||||
"format": "(gitzone format)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^12.0.0",
|
||||
"tslint": "^5.11.0",
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.0.13",
|
||||
"@types/node": "^12.7.12",
|
||||
"tslint": "^5.20.0",
|
||||
"tslint-config-prettier": "^1.15.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/early": "^3.0.3",
|
||||
"@pushrocks/smartcli": "^3.0.7",
|
||||
"typedoc": "^0.14.2"
|
||||
}
|
||||
"@pushrocks/smartfile": "^7.0.6",
|
||||
"@pushrocks/smartlog": "^2.0.19",
|
||||
"@pushrocks/smartlog-destination-local": "^8.0.2",
|
||||
"@pushrocks/smartshell": "^2.0.25",
|
||||
"typedoc": "^0.15.0",
|
||||
"typescript": "^3.6.4"
|
||||
},
|
||||
"files": [
|
||||
"ts/*",
|
||||
"ts_web/*",
|
||||
"dist/*",
|
||||
"dist_web/*",
|
||||
"dist_ts_web/*",
|
||||
"assets/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
]
|
||||
}
|
||||
|
26
readme.md
Normal file
26
readme.md
Normal file
@ -0,0 +1,26 @@
|
||||
# @gitzone/tsdoc
|
||||
a tool for better documentation
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@gitzone/tsdoc)
|
||||
* [gitlab.com (source)](https://gitlab.com/gitzone/tsdoc)
|
||||
* [github.com (source mirror)](https://github.com/gitzone/tsdoc)
|
||||
* [docs (typedoc)](https://gitzone.gitlab.io/tsdoc/)
|
||||
|
||||
## Status for master
|
||||
[](https://gitlab.com/gitzone/tsdoc/commits/master)
|
||||
[](https://gitlab.com/gitzone/tsdoc/commits/master)
|
||||
[](https://www.npmjs.com/package/@gitzone/tsdoc)
|
||||
[](https://snyk.io/test/npm/@gitzone/tsdoc)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://prettier.io/)
|
||||
|
||||
## Usage
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
@ -1,8 +1,8 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as tsdoc from '../ts/index'
|
||||
import * as tsdoc from '../ts/index';
|
||||
|
||||
tap.test('first test', async () => {
|
||||
console.log(tsdoc.standardExport)
|
||||
})
|
||||
console.log('test');
|
||||
});
|
||||
|
||||
tap.start()
|
||||
tap.start();
|
||||
|
@ -1,4 +1,6 @@
|
||||
import * as early from '@pushrocks/early';
|
||||
early.start('tsdoc');
|
||||
import * as plugins from './tsdoc.plugins';
|
||||
|
||||
import * as cli from './tsdoc.cli';
|
||||
early.stop();
|
||||
cli.run();
|
@ -0,0 +1,63 @@
|
||||
import * as plugins from './tsdoc.plugins';
|
||||
import * as paths from './tsdoc.paths';
|
||||
|
||||
export class MkDocs {
|
||||
public smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash',
|
||||
pathDirectories: [paths.binDir]
|
||||
});
|
||||
|
||||
public static async isMkDocsDir(dirPathArg: string): Promise<boolean> {
|
||||
const result = await plugins.smartfile.fs.fileExists(
|
||||
plugins.path.join(dirPathArg, 'mkdocs.yml')
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async handleCommand(argvArg) {
|
||||
const mkdocsInstance = new MkDocs(paths.cwd);
|
||||
switch (true) {
|
||||
case argvArg.serve:
|
||||
await mkdocsInstance.serve();
|
||||
break;
|
||||
case argvArg.publish:
|
||||
await mkdocsInstance.publish();
|
||||
break;
|
||||
default:
|
||||
await mkdocsInstance.compile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Instance
|
||||
public typedocDirectory: string;
|
||||
constructor(dirPathArg: string) {
|
||||
this.typedocDirectory = dirPathArg;
|
||||
}
|
||||
|
||||
public async update() {
|
||||
await this.smartshellInstance.exec(
|
||||
`docker pull registry.gitlab.com/hosttoday/ht-docker-mkdocs`
|
||||
);
|
||||
}
|
||||
|
||||
public async compile() {
|
||||
await this.update();
|
||||
await this.smartshellInstance.exec(`rm -rf public/`);
|
||||
await this.smartshellInstance.exec(
|
||||
`docker run --rm -p 8000:8000 -v ${paths.cwd}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs build`
|
||||
);
|
||||
}
|
||||
|
||||
public async serve() {
|
||||
await this.update();
|
||||
await this.smartshellInstance.exec(
|
||||
`docker run --rm -p 8000:8000 -v ${paths.cwd}:/docs registry.gitlab.com/hosttoday/ht-docker-mkdocs`
|
||||
);
|
||||
}
|
||||
|
||||
public async publish() {
|
||||
await this.compile();
|
||||
await this.smartshellInstance.exec(`gitzone commit`);
|
||||
}
|
||||
}
|
||||
|
62
ts/tsdoc.classes.tsdoc.ts
Normal file
62
ts/tsdoc.classes.tsdoc.ts
Normal 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 runAdditionalTasks() {
|
||||
const packageJson = plugins.smartfile.fs.toObjectSync(plugins.path.join(this.cwd, 'package.json'));
|
||||
if (packageJson.scripts.tsdoc) {
|
||||
this.smartshellInstance.exec('npm run tsdoc');
|
||||
}
|
||||
}
|
||||
}
|
@ -1,2 +1,29 @@
|
||||
import * as plugins from './tsdoc.plugins';
|
||||
import * as paths from './tsdoc.paths';
|
||||
|
||||
export class TypeDoc {
|
||||
public smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash',
|
||||
pathDirectories: [paths.binDir]
|
||||
});
|
||||
|
||||
// Static
|
||||
public static async isTypeDocDir(dirPathArg: string): Promise<boolean> {
|
||||
const result = await plugins.smartfile.fs.fileExists(
|
||||
plugins.path.join(dirPathArg, 'mkdocs.yml')
|
||||
);
|
||||
return !result;
|
||||
}
|
||||
|
||||
// Instance
|
||||
public typedocDirectory: string;
|
||||
constructor(dirPathArg) {
|
||||
this.typedocDirectory = dirPathArg;
|
||||
}
|
||||
|
||||
public async compile() {
|
||||
await this.smartshellInstance.exec(
|
||||
`typedoc --tsconfig ${paths.tsconfigFile} --out public/ ts/`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,28 @@
|
||||
import * as plugins from './tsdoc.plugins';
|
||||
import * as paths from './tsdoc.paths';
|
||||
import { logger } from './tsdoc.logging';
|
||||
|
||||
import { TypeDoc } from './tsdoc.classes.typedoc';
|
||||
import { MkDocs } from './tsdoc.classes.mkdocs';
|
||||
import { TsDoc } from './tsdoc.classes.tsdoc';
|
||||
|
||||
export const run = async () => {
|
||||
const tsdocCli = new plugins.smartcli.Smartcli();
|
||||
tsdocCli.addCommand('typedoc').subscribe(async argvArg => {
|
||||
|
||||
tsdocCli.standardTask().subscribe(async argvArg => {
|
||||
const tsdoc = new TsDoc(paths.cwd);
|
||||
await tsdoc.buildDirectory();
|
||||
});
|
||||
|
||||
tsdocCli.addCommand('mkdocs').subscribe(async argvArg => {
|
||||
|
||||
await MkDocs.handleCommand(argvArg);
|
||||
});
|
||||
|
||||
tsdocCli.standardTask().subscribe(async argvArg => {
|
||||
tsdocCli.addCommand('test').subscribe(argvArg => {
|
||||
process.on('exit', async () => {
|
||||
await plugins.smartfile.fs.remove(paths.publicDir);
|
||||
});
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
tsdocCli.startParse();
|
||||
};
|
||||
|
15
ts/tsdoc.logging.ts
Normal file
15
ts/tsdoc.logging.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import * as plugins from './tsdoc.plugins';
|
||||
|
||||
export const logger = new plugins.smartlog.Smartlog({
|
||||
logContext: {
|
||||
company: 'Some Company',
|
||||
companyunit: 'Some CompanyUnit',
|
||||
containerName: 'Some Containername',
|
||||
environment: 'local',
|
||||
runtime: 'node',
|
||||
zone: 'gitzone'
|
||||
},
|
||||
minimumLogLevel: 'silly'
|
||||
});
|
||||
|
||||
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
11
ts/tsdoc.paths.ts
Normal file
11
ts/tsdoc.paths.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import * as plugins from './tsdoc.plugins';
|
||||
|
||||
// dirs
|
||||
export const packageDir = plugins.path.join(__dirname, '../');
|
||||
export const cwd = process.cwd();
|
||||
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');
|
@ -1,13 +1,18 @@
|
||||
// node native
|
||||
import * as path from 'path';
|
||||
|
||||
export { path };
|
||||
|
||||
// pushrocks scope
|
||||
import * as smartcli from '@pushrocks/smartcli';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
|
||||
export {
|
||||
smartcli
|
||||
};
|
||||
export { smartcli, smartfile, smartlog, smartlogDestinationLocal, smartshell };
|
||||
|
||||
// third party scope
|
||||
import * as typedoc from 'typedoc';
|
||||
|
||||
export {
|
||||
typedoc
|
||||
};
|
||||
export { typedoc };
|
||||
|
Reference in New Issue
Block a user