templates-mo
Version:
Templates is a scaffolding framework that makes code generation simple, dynamic, and reusable. Generate files, parts of your app, or whole project structures—without the repetitive copy-pasting
91 lines (90 loc) • 3.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BuildError = exports.GlobalInitializedAlreadyError = exports.InitializedAlreadyError = exports.PromptInvalidAnswersError = exports.PromptNoPromptFoundError = exports.NoPromptsError = exports.SettingsUnkownFileTypeError = exports.PackageAlreadyCompiledError = exports.RequiresTemplateError = exports.TemplateNotFoundError = void 0;
class TemplateNotFoundError extends Error {
constructor(templateName) {
super(`Template (${templateName}) was not found.`);
this.name = 'TemplateNotFoundError';
this.template = templateName;
Object.setPrototypeOf(this, TemplateNotFoundError.prototype);
}
}
exports.TemplateNotFoundError = TemplateNotFoundError;
class RequiresTemplateError extends Error {
constructor() {
super('Must specify a template folder to use!');
this.name = 'RequiresTemplateError';
Object.setPrototypeOf(this, RequiresTemplateError.prototype);
}
}
exports.RequiresTemplateError = RequiresTemplateError;
class PackageAlreadyCompiledError extends Error {
constructor(packageName) {
super(`Package (${packageName}) was already compiled`);
this.name = 'PackageAlreadyCompiledError';
}
}
exports.PackageAlreadyCompiledError = PackageAlreadyCompiledError;
class SettingsUnkownFileTypeError extends Error {
constructor(settingsPath) {
super(`\
Could not load settings file! Please make sure this file is a json or js file
settings path: ${settingsPath}
`);
this.name = 'TpsSettingsUnknownFileTypeError';
this.settings = settingsPath;
}
}
exports.SettingsUnkownFileTypeError = SettingsUnkownFileTypeError;
class NoPromptsError extends Error {
constructor() {
super(...arguments);
this.name = 'NoPromptsError';
this.message = 'No prompts set';
}
}
exports.NoPromptsError = NoPromptsError;
class PromptNoPromptFoundError extends Error {
constructor(name) {
super(`There was no prompt found with the name of: ${name}`);
this.name = 'PromptNoPromptFoundError';
this.promptName = name;
}
}
exports.PromptNoPromptFoundError = PromptNoPromptFoundError;
class PromptInvalidAnswersError extends Error {
constructor(answers) {
super(`Invalid answers passed in. Answers needs to be an object. Got ${JSON.stringify(answers)}`);
this.name = 'PromptInvalidAnswersError';
this.answers = answers;
}
}
exports.PromptInvalidAnswersError = PromptInvalidAnswersError;
class InitializedAlreadyError extends Error {
constructor(filePath) {
super(`tps is already initialized in this repo. ${filePath}`);
this.name = 'InitializedAlreadyError';
this.path = filePath;
}
}
exports.InitializedAlreadyError = InitializedAlreadyError;
class GlobalInitializedAlreadyError extends Error {
constructor(filePath) {
super('tps is already initialized globally initialized');
this.name = 'GlobalInitializedAlreadyError';
this.path = filePath;
}
}
exports.GlobalInitializedAlreadyError = GlobalInitializedAlreadyError;
class BuildError extends Error {
constructor(buildPath, errors) {
super([
`Instance failed to get created ${buildPath}:`,
errors.map((error) => `- ${error.message}`).join('\n'),
].join('\n'));
this.buildPath = buildPath;
this.errors = errors;
this.name = 'BuildError';
}
}
exports.BuildError = BuildError;