From 361778a188cc7f920c52c3ed7eaa30dd68302904 Mon Sep 17 00:00:00 2001 From: Chen Asraf Date: Sun, 28 Jan 2024 20:14:25 +0200 Subject: [PATCH] feat!: rename verbose to logLevel --- pages/cli.md | 4 +-- pages/configuration_files.md | 6 ++--- pages/migration.md | 4 +-- pages/node.md | 3 +-- src/cmd.ts | 10 +++---- src/config.ts | 17 +++++++----- src/file.ts | 25 +++++++++-------- src/git.ts | 8 +++--- src/logger.ts | 31 ++++++++++----------- src/parser.ts | 6 ++--- src/scaffold.ts | 8 +++--- src/types.ts | 52 +++++++++++++++++------------------- tests/config.test.ts | 10 +++---- tests/parser.test.ts | 2 +- tests/scaffold.test.ts | 42 ++++++++++++++--------------- 15 files changed, 111 insertions(+), 117 deletions(-) diff --git a/pages/cli.md b/pages/cli.md index 1fe1b48..3400673 100644 --- a/pages/cli.md +++ b/pages/cli.md @@ -21,8 +21,8 @@ To see this and more information anytime, add the `-h` or `--help` flag to your | `--append-data`\|`-D` | Append additional custom data to the templates, which will overwrite --data, using an alternate syntax, which is easier to use with CLI: -D key1=string -D key2:=raw | | `--create-sub-folder`\|`-s` | Create subfolder with the input name (default: false) | | `--sub-folder-name-helper`\|`-sh` | Default helper to apply to subfolder name when using `--create-sub-folder true`. | -| `--quiet`\|`-q` | Suppress output logs (Same as --verbose 0) (default: false) | -| `--verbose`\|`-v` | Determine amount of logs to display. The values are: 0 (none) \| 1 (debug) \| 2 (info) \| 3 (warn) \| 4 (error). The provided level will display messages of the same level or higher. (default: 2) | +| `--quiet`\|`-q` | Suppress output logs (Same as --log-level 0) (default: false) | +| `--log-level`\|`-v` | Determine amount of logs to display. The values are: 0 (none) \| 1 (debug) \| 2 (info) \| 3 (warn) \| 4 (error). The provided level will display messages of the same level or higher. (default: 2) | | `--dry-run`\|`-dr` | Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write actual file contents or create directories. (default: false) | ## Examples: diff --git a/pages/configuration_files.md b/pages/configuration_files.md index fecffc9..e808f96 100644 --- a/pages/configuration_files.md +++ b/pages/configuration_files.md @@ -18,8 +18,7 @@ example: } ``` -The configuration contents are identical to the -[Node.js configuration structure](https://chenasraf.github.io/simple-scaffold/pages/node.md): +The configuration contents are identical to the [Node.js configuration structure](./node): ```ts interface ScaffoldConfig { @@ -29,8 +28,7 @@ interface ScaffoldConfig { createSubFolder?: boolean data?: Record overwrite?: FileResponse - quiet?: boolean - verbose?: LogLevel + logLevel?: LogLevel dryRun?: boolean helpers?: Record subFolderNameHelper?: DefaultHelpers | string diff --git a/pages/migration.md b/pages/migration.md index cf97ea8..55359db 100644 --- a/pages/migration.md +++ b/pages/migration.md @@ -8,8 +8,8 @@ reading the docs can tell). Alternatively, you can inject the transformed name into your `data` manually using a scaffold config file, by using the Node API or by appending the data to the CLI invocation. -- `verbose` can now take the names `debug`, `info`, `warn`, `error` or `none` (case insensitive) or - as usual by using the numbering from before. +- `verbose` has been renamed to `log-level`, and now takes the names `debug`, `info`, `warn`, + `error` or `none` (case insensitive) instead of using the numbering from before. - All boolean flags no longer take a value. `-q` instead of `-q 1` or `-q true`, `-s` instead of `-s 1`, `-w` instead of `-w 1`, etc. diff --git a/pages/node.md b/pages/node.md index a9516d9..a31fe31 100644 --- a/pages/node.md +++ b/pages/node.md @@ -16,8 +16,7 @@ interface ScaffoldConfig { createSubFolder?: boolean data?: Record overwrite?: FileResponse - quiet?: boolean - verbose?: LogLevel + logLevel?: LogLevel dryRun?: boolean helpers?: Record subFolderNameHelper?: DefaultHelpers | string diff --git a/src/cmd.ts b/src/cmd.ts index b94c948..00234c6 100644 --- a/src/cmd.ts +++ b/src/cmd.ts @@ -105,15 +105,15 @@ export async function parseCliArgs(args = process.argv.slice(2)) { name: "quiet", aliases: ["q"], defaultValue: false, - description: "Suppress output logs (Same as --verbose 0)", + description: "Suppress output logs (Same as --log-level none)", }) .option({ - name: "verbose", - aliases: ["v"], - defaultValue: LogLevel.Info, + name: "log-level", + aliases: ["l"], + defaultValue: LogLevel.info, description: "Determine amount of logs to display. The values are: " + - `${chalk.bold`0 (none) | 1 (debug) | 2 (info) | 3 (warn) | 4 (error)`}. ` + + `${chalk.bold`none | debug | info | warn | error`}. ` + "The provided level will display messages of the same level or higher.", parse: Number, }) diff --git a/src/config.ts b/src/config.ts index c1af977..d8c6cab 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,6 +3,7 @@ import { ConfigLoadConfig, FileResponse, FileResponseHandler, + LogConfig, LogLevel, ScaffoldCmdConfig, ScaffoldConfig, @@ -46,19 +47,23 @@ function isWrappedWithQuotes(string: string): boolean { /** @internal */ export async function parseConfigFile(config: ScaffoldCmdConfig): Promise { let c: ScaffoldConfig = config + + if (config.quiet) { + config.logLevel = LogLevel.none + } + if (config.github) { - log(config, LogLevel.Info, `Loading config from github ${config.github}`) + log(config, LogLevel.info, `Loading config from github ${config.github}`) config.config = githubPartToUrl(config.github) } if (config.config) { const { configFile, key, isRemote } = parseConfigSelection(config.config, config.key) - log(config, LogLevel.Info, `Loading config from ${configFile} with key ${key}`) + log(config, LogLevel.info, `Loading config from ${configFile} with key ${key}`) const configPromise = await getConfig({ config: configFile, isRemote, - quiet: config.quiet, - verbose: config.verbose, + logLevel: config.logLevel, }) let configImport = await resolve(configPromise, config) if (typeof configImport.default === "function" || configImport.default instanceof Promise) { @@ -101,11 +106,11 @@ export function githubPartToUrl(part: string): string { } /** @internal */ -export async function getConfig(config: ConfigLoadConfig): Promise { +export async function getConfig(config: ConfigLoadConfig & Partial): Promise { const { config: configFile, isRemote, ...logConfig } = config as Required if (!isRemote) { - log(logConfig, LogLevel.Info, `Loading config from file ${configFile}`) + log(logConfig, LogLevel.info, `Loading config from file ${configFile}`) const absolutePath = path.resolve(process.cwd(), configFile) return wrapNoopResolver(import(absolutePath)) } diff --git a/src/file.ts b/src/file.ts index a66e654..e4f91d8 100644 --- a/src/file.ts +++ b/src/file.ts @@ -12,7 +12,7 @@ const { stat, access, mkdir, readFile, writeFile } = fs export async function createDirIfNotExists(dir: string, config: ScaffoldConfig): Promise { if (config.dryRun) { - log(config, LogLevel.Info, `Dry Run. Not creating dir ${dir}`) + log(config, LogLevel.info, `Dry Run. Not creating dir ${dir}`) return } const parentDir = path.dirname(dir) @@ -23,7 +23,7 @@ export async function createDirIfNotExists(dir: string, config: ScaffoldConfig): if (!(await pathExists(dir))) { try { - log(config, LogLevel.Debug, `Creating dir ${dir}`) + log(config, LogLevel.debug, `Creating dir ${dir}`) await mkdir(dir) return } catch (e: any) { @@ -69,12 +69,11 @@ export function getBasePath(relPath: string): string { export async function getFileList(_config: ScaffoldConfig, template: string): Promise { template = template.replaceAll(/[\\]+/g, "/") - log(_config, LogLevel.Debug, `Getting file list for ${template}`) + log(_config, LogLevel.debug, `Getting file list for ${template}`) return ( await glob(template, { dot: true, nodir: true, - // debug: config.verbose === LogLevel.Debug, }) ).map(path.normalize) } @@ -89,13 +88,13 @@ export interface GlobInfo { export async function getTemplateGlobInfo(config: ScaffoldConfig, template: string): Promise { const isGlob = hasMagic(template) - log(config, LogLevel.Debug, "before isDir", "isGlob:", isGlob, template) + log(config, LogLevel.debug, "before isDir", "isGlob:", isGlob, template) let _template = template let nonGlobTemplate = isGlob ? removeGlob(template) : template nonGlobTemplate = path.normalize(nonGlobTemplate) const isDirOrGlob = isGlob ? true : await isDir(template) const _shouldAddGlob = !isGlob && isDirOrGlob - log(config, LogLevel.Debug, "after", { isDirOrGlob, _shouldAddGlob }) + log(config, LogLevel.debug, "after", { isDirOrGlob, _shouldAddGlob }) const origTemplate = template if (_shouldAddGlob) { _template = path.join(template, "**", "*") @@ -141,7 +140,7 @@ export async function copyFileTransformed( ): Promise { if (!exists || overwrite) { if (exists && overwrite) { - log(config, LogLevel.Info, `File ${outputPath} exists, overwriting`) + log(config, LogLevel.info, `File ${outputPath} exists, overwriting`) } const templateBuffer = await readFile(inputPath) const unprocessedOutputContents = handlebarsParse(config, templateBuffer) @@ -150,13 +149,13 @@ export async function copyFileTransformed( if (!config.dryRun) { await writeFile(outputPath, finalOutputContents) - log(config, LogLevel.Info, "Done.") + log(config, LogLevel.info, "Done.") } else { - log(config, LogLevel.Info, "Dry Run. Output should be:") - log(config, LogLevel.Info, finalOutputContents.toString()) + log(config, LogLevel.info, "Dry Run. Output should be:") + log(config, LogLevel.info, finalOutputContents.toString()) } } else if (exists) { - log(config, LogLevel.Info, `File ${outputPath} already exists, skipping`) + log(config, LogLevel.info, `File ${outputPath} already exists, skipping`) } } @@ -189,7 +188,7 @@ export async function handleTemplateFile( log( config, - LogLevel.Debug, + LogLevel.debug, `\nParsing ${templatePath}`, `\nBase path: ${basePath}`, `\nFull input path: ${inputPath}`, @@ -201,7 +200,7 @@ export async function handleTemplateFile( await createDirIfNotExists(path.dirname(outputPath), config) - log(config, LogLevel.Info, `Writing to ${outputPath}`) + log(config, LogLevel.info, `Writing to ${outputPath}`) await copyFileTransformed(config, { exists, overwrite, outputPath, inputPath }) resolve() } catch (e: any) { diff --git a/src/git.ts b/src/git.ts index 8a78e1a..ffa2b4c 100644 --- a/src/git.ts +++ b/src/git.ts @@ -11,7 +11,7 @@ export async function getGitConfig( ): Promise> { const repoUrl = `${url.protocol}//${url.host}${url.pathname}` - log(logConfig, LogLevel.Info, `Cloning git repo ${repoUrl}`) + log(logConfig, LogLevel.info, `Cloning git repo ${repoUrl}`) const tmpPath = path.resolve(os.tmpdir(), `scaffold-config-${Date.now()}`) @@ -21,7 +21,7 @@ export async function getGitConfig( clone.on("error", reject) clone.on("close", async (code) => { if (code === 0) { - log(logConfig, LogLevel.Info, `Loading config from git repo: ${repoUrl}`) + log(logConfig, LogLevel.info, `Loading config from git repo: ${repoUrl}`) const hashPath = url.hash?.replace("#", "") || "scaffold.config.js" const absolutePath = path.resolve(tmpPath, hashPath) const loadedConfig = await resolve( @@ -29,8 +29,8 @@ export async function getGitConfig( logConfig, ) - log(logConfig, LogLevel.Info, `Loaded config from git`) - log(logConfig, LogLevel.Debug, `Raw config:`, loadedConfig) + log(logConfig, LogLevel.info, `Loaded config from git`) + log(logConfig, LogLevel.debug, `Raw config:`, loadedConfig) const fixedConfig: ScaffoldConfigMap = {} for (const [k, v] of Object.entries(loadedConfig)) { fixedConfig[k] = { diff --git a/src/logger.ts b/src/logger.ts index a97dea5..14d841f 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -2,28 +2,28 @@ import { LogConfig, LogLevel, ScaffoldConfig } from "./types" import chalk from "chalk" export function log(config: LogConfig, level: LogLevel, ...obj: any[]): void { - if (config.quiet || config.verbose === LogLevel.None || level < (config.verbose ?? LogLevel.Info)) { + if (config.logLevel === LogLevel.none || level < (config.logLevel ?? LogLevel.info)) { return } - const levelColor: Record = { - [LogLevel.None]: "reset", - [LogLevel.Debug]: "blue", - [LogLevel.Info]: "dim", - [LogLevel.Warning]: "yellow", - [LogLevel.Error]: "red", + const levelColor: Record = { + [LogLevel.none]: "reset", + [LogLevel.debug]: "blue", + [LogLevel.info]: "dim", + [LogLevel.warning]: "yellow", + [LogLevel.error]: "red", } const chalkFn: any = chalk[levelColor[level]] - const key: "log" | "warn" | "error" = level === LogLevel.Error ? "error" : level === LogLevel.Warning ? "warn" : "log" + const key: "log" | "warn" | "error" = level === LogLevel.error ? "error" : level === LogLevel.warning ? "warn" : "log" const logFn: any = console[key] logFn( ...obj.map((i) => i instanceof Error ? chalkFn(i, JSON.stringify(i, undefined, 1), i.stack) : typeof i === "object" - ? chalkFn(JSON.stringify(i, undefined, 1)) - : chalkFn(i), + ? chalkFn(JSON.stringify(i, undefined, 1)) + : chalkFn(i), ), ) } @@ -41,25 +41,22 @@ export function logInputFile( isGlob: boolean }, ): void { - log(config, LogLevel.Debug, data) + log(config, LogLevel.debug, data) } export function logInitStep(config: ScaffoldConfig): void { - log(config, LogLevel.Debug, "Full config:", { + log(config, LogLevel.debug, "Full config:", { name: config.name, templates: config.templates, output: config.output, createSubFolder: config.createSubFolder, data: config.data, overwrite: config.overwrite, - quiet: config.quiet, subFolderNameHelper: config.subFolderNameHelper, helpers: Object.keys(config.helpers ?? {}), - verbose: `${config.verbose} (${Object.keys(LogLevel).find( - (k) => (LogLevel[k as any] as unknown as number) === config.verbose!, - )})`, + logLevel: config.logLevel, dryRun: config.dryRun, beforeWrite: config.beforeWrite, } as Record) - log(config, LogLevel.Info, "Data:", config.data) + log(config, LogLevel.info, "Data:", config.data) } diff --git a/src/parser.ts b/src/parser.ts index f54c507..e0783a5 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -97,7 +97,7 @@ function pascalCase(s: string): string { export function registerHelpers(config: ScaffoldConfig): void { const _helpers = { ...defaultHelpers, ...config.helpers } for (const helperName in _helpers) { - log(config, LogLevel.Debug, `Registering helper: ${helperName}`) + log(config, LogLevel.debug, `Registering helper: ${helperName}`) Handlebars.registerHelper(helperName, _helpers[helperName as keyof typeof _helpers]) } } @@ -120,8 +120,8 @@ export function handlebarsParse( } return Buffer.from(outputContents) } catch (e) { - log(config, LogLevel.Debug, e) - log(config, LogLevel.Warning, "Couldn't parse file with handlebars, returning original content") + log(config, LogLevel.debug, e) + log(config, LogLevel.warning, "Couldn't parse file with handlebars, returning original content") return Buffer.from(templateBuffer) } } diff --git a/src/scaffold.ts b/src/scaffold.ts index 9d7f0a6..44562a6 100644 --- a/src/scaffold.ts +++ b/src/scaffold.ts @@ -66,7 +66,7 @@ export async function Scaffold(config: ScaffoldConfig): Promise { _template, ) const files = await getFileList(config, template) - log(config, LogLevel.Debug, "Iterating files", { files, template }) + log(config, LogLevel.debug, "Iterating files", { files, template }) for (const inputFilePath of files) { if (await isDir(inputFilePath)) { continue @@ -93,7 +93,7 @@ export async function Scaffold(config: ScaffoldConfig): Promise { } } } catch (e: any) { - log(config, LogLevel.Error, e) + log(config, LogLevel.error, e) throw e } } @@ -109,7 +109,7 @@ export async function Scaffold(config: ScaffoldConfig): Promise { * @category Main * @return {Promise} A promise that resolves when the scaffold is complete */ -Scaffold.fromConfig = async function ( +Scaffold.fromConfig = async function( /** The path or URL to the config file */ pathOrUrl: string, /** Information needed before loading the config */ @@ -120,7 +120,7 @@ Scaffold.fromConfig = async function ( const _cmdConfig: ScaffoldCmdConfig = { dryRun: false, output: process.cwd(), - verbose: LogLevel.Info, + logLevel: LogLevel.info, overwrite: false, templates: [], createSubFolder: false, diff --git a/src/types.ts b/src/types.ts index 50879f0..636e538 100644 --- a/src/types.ts +++ b/src/types.ts @@ -68,12 +68,6 @@ export interface ScaffoldConfig { */ overwrite?: FileResponse - /** - * Suppress output logs (Same as `verbose: 0` or `verbose: LogLevel.None`) - * @see {@link verbose} - */ - quiet?: boolean - /** * Determine amount of logs to display. * @@ -84,7 +78,7 @@ export interface ScaffoldConfig { * * @default `2 (info)` */ - verbose?: LogLevel + logLevel?: LogLevel /** * Don't emit files. This is good for testing your scaffolds and making sure they don't fail, without having to write @@ -263,6 +257,23 @@ export type DefaultHelpers = CaseHelpers | DateHelpers */ export type Helper = HelperDelegate +export const LogLevel = { + /** Silent output */ + none: "none", + /** Debugging information. Very verbose and only recommended for troubleshooting. */ + debug: "debug", + /** + * The regular level of logging. Major actions are logged to show the scaffold progress. + * + * @default + */ + info: "info", + /** Warnings such as when file fails to replace token values properly in template. */ + warning: "warning", + /** Errors, such as missing files, bad replacement token syntax, or un-writable directories. */ + error: "error", +} as const + /** * The amount of information to log when generating scaffold. * When not `None`, the selected level will be the lowest level included. @@ -270,26 +281,14 @@ export type Helper = HelperDelegate * For example, level `Info` (2) will include `Info`, `Warning` and `Error`, but not `Debug`; and `Warning` will only * show `Warning` and `Error`. * + * You may use either the number or the name of the level. + * For example, `2` or `info` are both valid. + * * @default `2 (info)` * * @category Logging */ -export enum LogLevel { - /** Silent output */ - None = 0, - /** Debugging information. Very verbose and only recommended for troubleshooting. */ - Debug = 1, - /** - * The regular level of logging. Major actions are logged to show the scaffold progress. - * - * @default - */ - Info = 2, - /** Warnings such as when file fails to replace token values properly in template. */ - Warning = 3, - /** Errors, such as missing files, bad replacement token syntax, or un-writable directories. */ - Error = 4, -} +export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel] /** * A function that takes path information about file, and returns a value of type `T` @@ -315,8 +314,6 @@ export type FileResponseHandler = (fullPath: string, basedir: string, basenam * (fullPath: string, basedir: string, basename: string) => T * ``` * - * @typedef T The return type - * * @see {@link FileResponseHandler} * * @category Config @@ -337,7 +334,7 @@ export interface ScaffoldCmdConfig { appendData?: Record overwrite: boolean quiet: boolean - verbose: LogLevel + logLevel: LogLevel dryRun: boolean config?: string /** The key to use for the file which contains the template configurations. */ @@ -373,8 +370,9 @@ export type Resolver = R | ((value: T) => R) export type AsyncResolver = Resolver | R> /** @internal */ -export type LogConfig = Pick +export type LogConfig = Pick +// TODO deprecat isRemote /** @internal */ export type ConfigLoadConfig = LogConfig & Pick & { isRemote: boolean } diff --git a/tests/config.test.ts b/tests/config.test.ts index ca3ec3e..2149735 100644 --- a/tests/config.test.ts +++ b/tests/config.test.ts @@ -1,4 +1,4 @@ -import { ScaffoldCmdConfig } from "../src/types" +import { LogLevel, ScaffoldCmdConfig } from "../src/types" import * as config from "../src/config" import { resolve } from "../src/utils" // @ts-ignore @@ -17,7 +17,7 @@ jest.mock("../src/git", () => { const { githubPartToUrl, parseAppendData, parseConfigFile, parseConfigSelection } = config const blankCliConf: ScaffoldCmdConfig = { - verbose: 0, + logLevel: LogLevel.none, name: "", output: "", templates: [], @@ -128,8 +128,7 @@ describe("config", () => { const resultFn = await config.getConfig({ config: "https://github.com/chenasraf/simple-scaffold.git", isRemote: true, - quiet: true, - verbose: 0, + logLevel: LogLevel.none, }) const result = await resolve(resultFn, blankCliConf) expect(result).toEqual(blankCliConf) @@ -139,8 +138,7 @@ describe("config", () => { const resultFn = await config.getConfig({ config: "scaffold.config.js", isRemote: false, - quiet: true, - verbose: 0, + logLevel: LogLevel.none, }) const result = await resolve(resultFn, {} as any) expect(result).toEqual(configFile) diff --git a/tests/parser.test.ts b/tests/parser.test.ts index e7ca218..1b95498 100644 --- a/tests/parser.test.ts +++ b/tests/parser.test.ts @@ -4,7 +4,7 @@ import * as dateFns from "date-fns" import { dateHelper, defaultHelpers, handlebarsParse, nowHelper } from "../src/parser" const blankConf: ScaffoldConfig = { - verbose: 0, + logLevel: "none", name: "", output: "", templates: [], diff --git a/tests/scaffold.test.ts b/tests/scaffold.test.ts index 7b4dbd6..469016d 100644 --- a/tests/scaffold.test.ts +++ b/tests/scaffold.test.ts @@ -99,7 +99,7 @@ describe("Scaffold", () => { name: "app_name", output: "output", templates: ["input"], - verbose: 0, + logLevel: "none", }) const data = readFileSync(join(process.cwd(), "output", "app_name.txt")) expect(data.toString()).toEqual("Hello, my app is app_name") @@ -111,7 +111,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], createSubFolder: true, - verbose: 0, + logLevel: "none", }) const data = readFileSync(join(process.cwd(), "output", "app_name", "app_name.txt")) @@ -128,7 +128,7 @@ describe("Scaffold", () => { name: "app_name", output: "output", templates: ["input"], - verbose: 0, + logLevel: "none", }) const data = readFileSync(join(process.cwd(), "output", "app_name.txt")) expect(data.toString()).toEqual("Hello, my app is app_name") @@ -147,7 +147,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], data: { value: "1" }, - verbose: 0, + logLevel: "none", }) await Scaffold({ @@ -155,7 +155,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], data: { value: "2" }, - verbose: 0, + logLevel: "none", }) const data = readFileSync(join(process.cwd(), "output", "app_name.txt")) @@ -168,7 +168,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], data: { value: "1" }, - verbose: 0, + logLevel: "none", }) await Scaffold({ @@ -177,7 +177,7 @@ describe("Scaffold", () => { templates: ["input"], data: { value: "2" }, overwrite: true, - verbose: 0, + logLevel: "none", }) const data = readFileSync(join(process.cwd(), "output", "app_name.txt")) @@ -205,7 +205,7 @@ describe("Scaffold", () => { output: "output", templates: ["non-existing-input"], data: { value: "1" }, - verbose: 0, + logLevel: "none", }), ).rejects.toThrow() @@ -215,7 +215,7 @@ describe("Scaffold", () => { output: "output", templates: ["non-existing-input/non-existing-file.txt"], data: { value: "1" }, - verbose: 0, + logLevel: "none", }), ).rejects.toThrow() @@ -242,7 +242,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], data: { value: "1" }, - verbose: 0, + logLevel: "none", dryRun: true, }) @@ -260,7 +260,7 @@ describe("Scaffold", () => { output: (_, __, basename) => join("custom-output", `${basename.split(".")[0]}`), templates: ["input"], data: { value: "1" }, - verbose: 0, + logLevel: "none", }) const data = readFileSync(join(process.cwd(), "/custom-output/app_name/app_name.txt")) expect(data.toString()).toEqual("Hello, my app is app_name") @@ -277,7 +277,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], data: { value: "1" }, - verbose: 0, + logLevel: "none", }) const rootDir = readdirSync(join(process.cwd(), "output")) @@ -309,7 +309,7 @@ describe("Scaffold", () => { name: "app_name", output: "output", templates: ["input"], - verbose: 0, + logLevel: "none", helpers: _helpers, }) @@ -342,7 +342,7 @@ describe("Scaffold", () => { name: "app_name", output: "output", templates: ["input"], - verbose: 0, + logLevel: "none", data: { customDate }, }) @@ -380,7 +380,7 @@ describe("Scaffold", () => { name: "app_name", output: "output", templates: ["input"], - verbose: 0, + logLevel: "none", helpers: _helpers, }) @@ -403,7 +403,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], createSubFolder: true, - verbose: 0, + logLevel: "none", }) const data = readFileSync(join(process.cwd(), "output", "app_name", "app_name.txt")) @@ -416,7 +416,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], createSubFolder: true, - verbose: 0, + logLevel: "none", subFolderNameHelper: "upperCase", }) @@ -430,7 +430,7 @@ describe("Scaffold", () => { output: "output", templates: ["input"], createSubFolder: true, - verbose: 0, + logLevel: "none", subFolderNameHelper: "test", helpers: { test: () => "REPLACED", @@ -450,7 +450,7 @@ describe("Scaffold", () => { name: "app_name", output: "output", templates: ["input"], - verbose: 0, + logLevel: "none", data: { value: "value", }, @@ -465,7 +465,7 @@ describe("Scaffold", () => { name: "app_name", output: "output", templates: ["input"], - verbose: 0, + logLevel: "none", data: { value: "value", }, @@ -487,7 +487,7 @@ describe("Scaffold", () => { name: "app_name", output: "output", templates: ["input"], - verbose: 0, + logLevel: "none", data: { value: "value", },