diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh new file mode 100644 index 0000000..cec959a --- /dev/null +++ b/.husky/_/husky.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env sh +if [ -z "$husky_skip_init" ]; then + debug () { + if [ "$HUSKY_DEBUG" = "1" ]; then + echo "husky (debug) - $1" + fi + } + + readonly hook_name="$(basename -- "$0")" + debug "starting $hook_name..." + + if [ "$HUSKY" = "0" ]; then + debug "HUSKY env variable is set to 0, skipping hook" + exit 0 + fi + + if [ -f ~/.huskyrc ]; then + debug "sourcing ~/.huskyrc" + . ~/.huskyrc + fi + + readonly husky_skip_init=1 + export husky_skip_init + sh -e "$0" "$@" + exitCode="$?" + + if [ $exitCode != 0 ]; then + echo "husky - $hook_name hook exited with code $exitCode (error)" + fi + + if [ $exitCode = 127 ]; then + echo "husky - command not found in PATH=$PATH" + fi + + exit $exitCode +fi diff --git a/src/lib/Config/types/index.ts b/src/lib/Config/types/index.ts index 71e7f91..d399e43 100644 --- a/src/lib/Config/types/index.ts +++ b/src/lib/Config/types/index.ts @@ -52,6 +52,7 @@ export type CircleCIConfigShape = { export type UnknownConfigShape = { setup: boolean; + orbs?: Record; executors?: Record; jobs: Record; commands?: Record; diff --git a/src/lib/Orb/exports/OrbImport.ts b/src/lib/Orb/exports/OrbImport.ts index 91e5e74..932346c 100644 --- a/src/lib/Orb/exports/OrbImport.ts +++ b/src/lib/Orb/exports/OrbImport.ts @@ -20,9 +20,9 @@ export class OrbImport implements Generable { name: string; version: string; - jobs: Record>; - commands: Record>; - executors: Record>; + jobs: Record> = {}; + commands: Record> = {}; + executors: Record> = {}; description?: string; display?: OrbDisplayMeta; @@ -42,9 +42,12 @@ export class OrbImport implements Generable { this.version = version; this.description = description; this.display = display; - this.jobs = asImportManifest(manifest.jobs, this); - this.commands = asImportManifest(manifest.commands, this); - this.executors = asImportManifest(manifest.executors, this); + + if (manifest) { + this.jobs = asImportManifest(manifest.jobs, this); + this.commands = asImportManifest(manifest.commands, this); + this.executors = asImportManifest(manifest.executors, this); + } } generate(): Record {