@bemoje/cli 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/arg/ArgumentBuilder.js +2 -2
- package/cjs/arg/ArgumentBuilder.js.map +1 -1
- package/cjs/arg/ArgumentValidatorSelector.js +2 -2
- package/cjs/arg/ArgumentValidatorSelector.js.map +1 -1
- package/cjs/cmd/CommandBuilder.js +77 -34
- package/cjs/cmd/CommandBuilder.js.map +1 -1
- package/cjs/cmd/CommandBuilderMetaData.js +2 -2
- package/cjs/cmd/CommandBuilderMetaData.js.map +1 -1
- package/cjs/core/OutputManager.js +4 -4
- package/cjs/core/OutputManager.js.map +1 -1
- package/cjs/core/ParserSelector.js +11 -11
- package/cjs/core/ParserSelector.js.map +1 -1
- package/cjs/core/ValidatorSelector.js +11 -11
- package/cjs/core/ValidatorSelector.js.map +1 -1
- package/cjs/db/AbstractJsonFileSection.js +2 -3
- package/cjs/db/AbstractJsonFileSection.js.map +1 -1
- package/cjs/db/ConfigSection.js +3 -4
- package/cjs/db/ConfigSection.js.map +1 -1
- package/cjs/db/JsonFile.js +5 -6
- package/cjs/db/JsonFile.js.map +1 -1
- package/cjs/db/PresetsSection.js +2 -2
- package/cjs/db/PresetsSection.js.map +1 -1
- package/cjs/index.js +0 -78
- package/cjs/index.js.map +1 -1
- package/cjs/opt/OptionBuilder.js +2 -2
- package/cjs/opt/OptionBuilder.js.map +1 -1
- package/cjs/opt/OptionHelpers.js +5 -5
- package/cjs/opt/OptionHelpers.js.map +1 -1
- package/esm/arg/ArgumentBuilder.js +1 -1
- package/esm/arg/ArgumentBuilder.js.map +1 -1
- package/esm/arg/ArgumentValidatorSelector.js +1 -1
- package/esm/arg/ArgumentValidatorSelector.js.map +1 -1
- package/esm/cmd/CommandBuilder.js +59 -16
- package/esm/cmd/CommandBuilder.js.map +1 -1
- package/esm/cmd/CommandBuilderMetaData.js +1 -1
- package/esm/cmd/CommandBuilderMetaData.js.map +1 -1
- package/esm/core/OutputManager.js +1 -1
- package/esm/core/OutputManager.js.map +1 -1
- package/esm/core/ParserSelector.js +4 -4
- package/esm/core/ParserSelector.js.map +1 -1
- package/esm/core/ValidatorSelector.js +4 -4
- package/esm/core/ValidatorSelector.js.map +1 -1
- package/esm/db/AbstractJsonFileSection.js +1 -2
- package/esm/db/AbstractJsonFileSection.js.map +1 -1
- package/esm/db/ConfigSection.js +1 -2
- package/esm/db/ConfigSection.js.map +1 -1
- package/esm/db/JsonFile.js +1 -2
- package/esm/db/JsonFile.js.map +1 -1
- package/esm/db/PresetsSection.js +1 -1
- package/esm/db/PresetsSection.js.map +1 -1
- package/esm/index.js +0 -78
- package/esm/index.js.map +1 -1
- package/esm/opt/OptionBuilder.js +1 -1
- package/esm/opt/OptionBuilder.js.map +1 -1
- package/esm/opt/OptionHelpers.js +2 -2
- package/esm/opt/OptionHelpers.js.map +1 -1
- package/package.json +1 -1
- package/types/arg/ArgumentParserSelector.d.ts +2 -2
- package/types/arg/ArgumentValidatorSelector.d.ts +1 -1
- package/types/cmd/CommandBuilder.d.ts +40 -6
- package/types/cmd/CommandBuilderMetaData.d.ts +3 -3
- package/types/core/OutputManager.d.ts +2 -2
- package/types/core/ParserSelector.d.ts +2 -2
- package/types/core/ValidatorSelector.d.ts +2 -2
- package/types/db/AbstractJsonFileSection.d.ts +2 -3
- package/types/db/AppDataSection.d.ts +1 -1
- package/types/db/ConfigSection.d.ts +1 -3
- package/types/db/JsonFile.d.ts +1 -1
- package/types/index.d.ts +0 -78
- package/types/opt/OptionArgumentParserSelector.d.ts +1 -1
- package/types/opt/OptionArgumentValidatorSelector.d.ts +1 -1
- package/types/types/IConfig.d.ts +3 -3
- package/types/types/IPreset.d.ts +1 -1
- package/cjs/_example/bFindIn.js +0 -189
- package/cjs/_example/bFindIn.js.map +0 -1
- package/cjs/cmd/asdas.js +0 -27
- package/cjs/cmd/asdas.js.map +0 -1
- package/cjs/util/array/arrLast.js +0 -21
- package/cjs/util/array/arrLast.js.map +0 -1
- package/cjs/util/array/arrSome.js +0 -26
- package/cjs/util/array/arrSome.js.map +0 -1
- package/cjs/util/array/types/ArrayPredicate.js +0 -3
- package/cjs/util/array/types/ArrayPredicate.js.map +0 -1
- package/cjs/util/db/JsonDB.js +0 -145
- package/cjs/util/db/JsonDB.js.map +0 -1
- package/cjs/util/errors/ErrorParser.js +0 -164
- package/cjs/util/errors/ErrorParser.js.map +0 -1
- package/cjs/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js +0 -3
- package/cjs/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js.map +0 -1
- package/cjs/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js +0 -32
- package/cjs/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js.map +0 -1
- package/cjs/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js +0 -25
- package/cjs/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js.map +0 -1
- package/cjs/util/fs/readFile/readFileSafeSync.js +0 -28
- package/cjs/util/fs/readFile/readFileSafeSync.js.map +0 -1
- package/cjs/util/fs/readFile/readFileSync.js +0 -20
- package/cjs/util/fs/readFile/readFileSync.js.map +0 -1
- package/cjs/util/fs/readJsonFile/readJsonFileSafeSync.js +0 -24
- package/cjs/util/fs/readJsonFile/readJsonFileSafeSync.js.map +0 -1
- package/cjs/util/fs/removeFile/removeFile.js +0 -6
- package/cjs/util/fs/removeFile/removeFile.js.map +0 -1
- package/cjs/util/fs/tempFile/tempFileSync.js +0 -28
- package/cjs/util/fs/tempFile/tempFileSync.js.map +0 -1
- package/cjs/util/fs/types/IReadJsonFileOptions.js +0 -3
- package/cjs/util/fs/types/IReadJsonFileOptions.js.map +0 -1
- package/cjs/util/fs/writeFile/writeFileSafeSync.js +0 -6
- package/cjs/util/fs/writeFile/writeFileSafeSync.js.map +0 -1
- package/cjs/util/fs/writeFile/writeFileSync.js +0 -6
- package/cjs/util/fs/writeFile/writeFileSync.js.map +0 -1
- package/cjs/util/fs/writeJsonFile/writeJsonFileSafe.js +0 -6
- package/cjs/util/fs/writeJsonFile/writeJsonFileSafe.js.map +0 -1
- package/cjs/util/function/MethodDisabler.js +0 -94
- package/cjs/util/function/MethodDisabler.js.map +0 -1
- package/cjs/util/function/funSetName.js +0 -21
- package/cjs/util/function/funSetName.js.map +0 -1
- package/cjs/util/node/execInherit.js +0 -19
- package/cjs/util/node/execInherit.js.map +0 -1
- package/cjs/util/node/formatTableForTerminal.js +0 -21
- package/cjs/util/node/formatTableForTerminal.js.map +0 -1
- package/cjs/util/object/arrAssign.js +0 -6
- package/cjs/util/object/arrAssign.js.map +0 -1
- package/cjs/util/object/createArrayMerger.js +0 -20
- package/cjs/util/object/createArrayMerger.js.map +0 -1
- package/cjs/util/object/createObjectMerger.js +0 -20
- package/cjs/util/object/createObjectMerger.js.map +0 -1
- package/cjs/util/object/objAssign.js +0 -6
- package/cjs/util/object/objAssign.js.map +0 -1
- package/cjs/util/object/objUpdatePropertyDescriptors.js +0 -28
- package/cjs/util/object/objUpdatePropertyDescriptors.js.map +0 -1
- package/cjs/util/object/realizeLazyProperty.js +0 -14
- package/cjs/util/object/realizeLazyProperty.js.map +0 -1
- package/cjs/util/object/setNonEnumerable.js +0 -25
- package/cjs/util/object/setNonEnumerable.js.map +0 -1
- package/cjs/util/os/defaultOpenInEditorCommand.js +0 -18
- package/cjs/util/os/defaultOpenInEditorCommand.js.map +0 -1
- package/cjs/util/os/isOSX.js +0 -13
- package/cjs/util/os/isOSX.js.map +0 -1
- package/cjs/util/os/isVsCodeInstalled.js +0 -19
- package/cjs/util/os/isVsCodeInstalled.js.map +0 -1
- package/cjs/util/os/isWindows.js +0 -16
- package/cjs/util/os/isWindows.js.map +0 -1
- package/cjs/util/path/getTempDataPath.js +0 -20
- package/cjs/util/path/getTempDataPath.js.map +0 -1
- package/cjs/util/regex/regexEscapeString.js +0 -18
- package/cjs/util/regex/regexEscapeString.js.map +0 -1
- package/cjs/util/string/strEnsureStartsWith.js +0 -19
- package/cjs/util/string/strEnsureStartsWith.js.map +0 -1
- package/cjs/util/string/strFirstCharToUpperCase.js +0 -16
- package/cjs/util/string/strFirstCharToUpperCase.js.map +0 -1
- package/cjs/util/string/strIsLowerCase.js +0 -18
- package/cjs/util/string/strIsLowerCase.js.map +0 -1
- package/cjs/util/string/strIsUpperCase.js +0 -18
- package/cjs/util/string/strIsUpperCase.js.map +0 -1
- package/cjs/util/string/strSplitCamelCase.js +0 -55
- package/cjs/util/string/strSplitCamelCase.js.map +0 -1
- package/cjs/util/string-parsers/createBooleanParser.js +0 -21
- package/cjs/util/string-parsers/createBooleanParser.js.map +0 -1
- package/cjs/util/string-parsers/createTypedListParser.js +0 -22
- package/cjs/util/string-parsers/createTypedListParser.js.map +0 -1
- package/cjs/util/string-parsers/parseBoolean.js +0 -15
- package/cjs/util/string-parsers/parseBoolean.js.map +0 -1
- package/cjs/util/string-parsers/parseInteger.js +0 -17
- package/cjs/util/string-parsers/parseInteger.js.map +0 -1
- package/cjs/util/string-parsers/parseNumber.js +0 -13
- package/cjs/util/string-parsers/parseNumber.js.map +0 -1
- package/cjs/util/string-parsers/parseString.js +0 -8
- package/cjs/util/string-parsers/parseString.js.map +0 -1
- package/cjs/util/types/Any.js +0 -3
- package/cjs/util/types/Any.js.map +0 -1
- package/cjs/util/types/DeepArray.js +0 -3
- package/cjs/util/types/DeepArray.js.map +0 -1
- package/cjs/util/types/DeepObject.js +0 -3
- package/cjs/util/types/DeepObject.js.map +0 -1
- package/cjs/util/types/JsonArray.js +0 -3
- package/cjs/util/types/JsonArray.js.map +0 -1
- package/cjs/util/types/JsonDefinedPrimitive.js +0 -6
- package/cjs/util/types/JsonDefinedPrimitive.js.map +0 -1
- package/cjs/util/types/JsonObject.js +0 -3
- package/cjs/util/types/JsonObject.js.map +0 -1
- package/cjs/util/types/JsonRawPrimitive.js +0 -3
- package/cjs/util/types/JsonRawPrimitive.js.map +0 -1
- package/cjs/util/types/JsonValue.js +0 -3
- package/cjs/util/types/JsonValue.js.map +0 -1
- package/cjs/util/types/ObjectKey.js +0 -3
- package/cjs/util/types/ObjectKey.js.map +0 -1
- package/cjs/util/types/TConstructor.js +0 -3
- package/cjs/util/types/TConstructor.js.map +0 -1
- package/cjs/util/types/TFunction.js +0 -3
- package/cjs/util/types/TFunction.js.map +0 -1
- package/cjs/util/types/TFunctionNoNew.js +0 -3
- package/cjs/util/types/TFunctionNoNew.js.map +0 -1
- package/cjs/util/types/TPlainObject.js +0 -3
- package/cjs/util/types/TPlainObject.js.map +0 -1
- package/cjs/util/types/TPrimitive.js +0 -3
- package/cjs/util/types/TPrimitive.js.map +0 -1
- package/cjs/util/types/TStringParser.js +0 -3
- package/cjs/util/types/TStringParser.js.map +0 -1
- package/cjs/util/types/TValidator.js +0 -3
- package/cjs/util/types/TValidator.js.map +0 -1
- package/cjs/util/validation/createTypedArrayValidator.js +0 -26
- package/cjs/util/validation/createTypedArrayValidator.js.map +0 -1
- package/cjs/util/validation/ensureThat.js +0 -12
- package/cjs/util/validation/ensureThat.js.map +0 -1
- package/cjs/util/validation/isArray.js +0 -5
- package/cjs/util/validation/isArray.js.map +0 -1
- package/cjs/util/validation/isBoolean.js +0 -8
- package/cjs/util/validation/isBoolean.js.map +0 -1
- package/cjs/util/validation/isFunction.js +0 -17
- package/cjs/util/validation/isFunction.js.map +0 -1
- package/cjs/util/validation/isNamedFunction.js +0 -11
- package/cjs/util/validation/isNamedFunction.js.map +0 -1
- package/cjs/util/validation/isNamedFunctionArray.js +0 -9
- package/cjs/util/validation/isNamedFunctionArray.js.map +0 -1
- package/cjs/util/validation/isObject.js +0 -22
- package/cjs/util/validation/isObject.js.map +0 -1
- package/cjs/util/validation/isPlainObject.js +0 -19
- package/cjs/util/validation/isPlainObject.js.map +0 -1
- package/cjs/util/validation/isPrimitive.js +0 -18
- package/cjs/util/validation/isPrimitive.js.map +0 -1
- package/cjs/util/validation/isString.js +0 -8
- package/cjs/util/validation/isString.js.map +0 -1
- package/cjs/util/validation/isStringArray.js +0 -12
- package/cjs/util/validation/isStringArray.js.map +0 -1
- package/cjs/util/validation/isStringWithNoSpacesOrDashes.js +0 -9
- package/cjs/util/validation/isStringWithNoSpacesOrDashes.js.map +0 -1
- package/cjs/util/validation/numbers/isInteger.js +0 -17
- package/cjs/util/validation/numbers/isInteger.js.map +0 -1
- package/cjs/util/validation/numbers/isValidNumber.js +0 -22
- package/cjs/util/validation/numbers/isValidNumber.js.map +0 -1
- package/esm/_example/bFindIn.js +0 -187
- package/esm/_example/bFindIn.js.map +0 -1
- package/esm/cmd/asdas.js +0 -25
- package/esm/cmd/asdas.js.map +0 -1
- package/esm/util/array/arrLast.js +0 -17
- package/esm/util/array/arrLast.js.map +0 -1
- package/esm/util/array/arrSome.js +0 -22
- package/esm/util/array/arrSome.js.map +0 -1
- package/esm/util/array/types/ArrayPredicate.js +0 -2
- package/esm/util/array/types/ArrayPredicate.js.map +0 -1
- package/esm/util/db/JsonDB.js +0 -141
- package/esm/util/db/JsonDB.js.map +0 -1
- package/esm/util/errors/ErrorParser.js +0 -154
- package/esm/util/errors/ErrorParser.js.map +0 -1
- package/esm/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js +0 -2
- package/esm/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js.map +0 -1
- package/esm/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js +0 -28
- package/esm/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js.map +0 -1
- package/esm/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js +0 -21
- package/esm/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js.map +0 -1
- package/esm/util/fs/readFile/readFileSafeSync.js +0 -21
- package/esm/util/fs/readFile/readFileSafeSync.js.map +0 -1
- package/esm/util/fs/readFile/readFileSync.js +0 -13
- package/esm/util/fs/readFile/readFileSync.js.map +0 -1
- package/esm/util/fs/readJsonFile/readJsonFileSafeSync.js +0 -17
- package/esm/util/fs/readJsonFile/readJsonFileSafeSync.js.map +0 -1
- package/esm/util/fs/removeFile/removeFile.js +0 -2
- package/esm/util/fs/removeFile/removeFile.js.map +0 -1
- package/esm/util/fs/tempFile/tempFileSync.js +0 -21
- package/esm/util/fs/tempFile/tempFileSync.js.map +0 -1
- package/esm/util/fs/types/IReadJsonFileOptions.js +0 -2
- package/esm/util/fs/types/IReadJsonFileOptions.js.map +0 -1
- package/esm/util/fs/writeFile/writeFileSafeSync.js +0 -2
- package/esm/util/fs/writeFile/writeFileSafeSync.js.map +0 -1
- package/esm/util/fs/writeFile/writeFileSync.js +0 -2
- package/esm/util/fs/writeFile/writeFileSync.js.map +0 -1
- package/esm/util/fs/writeJsonFile/writeJsonFileSafe.js +0 -2
- package/esm/util/fs/writeJsonFile/writeJsonFileSafe.js.map +0 -1
- package/esm/util/function/MethodDisabler.js +0 -90
- package/esm/util/function/MethodDisabler.js.map +0 -1
- package/esm/util/function/funSetName.js +0 -17
- package/esm/util/function/funSetName.js.map +0 -1
- package/esm/util/node/execInherit.js +0 -15
- package/esm/util/node/execInherit.js.map +0 -1
- package/esm/util/node/formatTableForTerminal.js +0 -14
- package/esm/util/node/formatTableForTerminal.js.map +0 -1
- package/esm/util/object/arrAssign.js +0 -3
- package/esm/util/object/arrAssign.js.map +0 -1
- package/esm/util/object/createArrayMerger.js +0 -16
- package/esm/util/object/createArrayMerger.js.map +0 -1
- package/esm/util/object/createObjectMerger.js +0 -16
- package/esm/util/object/createObjectMerger.js.map +0 -1
- package/esm/util/object/objAssign.js +0 -3
- package/esm/util/object/objAssign.js.map +0 -1
- package/esm/util/object/objUpdatePropertyDescriptors.js +0 -24
- package/esm/util/object/objUpdatePropertyDescriptors.js.map +0 -1
- package/esm/util/object/realizeLazyProperty.js +0 -10
- package/esm/util/object/realizeLazyProperty.js.map +0 -1
- package/esm/util/object/setNonEnumerable.js +0 -21
- package/esm/util/object/setNonEnumerable.js.map +0 -1
- package/esm/util/os/defaultOpenInEditorCommand.js +0 -14
- package/esm/util/os/defaultOpenInEditorCommand.js.map +0 -1
- package/esm/util/os/isOSX.js +0 -9
- package/esm/util/os/isOSX.js.map +0 -1
- package/esm/util/os/isVsCodeInstalled.js +0 -15
- package/esm/util/os/isVsCodeInstalled.js.map +0 -1
- package/esm/util/os/isWindows.js +0 -12
- package/esm/util/os/isWindows.js.map +0 -1
- package/esm/util/path/getTempDataPath.js +0 -13
- package/esm/util/path/getTempDataPath.js.map +0 -1
- package/esm/util/regex/regexEscapeString.js +0 -14
- package/esm/util/regex/regexEscapeString.js.map +0 -1
- package/esm/util/string/strEnsureStartsWith.js +0 -15
- package/esm/util/string/strEnsureStartsWith.js.map +0 -1
- package/esm/util/string/strFirstCharToUpperCase.js +0 -12
- package/esm/util/string/strFirstCharToUpperCase.js.map +0 -1
- package/esm/util/string/strIsLowerCase.js +0 -14
- package/esm/util/string/strIsLowerCase.js.map +0 -1
- package/esm/util/string/strIsUpperCase.js +0 -14
- package/esm/util/string/strIsUpperCase.js.map +0 -1
- package/esm/util/string/strSplitCamelCase.js +0 -51
- package/esm/util/string/strSplitCamelCase.js.map +0 -1
- package/esm/util/string-parsers/createBooleanParser.js +0 -17
- package/esm/util/string-parsers/createBooleanParser.js.map +0 -1
- package/esm/util/string-parsers/createTypedListParser.js +0 -18
- package/esm/util/string-parsers/createTypedListParser.js.map +0 -1
- package/esm/util/string-parsers/parseBoolean.js +0 -12
- package/esm/util/string-parsers/parseBoolean.js.map +0 -1
- package/esm/util/string-parsers/parseInteger.js +0 -13
- package/esm/util/string-parsers/parseInteger.js.map +0 -1
- package/esm/util/string-parsers/parseNumber.js +0 -9
- package/esm/util/string-parsers/parseNumber.js.map +0 -1
- package/esm/util/string-parsers/parseString.js +0 -4
- package/esm/util/string-parsers/parseString.js.map +0 -1
- package/esm/util/types/Any.js +0 -2
- package/esm/util/types/Any.js.map +0 -1
- package/esm/util/types/DeepArray.js +0 -2
- package/esm/util/types/DeepArray.js.map +0 -1
- package/esm/util/types/DeepObject.js +0 -2
- package/esm/util/types/DeepObject.js.map +0 -1
- package/esm/util/types/JsonArray.js +0 -2
- package/esm/util/types/JsonArray.js.map +0 -1
- package/esm/util/types/JsonDefinedPrimitive.js +0 -5
- package/esm/util/types/JsonDefinedPrimitive.js.map +0 -1
- package/esm/util/types/JsonObject.js +0 -2
- package/esm/util/types/JsonObject.js.map +0 -1
- package/esm/util/types/JsonRawPrimitive.js +0 -2
- package/esm/util/types/JsonRawPrimitive.js.map +0 -1
- package/esm/util/types/JsonValue.js +0 -2
- package/esm/util/types/JsonValue.js.map +0 -1
- package/esm/util/types/ObjectKey.js +0 -2
- package/esm/util/types/ObjectKey.js.map +0 -1
- package/esm/util/types/TConstructor.js +0 -2
- package/esm/util/types/TConstructor.js.map +0 -1
- package/esm/util/types/TFunction.js +0 -2
- package/esm/util/types/TFunction.js.map +0 -1
- package/esm/util/types/TFunctionNoNew.js +0 -2
- package/esm/util/types/TFunctionNoNew.js.map +0 -1
- package/esm/util/types/TPlainObject.js +0 -2
- package/esm/util/types/TPlainObject.js.map +0 -1
- package/esm/util/types/TPrimitive.js +0 -2
- package/esm/util/types/TPrimitive.js.map +0 -1
- package/esm/util/types/TStringParser.js +0 -2
- package/esm/util/types/TStringParser.js.map +0 -1
- package/esm/util/types/TValidator.js +0 -2
- package/esm/util/types/TValidator.js.map +0 -1
- package/esm/util/validation/createTypedArrayValidator.js +0 -22
- package/esm/util/validation/createTypedArrayValidator.js.map +0 -1
- package/esm/util/validation/ensureThat.js +0 -8
- package/esm/util/validation/ensureThat.js.map +0 -1
- package/esm/util/validation/isArray.js +0 -2
- package/esm/util/validation/isArray.js.map +0 -1
- package/esm/util/validation/isBoolean.js +0 -4
- package/esm/util/validation/isBoolean.js.map +0 -1
- package/esm/util/validation/isFunction.js +0 -13
- package/esm/util/validation/isFunction.js.map +0 -1
- package/esm/util/validation/isNamedFunction.js +0 -7
- package/esm/util/validation/isNamedFunction.js.map +0 -1
- package/esm/util/validation/isNamedFunctionArray.js +0 -5
- package/esm/util/validation/isNamedFunctionArray.js.map +0 -1
- package/esm/util/validation/isObject.js +0 -18
- package/esm/util/validation/isObject.js.map +0 -1
- package/esm/util/validation/isPlainObject.js +0 -15
- package/esm/util/validation/isPlainObject.js.map +0 -1
- package/esm/util/validation/isPrimitive.js +0 -14
- package/esm/util/validation/isPrimitive.js.map +0 -1
- package/esm/util/validation/isString.js +0 -4
- package/esm/util/validation/isString.js.map +0 -1
- package/esm/util/validation/isStringArray.js +0 -8
- package/esm/util/validation/isStringArray.js.map +0 -1
- package/esm/util/validation/isStringWithNoSpacesOrDashes.js +0 -5
- package/esm/util/validation/isStringWithNoSpacesOrDashes.js.map +0 -1
- package/esm/util/validation/numbers/isInteger.js +0 -14
- package/esm/util/validation/numbers/isInteger.js.map +0 -1
- package/esm/util/validation/numbers/isValidNumber.js +0 -18
- package/esm/util/validation/numbers/isValidNumber.js.map +0 -1
- package/types/_example/bFindIn.d.ts +0 -1
- package/types/cmd/asdas.d.ts +0 -6
- package/types/util/array/arrLast.d.ts +0 -12
- package/types/util/array/arrSome.d.ts +0 -15
- package/types/util/array/types/ArrayPredicate.d.ts +0 -10
- package/types/util/db/JsonDB.d.ts +0 -65
- package/types/util/errors/ErrorParser.d.ts +0 -15
- package/types/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.d.ts +0 -15
- package/types/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.d.ts +0 -9
- package/types/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.d.ts +0 -13
- package/types/util/fs/readFile/readFileSafeSync.d.ts +0 -13
- package/types/util/fs/readFile/readFileSync.d.ts +0 -10
- package/types/util/fs/readJsonFile/readJsonFileSafeSync.d.ts +0 -9
- package/types/util/fs/removeFile/removeFile.d.ts +0 -1
- package/types/util/fs/tempFile/tempFileSync.d.ts +0 -7
- package/types/util/fs/types/IReadJsonFileOptions.d.ts +0 -1
- package/types/util/fs/writeFile/writeFileSafeSync.d.ts +0 -1
- package/types/util/fs/writeFile/writeFileSync.d.ts +0 -1
- package/types/util/fs/writeJsonFile/writeJsonFileSafe.d.ts +0 -1
- package/types/util/function/MethodDisabler.d.ts +0 -43
- package/types/util/function/funSetName.d.ts +0 -13
- package/types/util/node/execInherit.d.ts +0 -1
- package/types/util/node/formatTableForTerminal.d.ts +0 -1
- package/types/util/object/arrAssign.d.ts +0 -1
- package/types/util/object/createArrayMerger.d.ts +0 -4
- package/types/util/object/createObjectMerger.d.ts +0 -5
- package/types/util/object/objAssign.d.ts +0 -1
- package/types/util/object/objUpdatePropertyDescriptors.d.ts +0 -16
- package/types/util/object/realizeLazyProperty.d.ts +0 -1
- package/types/util/object/setNonEnumerable.d.ts +0 -15
- package/types/util/os/defaultOpenInEditorCommand.d.ts +0 -5
- package/types/util/os/isOSX.d.ts +0 -6
- package/types/util/os/isVsCodeInstalled.d.ts +0 -5
- package/types/util/os/isWindows.d.ts +0 -8
- package/types/util/path/getTempDataPath.d.ts +0 -6
- package/types/util/regex/regexEscapeString.d.ts +0 -11
- package/types/util/string/strEnsureStartsWith.d.ts +0 -12
- package/types/util/string/strFirstCharToUpperCase.d.ts +0 -9
- package/types/util/string/strIsLowerCase.d.ts +0 -11
- package/types/util/string/strIsUpperCase.d.ts +0 -11
- package/types/util/string/strSplitCamelCase.d.ts +0 -11
- package/types/util/string-parsers/createBooleanParser.d.ts +0 -7
- package/types/util/string-parsers/createTypedListParser.d.ts +0 -11
- package/types/util/string-parsers/parseBoolean.d.ts +0 -10
- package/types/util/string-parsers/parseInteger.d.ts +0 -1
- package/types/util/string-parsers/parseNumber.d.ts +0 -1
- package/types/util/string-parsers/parseString.d.ts +0 -1
- package/types/util/types/Any.d.ts +0 -1
- package/types/util/types/DeepArray.d.ts +0 -10
- package/types/util/types/DeepObject.d.ts +0 -14
- package/types/util/types/JsonArray.d.ts +0 -6
- package/types/util/types/JsonDefinedPrimitive.d.ts +0 -4
- package/types/util/types/JsonObject.d.ts +0 -6
- package/types/util/types/JsonRawPrimitive.d.ts +0 -5
- package/types/util/types/JsonValue.d.ts +0 -7
- package/types/util/types/ObjectKey.d.ts +0 -1
- package/types/util/types/TConstructor.d.ts +0 -5
- package/types/util/types/TFunction.d.ts +0 -4
- package/types/util/types/TFunctionNoNew.d.ts +0 -2
- package/types/util/types/TPlainObject.d.ts +0 -2
- package/types/util/types/TPrimitive.d.ts +0 -1
- package/types/util/types/TStringParser.d.ts +0 -1
- package/types/util/types/TValidator.d.ts +0 -2
- package/types/util/validation/createTypedArrayValidator.d.ts +0 -9
- package/types/util/validation/ensureThat.d.ts +0 -6
- package/types/util/validation/isArray.d.ts +0 -1
- package/types/util/validation/isBoolean.d.ts +0 -1
- package/types/util/validation/isFunction.d.ts +0 -11
- package/types/util/validation/isNamedFunction.d.ts +0 -5
- package/types/util/validation/isNamedFunctionArray.d.ts +0 -1
- package/types/util/validation/isObject.d.ts +0 -15
- package/types/util/validation/isPlainObject.d.ts +0 -6
- package/types/util/validation/isPrimitive.d.ts +0 -12
- package/types/util/validation/isString.d.ts +0 -1
- package/types/util/validation/isStringArray.d.ts +0 -4
- package/types/util/validation/isStringWithNoSpacesOrDashes.d.ts +0 -1
- package/types/util/validation/numbers/isInteger.d.ts +0 -13
- package/types/util/validation/numbers/isValidNumber.d.ts +0 -15
package/cjs/util/db/JsonDB.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonDB = void 0;
|
|
4
|
-
const ensureThat_1 = require("../validation/ensureThat");
|
|
5
|
-
const isObject_1 = require("../validation/isObject");
|
|
6
|
-
const readJsonFileSafeSync_1 = require("../fs/readJsonFile/readJsonFileSafeSync");
|
|
7
|
-
const writeJsonFileSafe_1 = require("../fs/writeJsonFile/writeJsonFileSafe");
|
|
8
|
-
/**
|
|
9
|
-
* Represents a simple JSON file database.
|
|
10
|
-
*/
|
|
11
|
-
class JsonDB {
|
|
12
|
-
filepath;
|
|
13
|
-
indents;
|
|
14
|
-
/**
|
|
15
|
-
* The data stored in the JSON database.
|
|
16
|
-
*/
|
|
17
|
-
data;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new instance of the JsonDB class.
|
|
20
|
-
* @param filepath - The filepath where the data file is stored or to be stored.
|
|
21
|
-
*/
|
|
22
|
-
constructor(filepath, indents = 0) {
|
|
23
|
-
this.filepath = filepath;
|
|
24
|
-
this.indents = indents;
|
|
25
|
-
this.data = (0, readJsonFileSafeSync_1.readJsonFileSafeSync)(this.filepath) ?? {};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Saves the data to the JSON file.
|
|
29
|
-
*/
|
|
30
|
-
async save(indents = this.indents) {
|
|
31
|
-
return await (0, writeJsonFileSafe_1.writeJsonFileSafe)(this.filepath, this.data, { spaces: indents });
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Sets the filepath of the JSON file.
|
|
35
|
-
* @param filepath - The new filepath.
|
|
36
|
-
*/
|
|
37
|
-
setFilepath(filepath, save = true) {
|
|
38
|
-
if (this.filepath === filepath)
|
|
39
|
-
return;
|
|
40
|
-
this.filepath = filepath;
|
|
41
|
-
if (save)
|
|
42
|
-
this.save();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Sets a value in the JSON database.
|
|
46
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
47
|
-
* @param value - The value to set.
|
|
48
|
-
* @param save - Whether to save the data to the JSON file.
|
|
49
|
-
*/
|
|
50
|
-
set(prefix, value = {}, save = true) {
|
|
51
|
-
if (!prefix) {
|
|
52
|
-
this.data = (0, ensureThat_1.ensureThat)(value, isObject_1.isObject);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
const keys = prefix.split('.');
|
|
56
|
-
const lastKey = keys.pop();
|
|
57
|
-
let node = this.data;
|
|
58
|
-
for (const key of keys) {
|
|
59
|
-
if (!Object.hasOwn(node, key)) {
|
|
60
|
-
node[key] = {};
|
|
61
|
-
}
|
|
62
|
-
node = node[key];
|
|
63
|
-
}
|
|
64
|
-
node[lastKey] = this.cloneDeep(value);
|
|
65
|
-
}
|
|
66
|
-
if (save)
|
|
67
|
-
this.save();
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Gets a value from the JSON database.
|
|
71
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
72
|
-
* @returns The value associated with the key.
|
|
73
|
-
* @throws An error if no entry is found at the specified key.
|
|
74
|
-
*/
|
|
75
|
-
get(prefix) {
|
|
76
|
-
const value = this.getSafe(prefix);
|
|
77
|
-
if (value === undefined)
|
|
78
|
-
throw new Error(`No entry at '${prefix}'`);
|
|
79
|
-
return this.cloneDeep(value);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Gets a value from the JSON database safely.
|
|
83
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
84
|
-
* @returns The value associated with the key, or undefined if no entry is found.
|
|
85
|
-
*/
|
|
86
|
-
getSafe(prefix) {
|
|
87
|
-
if (!prefix)
|
|
88
|
-
return this.cloneDeep(this.data);
|
|
89
|
-
const keys = prefix.split('.');
|
|
90
|
-
let node = this.data;
|
|
91
|
-
for (const key of keys) {
|
|
92
|
-
if (!Object.hasOwn(node, key)) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
node = node[key];
|
|
96
|
-
}
|
|
97
|
-
return this.cloneDeep(node);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Checks if a key exists in the JSON database.
|
|
101
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
102
|
-
* @returns True if the key exists, false otherwise.
|
|
103
|
-
*/
|
|
104
|
-
has(prefix) {
|
|
105
|
-
if (!prefix)
|
|
106
|
-
return true;
|
|
107
|
-
return this.getSafe(prefix) !== undefined;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Deletes a value from the JSON database.
|
|
111
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
112
|
-
* @param save - Whether to save the data to the JSON file.
|
|
113
|
-
*/
|
|
114
|
-
delete(prefix, save = true) {
|
|
115
|
-
if (!prefix) {
|
|
116
|
-
this.data = {};
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
const keys = prefix.split('.');
|
|
120
|
-
const lastKey = keys.pop();
|
|
121
|
-
let node = this.data;
|
|
122
|
-
for (const key of keys) {
|
|
123
|
-
if (!Object.hasOwn(node, key)) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
node = node[key];
|
|
127
|
-
}
|
|
128
|
-
delete node[lastKey];
|
|
129
|
-
}
|
|
130
|
-
if (save)
|
|
131
|
-
this.save();
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Creates a deep clone of an object.
|
|
135
|
-
* @param obj - The object to clone.
|
|
136
|
-
* @returns The cloned object.
|
|
137
|
-
*/
|
|
138
|
-
cloneDeep(obj) {
|
|
139
|
-
if (typeof obj !== 'object')
|
|
140
|
-
return obj;
|
|
141
|
-
return JSON.parse(JSON.stringify(obj));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.JsonDB = JsonDB;
|
|
145
|
-
//# sourceMappingURL=JsonDB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonDB.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/util/db/JsonDB.ts"],"names":[],"mappings":";;;AAAA,yDAAqD;AACrD,qDAAiD;AAGjD,kFAA8E;AAC9E,6EAAyE;AAEzE;;GAEG;AACH,MAAa,MAAM;IAUK;IAA4B;IATlD;;OAEG;IACO,IAAI,CAAY;IAE1B;;;OAGG;IACH,YAAsB,QAAgB,EAAY,UAAU,CAAC;QAAvC,aAAQ,GAAR,QAAQ,CAAQ;QAAY,YAAO,GAAP,OAAO,CAAI;QAC3D,IAAI,CAAC,I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GAAG,EAAY,CAAA;YACpC,IAAI,IAAI,GAAe,IAAI,CAAC,IAAI,CAAA;YAChC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;gBACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;oBAC7B,OAAM;iBACP;gBACD,IAAI,GAAG,IAAI,CAAC,GAAG,CAAe,CAAA;aAC/B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;SACrB;QACD,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACvB,CAAC;IAED;;;;OAIG;IACO,SAAS,CAAsB,GAAM;QAC7C,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,OAAO,GAAG,CAAA;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAM,CAAA;IAC7C,CAAC;CACF;AA/HD,wBA+HC"}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.errToObject = exports.errParseStack = exports.errPrettyStack = exports.ErrorParser = void 0;
|
|
7
|
-
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const isPlainObject_1 = require("../validation/isPlainObject");
|
|
10
|
-
const isPrimitive_1 = require("../validation/isPrimitive");
|
|
11
|
-
const regexEscapeString_1 = require("../regex/regexEscapeString");
|
|
12
|
-
class ErrorParser {
|
|
13
|
-
error;
|
|
14
|
-
constructor(error) {
|
|
15
|
-
this.error = error instanceof Error ? error : new Error(String(error));
|
|
16
|
-
}
|
|
17
|
-
get name() {
|
|
18
|
-
return this.error.name;
|
|
19
|
-
}
|
|
20
|
-
get message() {
|
|
21
|
-
return this.error.message;
|
|
22
|
-
}
|
|
23
|
-
get stack() {
|
|
24
|
-
return this.error.stack || '';
|
|
25
|
-
}
|
|
26
|
-
summary() {
|
|
27
|
-
return this.name + ': ' + this.message;
|
|
28
|
-
}
|
|
29
|
-
parseStackFrames() {
|
|
30
|
-
return errParseStack(this.stack);
|
|
31
|
-
}
|
|
32
|
-
prettyStack(parsedStackFrames) {
|
|
33
|
-
return errPrettyStack(this.error, parsedStackFrames);
|
|
34
|
-
}
|
|
35
|
-
toObject() {
|
|
36
|
-
return errToObject(this.error);
|
|
37
|
-
}
|
|
38
|
-
toJSON() {
|
|
39
|
-
return this.toObject();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.ErrorParser = ErrorParser;
|
|
43
|
-
function errPrettyStack(error, parsedStackFrames) {
|
|
44
|
-
const frames = parsedStackFrames ?? errParseStack(error.stack || '');
|
|
45
|
-
// width of the first column = the longest frame.cell string
|
|
46
|
-
const offset = 2 + frames.reduce((acc, frame) => Math.max(acc, frame[0].length), 0);
|
|
47
|
-
// type and message
|
|
48
|
-
const result = [
|
|
49
|
-
ansi_colors_1.default.bold(ansi_colors_1.default.red(error.name)) +
|
|
50
|
-
': ' +
|
|
51
|
-
' '.repeat(Math.max(0, offset - error.name.length)) +
|
|
52
|
-
ansi_colors_1.default.red(error.message),
|
|
53
|
-
];
|
|
54
|
-
// stack trace
|
|
55
|
-
result.push(ansi_colors_1.default.yellow('stack') + ':');
|
|
56
|
-
result.push(frames
|
|
57
|
-
.map((frame) => {
|
|
58
|
-
const [call, file] = frame;
|
|
59
|
-
let s = ' ';
|
|
60
|
-
let fp;
|
|
61
|
-
if (file.startsWith('node:')) {
|
|
62
|
-
s += ansi_colors_1.default.gray(call);
|
|
63
|
-
fp = ansi_colors_1.default.gray(file);
|
|
64
|
-
}
|
|
65
|
-
else if (file.includes('node_modules')) {
|
|
66
|
-
s += call;
|
|
67
|
-
const base = path_1.default.basename(file.split(':')[0]);
|
|
68
|
-
fp = file.replace(base, ansi_colors_1.default.yellow(base));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
s += call;
|
|
72
|
-
const base = path_1.default.basename(file.split(':')[0]);
|
|
73
|
-
fp = file.replace(base, ansi_colors_1.default.red(base));
|
|
74
|
-
}
|
|
75
|
-
s += ' '.repeat(offset - call.length);
|
|
76
|
-
s += fp;
|
|
77
|
-
return s;
|
|
78
|
-
})
|
|
79
|
-
.join('\n'));
|
|
80
|
-
// other properties
|
|
81
|
-
const ignore = ['name', 'message', 'frames', 'stack'];
|
|
82
|
-
const keys = Object.getOwnPropertyNames(error).filter((key) => !ignore.includes(key));
|
|
83
|
-
for (const k of keys) {
|
|
84
|
-
if (typeof k === 'symbol')
|
|
85
|
-
continue;
|
|
86
|
-
const key = k;
|
|
87
|
-
let s = ansi_colors_1.default.yellow(key.toString()) + ': ';
|
|
88
|
-
if ((0, isPlainObject_1.isPlainObject)(error[key])) {
|
|
89
|
-
const json = JSON.stringify(error[key], null, 2);
|
|
90
|
-
if (json.length < 350) {
|
|
91
|
-
s += JSON.stringify(error[key], null, 2)
|
|
92
|
-
.split('\n')
|
|
93
|
-
.map((line) => {
|
|
94
|
-
const arr = line.split('": ');
|
|
95
|
-
arr[0] = ansi_colors_1.default.gray(arr[0].replace('"', ''));
|
|
96
|
-
return arr.join(': ');
|
|
97
|
-
})
|
|
98
|
-
.join('\n');
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
s += JSON.stringify(error[key]);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else if ((0, isPrimitive_1.isPrimitive)(error[key])) {
|
|
105
|
-
s += String(error[key]);
|
|
106
|
-
}
|
|
107
|
-
else if (error[key] != null && typeof error[key] === 'object') {
|
|
108
|
-
s += error[key].toString();
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
s += JSON.stringify(error[key]);
|
|
112
|
-
}
|
|
113
|
-
result.push(s.trim());
|
|
114
|
-
}
|
|
115
|
-
return '\n' + result.join('\n') + '\n';
|
|
116
|
-
}
|
|
117
|
-
exports.errPrettyStack = errPrettyStack;
|
|
118
|
-
function errParseStack(stack) {
|
|
119
|
-
if (!stack)
|
|
120
|
-
return [];
|
|
121
|
-
const nodeRe = /^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
122
|
-
const recwd = new RegExp('^' + (0, regexEscapeString_1.regexEscapeString)(process.cwd() + path_1.default.sep), 'i');
|
|
123
|
-
const frames = [];
|
|
124
|
-
for (const line of stack.split('\n')) {
|
|
125
|
-
const parts = nodeRe.exec(line);
|
|
126
|
-
if (!parts)
|
|
127
|
-
continue;
|
|
128
|
-
frames.push([
|
|
129
|
-
parts[1] || '<unknown>',
|
|
130
|
-
`${(parts[2] || '').replace(recwd, '').replace(/\\\\?/g, '/')}:${+parts[3]}:${parts[4] ? +parts[4] : null}`,
|
|
131
|
-
]);
|
|
132
|
-
}
|
|
133
|
-
return frames;
|
|
134
|
-
}
|
|
135
|
-
exports.errParseStack = errParseStack;
|
|
136
|
-
function errToObject(error) {
|
|
137
|
-
const own = Object.getOwnPropertyNames(error).filter((key) => typeof key === 'string');
|
|
138
|
-
const keys = new Set(['name', 'message', 'frames', ...own]);
|
|
139
|
-
keys.delete('stack');
|
|
140
|
-
const entries = Array.from(keys)
|
|
141
|
-
.filter((key) => error[key] !== undefined)
|
|
142
|
-
.map((key) => [key, error[key]]);
|
|
143
|
-
return Object.fromEntries(entries);
|
|
144
|
-
}
|
|
145
|
-
exports.errToObject = errToObject;
|
|
146
|
-
// try {
|
|
147
|
-
// throw new TypeError('wow ok oops')
|
|
148
|
-
// } catch (error) {
|
|
149
|
-
// const err = new ErrorParser(error)
|
|
150
|
-
// console.log('----------------------')
|
|
151
|
-
// console.log({
|
|
152
|
-
// name: err.name,
|
|
153
|
-
// message: err.message,
|
|
154
|
-
// summary: err.summary,
|
|
155
|
-
// })
|
|
156
|
-
// console.log('----------------------')
|
|
157
|
-
// console.log(err.stack)
|
|
158
|
-
// console.log('----------------------')
|
|
159
|
-
// console.log(err.prettyStack())
|
|
160
|
-
// console.log('----------------------')
|
|
161
|
-
// console.log(err.toObject())
|
|
162
|
-
// console.log('----------------------')
|
|
163
|
-
// }
|
|
164
|
-
//# sourceMappingURL=ErrorParser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorParser.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/util/errors/ErrorParser.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAChC,gDAAuB;AAEvB,+DAA2D;AAC3D,2DAAuD;AACvD,kEAA8D;AAE9D,MAAa,WAAW;IACb,KAAK,CAAO;IAErB,YAAY,KAAc;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IACxE,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA;IACxB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAA;IAC3B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAA;IAC/B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,OAAO,CAAA;IACxC,CAAC;IAED,gBAAgB;QACd,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,WAAW,CAAC,iBAAsC;QAChD,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;IACtD,CAAC;IAED,QAAQ;QACN,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAA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AC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAA;IACtF,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,CAAC,CAAA;IAC3D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACpB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;SAC7B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAkB,CAAC,KAAK,SAAS,CAAC;SACxD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,GAAkB,CAAC,CAAC,CAAC,CAAA;IACjD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC;AARD,kCAQC;AAED,QAAQ;AACR,uCAAuC;AACvC,oBAAoB;AACpB,uCAAuC;AACvC,0CAA0C;AAC1C,kBAAkB;AAClB,sBAAsB;AACtB,4BAA4B;AAC5B,4BAA4B;AAC5B,OAAO;AACP,0CAA0C;AAC1C,2BAA2B;AAC3B,0CAA0C;AAC1C,mCAAmC;AACnC,0CAA0C;AAC1C,gCAAgC;AAChC,0CAA0C;AAC1C,IAAI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IGetUserInputFromEditorOptions.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptUserEditInTextEditorSync = void 0;
|
|
4
|
-
const defaultOpenInEditorCommand_1 = require("../../os/defaultOpenInEditorCommand");
|
|
5
|
-
const child_process_1 = require("child_process");
|
|
6
|
-
const readFileSync_1 = require("../readFile/readFileSync");
|
|
7
|
-
const strEnsureStartsWith_1 = require("../../string/strEnsureStartsWith");
|
|
8
|
-
const tempFileSync_1 = require("../tempFile/tempFileSync");
|
|
9
|
-
const writeFileSync_1 = require("../writeFile/writeFileSync");
|
|
10
|
-
/**
|
|
11
|
-
* Prompts the user to edit a string in the user's text editor.
|
|
12
|
-
*
|
|
13
|
-
* @example ```ts
|
|
14
|
-
* promptUserEditInTextEditor({ editor: 'notepad' })
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
function promptUserEditInTextEditorSync(options) {
|
|
18
|
-
const { editor, content, extension } = applyDefaults(options);
|
|
19
|
-
return (0, tempFileSync_1.tempFileSync)(extension, (tempfile) => {
|
|
20
|
-
(0, writeFileSync_1.writeFileSync)(tempfile, content);
|
|
21
|
-
(0, child_process_1.execSync)(`${editor} ${tempfile}`, { stdio: 'inherit' });
|
|
22
|
-
return (0, readFileSync_1.readFileSync)(tempfile);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
exports.promptUserEditInTextEditorSync = promptUserEditInTextEditorSync;
|
|
26
|
-
function applyDefaults(options = {}) {
|
|
27
|
-
const content = options.content ?? '';
|
|
28
|
-
const extension = (0, strEnsureStartsWith_1.strEnsureStartsWith)(options.extension ?? '.txt', '.');
|
|
29
|
-
const editor = options.editor ?? (0, defaultOpenInEditorCommand_1.defaultOpenInEditorCommand)();
|
|
30
|
-
return { content, extension, editor };
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=promptUserEditInTextEditorSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promptUserEditInTextEditorSync.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.ts"],"names":[],"mappings":";;;AAAA,oFAAgF;AAChF,iDAAwC;AAExC,2DAAuD;AACvD,0EAAsE;AACtE,2DAAuD;AACvD,8DAA0D;AAE1D;;;;;;GAMG;AACH,SAAgB,8BAA8B,CAAC,OAAwC;IACrF,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IAC7D,OAAO,IAAA,2BAAY,EAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC1C,IAAA,6BAAa,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAChC,IAAA,wBAAQ,EAAC,GAAG,MAAM,IAAI,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;QACvD,OAAO,IAAA,2BAAY,EAAC,QAAQ,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;AACJ,CAAC;AAPD,wEAOC;AAED,SAAS,aAAa,CAAC,UAA0C,EAAE;IACjE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAA;IACrC,MAAM,SAAS,GAAG,IAAA,yCAAmB,EAAC,OAAO,CAAC,SAAS,IAAI,MAAM,EAAE,GAAG,CAAC,CAAA;IACvE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAA,uDAA0B,GAAE,CAAA;IAC7D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAA;AACvC,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promptUserEditJsonInTextEditorSync = void 0;
|
|
4
|
-
const promptUserEditInTextEditorSync_1 = require("./promptUserEditInTextEditorSync");
|
|
5
|
-
/**
|
|
6
|
-
* Edit a JSON-stringify-compatible value in the user's editor and return the (JSON.parse'd) result.
|
|
7
|
-
*
|
|
8
|
-
* @param value - The value to edit (NOT a json string). Defaults to an empty object.
|
|
9
|
-
* @param editor - Launch command to start your editor. Defaults to VSCode: 'code -w' (if installed).
|
|
10
|
-
* - Otherwise this logic: isWindows() ? 'notepad' : isOSX() ? 'open vi' : 'xdg-open'
|
|
11
|
-
*
|
|
12
|
-
* @example ```ts
|
|
13
|
-
* promptUserEditJsonInTextEditorSync([1, 2])
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
function promptUserEditJsonInTextEditorSync(value = {}, editor) {
|
|
17
|
-
const json = (0, promptUserEditInTextEditorSync_1.promptUserEditInTextEditorSync)({
|
|
18
|
-
editor,
|
|
19
|
-
content: JSON.stringify(value, null, 2),
|
|
20
|
-
extension: '.json',
|
|
21
|
-
});
|
|
22
|
-
return JSON.parse(json);
|
|
23
|
-
}
|
|
24
|
-
exports.promptUserEditJsonInTextEditorSync = promptUserEditJsonInTextEditorSync;
|
|
25
|
-
//# sourceMappingURL=promptUserEditJsonInTextEditorSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"promptUserEditJsonInTextEditorSync.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.ts"],"names":[],"mappings":";;;AACA,qFAAiF;AAEjF;;;;;;;;;;GAUG;AACH,SAAgB,kCAAkC,CAChD,QAAW,EAAO,EAClB,MAAe;IAEf,MAAM,IAAI,GAAG,IAAA,+DAA8B,EAAC;QAC1C,MAAM;QACN,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,SAAS,EAAE,OAAO;KACnB,CAAC,CAAA;IACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAA;AAC9B,CAAC;AAVD,gFAUC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.readFileSafeSync = void 0;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
/**
|
|
9
|
-
* Reads a file and returns the file's contents.
|
|
10
|
-
*
|
|
11
|
-
* Identical to fs.readFileSync, except that:
|
|
12
|
-
* - it uses utf8 encoding by default
|
|
13
|
-
* - if operation fails, returns undefined instead of throwing
|
|
14
|
-
*
|
|
15
|
-
* @param filepath - The path to the file.
|
|
16
|
-
* @param encoding - The encoding to use when reading the file.
|
|
17
|
-
* @returns The file's contents or undefined if the file does not exist.
|
|
18
|
-
*/
|
|
19
|
-
function readFileSafeSync(filepath, encoding = 'utf8') {
|
|
20
|
-
try {
|
|
21
|
-
return fs_extra_1.default.readFileSync(filepath, encoding);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.readFileSafeSync = readFileSafeSync;
|
|
28
|
-
//# sourceMappingURL=readFileSafeSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readFileSafeSync.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/readFile/readFileSafeSync.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAyB;AAEzB;;;;;;;;;;GAUG;AACH,SAAgB,gBAAgB,CAAC,QAAgB,EAAE,WAA2B,MAAM;IAClF,IAAI;QACF,OAAO,kBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KAC3C;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AAND,4CAMC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.readFileSync = void 0;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
/**
|
|
9
|
-
* Reads a file and returns the file's contents.
|
|
10
|
-
* Identical to fs.readFileSync, except that it uses utf8 encoding by default.
|
|
11
|
-
*
|
|
12
|
-
* @param filepath - The path to the file.
|
|
13
|
-
* @param encoding - The encoding to use when reading the file.
|
|
14
|
-
* @returns The file's contents.
|
|
15
|
-
*/
|
|
16
|
-
function readFileSync(filepath, encoding = 'utf8') {
|
|
17
|
-
return fs_extra_1.default.readFileSync(filepath, encoding);
|
|
18
|
-
}
|
|
19
|
-
exports.readFileSync = readFileSync;
|
|
20
|
-
//# sourceMappingURL=readFileSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readFileSync.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/readFile/readFileSync.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAyB;AAEzB;;;;;;;GAOG;AACH,SAAgB,YAAY,CAAC,QAAgB,EAAE,WAA2B,MAAM;IAC9E,OAAO,kBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAC5C,CAAC;AAFD,oCAEC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.readJsonFileSafeSync = void 0;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
/**
|
|
9
|
-
* Reads a JSON file and then parses it into an object.
|
|
10
|
-
* If an error occurs, it returns undefined.
|
|
11
|
-
*
|
|
12
|
-
* @param filepath - The path to the JSON file.
|
|
13
|
-
* @param options - Options for reading the JSON file.
|
|
14
|
-
*/
|
|
15
|
-
function readJsonFileSafeSync(filepath, options) {
|
|
16
|
-
try {
|
|
17
|
-
return fs_extra_1.default.readJsonSync(filepath, options);
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.readJsonFileSafeSync = readJsonFileSafeSync;
|
|
24
|
-
//# sourceMappingURL=readJsonFileSafeSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readJsonFileSafeSync.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/readJsonFile/readJsonFileSafeSync.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAyB;AAGzB;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAI,QAAgB,EAAE,OAA8B;IACtF,IAAI;QACF,OAAO,kBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAM,CAAA;KAC/C;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,SAAS,CAAA;KACjB;AACH,CAAC;AAND,oDAMC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeFile = void 0;
|
|
4
|
-
var fs_extra_1 = require("fs-extra");
|
|
5
|
-
Object.defineProperty(exports, "removeFile", { enumerable: true, get: function () { return fs_extra_1.remove; } });
|
|
6
|
-
//# sourceMappingURL=removeFile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"removeFile.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/removeFile/removeFile.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;AAAtC,sGAAA,MAAM,OAAc"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.tempFileSync = void 0;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
const getTempDataPath_1 = require("../../path/getTempDataPath");
|
|
9
|
-
const strEnsureStartsWith_1 = require("../../string/strEnsureStartsWith");
|
|
10
|
-
/**
|
|
11
|
-
* Syncrhonously creates a temporary file and deletes it after the callback has finished.
|
|
12
|
-
* @param fileExtension - The file extension to use for the temporary file.
|
|
13
|
-
* @param callback - The callback to execute with the temporary file path. The callback can return a promise and the temporary file will not be deleted until the promise has resolved or rejected.
|
|
14
|
-
*/
|
|
15
|
-
function tempFileSync(fileExtension, callback) {
|
|
16
|
-
const fpath = (0, getTempDataPath_1.getTempDataPath)('temp', Date.now() + (0, strEnsureStartsWith_1.strEnsureStartsWith)(fileExtension, '.'));
|
|
17
|
-
fs_extra_1.default.ensureFileSync(fpath);
|
|
18
|
-
try {
|
|
19
|
-
const retval = callback(fpath);
|
|
20
|
-
fs_extra_1.default.remove(fpath);
|
|
21
|
-
return retval;
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
fs_extra_1.default.remove(fpath);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.tempFileSync = tempFileSync;
|
|
28
|
-
//# sourceMappingURL=tempFileSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tempFileSync.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/tempFile/tempFileSync.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAyB;AAEzB,gEAA4D;AAC5D,0EAAsE;AAEtE;;;;GAIG;AACH,SAAgB,YAAY,CAAC,aAAqB,EAAE,QAAgC;IAClF,MAAM,KAAK,GAAG,IAAA,iCAAe,EAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAA,yCAAmB,EAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAA;IAC3F,kBAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;IACxB,IAAI;QACF,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC9B,kBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAChB,OAAO,MAAM,CAAA;KACd;IAAC,OAAO,KAAK,EAAE;QACd,kBAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;KACjB;AACH,CAAC;AAVD,oCAUC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IReadJsonFileOptions.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/types/IReadJsonFileOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeFileSafeSync = void 0;
|
|
4
|
-
var fs_extra_1 = require("fs-extra");
|
|
5
|
-
Object.defineProperty(exports, "writeFileSafeSync", { enumerable: true, get: function () { return fs_extra_1.outputFileSync; } });
|
|
6
|
-
//# sourceMappingURL=writeFileSafeSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeFileSafeSync.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/writeFile/writeFileSafeSync.ts"],"names":[],"mappings":";;;AAAA,qCAA8D;AAArD,6GAAA,cAAc,OAAqB"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeFileSync = void 0;
|
|
4
|
-
var fs_extra_1 = require("fs-extra");
|
|
5
|
-
Object.defineProperty(exports, "writeFileSync", { enumerable: true, get: function () { return fs_extra_1.writeFileSync; } });
|
|
6
|
-
//# sourceMappingURL=writeFileSync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeFileSync.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/writeFile/writeFileSync.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AAA/B,yGAAA,aAAa,OAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeJsonFileSafe = void 0;
|
|
4
|
-
var fs_extra_1 = require("fs-extra");
|
|
5
|
-
Object.defineProperty(exports, "writeJsonFileSafe", { enumerable: true, get: function () { return fs_extra_1.outputJson; } });
|
|
6
|
-
//# sourceMappingURL=writeJsonFileSafe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writeJsonFileSafe.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/fs/writeJsonFile/writeJsonFileSafe.ts"],"names":[],"mappings":";;;AAAA,qCAA0D;AAAjD,6GAAA,UAAU,OAAqB"}
|