From cd8ddc08632f0d827e65982b60afe8395d5d49b4 Mon Sep 17 00:00:00 2001 From: kreuzerk Date: Wed, 2 Feb 2022 22:25:30 +0100 Subject: [PATCH] feat(binaries): provide new binaries --- package.json | 6 +++--- src/lib/helpers/logger.ts | 4 +--- .../commander/constant-options.commander.ts | 2 ++ .../options/commander/file-options.commander.ts | 2 ++ .../commander/object-options.commander.ts | 3 ++- .../commandline-consts-options.collector.ts | 16 +++++++--------- .../commandline-object-options.collector.ts | 11 +++++------ 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index fd2c3fc..d06063c 100644 --- a/package.json +++ b/package.json @@ -60,9 +60,9 @@ } }, "bin": { - "svg-to-ts-files": "./src/bin/svg-to-ts.js", - "svg-to-ts-consts": "./src/bin/svg-to-ts.js", - "svg-to-ts-object": "./src/bin/svg-to-ts.js" + "svg-to-ts-files": "./src/bin/svg-to-ts-files.js", + "svg-to-ts-constants": "./src/bin/svg-to-ts-constants.js", + "svg-to-ts-object": "./src/bin/svg-to-ts-object.js" }, "keywords": [ "SVG", diff --git a/src/lib/helpers/logger.ts b/src/lib/helpers/logger.ts index e29b0d2..d5fa97c 100644 --- a/src/lib/helpers/logger.ts +++ b/src/lib/helpers/logger.ts @@ -1,11 +1,9 @@ import chalk from 'chalk'; -import { DEFAULT_OPTIONS } from '../options/default-options'; - export const messagePrefix = 'svg-to-ts:'; export class Logger { - private static verbose = DEFAULT_OPTIONS.verbose; + private static verbose = false; public static changeVisibility(verbose: boolean) { Logger.verbose = verbose; diff --git a/src/lib/options/commander/constant-options.commander.ts b/src/lib/options/commander/constant-options.commander.ts index 58579b8..b3c8fc3 100644 --- a/src/lib/options/commander/constant-options.commander.ts +++ b/src/lib/options/commander/constant-options.commander.ts @@ -62,3 +62,5 @@ export const setupConstantOptionsCommander = () => { ) .parse(process.argv); }; + +export const getConfigPath = (): string | undefined => commander.config; diff --git a/src/lib/options/commander/file-options.commander.ts b/src/lib/options/commander/file-options.commander.ts index 5843f46..28ae5c0 100644 --- a/src/lib/options/commander/file-options.commander.ts +++ b/src/lib/options/commander/file-options.commander.ts @@ -78,3 +78,5 @@ export const setupFilesOptionsCommander = () => { ) .parse(process.argv); }; + +export const getConfigPath = (): string | undefined => commander.config; diff --git a/src/lib/options/commander/object-options.commander.ts b/src/lib/options/commander/object-options.commander.ts index 430094a..d4349ec 100644 --- a/src/lib/options/commander/object-options.commander.ts +++ b/src/lib/options/commander/object-options.commander.ts @@ -2,7 +2,6 @@ import commander from 'commander'; import * as packgeJSON from '../../../../package.json'; import { Delimiter } from '../../generators/code-snippet-generators'; -import { DEFAULT_OPTIONS } from '../default-options'; import { DEFAULT_OBJECT_CONVERSION_OPTIONS } from '../default-options/default-object-conversion-options'; export const setupObjectOptionsCommander = () => { @@ -36,3 +35,5 @@ export const setupObjectOptionsCommander = () => { ) .parse(process.argv); }; + +export const getConfigPath = (): string | undefined => commander.config; diff --git a/src/lib/options/options-collector/command-line-options-collectors/commandline-consts-options.collector.ts b/src/lib/options/options-collector/command-line-options-collectors/commandline-consts-options.collector.ts index 1ec8de0..68f4bd1 100644 --- a/src/lib/options/options-collector/command-line-options-collectors/commandline-consts-options.collector.ts +++ b/src/lib/options/options-collector/command-line-options-collectors/commandline-consts-options.collector.ts @@ -1,14 +1,13 @@ import commander from 'commander'; import { getSvgoConfig } from '../../../helpers/svg-optimization'; -import { ConstantsConversionOptions } from '../../conversion-options'; -import { DEFAULT_OPTIONS } from '../../default-options'; +import { ConstantsConversionOptions } from '../../conversion-options/constant-conversion-options'; +import { DEFAULT_CONST_CONVERSION_OPTIONS } from '../../default-options/default-constants-conversion-options'; import { toBoolean } from './command-line-collector.helpers'; export const collectCommandLineConstantOptions = async (): Promise => { let { - conversionType, delimiter, fileName, interfaceName, @@ -22,21 +21,20 @@ export const collectCommandLineConstantOptions = async (): Promise => { - let { conversionType, objectName, delimiter, fileName, outputDirectory, verbose } = commander; + let { objectName, delimiter, fileName, outputDirectory, verbose } = commander; let svgoConfig = commander.svgoConfig; // Parse boolean values - verbose = toBoolean(verbose, DEFAULT_OPTIONS.verbose); + verbose = toBoolean(verbose, DEFAULT_OBJECT_CONVERSION_OPTIONS.verbose); let srcFiles = commander.srcFiles; if (srcFiles.length === 0) { - srcFiles = DEFAULT_OPTIONS.srcFiles; + srcFiles = DEFAULT_OBJECT_CONVERSION_OPTIONS.srcFiles; } svgoConfig = await getSvgoConfig(svgoConfig); return { - conversionType, delimiter, srcFiles, outputDirectory,