22 Commits

Author SHA1 Message Date
7b27b231ff 2.0.6 2019-02-17 16:56:18 +01:00
bd9ac0ab46 fix(security): add snyk 2019-02-17 16:56:18 +01:00
1c53edca7d 2.0.5 2019-02-17 16:55:08 +01:00
6b279824fb fix(core): update 2019-02-17 16:55:07 +01:00
c06b8e6a18 2.0.4 2018-09-15 12:43:01 +02:00
a707dff92d fix(structure): fix internal naming 2018-09-15 12:43:01 +02:00
7bad738cb1 2.0.3 2018-09-15 01:31:22 +02:00
0e5db8f6b4 fix(core): update 2018-09-15 01:31:22 +02:00
deadd463de 2.0.2 2018-09-15 01:19:54 +02:00
e783dcb1f8 fix(core): update 2018-09-15 01:19:54 +02:00
Phil Kunz
62cacffe61 Merge branch 'master' into 'master'
Master

See merge request pushrocks/tlt!1
2018-09-14 21:02:17 +00:00
Phil Kunz
df76935a52 Master 2018-09-14 21:02:17 +00:00
f078653846 update 2018-09-14 10:12:37 +02:00
50d70eaece update gitlab yml 2017-02-25 23:41:06 +01:00
452f086d84 1.0.5 2017-02-25 23:40:22 +01:00
0113d8ea19 update to handlebars 2017-02-25 23:40:15 +01:00
a5a8f5ae24 1.0.4 2016-11-20 17:54:39 +01:00
01ad44078c improve README 2016-11-20 17:54:13 +01:00
f846505fab 1.0.3 2016-11-20 17:45:12 +01:00
6e5e1bb631 improve README 2016-11-20 17:44:56 +01:00
de578b3123 1.0.2 2016-11-20 17:41:53 +01:00
450ee5162c initial 2016-11-20 17:41:26 +01:00
9 changed files with 1673 additions and 30 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
node_modules/
coverage/
public/
pages/

View File

@@ -1,59 +1,142 @@
image: hosttoday/ht-docker-node:npmts
# gitzone standard
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- trigger
- pages
- metadata
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
snyk:
stage: security
script:
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
# ====================
# test stage
# ====================
testLEGACY:
stage: test
script:
- npmci test legacy
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
stage: test
script:
- npmci test stable
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
release:
stage: release
script:
- npmci publish
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- docker
- notpriv
# ====================
# metadata stage
# ====================
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]
tags:
- docker
- priv
trigger:
stage: trigger
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmpage
stage: pages
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npmpage --host gitlab
- npmci command npm install -g typedoc typescript
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true
windowsCompatibility:
image: stefanscherer/node-windows:10-build-tools
stage: metadata
script:
- npm install & npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- windows
allow_failure: true

4
.snyk Normal file
View File

@@ -0,0 +1,4 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.3
ignore: {}
patch: {}

View File

@@ -1,15 +1,41 @@
# tlt
templates done right
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/tlt)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/tlt)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/tlt)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/tlt/)
## Status for master
[![build status](https://GitLab.com/pushrocks/tlt/badges/master/build.svg)](https://GitLab.com/pushrocks/tlt/commits/master)
[![coverage report](https://GitLab.com/pushrocks/tlt/badges/master/coverage.svg)](https://GitLab.com/pushrocks/tlt/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/tlt.svg)](https://www.npmjs.com/package/tlt)
[![Dependency Status](https://david-dm.org/pushrocks/tlt.svg)](https://david-dm.org/pushrocks/tlt)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/tlt/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/tlt/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/tlt/badges/code.svg)](https://www.bithound.io/github/pushrocks/tlt)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
We recommend the use of TypeScript for best in class Intellisense
Use TypeScript for best in class instellisense.
```javascript
import * as tlt from 'tlt
import { Tlt } from 'tlt'
let myTlt = new tlt('my template String for {{somePlaceholder}} and {{anotherPlaceholder}}')
myTlt.getStringFor({
"somePlaceholder": "pushrocks",
"anotherPlaceholder": "anotherPlaceholder"
let myTlt = new Tlt('my {{somePlaceholder}} are {{anotherPlaceholder}}!')
let appliedString = myTlt.applyData({
"somePlaceholder": "horses",
"anotherPlaceholder": "awesome"
})
// appliedString will be 'my horses are awesome!'
```
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.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

5
npmextra.json Normal file
View File

@@ -0,0 +1,5 @@
{
"npmci": {
"npmAccessLevel": "public"
}
}

1463
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,13 @@
{
"name": "tlt",
"version": "1.0.1",
"name": "@pushrocks/smartmustache",
"version": "2.0.6",
"description": "templates done right",
"private": false,
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)"
"test": "(tstest test/)",
"build": "(tsbuild)"
},
"repository": {
"type": "git",
@@ -19,5 +21,14 @@
"bugs": {
"url": "https://gitlab.com/pushrocks/tlt/issues"
},
"homepage": "https://gitlab.com/pushrocks/tlt#README"
"homepage": "https://gitlab.com/pushrocks/tlt#README",
"dependencies": {
"handlebars": "^4.1.0"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.8",
"@gitzone/tsrun": "^1.1.17",
"@gitzone/tstest": "^1.0.18",
"@pushrocks/tapbundle": "^3.0.7"
}
}

18
test/test.ts Normal file
View File

@@ -0,0 +1,18 @@
import { tap, expect } from '@pushrocks/tapbundle';
import * as tlt from '../ts/index';
let testMustache: tlt.SmartMustache;
tap.test('should create a valid instance of tlt', async () => {
testMustache = new tlt.SmartMustache('some awesome {{customString}} that is {{license}} licensed');
expect(testMustache).to.be.instanceOf(tlt.SmartMustache);
});
tap.test('should output a valid string with some data', async () => {
let appliedString = testMustache.applyData({
customString: 'horse',
license: 'MIT'
});
expect(appliedString).to.equal('some awesome horse that is MIT licensed');
});
tap.start();

29
ts/index.ts Normal file
View File

@@ -0,0 +1,29 @@
import * as handlebars from 'handlebars';
/**
* class Tlt allows templates to be used with different sets of data
*/
export class SmartMustache {
template: any;
/**
* constructor of class Tlt
*/
constructor(templateStringArg: string) {
this.template = handlebars.compile(templateStringArg);
}
/**
* returns template string with data applied
*/
applyData(data: any): string {
return this.template(data);
}
/**
* set a new template string
*/
setTemplate(templateStringArg: string) {
this.template = handlebars.compile(templateStringArg);
}
}