@dotcom-tool-kit/types
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -0,1 +1,2 @@ | ||
import type { Logger } from 'winston'; | ||
import { Schema, SchemaOutput } from './schema'; | ||
@@ -8,3 +9,4 @@ export declare abstract class Task<O extends Schema = Record<string, never>> { | ||
options: SchemaOutput<O>; | ||
constructor(options?: Partial<SchemaOutput<O>>); | ||
logger: Logger; | ||
constructor(logger: Logger, options?: Partial<SchemaOutput<O>>); | ||
abstract run(files?: string[]): Promise<void>; | ||
@@ -16,3 +18,5 @@ } | ||
plugin?: Plugin; | ||
logger: Logger; | ||
static description?: string; | ||
constructor(logger: Logger); | ||
abstract check(): Promise<boolean>; | ||
@@ -34,7 +38,7 @@ abstract install(): Promise<void>; | ||
[id: string]: { | ||
new (): Hook; | ||
new (logger: Logger): Hook; | ||
}; | ||
}; | ||
} | ||
export declare function instantiatePlugin(plugin: unknown): Plugin; | ||
export declare function instantiatePlugin(plugin: unknown, logger: Logger): Plugin; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,4 +9,6 @@ "use strict"; | ||
class Task { | ||
constructor(options = {}) { | ||
this.options = Object.assign({}, this.constructor.defaultOptions, options); | ||
constructor(logger, options = {}) { | ||
const staticThis = this.constructor; | ||
this.options = Object.assign({}, staticThis.defaultOptions, options); | ||
this.logger = logger.child({ task: staticThis.id }); | ||
} | ||
@@ -17,7 +19,10 @@ } | ||
class Hook { | ||
constructor(logger) { | ||
this.logger = logger.child({ hook: this.constructor.name }); | ||
} | ||
} | ||
exports.Hook = Hook; | ||
function instantiatePlugin(plugin) { | ||
function instantiatePlugin(plugin, logger) { | ||
const rawPlugin = plugin; | ||
const parent = rawPlugin.parent && instantiatePlugin(rawPlugin.parent); | ||
const parent = rawPlugin.parent && instantiatePlugin(rawPlugin.parent, logger); | ||
if (rawPlugin.tasks && | ||
@@ -33,3 +38,3 @@ !(Array.isArray(rawPlugin.tasks) && rawPlugin.tasks.every((task) => task.prototype instanceof Task))) { | ||
const hooks = (0, lodash_mapvalues_1.default)(rawPlugin.hooks, (Hook) => { | ||
return new Hook(); | ||
return new Hook(logger); | ||
}); | ||
@@ -36,0 +41,0 @@ return { ...rawPlugin, parent, hooks }; |
import type prompts from 'prompts'; | ||
import type { Logger } from 'winston'; | ||
export declare type ScalarSchemaType = 'string' | 'number' | 'boolean' | `|${string},${string}` | 'unknown'; | ||
export declare type SchemaType = ScalarSchemaType | `array.${ScalarSchemaType}` | `record.${ScalarSchemaType}`; | ||
export declare type SchemaPromptGenerator<T> = (prompt: typeof prompts, onCancel: () => void) => Promise<T>; | ||
export declare type SchemaPromptGenerator<T> = (logger: Logger, prompt: typeof prompts, onCancel: () => void) => Promise<T>; | ||
export declare type ModifiedSchemaType = SchemaType | `${SchemaType}?` | SchemaPromptGenerator<unknown>; | ||
@@ -28,2 +29,3 @@ export declare type Schema = { | ||
import type { LintStagedNpmOptions } from './schema/lint-staged-npm'; | ||
import type { BabelOptions } from './schema/babel'; | ||
export declare type Options = { | ||
@@ -41,4 +43,5 @@ '@dotcom-tool-kit/eslint'?: ESLintOptions; | ||
'@dotcom-tool-kit/lint-staged-npm'?: LintStagedNpmOptions; | ||
'@dotcom-tool-kit/babel'?: BabelOptions; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=schema.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Schema = exports.HerokuSchema = void 0; | ||
const scaling = async (prompt, onCancel) => { | ||
console.log('You must configure the scaling for each of the Heroku apps in your pipeline.'); | ||
const scaling = async (logger, prompt, onCancel) => { | ||
logger.error('You must configure the scaling for each of the Heroku apps in your pipeline.'); | ||
const scaling = {}; | ||
@@ -7,0 +7,0 @@ let allAppsConfigured = false; |
{ | ||
"name": "@dotcom-tool-kit/types", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "", | ||
@@ -26,3 +26,3 @@ "main": "lib", | ||
"dependencies": { | ||
"@dotcom-tool-kit/error": "^1.3.0", | ||
"@dotcom-tool-kit/error": "^1.4.0", | ||
"lodash.isplainobject": "^4.0.6", | ||
@@ -35,4 +35,5 @@ "lodash.mapvalues": "^4.6.0" | ||
"@types/lodash.mapvalues": "^4.6.6", | ||
"@types/prompts": "^2.0.14" | ||
"@types/prompts": "^2.0.14", | ||
"winston": "^3.4.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
29148
47
420
5