fix(core): update
This commit is contained in:
		
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -15,8 +15,6 @@ node_modules/
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# builds
 | 
					# builds
 | 
				
			||||||
dist/
 | 
					dist/
 | 
				
			||||||
dist_web/
 | 
					dist_*/
 | 
				
			||||||
dist_serve/
 | 
					 | 
				
			||||||
dist_ts_web/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# custom
 | 
					# custom
 | 
				
			||||||
@@ -4,7 +4,7 @@ image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
 | 
				
			|||||||
cache:
 | 
					cache:
 | 
				
			||||||
  paths:
 | 
					  paths:
 | 
				
			||||||
    - .npmci_cache/
 | 
					    - .npmci_cache/
 | 
				
			||||||
  key: "$CI_BUILD_STAGE"
 | 
					  key: '$CI_BUILD_STAGE'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
stages:
 | 
					stages:
 | 
				
			||||||
  - security
 | 
					  - security
 | 
				
			||||||
@@ -12,27 +12,35 @@ stages:
 | 
				
			|||||||
  - release
 | 
					  - release
 | 
				
			||||||
  - metadata
 | 
					  - metadata
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					before_script:
 | 
				
			||||||
 | 
					  - npm install -g @shipzone/npmci
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ====================
 | 
					# ====================
 | 
				
			||||||
# security stage
 | 
					# security stage
 | 
				
			||||||
# ====================
 | 
					# ====================
 | 
				
			||||||
mirror:
 | 
					auditProductionDependencies:
 | 
				
			||||||
  stage: security
 | 
					  image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
 | 
				
			||||||
  script:
 | 
					 | 
				
			||||||
  - npmci git mirror
 | 
					 | 
				
			||||||
  tags:
 | 
					 | 
				
			||||||
  - docker
 | 
					 | 
				
			||||||
  - notpriv
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
snyk:
 | 
					 | 
				
			||||||
  stage: security
 | 
					  stage: security
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npmci npm prepare
 | 
					    - npmci npm prepare
 | 
				
			||||||
    - npmci command npm install -g snyk
 | 
					    - npmci command npm install --production --ignore-scripts
 | 
				
			||||||
    - npmci command npm install --ignore-scripts
 | 
					    - npmci command npm config set registry https://registry.npmjs.org
 | 
				
			||||||
    - npmci command snyk test
 | 
					    - npmci command npm audit --audit-level=high --only=prod --production
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
  - notpriv
 | 
					  allow_failure: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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
 | 
					# test stage
 | 
				
			||||||
@@ -48,7 +56,6 @@ testStable:
 | 
				
			|||||||
  coverage: /\d+.?\d+?\%\s*coverage/
 | 
					  coverage: /\d+.?\d+?\%\s*coverage/
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
  - priv
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
testBuild:
 | 
					testBuild:
 | 
				
			||||||
  stage: test
 | 
					  stage: test
 | 
				
			||||||
@@ -60,7 +67,6 @@ testBuild:
 | 
				
			|||||||
  coverage: /\d+.?\d+?\%\s*coverage/
 | 
					  coverage: /\d+.?\d+?\%\s*coverage/
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
  - notpriv
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
release:
 | 
					release:
 | 
				
			||||||
  stage: release
 | 
					  stage: release
 | 
				
			||||||
@@ -70,6 +76,7 @@ release:
 | 
				
			|||||||
  only:
 | 
					  only:
 | 
				
			||||||
    - tags
 | 
					    - tags
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
 | 
					    - lossless
 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
    - notpriv
 | 
					    - notpriv
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -79,11 +86,14 @@ release:
 | 
				
			|||||||
