@adonisjs/sink
Advanced tools
Comparing version 2.5.0 to 2.5.1
{ | ||
"name": "@adonisjs/sink", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Utilities to create AdonisJs boilerplates and custom providers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
import { file } from 'mrm-core'; | ||
import { template } from 'mrm-core'; | ||
import { BaseFile } from '../base/BaseFile'; | ||
@@ -7,7 +7,4 @@ /** | ||
export declare class TemplateFile extends BaseFile { | ||
private templatePath; | ||
private templateData; | ||
private whitespace; | ||
protected $actions: never[]; | ||
filePointer: ReturnType<typeof file>; | ||
filePointer: ReturnType<typeof template>; | ||
removeOnRollback: boolean; | ||
@@ -17,6 +14,2 @@ overwrite: boolean; | ||
/** | ||
* Returns the contents of the template file | ||
*/ | ||
private readTemplate; | ||
/** | ||
* Returns existing contents for a template file | ||
@@ -34,7 +27,2 @@ */ | ||
/** | ||
* Control whether or not to render whitespace. It is enabled by | ||
* default | ||
*/ | ||
renderWhitespace(whitespaceFlag: boolean): this; | ||
/** | ||
* Commit changes | ||
@@ -41,0 +29,0 @@ */ |
@@ -10,9 +10,4 @@ "use strict"; | ||
*/ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const dot_1 = __importDefault(require("dot")); | ||
const mrm_core_1 = require("mrm-core"); | ||
const fs_1 = require("fs"); | ||
const BaseFile_1 = require("../base/BaseFile"); | ||
@@ -25,5 +20,2 @@ /** | ||
super(basePath); | ||
this.templatePath = templatePath; | ||
this.templateData = {}; | ||
this.whitespace = true; | ||
this.$actions = []; | ||
@@ -33,22 +25,6 @@ this.removeOnRollback = true; | ||
this.$cdIn(); | ||
this.filePointer = mrm_core_1.file(filename); | ||
this.filePointer = mrm_core_1.template(filename, templatePath); | ||
this.$cdOut(); | ||
} | ||
/** | ||
* Returns the contents of the template file | ||
*/ | ||
readTemplate() { | ||
try { | ||
return fs_1.readFileSync(this.templatePath, 'utf8'); | ||
} | ||
catch (err) { | ||
if (err.code === 'ENOENT') { | ||
throw Error(`Template file not found: ${this.templatePath}`); | ||
} | ||
else { | ||
throw err; | ||
} | ||
} | ||
} | ||
/** | ||
* Returns existing contents for a template file | ||
@@ -69,14 +45,6 @@ */ | ||
apply(contents) { | ||
this.templateData = contents || {}; | ||
this.filePointer.apply(contents); | ||
return this; | ||
} | ||
/** | ||
* Control whether or not to render whitespace. It is enabled by | ||
* default | ||
*/ | ||
renderWhitespace(whitespaceFlag) { | ||
this.whitespace = whitespaceFlag; | ||
return this; | ||
} | ||
/** | ||
* Commit changes | ||
@@ -94,13 +62,4 @@ */ | ||
} | ||
try { | ||
const templateFn = dot_1.default.template(this.readTemplate(), Object.assign({}, dot_1.default.templateSettings, { | ||
strip: !this.whitespace, | ||
})); | ||
this.filePointer.save(templateFn(this.templateData)); | ||
this.$cdOut(); | ||
} | ||
catch (error) { | ||
this.$cdOut(); | ||
throw error; | ||
} | ||
this.filePointer.save(); | ||
this.$cdOut(); | ||
} | ||
@@ -107,0 +66,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
82623
2407