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