update ci
This commit is contained in:
		| @@ -1,4 +1,10 @@ | ||||
| image: hosttoday/ht-docker-node:npmts | ||||
| # gitzone standard | ||||
| image: hosttoday/ht-docker-node:npmci | ||||
|  | ||||
| cache: | ||||
|   paths: | ||||
|   - .yarn/ | ||||
|   key: "$CI_BUILD_STAGE" | ||||
|  | ||||
| stages: | ||||
| - test | ||||
| @@ -10,6 +16,7 @@ testLEGACY: | ||||
|   stage: test | ||||
|   script: | ||||
|     - npmci test legacy | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
|   tags: | ||||
|     - docker | ||||
|   allow_failure: true | ||||
| @@ -18,6 +25,7 @@ testLTS: | ||||
|   stage: test | ||||
|   script: | ||||
|     - npmci test lts | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
|   tags: | ||||
|     - docker | ||||
|      | ||||
| @@ -25,6 +33,7 @@ testSTABLE: | ||||
|   stage: test | ||||
|   script: | ||||
|     - npmci test stable | ||||
|   coverage: /\d+.?\d+?\%\s*coverage/ | ||||
|   tags: | ||||
|     - docker | ||||
|  | ||||
| @@ -50,7 +59,7 @@ pages: | ||||
|   image: hosttoday/ht-docker-node:npmpage | ||||
|   stage: pages | ||||
|   script: | ||||
|     - npmci command npmpage --host gitlab | ||||
|     - npmci command npmpage --publish gitlab | ||||
|   only: | ||||
|     - tags | ||||
|   artifacts: | ||||
|   | ||||
							
								
								
									
										44
									
								
								ts/index.ts
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								ts/index.ts
									
									
									
									
									
								
							| @@ -4,50 +4,50 @@ let grayMatter = require('gray-matter') | ||||
| export type TFrontMatter = 'yaml' | 'json' | ||||
|  | ||||
| export interface IParsedFM { | ||||
|     data: any | ||||
|     content: string | ||||
|     orig: string | ||||
|   data: any | ||||
|   content: string | ||||
|   orig: string | ||||
| } | ||||
|  | ||||
| export interface ISmartfmContructorOptions { | ||||
|     fmType: TFrontMatter | ||||
|   fmType: TFrontMatter | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * class smartfm handles frontmatter | ||||
|  */ | ||||
| export class Smartfm { | ||||
|     fmType: TFrontMatter | ||||
|   fmType: TFrontMatter | ||||
|  | ||||
|     constructor(optionsArg: ISmartfmContructorOptions) { | ||||
|         this.fmType = optionsArg.fmType | ||||
|     } | ||||
|   constructor(optionsArg: ISmartfmContructorOptions) { | ||||
|     this.fmType = optionsArg.fmType | ||||
|   } | ||||
|  | ||||
|     /** | ||||
|      * add frontmatter to a string | ||||
|      */ | ||||
|     stringify(bodyString: string, frontmatterData: any) { | ||||
|         return stringify(bodyString, frontmatterData) | ||||
|     } | ||||
|   /** | ||||
|    * add frontmatter to a string | ||||
|    */ | ||||
|   stringify(bodyString: string, frontmatterData: any) { | ||||
|     return stringify(bodyString, frontmatterData) | ||||
|   } | ||||
|  | ||||
|     /** | ||||
|      * parse a string that has frontmatter attached, YAML notation | ||||
|      */ | ||||
|     parse(stringToParse: string): IParsedFM { | ||||
|         return parse(stringToParse) | ||||
|     } | ||||
|   /** | ||||
|    * parse a string that has frontmatter attached, YAML notation | ||||
|    */ | ||||
|   parse(stringToParse: string): IParsedFM { | ||||
|     return parse(stringToParse) | ||||
|   } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * parse a string that has frontmatter attached, YAML notation | ||||
|  */ | ||||
| export let parse = (stringToParse: string): IParsedFM => { | ||||
|     return grayMatter(stringToParse) | ||||
|   return grayMatter(stringToParse) | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * add frontmatter to a string | ||||
|  */ | ||||
| export let stringify = (bodyString: string, frontmatterData: any) => { | ||||
|     return grayMatter.stringify(bodyString, frontmatterData) | ||||
|   return grayMatter.stringify(bodyString, frontmatterData) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user