codequality:
 | 
					codequality:
 | 
				
			||||||
  stage: metadata
 | 
					  stage: metadata
 | 
				
			||||||
  allow_failure: true
 | 
					  allow_failure: true
 | 
				
			||||||
 | 
					  only:
 | 
				
			||||||
 | 
					    - tags
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npmci command npm install -g tslint typescript
 | 
					    - npmci command npm install -g typescript
 | 
				
			||||||
 | 
					    - npmci npm prepare
 | 
				
			||||||
    - npmci npm install
 | 
					    - npmci npm install
 | 
				
			||||||
    - npmci command "tslint -c tslint.json ./ts/**/*.ts"
 | 
					 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
 | 
					    - lossless
 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
    - priv
 | 
					    - priv
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -94,20 +104,19 @@ trigger:
 | 
				
			|||||||
  only:
 | 
					  only:
 | 
				
			||||||
    - tags
 | 
					    - tags
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
 | 
					    - lossless
 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
    - notpriv
 | 
					    - notpriv
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pages:
 | 
					pages:
 | 
				
			||||||
  image: hosttoday/ht-docker-dbase:npmci
 | 
					 | 
				
			||||||
  services:
 | 
					 | 
				
			||||||
   - docker:stable-dind
 | 
					 | 
				
			||||||
  stage: metadata
 | 
					  stage: metadata
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - npmci command npm install -g @gitzone/tsdoc
 | 
					    - npmci node install stable 
 | 
				
			||||||
    - npmci npm prepare
 | 
					    - npmci npm prepare
 | 
				
			||||||
    - npmci npm install
 | 
					    - npmci npm install
 | 
				
			||||||
    - npmci command tsdoc
 | 
					    - npmci command npm run buildDocs
 | 
				
			||||||
  tags:
 | 
					  tags:
 | 
				
			||||||
 | 
					    - lossless
 | 
				
			||||||
    - docker
 | 
					    - docker
 | 
				
			||||||
    - notpriv
 | 
					    - notpriv
 | 
				
			||||||
  only:
 | 
					  only:
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								.snyk
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								.snyk
									
									
									
									
									
								
							@@ -1,4 +0,0 @@
 | 
				
			|||||||
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
 | 
					 | 
				
			||||||
version: v1.13.3
 | 
					 | 
				
			||||||
ignore: {}
 | 
					 | 
				
			||||||
patch: {}
 | 
					 | 
				
			||||||
							
								
								
									
										11
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
										Normal 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
									
								
							
							
						
						
									
										26
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal 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"]
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										40
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								README.md
									
									
									
									
									
								
							@@ -1,40 +0,0 @@
 | 
				
			|||||||
# @pushrocks/smarthbs
 | 
					 | 
				
			||||||
handlebars with better fs support
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Availabililty and Links
 | 
					 | 
				
			||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smarthbs)
 | 
					 | 
				
			||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smarthbs)
 | 
					 | 
				
			||||||
* [github.com (source mirror)](https://github.com/pushrocks/smarthbs)
 | 
					 | 
				
			||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smarthbs/)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Status for master
 | 
					 | 
				
			||||||
