@dotcom-tool-kit/types
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -0,4 +1,6 @@ | ||
import type prompts from 'prompts'; | ||
export declare type ScalarSchemaType = 'string' | 'number' | 'boolean' | `|${string},${string}` | 'unknown'; | ||
export declare type SchemaType = ScalarSchemaType | `array.${ScalarSchemaType}` | `record.${ScalarSchemaType}`; | ||
export declare type ModifiedSchemaType = SchemaType | `${SchemaType}?`; | ||
export declare type SchemaPromptGenerator<T> = (prompt: typeof prompts, onCancel: () => void) => Promise<T>; | ||
export declare type ModifiedSchemaType = SchemaType | `${SchemaType}?` | SchemaPromptGenerator<unknown>; | ||
export declare type Schema = { | ||
@@ -12,2 +14,4 @@ readonly [option: string]: ModifiedSchemaType; | ||
-readonly [option in keyof T as T[option] extends `${string}?` ? option : never]?: T[option] extends `${infer S}?` ? S extends SchemaType ? SchemaTypeOutput<S> : never : never; | ||
} & { | ||
-readonly [option in keyof T as T[option] extends SchemaPromptGenerator<unknown> ? option : never]: T[option] extends SchemaPromptGenerator<infer R> ? R : never; | ||
}; | ||
@@ -14,0 +18,0 @@ import type { ESLintOptions } from './schema/eslint'; |
@@ -1,5 +0,14 @@ | ||
import { SchemaOutput } from '../schema'; | ||
import { SchemaOutput, SchemaPromptGenerator } from '../schema'; | ||
export interface HerokuScaling { | ||
[app: string]: { | ||
[processType: string]: { | ||
size: string; | ||
quantity: number; | ||
}; | ||
}; | ||
} | ||
export declare const HerokuSchema: { | ||
readonly pipeline: "string"; | ||
readonly systemCode: "string"; | ||
readonly scaling: SchemaPromptGenerator<HerokuScaling>; | ||
}; | ||
@@ -10,3 +19,4 @@ export declare type HerokuOptions = SchemaOutput<typeof HerokuSchema>; | ||
readonly systemCode: "string"; | ||
readonly scaling: SchemaPromptGenerator<HerokuScaling>; | ||
}; | ||
//# sourceMappingURL=heroku.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 = {}; | ||
let allAppsConfigured = false; | ||
while (!allAppsConfigured) { | ||
const { app } = await prompt({ | ||
name: 'app', | ||
type: 'text', | ||
message: 'Enter the name of the Heroku app to configure' | ||
}, { onCancel }); | ||
const { processType, size, quantity, moreApps } = await prompt([ | ||
{ | ||
name: 'processType', | ||
type: 'text', | ||
initial: 'web', | ||
message: `What is the process type of ${app}?` | ||
}, | ||
{ name: 'size', type: 'text', initial: 'standard-1X', message: `What should the size of ${app} be?` }, | ||
{ name: 'quantity', type: 'number', message: `What should the dyno size of ${app} be?` }, | ||
{ name: 'moreApps', type: 'confirm', message: 'Are there more Heroku apps in this pipeline?' } | ||
], { onCancel }); | ||
scaling[app] = { [processType]: { size, quantity } }; | ||
allAppsConfigured = !moreApps; | ||
} | ||
return scaling; | ||
}; | ||
exports.HerokuSchema = { | ||
pipeline: 'string', | ||
systemCode: 'string' | ||
systemCode: 'string', | ||
scaling | ||
}; | ||
exports.Schema = exports.HerokuSchema; |
{ | ||
"name": "@dotcom-tool-kit/types", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "", | ||
@@ -26,3 +26,3 @@ "main": "lib", | ||
"dependencies": { | ||
"@dotcom-tool-kit/error": "^1.2.2", | ||
"@dotcom-tool-kit/error": "^1.2.3", | ||
"lodash.isplainobject": "^4.0.6", | ||
@@ -34,4 +34,5 @@ "lodash.mapvalues": "^4.6.0" | ||
"@types/lodash.isplainobject": "^4.0.6", | ||
"@types/lodash.mapvalues": "^4.6.6" | ||
"@types/lodash.mapvalues": "^4.6.6", | ||
"@types/prompts": "^2.0.14" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
26431
371
4