-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
177 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.16 | ||
0.0.18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
declare class TemplateWriter { | ||
context: {}; | ||
/** | ||
* Configuration for the Nunjucks writer compiler. | ||
*/ | ||
private config; | ||
/** | ||
* Default configuration for the TypeScript compiler. | ||
*/ | ||
private static defaultConfig; | ||
/** | ||
* Constructs a TemplateWriter instance. | ||
* @param templatesDir - Directory for Nunjucks templates. | ||
* @param enableCache - Enable or disable caching for Nunjucks. | ||
*/ | ||
constructor(templatesDir: string, enableCache?: boolean); | ||
constructor(templatesDir: string, context: {}, customConfig?: any); | ||
/** | ||
* Generates a template using the provided template file and context. | ||
* @param template - The template file name. | ||
* @param context - Context data to render the template with. | ||
* @returns The rendered template as a string. | ||
*/ | ||
generateTemplate(template: string, context: {}): Promise<string>; | ||
generateTemplate(template: string): Promise<string>; | ||
/** | ||
* Writes the rendered template content to a file. | ||
* @param template - The template file name. | ||
* @param outputFile - The output file path. | ||
* @param context - Context data to render the template with. | ||
*/ | ||
generateToFile(template: string, outputFile: string, context: {}): Promise<void>; | ||
generateToFile(template: string, outputFile: string): Promise<void>; | ||
} | ||
export default TemplateWriter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare const nunjucksConfig: { | ||
autoescape: boolean; | ||
throwOnUndefined: boolean; | ||
trimBlocks: boolean; | ||
lstripBlocks: boolean; | ||
noCache: boolean; | ||
}; | ||
export default nunjucksConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"use strict"; | ||
// config/nunjucks.config.ts | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// ============================================================================ | ||
// Constants | ||
// ============================================================================ | ||
const nunjucksConfig = { | ||
autoescape: true, // Controls if output with dangerous characters are escaped automatically | ||
throwOnUndefined: false, // Throw errors when outputting a null/undefined value | ||
trimBlocks: true, // Automatically remove trailing newlines from a block/tag | ||
lstripBlocks: true, // Automatically remove leading whitespace from a block/tag | ||
noCache: true | ||
}; | ||
// ============================================================================ | ||
// Export | ||
// ============================================================================ | ||
exports.default = nunjucksConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Cleans a specified directory and logs the process. | ||
* @param directoryPath - The path of the directory to clean. | ||
*/ | ||
declare function cleanDirectory(directoryPath: string): Promise<void>; | ||
export default cleanDirectory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var DirectoryCleaner_js_1 = __importDefault(require("../class/DirectoryCleaner.js")); | ||
var StylizedLogger_js_1 = __importDefault(require("../class/StylizedLogger.js")); | ||
const directoryCleaner = new DirectoryCleaner_js_1.default(); | ||
const logger = new StylizedLogger_js_1.default(); | ||
/** | ||
* Cleans a specified directory and logs the process. | ||
* @param directoryPath - The path of the directory to clean. | ||
*/ | ||
async function cleanDirectory(directoryPath) { | ||
try { | ||
logger.header('Clean Directories'); | ||
await directoryCleaner.cleanDirectory(directoryPath); | ||
logger.body(`Directory cleaned: ${directoryPath}`); | ||
} | ||
catch (error) { | ||
logger.error(`Error cleaning directory: ${error}`); | ||
throw error; // Rethrow the error for further handling if necessary | ||
} | ||
} | ||
// ============================================================================ | ||
// Export | ||
// ============================================================================ | ||
exports.default = cleanDirectory; | ||
// Usage example | ||
// cleanAndLogDirectory(CONFIG.path.dist) | ||
// .then(() => console.log('Directory cleaning completed.')) | ||
// .catch(error => console.error(error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import DirectoryCleaner from '../class/DirectoryCleaner.js'; | ||
import StylizedLogger from '../class/StylizedLogger.js'; | ||
import CONFIG from '../path/to/config.js'; // Assuming CONFIG is imported from a config file | ||
|
||
const directoryCleaner = new DirectoryCleaner(); | ||
const logger = new StylizedLogger(); | ||
|
||
/** | ||
* Cleans a specified directory and logs the process. | ||
* @param directoryPath - The path of the directory to clean. | ||
*/ | ||
async function cleanDirectory(directoryPath: string): Promise<void> { | ||
try { | ||
logger.header('Clean Directories'); | ||
await directoryCleaner.cleanDirectory(directoryPath); | ||
logger.body(`Directory cleaned: ${directoryPath}`); | ||
} catch (error) { | ||
logger.error(`Error cleaning directory: ${error}`); | ||
throw error; // Rethrow the error for further handling if necessary | ||
} | ||
} | ||
|
||
// ============================================================================ | ||
// Export | ||
// ============================================================================ | ||
|
||
export default cleanDirectory; | ||
|
||
|
||
// Usage example | ||
// cleanAndLogDirectory(CONFIG.path.dist) | ||
// .then(() => console.log('Directory cleaning completed.')) | ||
// .catch(error => console.error(error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.