[](https://gitlab.com/pushrocks/smarthbs/commits/master)
 | 
					 | 
				
			||||||
[](https://gitlab.com/pushrocks/smarthbs/commits/master)
 | 
					 | 
				
			||||||
[](https://www.npmjs.com/package/@pushrocks/smarthbs)
 | 
					 | 
				
			||||||
[](https://snyk.io/test/npm/@pushrocks/smarthbs)
 | 
					 | 
				
			||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
 | 
					 | 
				
			||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
 | 
					 | 
				
			||||||
[](https://prettier.io/)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Usage
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> Note: Why did we decide against a class based architecture?  
 | 
					 | 
				
			||||||
> Easy: handlebars.js is already pretty determined how things are handled internally, namely a global partial template registry
 | 
					 | 
				
			||||||
> It doesn't make sense to then introduce a scoped partial template approach.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```javascript
 | 
					 | 
				
			||||||
import * as smarthbs from 'smarthbs';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// read all .hbs files in a directory and any child directories and use relative path as partial string identifier
 | 
					 | 
				
			||||||
smarthbs.registerPartialDir(testPartialDir);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// read all .hbs files in a particular directory and level, output them to a destination and specify a .json file to read any referenced data
 | 
					 | 
				
			||||||
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json');
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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)
 | 
					 | 
				
			||||||
@@ -4,11 +4,12 @@
 | 
				
			|||||||
    "npmAccessLevel": "public"
 | 
					    "npmAccessLevel": "public"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "gitzone": {
 | 
					  "gitzone": {
 | 
				
			||||||
 | 
					    "projectType": "npm",
 | 
				
			||||||
    "module": {
 | 
					    "module": {
 | 
				
			||||||
      "githost": "gitlab.com",
 | 
					      "githost": "gitlab.com",
 | 
				
			||||||
      "gitscope": "pushrocks",
 | 
					      "gitscope": "pushrocks",
 | 
				
			||||||
      "gitrepo": "smarthbs",
 | 
					      "gitrepo": "smarthbs",
 | 
				
			||||||
      "shortDescription": "handlebars with better fs support",
 | 
					      "description": "handlebars with better fs support",
 | 
				
			||||||
      "npmPackagename": "@pushrocks/smarthbs",
 | 
					      "npmPackagename": "@pushrocks/smarthbs",
 | 
				
			||||||
      "license": "MIT"
 | 
					      "license": "MIT"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										14404
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										14404
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										41
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								package.json
									
									
									
									
									
								
							@@ -3,11 +3,12 @@
 | 
				
			|||||||
  "version": "2.0.8",
 | 
					  "version": "2.0.8",
 | 
				
			||||||
  "private": false,
 | 
					  "private": false,
 | 
				
			||||||
  "description": "handlebars with better fs support",
 | 
					  "description": "handlebars with better fs support",
 | 
				
			||||||
  "main": "dist/index.js",
 | 
					  "main": "dist_ts/index.js",
 | 
				
			||||||
  "typings": "dist/index.d.ts",
 | 
					  "typings": "dist_ts/index.d.ts",
 | 
				
			||||||
 | 
					  "type": "module",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "test": "(tstest test/)",
 | 
					    "test": "(tstest test/)",
 | 
				
			||||||
    "build": "(tsbuild)"
 | 
					    "build": "(tsbuild --allowimplicitany)"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "repository": {
 | 
					  "repository": {
 | 
				
			||||||
    "type": "git",
 | 
					    "type": "git",
 | 
				
			||||||
@@ -23,27 +24,33 @@
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  "homepage": "https://gitlab.com/pkunz/smarthbs#README",
 | 
					  "homepage": "https://gitlab.com/pkunz/smarthbs#README",
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
    "@pushrocks/smartfile": "^7.0.4",
 | 
					    "@pushrocks/smartfile": "^10.0.2",
 | 
				
			||||||
    "@pushrocks/smartpromise": "^3.0.2",
 | 
					    "@pushrocks/smartpath": "^5.0.5",
 | 
				
			||||||
    "handlebars": "^4.2.0",
 | 
					    "@pushrocks/smartpromise": "^3.1.7",
 | 
				
			||||||
 | 
					    "@types/lodash.uniq": "^4.5.7",
 | 
				
			||||||
 | 
					    "handlebars": "^4.7.7",
 | 
				
			||||||
    "lodash.uniq": "^4.5.0"
 | 
					    "lodash.uniq": "^4.5.0"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@gitzone/tsbuild": "^2.1.17",
 | 
					    "@gitzone/tsbuild": "^2.1.63",
 | 
				
			||||||
    "@gitzone/tsrun": "^1.2.8",
 | 
					    "@gitzone/tsrun": "^1.2.37",
 | 
				
			||||||
    "@gitzone/tstest": "^1.0.24",
 | 
					    "@gitzone/tstest": "^1.0.72",
 | 
				
			||||||
    "@pushrocks/tapbundle": "^3.0.13",
 | 
					    "@pushrocks/tapbundle": "^5.0.4",
 | 
				
			||||||
    "@types/node": "^12.7.4"
 | 
					    "@types/node": "^18.0.6"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "files": [
 | 
					  "files": [
 | 
				
			||||||
    "ts/*",
 | 
					    "ts/**/*",
 | 
				
			||||||
    "ts_web/*",
 | 
					    "ts_web/**/*",
 | 
				
			||||||
    "dist/*",
 | 
					    "dist/**/*",
 | 
				
			||||||
    "dist_web/*",
 | 
					    "dist_*/**/*",
 | 
				
			||||||
    "dist_ts_web/*",
 | 
					    "dist_ts/**/*",
 | 
				
			||||||
    "assets/*",
 | 
					    "dist_ts_web/**/*",
 | 
				
			||||||
 | 
					    "assets/**/*",
 | 
				
			||||||
    "cli.js",
 | 
					    "cli.js",
 | 
				
			||||||
    "npmextra.json",
 | 
					    "npmextra.json",
 | 
				
			||||||
    "readme.md"
 | 
					    "readme.md"
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "browserslist": [
 | 
				
			||||||
 | 
					    "last 1 chrome versions"
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										26
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								test/test.ts
									
									
									
									
									
								
							@@ -1,10 +1,14 @@
 | 
				
			|||||||
import { expect, tap } from '@pushrocks/tapbundle';
 | 
					import { expect, tap } from '@pushrocks/tapbundle';
 | 
				
			||||||
import * as smarthbs from '../ts/index';
 | 
					import * as smarthbs from '../ts/index.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import * as smartpath from '@pushrocks/smartpath';
 | 
				
			||||||
import * as path from 'path';
 | 
					import * as path from 'path';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let testHbsDir = path.join(__dirname, 'hbs_testfiles');
 | 
					const dirname = smartpath.get.dirnameFromImportMetaUrl(import.meta.url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					let testHbsDir = path.join(dirname, 'hbs_testfiles');
 | 
				
			||||||
let testPartialDir = path.join(testHbsDir, 'partials');
 | 
					let testPartialDir = path.join(testHbsDir, 'partials');
 | 
				
			||||||
let testResultDir = path.join(__dirname, 'testresult');
 | 
					let testResultDir = path.join(dirname, 'testresult');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tap.test('smarthbs -> should create partials', async () => {
 | 
					tap.test('smarthbs -> should create partials', async () => {
 | 
				
			||||||
  await smarthbs.registerPartialDir(testPartialDir);
 | 
					  await smarthbs.registerPartialDir(testPartialDir);
 | 
				
			||||||
@@ -17,8 +21,8 @@ tap.test('smarthbs -> should compile a directory', async () => {
 | 
				
			|||||||
tap.test('', async () => {
 | 
					tap.test('', async () => {
 | 
				
			||||||
  let templateString = '{{{firstVar}}} {{secondVar}}';
 | 
					  let templateString = '{{{firstVar}}} {{secondVar}}';
 | 
				
			||||||
  let templateVars = await smarthbs.findVarsInHbsString(templateString);
 | 
					  let templateVars = await smarthbs.findVarsInHbsString(templateString);
 | 
				
			||||||
  expect(templateVars).to.include('firstVar');
 | 
					  expect(templateVars).toContain('firstVar');
 | 
				
			||||||
  expect(templateVars).to.include('secondVar');
 | 
					  expect(templateVars).toContain('secondVar');
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tap.test('', async () => {
 | 
					tap.test('', async () => {
 | 
				
			||||||
@@ -29,12 +33,14 @@ tap.test('', async () => {
 | 
				
			|||||||
    secondVar: 'hello',
 | 
					    secondVar: 'hello',
 | 
				
			||||||
    fourthVar: {
 | 
					    fourthVar: {
 | 
				
			||||||
      otherKey: {
 | 
					      otherKey: {
 | 
				
			||||||
        nextKey: 'wow'
 | 
					        nextKey: 'wow',
 | 
				
			||||||
      }
 | 
					      },
 | 
				
			||||||
    }
 | 
					    },
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
  expect(missingVars).to.contain('thirdVar', 'fourthVar.someKey');
 | 
					  expect(missingVars).toContain('thirdVar');
 | 
				
			||||||
  expect(missingVars).to.not.contain('secondVar', 'fourthVar.otherKey.nextKey');
 | 
					  expect(missingVars).toContain('fourthVar.someKey');
 | 
				
			||||||
 | 
					  expect(missingVars).not.toContain('secondVar');
 | 
				
			||||||
 | 
					  expect(missingVars).not.toContain('fourthVar.otherKey.nextKey');
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tap.start();
 | 
					tap.start();
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								ts/00_commitinfo_data.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								ts/00_commitinfo_data.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * autocreated commitinfo by @pushrocks/commitinfo
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					export const commitinfo = {
 | 
				
			||||||
 | 
					  name: '@pushrocks/smarthbs',
 | 
				
			||||||
 | 
					  version: '2.0.9',
 | 
				
			||||||
 | 
					  description: 'handlebars with better fs support'
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								ts/index.ts
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								ts/index.ts
									
									
									
									
									
								
							@@ -1,10 +1,10 @@
 | 
				
			|||||||
import * as plugins from './smarthbs.plugins';
 | 
					import * as plugins from './smarthbs.plugins.js';
 | 
				
			||||||
export type TTemplateStringType = 'filePath' | 'code';
 | 
					export type TTemplateStringType = 'filePath' | 'code';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export let handlebars = plugins.handlebars;
 | 
					export let handlebars = plugins.handlebars;
 | 
				
			||||||
export * from './smarthbs.compile';
 | 
					export * from './smarthbs.compile.js';
 | 
				
			||||||
import './smarthbs.helpers';
 | 
					import './smarthbs.helpers.js';
 | 
				
			||||||
export * from './smarthbs.partials';
 | 
					export * from './smarthbs.partials.js';
 | 
				
			||||||
export * from './smarthbs.template';
 | 
					export * from './smarthbs.template.js';
 | 
				
			||||||
export * from './smarthbs.variables';
 | 
					export * from './smarthbs.variables.js';
 | 
				
			||||||
export * from './smarthbs.postprocess';
 | 
					export * from './smarthbs.postprocess.js';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import * as plugins from './smarthbs.plugins';
 | 
					import * as plugins from './smarthbs.plugins.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * compiles a directory and outputs it
 | 
					 * compiles a directory and outputs it
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,10 @@
 | 
				
			|||||||
import * as plugins from './smarthbs.plugins';
 | 
					import * as plugins from './smarthbs.plugins.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Helper:
 | 
					 * Helper:
 | 
				
			||||||
 * Allows you to analyze a context
 | 
					 * Allows you to analyze a context
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
plugins.handlebars.registerHelper('__analyze', analyzeContext => {
 | 
					plugins.handlebars.registerHelper('__analyze', (analyzeContext) => {
 | 
				
			||||||
  if (typeof analyzeContext === 'string') {
 | 
					  if (typeof analyzeContext === 'string') {
 | 
				
			||||||
    if (plugins.handlebars.partials[analyzeContext]) {
 | 
					    if (plugins.handlebars.partials[analyzeContext]) {
 | 
				
			||||||
      console.log(`The analyzed partial ${analyzeContext} looks like this`);
 | 
					      console.log(`The analyzed partial ${analyzeContext} looks like this`);
 | 
				
			||||||
@@ -20,7 +20,7 @@ plugins.handlebars.registerHelper('__analyze', analyzeContext => {
 | 
				
			|||||||
 * Helper:
 | 
					 * Helper:
 | 
				
			||||||
 * logs all registered partials to console
 | 
					 * logs all registered partials to console
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
plugins.handlebars.registerHelper('__allPartialsLog', analyzeContext => {
 | 
					plugins.handlebars.registerHelper('__allPartialsLog', (analyzeContext) => {
 | 
				
			||||||
  console.log(plugins.handlebars.partials);
 | 
					  console.log(plugins.handlebars.partials);
 | 
				
			||||||
  return 'analyzed';
 | 
					  return 'analyzed';
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,11 @@
 | 
				
			|||||||
import * as plugins from './smarthbs.plugins';
 | 
					import * as plugins from './smarthbs.plugins.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 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): Promise<any> => {
 | 
					export let registerPartialDir = (dirPathArg: string): Promise<any> => {
 | 
				
			||||||
  let done = plugins.smartpromise.defer();
 | 
					  let done = plugins.smartpromise.defer();
 | 
				
			||||||
  plugins.smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
 | 
					  plugins.smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then((hbsFileArrayArg) => {
 | 
				
			||||||
    for (let hbsFilePath of hbsFileArrayArg) {
 | 
					    for (let hbsFilePath of hbsFileArrayArg) {
 | 
				
			||||||
      let parsedPath = plugins.path.parse(hbsFilePath);
 | 
					      let parsedPath = plugins.path.parse(hbsFilePath);
 | 
				
			||||||
      let hbsFileString = plugins.smartfile.fs.toStringSync(
 | 
					      let hbsFileString = plugins.smartfile.fs.toStringSync(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
import * as handlebars from 'handlebars';
 | 
					import handlebars from 'handlebars';
 | 
				
			||||||
import lodashUniq from 'lodash.uniq';
 | 
					import lodashUniq from 'lodash.uniq';
 | 
				
			||||||
 | 
					import * as smartpath from '@pushrocks/smartpath';
 | 
				
			||||||
import * as path from 'path';
 | 
					import * as path from 'path';
 | 
				
			||||||
import * as smartfile from '@pushrocks/smartfile';
 | 
					import * as smartfile from '@pushrocks/smartfile';
 | 
				
			||||||
import * as smartpromise from '@pushrocks/smartpromise';
 | 
					import * as smartpromise from '@pushrocks/smartpromise';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import * as plugins from './smarthbs.plugins';
 | 
					import * as plugins from './smarthbs.plugins.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let safeSyntaxBeginRegex = /{-{/g;
 | 
					let safeSyntaxBeginRegex = /{-{/g;
 | 
				
			||||||
let safeSyntaxEndRegex = /}-}/g;
 | 
					let safeSyntaxEndRegex = /}-}/g;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
import * as plugins from './smarthbs.plugins';
 | 
					import * as plugins from './smarthbs.plugins.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * get a template for a file on disk
 | 
					 * get a template for a file on disk
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
// This file contains code that makes it easy to search handlebar templates for variables.
 | 
					// This file contains code that makes it easy to search handlebar templates for variables.
 | 
				
			||||||
// Why? To get a clue if you are missing some.
 | 
					// Why? To get a clue if you are missing some.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import * as plugins from './smarthbs.plugins';
 | 
					import * as plugins from './smarthbs.plugins.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// the curly regex objects
 | 
					// the curly regex objects
 | 
				
			||||||
let tripleCurlyRegex = /{{{\s*[\w\.]+\s*}}}/g;
 | 
					let tripleCurlyRegex = /{{{\s*[\w\.]+\s*}}}/g;
 | 
				
			||||||
@@ -26,7 +26,7 @@ export let findVarsInHbsString = async (hbsStringArg: string) => {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // make sure we are clean from curly brackets
 | 
					  // make sure we are clean from curly brackets
 | 
				
			||||||
  varNameArray = varNameArray.map(x => {
 | 
					  varNameArray = varNameArray.map((x) => {
 | 
				
			||||||
    return x.match(nameInCurlsRegex)[0];
 | 
					    return x.match(nameInCurlsRegex)[0];
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "compilerOptions": {
 | 
				
			||||||
 | 
					    "experimentalDecorators": true,
 | 
				
			||||||
 | 
					    "useDefineForClassFields": false,
 | 
				
			||||||
 | 
					    "target": "ES2022",
 | 
				
			||||||
 | 
					    "module": "ES2022",
 | 
				
			||||||
 | 
					    "moduleResolution": "nodenext",
 | 
				
			||||||
 | 
					    "esModuleInterop": true
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										17
									
								
								tslint.json
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								tslint.json
									
									
									
									
									
								
							@@ -1,17 +0,0 @@
 | 
				
			|||||||
{
 | 
					 | 
				
			||||||
  "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