38 Commits

Author SHA1 Message Date
0040d714ef 3.0.0 2022-08-07 16:45:39 +02:00
084954b210 BREAKING CHANGE(core): switch to esm 2022-08-07 16:45:38 +02:00
1d6cc3833d 2.0.12 2021-05-17 15:49:47 +00:00
034c99151d fix(core): update 2021-05-17 15:49:46 +00:00
0c2b543d34 2.0.11 2021-05-17 12:37:02 +00:00
a0702190f7 fix(core): update 2021-05-17 12:37:01 +00:00
dedd7135f5 update 2021-05-17 12:36:21 +00:00
f84280d330 update 2021-05-17 12:36:15 +00:00
b0a2ebe470 2.0.10 2021-03-27 15:07:02 +00:00
1ab3432325 fix(core): update 2021-03-27 15:07:02 +00:00
c6a09e5f40 2.0.9 2020-01-12 18:54:10 +00:00
099d331fa7 fix(core): update 2020-01-12 18:54:09 +00:00
e6f9459fc8 2.0.8 2019-10-26 23:36:13 +02:00
d25fe85fcd fix(core): update 2019-10-26 23:36:13 +02:00
5ef057e31f 2.0.7 2019-02-17 17:04:32 +01:00
494cb72d78 fix(core): update 2019-02-17 17:04:31 +01:00
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
13 changed files with 14406 additions and 44 deletions

20
.gitignore vendored Normal file
View File

@@ -0,0 +1,20 @@
.nogit/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@@ -1,59 +1,128 @@
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
before_script:
- npm install -g @shipzone/npmci
# ====================
# security stage
# ====================
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci test legacy
- npmci npm prepare
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
allow_failure: true
testLTS:
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
allow_failure: true
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci test lts
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
testBuild:
stage: test
script:
- npmci test stable
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci publish
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g typescript
- npmci npm prepare
- npmci npm install
tags:
- lossless
- docker
- priv
trigger:
stage: trigger
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmpage
stage: pages
stage: metadata
script:
- npmci command npmpage --host gitlab
- npmci node install stable
- npmci npm prepare
- npmci npm install
- npmci command npm run buildDocs
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

11
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@@ -1,15 +0,0 @@
# tlt
templates done right
## Usage
We recommend the use of TypeScript for best in class Intellisense
```javascript
import * as tlt from 'tlt
let myTlt = new tlt('my template String for {{somePlaceholder}} and {{anotherPlaceholder}}')
myTlt.getStringFor({
"somePlaceholder": "pushrocks",
"anotherPlaceholder": "anotherPlaceholder"
})
```

16
npmextra.json Normal file
View File

@@ -0,0 +1,16 @@
{
"npmci": {
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartmustache",
"description": "templates done right",
"npmPackagename": "@pushrocks/smartmustache",
"license": "MIT"
}
}
}

14102
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,15 @@
{
"name": "tlt",
"version": "1.0.1",
"name": "@pushrocks/smartmustache",
"version": "3.0.0",
"description": "templates done right",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"private": false,
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"scripts": {
"test": "(npmts)"
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)",
"buildDocs": "tsdoc"
},
"repository": {
"type": "git",
@@ -19,5 +23,29 @@
"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.7"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.65",
"@gitzone/tsrun": "^1.2.37",
"@gitzone/tstest": "^1.0.73",
"@pushrocks/tapbundle": "^5.0.4"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

51
readme.md Normal file
View File

@@ -0,0 +1,51 @@
# @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
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartmustache/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartmustache/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartmustache)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartmustache)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartmustache)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartmustache)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartmustache)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage
Use TypeScript for best in class instellisense.
```javascript
import { SmartMustache } from '@pushrocks/smartmustache';
const mySmartmustache = new SmartMustache('my {{somePlaceholder}} are {{anotherPlaceholder}}!');
const appliedString = myTlt.applyData({
somePlaceholder: 'horses',
anotherPlaceholder: 'awesome',
});
// appliedString will be 'my horses are awesome!'
```
## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
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)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

20
test/test.ts Normal file
View File

@@ -0,0 +1,20 @@
import { tap, expect } from '@pushrocks/tapbundle';
import * as tlt from '../ts/index.js';
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).toBeInstanceOf(tlt.SmartMustache);
});
tap.test('should output a valid string with some data', async () => {
let appliedString = testMustache.applyData({
customString: 'horse',
license: 'MIT',
});
expect(appliedString).toEqual('some awesome horse that is MIT licensed');
});
tap.start();

8
ts/00_commitinfo_data.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartmustache',
version: '3.0.0',
description: 'templates done right'
}

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);
}
}

View File

@@ -1,3 +0,0 @@
{
"extends": "tslint-config-standard"
}