varlock 0.0.1 → 0.0.2
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/dist/auto-load.js +4 -4
- package/dist/auto-load.js.map +1 -1
- package/dist/{chunk-BS3AGAHF.js → chunk-332HXE6L.js} +4 -4
- package/dist/{chunk-BS3AGAHF.js.map → chunk-332HXE6L.js.map} +1 -1
- package/dist/{chunk-BRP5MZU6.js → chunk-4WO4BGKU.js} +5 -5
- package/dist/{chunk-BRP5MZU6.js.map → chunk-4WO4BGKU.js.map} +1 -1
- package/dist/{chunk-QTYVZQSF.js → chunk-6YLXKXKR.js} +3 -3
- package/dist/{chunk-QTYVZQSF.js.map → chunk-6YLXKXKR.js.map} +1 -1
- package/dist/{chunk-HZADDTO5.js → chunk-G4BD2BPH.js} +2 -2
- package/dist/{chunk-HZADDTO5.js.map → chunk-G4BD2BPH.js.map} +1 -1
- package/dist/{chunk-35HGPX6I.js → chunk-O2QPQ5MG.js} +4 -4
- package/dist/{chunk-35HGPX6I.js.map → chunk-O2QPQ5MG.js.map} +1 -1
- package/dist/{chunk-EMPXU5TW.js → chunk-RY3YIJFG.js} +4 -4
- package/dist/{chunk-EMPXU5TW.js.map → chunk-RY3YIJFG.js.map} +1 -1
- package/dist/{chunk-R53MTEAM.js → chunk-XCFZJA7V.js} +3 -3
- package/dist/{chunk-R53MTEAM.js.map → chunk-XCFZJA7V.js.map} +1 -1
- package/dist/{chunk-NZDUC7Q3.js → chunk-Z55UMN2B.js} +4 -4
- package/dist/{chunk-NZDUC7Q3.js.map → chunk-Z55UMN2B.js.map} +1 -1
- package/dist/cli/cli-executable.js +16 -17
- package/dist/cli/cli-executable.js.map +1 -1
- package/dist/doctor.command-SHZI7SR3.js +6 -0
- package/dist/{doctor.command-N5JAIXRM.js.map → doctor.command-SHZI7SR3.js.map} +1 -1
- package/dist/dotenv-compat.js +4 -4
- package/dist/dotenv-compat.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/init.command-ERPGU436.js +10 -0
- package/dist/{init.command-7BSALNL5.js.map → init.command-ERPGU436.js.map} +1 -1
- package/dist/load.command-LQDSWJSK.js +9 -0
- package/dist/{load.command-4MJR5J43.js.map → load.command-LQDSWJSK.js.map} +1 -1
- package/dist/run.command-OF3UV7AD.js +9 -0
- package/dist/{run.command-ASKXIWBC.js.map → run.command-OF3UV7AD.js.map} +1 -1
- package/package.json +3 -3
- package/dist/doctor.command-N5JAIXRM.js +0 -6
- package/dist/init.command-7BSALNL5.js +0 -10
- package/dist/load.command-4MJR5J43.js +0 -9
- package/dist/run.command-ASKXIWBC.js +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/ascii-art.ts","../../src/cli/helpers/analytics.ts","../../package.json","../../src/cli/cli-executable.ts"],"names":["commandSpec"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAYO,IAAM,cAAiB,GAAA;AAAA,EAC5B,EAAA;AAAA,EACA,yOAAA;AAAA,EACA,6QAAA;AAAA,EACA,wQAAA;AAAA,EACA,iSAAA;AAAA,EACA,2SAAA;AAAA,EACA,8PAAA;AAAA,EACA,uMAAA;AAAA,EACA,0JAAA;AAAA,EACA;AAAA;AAEF,CAAA,CAAE,KAAK,IAAI,CAAA;AAeJ,IAAM,oBAAA,GAAuB,eACjC,UAAW,CAAA,qCAAA,EAAuC,CAAC,CAAM,KAAA,aAAA,CAAM,IAAI,SAAS,CAAA,CAAE,CAAC,CAAC,CAAA,CAChF,WAAW,WAAa,EAAA,CAAC,MAAM,aAAM,CAAA,IAAA,CAAK,CAAC,CAAC,CAAA;AClC/C,eAAe,eAAoC,GAAA;AAEjD,EAAI,IAAA,OAAA,CAAQ,GAAI,CAAA,UAAA,KAAe,MAAQ,EAAA;AACrC,IAAO,OAAA,IAAA;AAAA;AAIT,EAAA,MAAM,UAAa,GAAA,IAAA,CAAK,OAAQ,EAAA,EAAG,YAAY,aAAa,CAAA;AAC5D,EAAI,IAAA,UA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 ▄█▄ █ █▀ ',\n ' █ █ █ █ ▄▀ █ █ █ █▀ ▀▄ █▄█ ',\n '█ █ █▄▄█ █▀▀▌ █ █ █ █ ▀ █▀▄ ',\n ' █ █ █ █ █ █ ███▄ ▀████ █▄ ▄▀ █ █ ',\n ' █ █ █ █ ▀ ▀███▀ █ ',\n ' █▐ █ ▀ ▀ ',\n ' ▐ ▀ ',\n].join('\\n');\n\nexport const VARLOCK_BANNER = [\n '',\n ' ██▒ █▓ ▄▄▄ ██▀███ ██▓ ▒█████ ▄████▄ ██ ▄█▀',\n ' ▓██░ █▒▒████▄ ▓██ ▒ ██▒▓██▒ ▒██▒ ██▒▒██▀ ▀█ ██▄█▒ ',\n ' ▓██ █▒░▒██ ▀█▄ ▓██ ░▄█ ▒▒██░ ▒██░ ██▒▒██ ▄ ▓███▄░ ',\n ' ▒██ █░░░██▄▄▄▄██ ▒██▀▀█▄ ▒██░ ▒██ ██░▒██▄ ▄██▒▓██ █▄ ',\n ' ▒▀█░ ▓█ ▓██▒░██▓ ▒██▒░██████▒░ █████▒░▒ ████▀ ░▒██▒ █▄',\n ' ░ ▐░ ▒▒ ▓▒█░░ ▒▓ ░▒▓░░ ▒░▓ ░░ ▒░▒░▒░ ░ ░▒ ▒ ░▒ ▒▒ ▓▒',\n ' ░ ░░ ▒ ▒▒ ░ ░▒ ░ ▒░░ ░ ▒ ░ ░ ▒ ▒░ ░ ▒ ░ ░▒ ▒░',\n ' ░░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░░ ░ ',\n ' ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ',\n // ' ░ ░ ',\n].join('\\n');\n\n\nexport const FIRE = [\n ' ▚▐▟ ',\n '▗▗█▓▓█ ',\n '▟█▓░▓█▙',\n '▜█░▒░█▛',\n ' ▜▓░▓▛ ',\n ' ▀▀▀ ',\n].join('\\n');\n\n// const SOLID_BLOCK_CHARS = '▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐▔▕▖▗▘▙▚▛▜▝▞▟';\n// const LIGHT_BLOCK_CHARS = '░▒▓';\n\nexport const VARLOCK_BANNER_COLOR = VARLOCK_BANNER\n .replaceAll(/([▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐▔▕▖▗▘▙▚▛▜▝▞▟]+)/g, (m) => ansis.hex('#DD0000')(m))\n .replaceAll(/([▓░▒]+)/g, (m) => ansis.blue(m));\n\n\n","import { homedir } from 'os';\nimport { join } from 'path';\nimport { readFile } from 'fs/promises';\nimport { existsSync } from 'fs';\n\nimport { CONFIG } from '../../config';\n\nasync function checkIsOptedOut(): Promise<boolean> {\n // Check environment variable first\n if (process.env.PH_OPT_OUT === 'true') {\n return true;\n }\n\n // Then check config file\n const configPath = join(homedir(), '.varlock', 'config.json');\n if (existsSync(configPath)) {\n try {\n const configContent = await readFile(configPath, 'utf-8');\n const config = JSON.parse(configContent);\n return config.analytics_opt_out === true;\n } catch (error) {\n console.debug('Failed to read analytics config:', error);\n }\n }\n return false;\n}\n\nconst DEBUG_PH = !!process.env.DEBUG_PH;\n\nconst isOptedOut = await checkIsOptedOut();\nif (DEBUG_PH) console.log('posthog opted out: ', isOptedOut);\n\nasync function posthogCapture(event: string, properties?: Record<string, any>) {\n if (isOptedOut) return;\n\n const payload = {\n api_key: CONFIG.POSTHOG_API_KEY,\n event,\n properties: {\n $process_person_profile: false,\n ...properties,\n },\n distinct_id: 'anonymous',\n };\n\n const res = await fetch(`${CONFIG.POSTHOG_HOST}/i/v0/e/`, {\n method: 'POST',\n body: JSON.stringify(payload),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n if (DEBUG_PH) console.log('res', await res.text());\n}\n\nexport async function trackCommand(command: string, properties?: Record<string, any>) {\n await posthogCapture('cli_command_executed', {\n command,\n ...properties,\n });\n}\n\nexport async function trackInstall(source: 'brew' | 'curl') {\n await posthogCapture('cli_install', {\n source,\n });\n}\n\n","{\n \"name\": \"varlock\",\n \"version\": \"0.0.1\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"type\": \"module\",\n \"author\": \"dmno-dev\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:sea\": \"tsup --config tsup-sea.config.ts\",\n \"dev\": \"tsup\",\n \"test\": \"vitest\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"pnpm run lint --fix\"\n },\n \"keywords\": [],\n \"files\": [\n \"/bin\",\n \"/dist\"\n ],\n \"bin\": {\n \"varlock\": \"./bin/cli.js\"\n },\n \"exports\": {\n \".\": \"./dist/index.js\",\n \"./auto-load\": \"./dist/auto-load.js\",\n \"./config\": \"./dist/dotenv-compat.js\",\n \"./config.js\": \"./dist/dotenv-compat.js\"\n },\n \"dependencies\": {\n \"@env-spec/parser\": \"workspace:*\",\n \"debug\": \"catalog:\",\n \"execa\": \"^9.5.2\",\n \"which\": \"^5.0.0\"\n },\n \"devDependencies\": {\n \"@clack/core\": \"^0.5.0\",\n \"@clack/prompts\": \"^0.11.0\",\n \"@env-spec/env-graph\": \"workspace:*\",\n \"@env-spec/utils\": \"workspace:*\",\n \"@sindresorhus/is\": \"catalog:\",\n \"@types/debug\": \"catalog:\",\n \"@types/node\": \"catalog:\",\n \"@types/which\": \"^3.0.4\",\n \"@yao-pkg/pkg\": \"^6.4.1\",\n \"ansis\": \"catalog:\",\n \"gunshi\": \"^0.26.3\",\n \"is-unicode-supported\": \"^2.1.0\",\n \"outdent\": \"^0.8.0\",\n \"tsup\": \"catalog:\",\n \"vitest\": \"catalog:\"\n }\n}\n","import { cli, Command, define } from 'gunshi';\n\nimport { VARLOCK_BANNER, VARLOCK_BANNER_COLOR } from '../lib/ascii-art';\nimport { CliExitError } from './helpers/exit-error';\nimport { EnvSourceParseError } from '@env-spec/env-graph';\nimport ansis from 'ansis';\nimport { fmt } from './helpers/pretty-format';\nimport { trackCommand, trackInstall } from './helpers/analytics';\nimport { InvalidEnvError } from './helpers/error-checks';\nimport packageJson from '../../package.json';\n\n// we'll import just the spec from each, so the implementations can be lazy loaded\nimport { commandSpec as initCommandSpec } from './commands/init.command';\nimport { commandSpec as loadCommandSpec } from './commands/load.command';\nimport { commandSpec as runCommandSpec } from './commands/run.command';\nimport { commandSpec as encryptCommandSpec } from './commands/encrypt.command';\nimport { commandSpec as doctorCommandSpec } from './commands/doctor.command';\nimport { commandSpec as helpCommandSpec } from './commands/help.command';\nimport { commandSpec as optOutCommandSpec } from './commands/opt-out.command';\nimport { commandSpec as loginCommandSpec } from './commands/login.command';\n\n\nconst mainCommand = {\n run: () => {\n console.log('Use one of the sub-commands...');\n },\n};\n\n\n// TODO: this is not splitting the bundle correctly to actually lazy load the command fns\n\nfunction buildLazyCommand(\n commandSpec: Command<any>,\n loadCommandFn: () => Promise<{ commandSpec: Command<any>, commandFn: any }>,\n) {\n const commandName = commandSpec.name!;\n return {\n ...commandSpec,\n run: async (...args: Array<any>) => {\n // Track command execution\n await trackCommand(commandName, { command: commandName });\n // load the command fn and run it\n const commandSpecAndFn = await loadCommandFn();\n return commandSpecAndFn.commandFn(...args);\n },\n };\n}\n\nconst subCommands = new Map();\nsubCommands.set('init', buildLazyCommand(initCommandSpec, async () => await import('./commands/init.command')));\nsubCommands.set('load', buildLazyCommand(loadCommandSpec, async () => await import('./commands/load.command')));\nsubCommands.set('run', buildLazyCommand(runCommandSpec, async () => await import('./commands/run.command')));\nsubCommands.set('encrypt', buildLazyCommand(encryptCommandSpec, async () => await import('./commands/encrypt.command')));\nsubCommands.set('doctor', buildLazyCommand(doctorCommandSpec, async () => await import('./commands/doctor.command')));\nsubCommands.set('help', buildLazyCommand(helpCommandSpec, async () => await import('./commands/help.command')));\nsubCommands.set('opt-out', buildLazyCommand(optOutCommandSpec, async () => await import('./commands/opt-out.command')));\nsubCommands.set('login', buildLazyCommand(loginCommandSpec, async () => await import('./commands/login.command')));\n\n// subCommandsArray.forEach((commandSpec) => {\n// const commandName = commandSpec.name!;\n// subCommands.set(commandName, {\n// ...commandSpec,\n// run: async (...args: Array<any>) => {\n// const commandSpecAndFn = await import(`./commands/${commandName}.command.ts`);\n// // Track command execution\n// await trackCommand(commandName, { command: commandName });\n// // Run the actual command\n// return commandSpecAndFn.commandFn(...args);\n// },\n// });\n// });\n\n\n(async function go() {\n try {\n let args = process.argv.slice(2);\n\n // TODO: remove this once we have a better way to re-trigger help\n if (args[0] === 'help') args = ['--help'];\n\n // track standalone installs via hombrew/curl\n if (__VARLOCK_SEA_BUILD__) {\n if (args[0] === '--post-install') {\n await trackInstall(args[1] as 'brew' | 'curl');\n // TODO track version, inject post build?\n process.exit(0);\n }\n }\n\n await cli(args, mainCommand, {\n name: 'varlock',\n description: 'Encrypt and protect your env vars',\n version: packageJson.version,\n subCommands,\n renderHeader: async (ctx) => {\n // do not show header if we are running a sub-command\n if (ctx.name) return '';\n return VARLOCK_BANNER_COLOR;\n },\n });\n process.exit(0);\n } catch (error) {\n if (error instanceof CliExitError || error instanceof InvalidEnvError) {\n // in watch mode, we just log but do not actually exit\n console.error(error.getFormattedOutput());\n // TODO: we'll probably want to implement watch mode, so it wont actually exit\n } else if (error instanceof EnvSourceParseError) {\n console.log(`🚨 Error encountered while loading ${error.location.path}`);\n console.log(error.message);\n\n const errLoc = error.location as any;\n\n const errPreview = [\n errLoc.lineStr,\n `${ansis.gray('-'.repeat(errLoc.colNumber - 1))}${ansis.red('^')}`,\n ].join('\\n');\n\n console.log('Error parsing .env file');\n console.log(fmt.filePath(`${errLoc.path}:${errLoc.lineNumber}:${errLoc.colNumber}`));\n console.log(errPreview);\n\n process.exit(1);\n } else {\n throw error;\n }\n\n process.exit(1);\n }\n}());\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/ascii-art.ts","../../src/cli/helpers/analytics.ts","../../package.json","../../src/cli/cli-executable.ts"],"names":["commandSpec"],"mappings":";;;;;;;;;;;;;;;;;;;;AAYO,IAAM,cAAiB,GAAA;AAAA,EAC5B,EAAA;AAAA,EACA,yOAAA;AAAA,EACA,6QAAA;AAAA,EACA,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AClE,CAAE,KAAK,IAAI,CAAA;AAEX,MAAA,OAAA,CAAQ,IAAI,yBAAyB,CAAA;AACrC,MAAA,OAAA,CAAQ,GAAI,CAAA,GAAA,CAAI,QAAS,CAAA,CAAA,EAAG,MAAO,CAAA,IAAI,CAAI,CAAA,EAAA,MAAA,CAAO,UAAU,CAAA,CAAA,EAAI,MAAO,CAAA,SAAS,EAAE,CAAC,CAAA;AACnF,MAAA,OAAA,CAAQ,IAAI,UAAU,CAAA;AAEtB,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,KACT,MAAA;AACL,MAAM,MAAA,KAAA;AAAA;AAGR,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA;AAElB,CAAA,EAvDC,IAuDC,CAAA,GAAA","file":"cli-executable.js","sourcesContent":["import ansis from 'ansis';\n\nexport const VARLOCK_BANNER2 = [\n ' ▄ ██ █▄▄▄▄ █ ████▄ ▄█▄ █ █▀ ',\n ' █ █ █ █ ▄▀ █ █ █ █▀ ▀▄ █▄█ ',\n '█ █ █▄▄█ █▀▀▌ █ █ █ █ ▀ █▀▄ ',\n ' █ █ █ █ █ █ ███▄ ▀████ █▄ ▄▀ █ █ ',\n ' █ █ █ █ ▀ ▀███▀ █ ',\n ' █▐ █ ▀ ▀ ',\n ' ▐ ▀ ',\n].join('\\n');\n\nexport const VARLOCK_BANNER = [\n '',\n ' ██▒ █▓ ▄▄▄ ██▀███ ██▓ ▒█████ ▄████▄ ██ ▄█▀',\n ' ▓██░ █▒▒████▄ ▓██ ▒ ██▒▓██▒ ▒██▒ ██▒▒██▀ ▀█ ██▄█▒ ',\n ' ▓██ █▒░▒██ ▀█▄ ▓██ ░▄█ ▒▒██░ ▒██░ ██▒▒██ ▄ ▓███▄░ ',\n ' ▒██ █░░░██▄▄▄▄██ ▒██▀▀█▄ ▒██░ ▒██ ██░▒██▄ ▄██▒▓██ █▄ ',\n ' ▒▀█░ ▓█ ▓██▒░██▓ ▒██▒░██████▒░ █████▒░▒ ████▀ ░▒██▒ █▄',\n ' ░ ▐░ ▒▒ ▓▒█░░ ▒▓ ░▒▓░░ ▒░▓ ░░ ▒░▒░▒░ ░ ░▒ ▒ ░▒ ▒▒ ▓▒',\n ' ░ ░░ ▒ ▒▒ ░ ░▒ ░ ▒░░ ░ ▒ ░ ░ ▒ ▒░ ░ ▒ ░ ░▒ ▒░',\n ' ░░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░░ ░ ',\n ' ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ',\n // ' ░ ░ ',\n].join('\\n');\n\n\nexport const FIRE = [\n ' ▚▐▟ ',\n '▗▗█▓▓█ ',\n '▟█▓░▓█▙',\n '▜█░▒░█▛',\n ' ▜▓░▓▛ ',\n ' ▀▀▀ ',\n].join('\\n');\n\n// const SOLID_BLOCK_CHARS = '▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐▔▕▖▗▘▙▚▛▜▝▞▟';\n// const LIGHT_BLOCK_CHARS = '░▒▓';\n\nexport const VARLOCK_BANNER_COLOR = VARLOCK_BANNER\n .replaceAll(/([▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐▔▕▖▗▘▙▚▛▜▝▞▟]+)/g, (m) => ansis.hex('#DD0000')(m))\n .replaceAll(/([▓░▒]+)/g, (m) => ansis.blue(m));\n\n\n","import { homedir } from 'os';\nimport { join } from 'path';\nimport { existsSync, readFileSync } from 'node:fs';\n\nimport { CONFIG } from '../../config';\n\nfunction checkIsOptedOut() {\n // Check environment variable first\n if (process.env.PH_OPT_OUT === 'true') {\n return true;\n }\n\n // Then check config file\n const configPath = join(homedir(), '.varlock', 'config.json');\n if (existsSync(configPath)) {\n try {\n const configContent = readFileSync(configPath, 'utf-8');\n const config = JSON.parse(configContent);\n return config.analytics_opt_out === true;\n } catch (error) {\n console.debug('Failed to read analytics config:', error);\n }\n }\n return false;\n}\n\nconst DEBUG_PH = !!process.env.DEBUG_PH;\n\nconst isOptedOut = checkIsOptedOut();\nif (DEBUG_PH) console.log('posthog opted out: ', isOptedOut);\n\nasync function posthogCapture(event: string, properties?: Record<string, any>) {\n if (isOptedOut) return;\n\n const payload = {\n api_key: CONFIG.POSTHOG_API_KEY,\n event,\n properties: {\n $process_person_profile: false,\n ...properties,\n },\n distinct_id: 'anonymous',\n };\n\n const res = await fetch(`${CONFIG.POSTHOG_HOST}/i/v0/e/`, {\n method: 'POST',\n body: JSON.stringify(payload),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n if (DEBUG_PH) console.log('res', await res.text());\n}\n\nexport async function trackCommand(command: string, properties?: Record<string, any>) {\n await posthogCapture('cli_command_executed', {\n command,\n ...properties,\n });\n}\n\nexport async function trackInstall(source: 'brew' | 'curl') {\n await posthogCapture('cli_install', {\n source,\n });\n}\n\n","{\n \"name\": \"varlock\",\n \"version\": \"0.0.2\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"type\": \"module\",\n \"author\": \"dmno-dev\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:sea\": \"tsup --config tsup-sea.config.ts\",\n \"dev\": \"tsup\",\n \"test\": \"vitest\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"pnpm run lint --fix\"\n },\n \"keywords\": [],\n \"files\": [\n \"/bin\",\n \"/dist\"\n ],\n \"bin\": {\n \"varlock\": \"./bin/cli.js\"\n },\n \"exports\": {\n \".\": \"./dist/index.js\",\n \"./auto-load\": \"./dist/auto-load.js\",\n \"./config\": \"./dist/dotenv-compat.js\",\n \"./config.js\": \"./dist/dotenv-compat.js\"\n },\n \"dependencies\": {\n \"@env-spec/parser\": \"workspace:*\",\n \"debug\": \"catalog:\",\n \"execa\": \"^9.5.2\",\n \"which\": \"^5.0.0\"\n },\n \"devDependencies\": {\n \"@clack/core\": \"^0.5.0\",\n \"@clack/prompts\": \"^0.11.0\",\n \"@env-spec/env-graph\": \"workspace:*\",\n \"@env-spec/utils\": \"workspace:*\",\n \"@sindresorhus/is\": \"catalog:\",\n \"@types/debug\": \"catalog:\",\n \"@types/node\": \"catalog:\",\n \"@types/which\": \"^3.0.4\",\n \"@yao-pkg/pkg\": \"^6.4.1\",\n \"ansis\": \"catalog:\",\n \"gunshi\": \"^0.26.3\",\n \"is-unicode-supported\": \"^2.1.0\",\n \"outdent\": \"^0.8.0\",\n \"tsup\": \"catalog:\",\n \"vitest\": \"catalog:\"\n }\n}\n","import { cli, Command, define } from 'gunshi';\n\nimport { VARLOCK_BANNER, VARLOCK_BANNER_COLOR } from '../lib/ascii-art';\nimport { CliExitError } from './helpers/exit-error';\nimport { EnvSourceParseError } from '@env-spec/env-graph';\nimport ansis from 'ansis';\nimport { fmt } from './helpers/pretty-format';\nimport { trackCommand, trackInstall } from './helpers/analytics';\nimport { InvalidEnvError } from './helpers/error-checks';\nimport packageJson from '../../package.json';\n\n// we'll import just the spec from each, so the implementations can be lazy loaded\nimport { commandSpec as initCommandSpec } from './commands/init.command';\nimport { commandSpec as loadCommandSpec } from './commands/load.command';\nimport { commandSpec as runCommandSpec } from './commands/run.command';\nimport { commandSpec as encryptCommandSpec } from './commands/encrypt.command';\nimport { commandSpec as doctorCommandSpec } from './commands/doctor.command';\nimport { commandSpec as helpCommandSpec } from './commands/help.command';\nimport { commandSpec as optOutCommandSpec } from './commands/opt-out.command';\nimport { commandSpec as loginCommandSpec } from './commands/login.command';\n\n\nconst mainCommand = {\n run: () => {\n console.log('Use one of the sub-commands...');\n },\n};\n\n\n// TODO: this is not splitting the bundle correctly to actually lazy load the command fns\n\nfunction buildLazyCommand(\n commandSpec: Command<any>,\n loadCommandFn: () => Promise<{ commandSpec: Command<any>, commandFn: any }>,\n) {\n const commandName = commandSpec.name!;\n return {\n ...commandSpec,\n run: async (...args: Array<any>) => {\n // Track command execution\n await trackCommand(commandName, { command: commandName });\n // load the command fn and run it\n const commandSpecAndFn = await loadCommandFn();\n return commandSpecAndFn.commandFn(...args);\n },\n };\n}\n\nconst subCommands = new Map();\nsubCommands.set('init', buildLazyCommand(initCommandSpec, async () => await import('./commands/init.command')));\nsubCommands.set('load', buildLazyCommand(loadCommandSpec, async () => await import('./commands/load.command')));\nsubCommands.set('run', buildLazyCommand(runCommandSpec, async () => await import('./commands/run.command')));\nsubCommands.set('encrypt', buildLazyCommand(encryptCommandSpec, async () => await import('./commands/encrypt.command')));\nsubCommands.set('doctor', buildLazyCommand(doctorCommandSpec, async () => await import('./commands/doctor.command')));\nsubCommands.set('help', buildLazyCommand(helpCommandSpec, async () => await import('./commands/help.command')));\nsubCommands.set('opt-out', buildLazyCommand(optOutCommandSpec, async () => await import('./commands/opt-out.command')));\nsubCommands.set('login', buildLazyCommand(loginCommandSpec, async () => await import('./commands/login.command')));\n\n// subCommandsArray.forEach((commandSpec) => {\n// const commandName = commandSpec.name!;\n// subCommands.set(commandName, {\n// ...commandSpec,\n// run: async (...args: Array<any>) => {\n// const commandSpecAndFn = await import(`./commands/${commandName}.command.ts`);\n// // Track command execution\n// await trackCommand(commandName, { command: commandName });\n// // Run the actual command\n// return commandSpecAndFn.commandFn(...args);\n// },\n// });\n// });\n\n\n(async function go() {\n try {\n let args = process.argv.slice(2);\n\n // TODO: remove this once we have a better way to re-trigger help\n if (args[0] === 'help') args = ['--help'];\n\n // track standalone installs via hombrew/curl\n if (__VARLOCK_SEA_BUILD__) {\n if (args[0] === '--post-install') {\n await trackInstall(args[1] as 'brew' | 'curl');\n // TODO track version, inject post build?\n process.exit(0);\n }\n }\n\n await cli(args, mainCommand, {\n name: 'varlock',\n description: 'Encrypt and protect your env vars',\n version: packageJson.version,\n subCommands,\n renderHeader: async (ctx) => {\n // do not show header if we are running a sub-command\n if (ctx.name) return '';\n return VARLOCK_BANNER_COLOR;\n },\n });\n process.exit(0);\n } catch (error) {\n if (error instanceof CliExitError || error instanceof InvalidEnvError) {\n // in watch mode, we just log but do not actually exit\n console.error(error.getFormattedOutput());\n // TODO: we'll probably want to implement watch mode, so it wont actually exit\n } else if (error instanceof EnvSourceParseError) {\n console.log(`🚨 Error encountered while loading ${error.location.path}`);\n console.log(error.message);\n\n const errLoc = error.location as any;\n\n const errPreview = [\n errLoc.lineStr,\n `${ansis.gray('-'.repeat(errLoc.colNumber - 1))}${ansis.red('^')}`,\n ].join('\\n');\n\n console.log('Error parsing .env file');\n console.log(fmt.filePath(`${errLoc.path}:${errLoc.lineNumber}:${errLoc.colNumber}`));\n console.log(errPreview);\n\n process.exit(1);\n } else {\n throw error;\n }\n\n process.exit(1);\n }\n}());\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"doctor.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"doctor.command-SHZI7SR3.js"}
|
package/dist/dotenv-compat.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { load } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
import { load } from './chunk-332HXE6L.js';
|
|
2
|
+
import './chunk-Z55UMN2B.js';
|
|
3
|
+
import './chunk-6YLXKXKR.js';
|
|
4
|
+
import './chunk-G4BD2BPH.js';
|
|
5
5
|
import './chunk-7UQXFWKN.js';
|
|
6
6
|
import './chunk-XN24GZXQ.js';
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dotenv-compat.ts"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/dotenv-compat.ts"],"names":[],"mappings":";;;;;;;;AAaA,MAAM,IAAK,EAAA","file":"dotenv-compat.js","sourcesContent":["/*\n This file is exposed as `varlock/config` so that when using overrides to sub in varlock for dotenv\n `import dotenv/config` will import this instead!\n\n We'll want to make sure that there is a similar compat availble when importing via CJS\n but this will have to be on the default export of the package\n\n SEE https://github.com/motdotla/dotenv\n*/\nimport { load } from './index';\n\n// TODO: this should probably not be async\n// eslint-disable-next-line es-x/no-top-level-await\nawait load();\n"]}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { ENV, PUBLIC_ENV, load, loadSync } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
export { VarlockRedactor } from './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { ENV, PUBLIC_ENV, load, loadSync } from './chunk-332HXE6L.js';
|
|
2
|
+
import './chunk-Z55UMN2B.js';
|
|
3
|
+
export { VarlockRedactor } from './chunk-6YLXKXKR.js';
|
|
4
|
+
import './chunk-G4BD2BPH.js';
|
|
5
5
|
import './chunk-7UQXFWKN.js';
|
|
6
6
|
import './chunk-XN24GZXQ.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-RY3YIJFG.js';
|
|
2
|
+
import './chunk-DAZNZPLN.js';
|
|
3
|
+
import './chunk-LQZ6ICSS.js';
|
|
4
|
+
import './chunk-33ROL4J5.js';
|
|
5
|
+
import './chunk-6YLXKXKR.js';
|
|
6
|
+
import './chunk-G4BD2BPH.js';
|
|
7
|
+
import './chunk-7UQXFWKN.js';
|
|
8
|
+
import './chunk-XN24GZXQ.js';
|
|
9
|
+
//# sourceMappingURL=init.command-ERPGU436.js.map
|
|
10
|
+
//# sourceMappingURL=init.command-ERPGU436.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-ERPGU436.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-4WO4BGKU.js';
|
|
2
|
+
import './chunk-Z55UMN2B.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-6YLXKXKR.js';
|
|
5
|
+
import './chunk-G4BD2BPH.js';
|
|
6
|
+
import './chunk-7UQXFWKN.js';
|
|
7
|
+
import './chunk-XN24GZXQ.js';
|
|
8
|
+
//# sourceMappingURL=load.command-LQDSWJSK.js.map
|
|
9
|
+
//# sourceMappingURL=load.command-LQDSWJSK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-LQDSWJSK.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-O2QPQ5MG.js';
|
|
2
|
+
import './chunk-Z55UMN2B.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-6YLXKXKR.js';
|
|
5
|
+
import './chunk-G4BD2BPH.js';
|
|
6
|
+
import './chunk-7UQXFWKN.js';
|
|
7
|
+
import './chunk-XN24GZXQ.js';
|
|
8
|
+
//# sourceMappingURL=run.command-OF3UV7AD.js.map
|
|
9
|
+
//# sourceMappingURL=run.command-OF3UV7AD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-OF3UV7AD.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "varlock",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"outdent": "^0.8.0",
|
|
41
41
|
"tsup": "^8.2.4",
|
|
42
42
|
"vitest": "^3.2.4",
|
|
43
|
-
"@env-spec/
|
|
44
|
-
"@env-spec/
|
|
43
|
+
"@env-spec/utils": "0.0.0",
|
|
44
|
+
"@env-spec/env-graph": "0.0.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsup",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { commandFn, commandSpec } from './chunk-EMPXU5TW.js';
|
|
2
|
-
import './chunk-DAZNZPLN.js';
|
|
3
|
-
import './chunk-LQZ6ICSS.js';
|
|
4
|
-
import './chunk-33ROL4J5.js';
|
|
5
|
-
import './chunk-QTYVZQSF.js';
|
|
6
|
-
import './chunk-HZADDTO5.js';
|
|
7
|
-
import './chunk-7UQXFWKN.js';
|
|
8
|
-
import './chunk-XN24GZXQ.js';
|
|
9
|
-
//# sourceMappingURL=init.command-7BSALNL5.js.map
|
|
10
|
-
//# sourceMappingURL=init.command-7BSALNL5.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { commandFn, commandSpec } from './chunk-BRP5MZU6.js';
|
|
2
|
-
import './chunk-NZDUC7Q3.js';
|
|
3
|
-
import './chunk-33ROL4J5.js';
|
|
4
|
-
import './chunk-QTYVZQSF.js';
|
|
5
|
-
import './chunk-HZADDTO5.js';
|
|
6
|
-
import './chunk-7UQXFWKN.js';
|
|
7
|
-
import './chunk-XN24GZXQ.js';
|
|
8
|
-
//# sourceMappingURL=load.command-4MJR5J43.js.map
|
|
9
|
-
//# sourceMappingURL=load.command-4MJR5J43.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { commandFn, commandSpec } from './chunk-35HGPX6I.js';
|
|
2
|
-
import './chunk-NZDUC7Q3.js';
|
|
3
|
-
import './chunk-33ROL4J5.js';
|
|
4
|
-
import './chunk-QTYVZQSF.js';
|
|
5
|
-
import './chunk-HZADDTO5.js';
|
|
6
|
-
import './chunk-7UQXFWKN.js';
|
|
7
|
-
import './chunk-XN24GZXQ.js';
|
|
8
|
-
//# sourceMappingURL=run.command-ASKXIWBC.js.map
|
|
9
|
-
//# sourceMappingURL=run.command-ASKXIWBC.js.map
|