Skip to content

Commit

Permalink
generated types declaration file for package
Browse files Browse the repository at this point in the history
  • Loading branch information
biggaji committed Sep 12, 2023
1 parent 44f30b9 commit 21a0819
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
37 changes: 37 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*!
* HandlebarsConverter
* Copyright(c) 2023 Tobi Ajibade
* MIT Licensed
*/
type TemplateInitOptions = {
templateDirPath: string;
extName?: string;
partialDirPath?: string;
defaultLayoutFilePath?: string;
};
type TemplateGenerationOptions = {
templateName: string;
context?: object;
};
/**
* @class
* @description A wrapper around handlebars that easily converts handlebars file to a html string or file
* @author Tobi Ajibade
*/
export declare class HandlebarsConverter {
private templateDirPath;
private defaultExtName;
private extName?;
private defaultLayoutFilePath?;
private partialDirPath?;
constructor(configs: TemplateInitOptions);
/**
* @method compile
* @description Compiles and generate a html code
* @param {object} opts - The needed configuration data containing the template name and optional context to find and generate the html code.
* @memberof HbsToHtml
*/
compile(opts: TemplateGenerationOptions): Promise<string>;
protected registerPartials(dir: string): Promise<void>;
}
export {};
10 changes: 5 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
"use strict";
/*!
* HandlebarsConverter
* Copyright(c) 2023 Tobi Ajibade
* MIT Licensed
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
Expand Down Expand Up @@ -36,11 +41,6 @@ exports.HandlebarsConverter = void 0;
const fs = __importStar(require("fs/promises"));
const path = __importStar(require("path"));
const handlebars = __importStar(require("handlebars"));
/*!
* HandlebarsConverter
* Copyright(c) 2023 Tobi Ajibade
* MIT Licensed
*/
/**
* @class
* @description A wrapper around handlebars that easily converts handlebars file to a html string or file
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "handlebars-converter",
"version": "1.0.1",
"main": "index.js",
"version": "1.0.2",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"repository": "git@github.com:biggaji/handlebars-converter.git",
"author": "Tobi Ajibade <tobiajibade2017@yandex.com>",
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "commonjs","rootDir": "./package",
"moduleResolution": "node10",
"outDir": "./lib",
"declaration": true,
"esModuleInterop": true,"forceConsistentCasingInFileNames": true,
"strict": true,"skipLibCheck": true
}
Expand Down

0 comments on commit 21a0819

Please sign in to comment.