add ci
This commit is contained in:
parent
e49fb5352c
commit
a1068832f0
63
.gitlab-ci.yml
Normal file
63
.gitlab-ci.yml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
# gitzone standard
|
||||||
|
image: hosttoday/ht-docker-node:npmts
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- test
|
||||||
|
- release
|
||||||
|
- trigger
|
||||||
|
- pages
|
||||||
|
|
||||||
|
testLEGACY:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test legacy
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
testLTS:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test lts
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
testSTABLE:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci test stable
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
script:
|
||||||
|
- npmci publish
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
stage: trigger
|
||||||
|
script:
|
||||||
|
- npmci trigger
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
pages:
|
||||||
|
image: hosttoday/ht-docker-node:npmpage
|
||||||
|
stage: pages
|
||||||
|
script:
|
||||||
|
- npmci command npmpage --publish gitlab
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
paths:
|
||||||
|
- public
|
2
dist/index.js
vendored
2
dist/index.js
vendored
@ -49,4 +49,4 @@ exports.getTemplateForFile = (filePathArg) => __awaiter(this, void 0, void 0, fu
|
|||||||
let filePathAbsolute = path.resolve(filePathArg);
|
let filePathAbsolute = path.resolve(filePathArg);
|
||||||
return handlebars.compile(smartfile.fs.toStringSync(filePathAbsolute));
|
return handlebars.compile(smartfile.fs.toStringSync(filePathAbsolute));
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSwwQkFBdUI7QUFDdkIseUNBQXdDO0FBQ3hDLHVDQUFzQztBQUN0Qyw2QkFBNEI7QUFHNUI7O0dBRUc7QUFDUSxRQUFBLGtCQUFrQixHQUFHLENBQUMsVUFBa0I7SUFDL0MsU0FBUyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsVUFBVSxFQUFFLFVBQVUsQ0FBQyxDQUFDLElBQUksQ0FBQyxlQUFlO1FBQ2xFLEdBQUcsQ0FBQyxDQUFDLElBQUksV0FBVyxJQUFJLGVBQWUsQ0FBQyxDQUFDLENBQUM7WUFDdEMsSUFBSSxVQUFVLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQTtZQUN4QyxJQUFJLGFBQWEsR0FBRyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFVBQVUsRUFBRSxXQUFXLENBQUMsQ0FBQyxDQUFBO1lBQ2pGLEVBQUUsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxHQUFHLEtBQUssRUFBRSxDQUFDLENBQUMsQ0FBQztnQkFDeEIsVUFBVSxDQUFDLElBQUksR0FBRyxHQUFHLEdBQUcsVUFBVSxDQUFDLElBQUksQ0FBQTtZQUMzQyxDQUFDO1lBQ0QsSUFBSSxXQU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N4QyxJQUFJLGFBQWEsR0FBRyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLGdCQUFnQixFQUFFLFdBQVcsQ0FBQyxDQUFDLENBQUE7UUFDdkYsSUFBSSxRQUFRLEdBQUcsVUFBVSxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsQ0FBQTtRQUNoRCxJQUFJLE1BQU0sR0FBRyxRQUFRLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDM0IsT0FBTyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEdBQUcsTUFBTSxHQUFHLEtBQUssQ0FBQyxDQUFBO1FBQ25DLFNBQVMsQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLE1BQU0sRUFBRSxJQUFJLENBQUMsSUFBSSxDQUFDLHFCQUFxQixFQUFFLFVBQVUsQ0FBQyxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQTtJQUNoRyxDQUFDO0FBQ0gsQ0FBQyxDQUFBLENBQUE7QUFFRDs7R0FFRztBQUNRLFFBQUEsa0JBQWtCLEdBQUcsQ0FBTyxXQUFtQjtJQUN4RCxJQUFJLGdCQUFnQixHQUFHLElBQUksQ0FBQyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUE7SUFDaEQsTUFBTSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxDQUFBO0FBQ3hFLENBQUMsQ0FBQSxDQUFBIn0=
|
52
ts/index.ts
52
ts/index.ts
@ -8,43 +8,43 @@ export type TTemplateStringType = 'filePath' | 'code'
|
|||||||
* registers a directory of partials to make them available within handlebars compilation
|
* registers a directory of partials to make them available within handlebars compilation
|
||||||
*/
|
*/
|
||||||
export let registerPartialDir = (dirPathArg: string) => {
|
export let registerPartialDir = (dirPathArg: string) => {
|
||||||
smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
|
smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
|
||||||
for (let hbsFilePath of hbsFileArrayArg) {
|
for (let hbsFilePath of hbsFileArrayArg) {
|
||||||
let parsedPath = path.parse(hbsFilePath)
|
let parsedPath = path.parse(hbsFilePath)
|
||||||
let hbsFileString = smartfile.fs.toStringSync(path.join(dirPathArg, hbsFilePath))
|
let hbsFileString = smartfile.fs.toStringSync(path.join(dirPathArg, hbsFilePath))
|
||||||
if (parsedPath.dir === '') {
|
if (parsedPath.dir === '') {
|
||||||
parsedPath.name = '/' + parsedPath.name
|
parsedPath.name = '/' + parsedPath.name
|
||||||
}
|
}
|
||||||
let partialName = `partials${parsedPath.dir}${parsedPath.name}`
|
let partialName = `partials${parsedPath.dir}${parsedPath.name}`
|
||||||
handlebars.registerPartial(partialName, hbsFileString)
|
handlebars.registerPartial(partialName, hbsFileString)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compiles a directory and outputs it
|
* compiles a directory and outputs it
|
||||||
*/
|
*/
|
||||||
export let compileDirectory = async (
|
export let compileDirectory = async (
|
||||||
originDirPathArg: string,
|
originDirPathArg: string,
|
||||||
destinationDirPathArg: string,
|
destinationDirPathArg: string,
|
||||||
dataFileNameArg: string
|
dataFileNameArg: string
|
||||||
) => {
|
) => {
|
||||||
let hbsFilePathArray = smartfile.fs.listFilesSync(originDirPathArg, /.hbs/)
|
let hbsFilePathArray = smartfile.fs.listFilesSync(originDirPathArg, /.hbs/)
|
||||||
let data = smartfile.fs.toObjectSync(path.join(originDirPathArg, dataFileNameArg))
|
let data = smartfile.fs.toObjectSync(path.join(originDirPathArg, dataFileNameArg))
|
||||||
for(let hbsFilePath of hbsFilePathArray) {
|
for (let hbsFilePath of hbsFilePathArray) {
|
||||||
let parsedPath = path.parse(hbsFilePath)
|
let parsedPath = path.parse(hbsFilePath)
|
||||||
let hbsFileString = smartfile.fs.toStringSync(path.join(originDirPathArg, hbsFilePath))
|
let hbsFileString = smartfile.fs.toStringSync(path.join(originDirPathArg, hbsFilePath))
|
||||||
let template = handlebars.compile(hbsFileString)
|
let template = handlebars.compile(hbsFileString)
|
||||||
let output = template(data)
|
let output = template(data)
|
||||||
console.log('hi ' + output + ' hi')
|
console.log('hi ' + output + ' hi')
|
||||||
smartfile.memory.toFsSync(output, path.join(destinationDirPathArg, parsedPath.name + '.html'))
|
smartfile.memory.toFsSync(output, path.join(destinationDirPathArg, parsedPath.name + '.html'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a template for a file on disk
|
* get a template for a file on disk
|
||||||
*/
|
*/
|
||||||
export let getTemplateForFile = async (filePathArg: string) => {
|
export let getTemplateForFile = async (filePathArg: string) => {
|
||||||
let filePathAbsolute = path.resolve(filePathArg)
|
let filePathAbsolute = path.resolve(filePathArg)
|
||||||
return handlebars.compile(smartfile.fs.toStringSync(filePathAbsolute))
|
return handlebars.compile(smartfile.fs.toStringSync(filePathAbsolute))
|
||||||
}
|
}
|
||||||
|
3
tslint.json
Normal file
3
tslint.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "tslint-config-standard"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user