Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c6a09e5f40 | |||
| 099d331fa7 | |||
| e6f9459fc8 | |||
| d25fe85fcd | |||
| 5ef057e31f | |||
| 494cb72d78 | |||
| 7b27b231ff | |||
| bd9ac0ab46 | |||
| 1c53edca7d | |||
| 6b279824fb | |||
| c06b8e6a18 | |||
| a707dff92d | |||
| 7bad738cb1 | |||
| 0e5db8f6b4 | |||
| deadd463de | |||
| e783dcb1f8 | |||
|
|
62cacffe61 | ||
|
|
df76935a52 | ||
| f078653846 | |||
| 50d70eaece | |||
| 452f086d84 | |||
| 0113d8ea19 | |||
| a5a8f5ae24 | |||
| 01ad44078c | |||
| f846505fab | |||
| 6e5e1bb631 | |||
| de578b3123 | |||
| 450ee5162c |
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
.nogit/
|
||||
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
|
||||
# caches
|
||||
.yarn/
|
||||
.cache/
|
||||
.rpt2_cache
|
||||
|
||||
# builds
|
||||
dist/
|
||||
dist_web/
|
||||
dist_serve/
|
||||
dist_ts_web/
|
||||
|
||||
# custom
|
||||
@@ -1,59 +1,118 @@
|
||||
image: hosttoday/ht-docker-node:npmts
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: "$CI_BUILD_STAGE"
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- trigger
|
||||
- pages
|
||||
- metadata
|
||||
|
||||
testLEGACY:
|
||||
stage: test
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci test legacy
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- docker
|
||||
allow_failure: true
|
||||
- notpriv
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
snyk:
|
||||
stage: security
|
||||
script:
|
||||
- npmci test lts
|
||||
- npmci npm prepare
|
||||
- npmci command npm install -g snyk
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command snyk test
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testSTABLE:
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci test stable
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
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:
|
||||
stage: release
|
||||
script:
|
||||
- npmci publish
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
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
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci command npmpage --host gitlab
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
allow_failure: true
|
||||
|
||||
4
.snyk
Normal file
4
.snyk
Normal file
@@ -0,0 +1,4 @@
|
||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
|
||||
version: v1.13.3
|
||||
ignore: {}
|
||||
patch: {}
|
||||
41
README.md
41
README.md
@@ -1,15 +1,40 @@
|
||||
# tlt
|
||||
# @pushrocks/smartmustache
|
||||
templates done right
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartmustache)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartmustache)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/smartmustache)
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartmustache/)
|
||||
|
||||
## Status for master
|
||||
[](https://gitlab.com/pushrocks/smartmustache/commits/master)
|
||||
[](https://gitlab.com/pushrocks/smartmustache/commits/master)
|
||||
[](https://www.npmjs.com/package/@pushrocks/smartmustache)
|
||||
[](https://snyk.io/test/npm/@pushrocks/smartmustache)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
[](https://prettier.io/)
|
||||
|
||||
## 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 { SmartMustache } from '@pushrocks/smartmustache';
|
||||
|
||||
let myTlt = new tlt('my template String for {{somePlaceholder}} and {{anotherPlaceholder}}')
|
||||
myTlt.getStringFor({
|
||||
"somePlaceholder": "pushrocks",
|
||||
"anotherPlaceholder": "anotherPlaceholder"
|
||||
})
|
||||
const mySmartmustache = new SmartMustache('my {{somePlaceholder}} are {{anotherPlaceholder}}!');
|
||||
const 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)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
||||
15
npmextra.json
Normal file
15
npmextra.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"npmci": {
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"gitzone": {
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "pushrocks",
|
||||
"gitrepo": "smartmustache",
|
||||
"shortDescription": "templates done right",
|
||||
"npmPackagename": "@pushrocks/smartmustache",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
1576
package-lock.json
generated
Normal file
1576
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@@ -1,11 +1,13 @@
|
||||
{
|
||||
"name": "tlt",
|
||||
"version": "1.0.1",
|
||||
"name": "@pushrocks/smartmustache",
|
||||
"version": "2.0.9",
|
||||
"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,25 @@
|
||||
"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.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.17",
|
||||
"@gitzone/tsrun": "^1.2.8",
|
||||
"@gitzone/tstest": "^1.0.28",
|
||||
"@pushrocks/tapbundle": "^3.2.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
"ts_web/**/*",
|
||||
"dist/**/*",
|
||||
"dist_web/**/*",
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
]
|
||||
}
|
||||
|
||||
20
test/test.ts
Normal file
20
test/test.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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
29
ts/index.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
16
tslint.json
16
tslint.json
@@ -1,3 +1,17 @@
|
||||
{
|
||||
"extends": "tslint-config-standard"
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user