@dotenvx/dotenvx 2.38.2 → 3.0.0-beta.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/README.md +197 -3314
- package/bin/dotenvx.cjs +34 -0
- package/config.cjs +1 -0
- package/config.d.ts +1 -0
- package/config.mjs +2 -0
- package/index.cjs +141 -0
- package/index.d.ts +66 -0
- package/index.mjs +3 -0
- package/lib/cli.cjs +43 -0
- package/lib/native-package.cjs +21 -0
- package/lib/platforms.cjs +18 -0
- package/{src/lib/helpers/redactOutput.js → lib/redactOutput.cjs} +2 -48
- package/lib/redaction.cjs +64 -0
- package/lib/validateOptions.cjs +57 -0
- package/native.cjs +23 -0
- package/package.json +57 -65
- package/CHANGELOG.md +0 -2733
- package/src/cli/actions/armor/down.js +0 -38
- package/src/cli/actions/armor/invite.js +0 -21
- package/src/cli/actions/armor/move.js +0 -43
- package/src/cli/actions/armor/open.js +0 -28
- package/src/cli/actions/armor/pull.js +0 -38
- package/src/cli/actions/armor/push.js +0 -38
- package/src/cli/actions/armor/status.js +0 -7
- package/src/cli/actions/armor/up.js +0 -38
- package/src/cli/actions/check.js +0 -78
- package/src/cli/actions/curl.js +0 -71
- package/src/cli/actions/decrypt.js +0 -119
- package/src/cli/actions/del.js +0 -54
- package/src/cli/actions/doctor.js +0 -22
- package/src/cli/actions/encrypt.js +0 -104
- package/src/cli/actions/ext/genexample.js +0 -36
- package/src/cli/actions/ext/gitignore.js +0 -106
- package/src/cli/actions/ext/prebuild.js +0 -7
- package/src/cli/actions/ext/precommit.js +0 -38
- package/src/cli/actions/ext/scan.js +0 -33
- package/src/cli/actions/feedback.js +0 -42
- package/src/cli/actions/get.js +0 -128
- package/src/cli/actions/init.js +0 -67
- package/src/cli/actions/keychain/down.js +0 -30
- package/src/cli/actions/keychain/pull.js +0 -30
- package/src/cli/actions/keychain/push.js +0 -30
- package/src/cli/actions/keychain/up.js +0 -30
- package/src/cli/actions/keypair.js +0 -84
- package/src/cli/actions/login.js +0 -64
- package/src/cli/actions/logout.js +0 -37
- package/src/cli/actions/ls.js +0 -76
- package/src/cli/actions/policy.js +0 -14
- package/src/cli/actions/primitivesCheck.js +0 -32
- package/src/cli/actions/primitivesProfile.js +0 -15
- package/src/cli/actions/primitivesRedact.js +0 -19
- package/src/cli/actions/protect.js +0 -75
- package/src/cli/actions/protectDocker.js +0 -30
- package/src/cli/actions/protectProcess.js +0 -126
- package/src/cli/actions/protectStdin.js +0 -80
- package/src/cli/actions/run.js +0 -203
- package/src/cli/actions/set.js +0 -103
- package/src/cli/actions/settings/device.js +0 -23
- package/src/cli/actions/settings/hostname.js +0 -20
- package/src/cli/actions/settings/off.js +0 -14
- package/src/cli/actions/settings/on.js +0 -14
- package/src/cli/actions/settings/path.js +0 -20
- package/src/cli/actions/settings/token.js +0 -23
- package/src/cli/actions/settings/username.js +0 -20
- package/src/cli/actions/update.js +0 -15
- package/src/cli/commandAction.js +0 -16
- package/src/cli/commands/armor.js +0 -129
- package/src/cli/commands/custody.js +0 -45
- package/src/cli/commands/ext.js +0 -88
- package/src/cli/commands/fileOptions.js +0 -22
- package/src/cli/commands/native.js +0 -54
- package/src/cli/commands/primitives.js +0 -73
- package/src/cli/commands/settings.js +0 -63
- package/src/cli/dotenvx.js +0 -443
- package/src/cli/help.js +0 -179
- package/src/db/device.js +0 -67
- package/src/db/session.js +0 -330
- package/src/lib/api/getAccount.js +0 -32
- package/src/lib/api/getConnectionResources.js +0 -21
- package/src/lib/api/getTeamConnections.js +0 -27
- package/src/lib/api/getTeamServices.js +0 -23
- package/src/lib/api/getTeams.js +0 -28
- package/src/lib/api/postArmorDown.js +0 -48
- package/src/lib/api/postArmorMove.js +0 -48
- package/src/lib/api/postArmorPull.js +0 -48
- package/src/lib/api/postArmorPush.js +0 -48
- package/src/lib/api/postArmorUp.js +0 -53
- package/src/lib/api/postConnectionKeypair.js +0 -23
- package/src/lib/api/postFeedback.js +0 -31
- package/src/lib/api/postLogout.js +0 -34
- package/src/lib/api/postOauthDeviceCode.js +0 -38
- package/src/lib/api/postOauthToken.js +0 -35
- package/src/lib/api/postTeamInvitation.js +0 -28
- package/src/lib/api/teamConnectionSetup.js +0 -31
- package/src/lib/config.d.ts +0 -1
- package/src/lib/config.js +0 -1
- package/src/lib/conventions/environment.js +0 -27
- package/src/lib/conventions/filepaths.js +0 -9
- package/src/lib/conventions/keynames.js +0 -38
- package/src/lib/custodians/index.js +0 -75
- package/src/lib/custodians/local/bitwarden.js +0 -165
- package/src/lib/custodians/local/file.js +0 -18
- package/src/lib/custodians/local/native/backend.js +0 -56
- package/src/lib/custodians/local/native/index.js +0 -28
- package/src/lib/custodians/local/native/store.js +0 -24
- package/src/lib/custodians/local/onepassword.js +0 -149
- package/src/lib/custodians/managed/armor/index.js +0 -14
- package/src/lib/custodians/managed/armor/store.js +0 -48
- package/src/lib/custodians/resolveLocalKey.js +0 -67
- package/src/lib/decryptors/armor/index.js +0 -23
- package/src/lib/decryptors/decryptor-worker.js +0 -6
- package/src/lib/decryptors/index.js +0 -69
- package/src/lib/envfile/discovery/discoverEnvFiles.js +0 -29
- package/src/lib/envfile/discovery/extractEnvKeys.js +0 -173
- package/src/lib/envfile/discovery/scanSource.js +0 -79
- package/src/lib/envfile/parsing/formatEnvfileSyntaxError.js +0 -24
- package/src/lib/envfile/parsing/readEnvfile.js +0 -43
- package/src/lib/envfile/parsing/resolveEnvfilePath.js +0 -5
- package/src/lib/envfile/rendering/normalizeEnvfile.js +0 -53
- package/src/lib/envfile/rendering/previewEnvfile.js +0 -43
- package/src/lib/envfile/rendering/renderEnvfile.js +0 -30
- package/src/lib/envfile/validation/diagnosticLocation.js +0 -29
- package/src/lib/envfile/validation/protectEnvfile.js +0 -40
- package/src/lib/envfile/validation/validateEnvfile.js +0 -14
- package/src/lib/events/backends/armor.js +0 -31
- package/src/lib/events/background.js +0 -59
- package/src/lib/events/catalog.js +0 -14
- package/src/lib/events/cli.js +0 -40
- package/src/lib/events/delivery.js +0 -89
- package/src/lib/events/index.js +0 -73
- package/src/lib/events/metadata.js +0 -25
- package/src/lib/events/sdk.js +0 -44
- package/src/lib/events/worker.js +0 -29
- package/src/lib/events/workerEnvironment.js +0 -14
- package/src/lib/helpers/armoredKeyDisplay.js +0 -10
- package/src/lib/helpers/arrayToTree.js +0 -27
- package/src/lib/helpers/buildApiError.js +0 -19
- package/src/lib/helpers/buildCommandEnvs.js +0 -40
- package/src/lib/helpers/buildConfigEnvs.js +0 -13
- package/src/lib/helpers/buildEnvs.js +0 -24
- package/src/lib/helpers/buildOauthError.js +0 -14
- package/src/lib/helpers/canonicalEnvFilename.js +0 -13
- package/src/lib/helpers/catchAndLog.js +0 -16
- package/src/lib/helpers/checklist.js +0 -50
- package/src/lib/helpers/chomp.js +0 -5
- package/src/lib/helpers/colorDepth.js +0 -23
- package/src/lib/helpers/conventions.js +0 -28
- package/src/lib/helpers/createElapsedStatus.js +0 -17
- package/src/lib/helpers/createProtectSpinner.js +0 -13
- package/src/lib/helpers/createSpinner.js +0 -40
- package/src/lib/helpers/cryptography/decryptKeyValue.js +0 -50
- package/src/lib/helpers/cryptography/index.js +0 -7
- package/src/lib/helpers/cryptography/isDotenvPublicKey.js +0 -7
- package/src/lib/helpers/cryptography/isPlainKey.js +0 -7
- package/src/lib/helpers/cryptography/mutateKeysSrc.js +0 -22
- package/src/lib/helpers/cryptography/mutateSrc.js +0 -24
- package/src/lib/helpers/custodySelect.js +0 -25
- package/src/lib/helpers/decryptDeviceValue.js +0 -7
- package/src/lib/helpers/detectEncoding.js +0 -22
- package/src/lib/helpers/detectEncodingSync.js +0 -22
- package/src/lib/helpers/dotenvOptionPaths.js +0 -25
- package/src/lib/helpers/dotenvPrivateKeyNames.js +0 -7
- package/src/lib/helpers/enclavedHint.js +0 -11
- package/src/lib/helpers/encryptDeviceValue.js +0 -7
- package/src/lib/helpers/envResolution/determine.js +0 -49
- package/src/lib/helpers/envResolution/index.js +0 -8
- package/src/lib/helpers/errors.js +0 -374
- package/src/lib/helpers/escape.js +0 -6
- package/src/lib/helpers/execute.js +0 -12
- package/src/lib/helpers/executeCommand.js +0 -208
- package/src/lib/helpers/executeDynamic.js +0 -86
- package/src/lib/helpers/executeExtension.js +0 -39
- package/src/lib/helpers/filterKeys.js +0 -15
- package/src/lib/helpers/findEnvFiles.js +0 -25
- package/src/lib/helpers/formatCode.js +0 -11
- package/src/lib/helpers/fsx.js +0 -110
- package/src/lib/helpers/guessPrivateKeyFilename.js +0 -15
- package/src/lib/helpers/hasPlaintextSecrets.js +0 -7
- package/src/lib/helpers/http.js +0 -14
- package/src/lib/helpers/installPrecommitHook.js +0 -82
- package/src/lib/helpers/installProtectFilter.js +0 -57
- package/src/lib/helpers/installProtectIgnore.js +0 -27
- package/src/lib/helpers/isPublicKey.js +0 -3
- package/src/lib/helpers/isTeamRequiredError.js +0 -10
- package/src/lib/helpers/jsonToEnv.js +0 -7
- package/src/lib/helpers/keypairMetadata.js +0 -90
- package/src/lib/helpers/kits/sample.js +0 -5
- package/src/lib/helpers/linuxSecretService.js +0 -52
- package/src/lib/helpers/listenForOpenKey.js +0 -46
- package/src/lib/helpers/logProtectedFiles.js +0 -9
- package/src/lib/helpers/logSetSummary.js +0 -21
- package/src/lib/helpers/macosKeychain.js +0 -52
- package/src/lib/helpers/mask.js +0 -22
- package/src/lib/helpers/maskEnvSrc.js +0 -15
- package/src/lib/helpers/maskProcessedEnvs.js +0 -29
- package/src/lib/helpers/matchesStoredKey.js +0 -5
- package/src/lib/helpers/nativeStoreError.js +0 -10
- package/src/lib/helpers/normalizeDotenvConfigConvention.js +0 -13
- package/src/lib/helpers/normalizeDotenvConfigIgnore.js +0 -18
- package/src/lib/helpers/normalizeDotenvConfigPath.js +0 -14
- package/src/lib/helpers/normalizeDotenvConfigQuiet.js +0 -13
- package/src/lib/helpers/normalizeToken.js +0 -5
- package/src/lib/helpers/openUrl.js +0 -7
- package/src/lib/helpers/packageJson.js +0 -3
- package/src/lib/helpers/parseWithDecryptor.js +0 -115
- package/src/lib/helpers/plaintextKeys.js +0 -9
- package/src/lib/helpers/precommitEnvPatterns.js +0 -1
- package/src/lib/helpers/prependPublicKey.js +0 -17
- package/src/lib/helpers/preserveShebang.js +0 -16
- package/src/lib/helpers/prompts.js +0 -169
- package/src/lib/helpers/protectSettings.js +0 -64
- package/src/lib/helpers/ptyCommand.js +0 -27
- package/src/lib/helpers/readEnvKey.js +0 -32
- package/src/lib/helpers/redact.js +0 -9
- package/src/lib/helpers/redactProcessOutput.js +0 -58
- package/src/lib/helpers/redactedValues.js +0 -29
- package/src/lib/helpers/removeDynamicHelpSection.js +0 -21
- package/src/lib/helpers/removeEnvKey.js +0 -51
- package/src/lib/helpers/removeLegacyProtectFilter.js +0 -43
- package/src/lib/helpers/removeOptionsHelpParts.js +0 -59
- package/src/lib/helpers/resolveBitwardenPassword.js +0 -165
- package/src/lib/helpers/resolveDirectoryFilepath.js +0 -16
- package/src/lib/helpers/resolveEnvKeysFile.js +0 -11
- package/src/lib/helpers/resolveHome.js +0 -12
- package/src/lib/helpers/resolveOnePassword.js +0 -82
- package/src/lib/helpers/sanitizeCommandForMetadata.js +0 -64
- package/src/lib/helpers/selectConnection.js +0 -51
- package/src/lib/helpers/selectConnectionResource.js +0 -41
- package/src/lib/helpers/selectEnvfileEnvs.js +0 -29
- package/src/lib/helpers/selectKeyStorage.js +0 -140
- package/src/lib/helpers/statusReporter.js +0 -8
- package/src/lib/helpers/storeKeyStorage.js +0 -39
- package/src/lib/helpers/teamChoicesFromMeta.js +0 -8
- package/src/lib/helpers/truncate.js +0 -10
- package/src/lib/helpers/uninstallPrecommitHook.js +0 -67
- package/src/lib/helpers/upsertEnvKey.js +0 -62
- package/src/lib/helpers/windowsCredentialManager.js +0 -166
- package/src/lib/main.d.ts +0 -509
- package/src/lib/main.js +0 -468
- package/src/lib/providers/index.js +0 -86
- package/src/lib/providers/native/index.js +0 -2
- package/src/lib/resolvers/envs.js +0 -416
- package/src/lib/resolvers/get.js +0 -87
- package/src/lib/resolvers/keypair.js +0 -135
- package/src/lib/resolvers/ls.js +0 -69
- package/src/lib/services/armorDown.js +0 -73
- package/src/lib/services/armorInvite.js +0 -36
- package/src/lib/services/armorMove.js +0 -55
- package/src/lib/services/armorOpen.js +0 -26
- package/src/lib/services/armorPull.js +0 -73
- package/src/lib/services/armorPush.js +0 -66
- package/src/lib/services/armorUp.js +0 -71
- package/src/lib/services/custodyTransfer.js +0 -50
- package/src/lib/services/doctor.js +0 -93
- package/src/lib/services/genexample.js +0 -112
- package/src/lib/services/init.js +0 -83
- package/src/lib/services/keychainDown.js +0 -60
- package/src/lib/services/keychainPull.js +0 -46
- package/src/lib/services/keychainPush.js +0 -51
- package/src/lib/services/keychainUp.js +0 -72
- package/src/lib/services/login.js +0 -51
- package/src/lib/services/logout.js +0 -26
- package/src/lib/services/prebuild.js +0 -91
- package/src/lib/services/precommit.js +0 -144
- package/src/lib/services/validate.js +0 -57
- package/src/lib/transforms/decrypt.js +0 -98
- package/src/lib/transforms/del.js +0 -58
- package/src/lib/transforms/encrypt.js +0 -164
- package/src/lib/transforms/set.js +0 -144
- package/src/shared/colors.js +0 -67
- package/src/shared/logger.js +0 -148
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const { logger } = require('../../../shared/logger')
|
|
2
|
-
const Session = require('./../../../db/session')
|
|
3
|
-
const ArmorDown = require('./../../../lib/services/armorDown')
|
|
4
|
-
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
5
|
-
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
-
|
|
7
|
-
async function down () {
|
|
8
|
-
const options = this.opts()
|
|
9
|
-
const spinnerOptions = typeof this.optsWithGlobals === 'function' ? this.optsWithGlobals() : options
|
|
10
|
-
const spinner = await createSpinner({ ...spinnerOptions, ...options, text: 'dearmoring' })
|
|
11
|
-
|
|
12
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
13
|
-
|
|
14
|
-
const sesh = new Session()
|
|
15
|
-
await sesh.notifyUpdate()
|
|
16
|
-
const hostname = options.hostname || sesh.hostname()
|
|
17
|
-
const token = options.token || sesh.token()
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const devicePublicKey = sesh.devicePublicKey()
|
|
21
|
-
|
|
22
|
-
const { changed, privateKeyName, publicKeyValue } = await new ArmorDown(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
23
|
-
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
24
|
-
|
|
25
|
-
if (spinner) spinner.stop()
|
|
26
|
-
if (changed) {
|
|
27
|
-
logger.success(`◇ dearmored ${options.envFile || '.env'} (${keyDisplay}) to .env.keys`)
|
|
28
|
-
} else {
|
|
29
|
-
logger.info(`○ no change to ${options.envFile || '.env'} (${keyDisplay})`)
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
if (spinner) spinner.stop()
|
|
33
|
-
logger.error(error.message)
|
|
34
|
-
return { exitCode: 1, error }
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = down
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const { logger } = require('../../../shared/logger')
|
|
2
|
-
const Session = require('../../../db/session')
|
|
3
|
-
const ArmorInvite = require('../../../lib/services/armorInvite')
|
|
4
|
-
|
|
5
|
-
async function invite () {
|
|
6
|
-
const options = this.opts()
|
|
7
|
-
const sesh = new Session()
|
|
8
|
-
await sesh.notifyUpdate()
|
|
9
|
-
const hostname = options.hostname || sesh.hostname()
|
|
10
|
-
const token = options.token || sesh.token()
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const { team, email } = await new ArmorInvite(hostname, token, options.team, options.email).run()
|
|
14
|
-
logger.success(`⛨ invited ${email} to ${team}`)
|
|
15
|
-
} catch (error) {
|
|
16
|
-
logger.error(error.message)
|
|
17
|
-
return { exitCode: 1, error }
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = invite
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const { logger } = require('../../../shared/logger')
|
|
2
|
-
const Session = require('./../../../db/session')
|
|
3
|
-
const ArmorMove = require('./../../../lib/services/armorMove')
|
|
4
|
-
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
5
|
-
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
-
|
|
7
|
-
async function move () {
|
|
8
|
-
const options = this.opts()
|
|
9
|
-
const spinnerOptions = typeof this.optsWithGlobals === 'function' ? this.optsWithGlobals() : options
|
|
10
|
-
const spinner = await createSpinner({ ...spinnerOptions, ...options, text: 'moving' })
|
|
11
|
-
|
|
12
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
13
|
-
|
|
14
|
-
const sesh = new Session()
|
|
15
|
-
await sesh.notifyUpdate()
|
|
16
|
-
const hostname = options.hostname || sesh.hostname()
|
|
17
|
-
const token = options.token || sesh.token()
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const devicePublicKey = sesh.devicePublicKey()
|
|
21
|
-
|
|
22
|
-
const {
|
|
23
|
-
changed,
|
|
24
|
-
privateKeyName,
|
|
25
|
-
publicKeyValue,
|
|
26
|
-
team
|
|
27
|
-
} = await new ArmorMove(hostname, token, devicePublicKey, options.envFile).run()
|
|
28
|
-
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
29
|
-
|
|
30
|
-
if (spinner) spinner.stop()
|
|
31
|
-
if (changed) {
|
|
32
|
-
logger.success(`⛨ moved to ${team} (${keyDisplay})`)
|
|
33
|
-
} else {
|
|
34
|
-
logger.info(`○ no change (${keyDisplay})`)
|
|
35
|
-
}
|
|
36
|
-
} catch (error) {
|
|
37
|
-
if (spinner) spinner.stop()
|
|
38
|
-
logger.error(error.message)
|
|
39
|
-
return { exitCode: 1, error }
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
module.exports = move
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const { logger } = require('../../../shared/logger')
|
|
2
|
-
const Session = require('./../../../db/session')
|
|
3
|
-
const ArmorOpen = require('./../../../lib/services/armorOpen')
|
|
4
|
-
const openUrl = require('../../../lib/helpers/openUrl')
|
|
5
|
-
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
-
|
|
7
|
-
async function open () {
|
|
8
|
-
const options = this.opts()
|
|
9
|
-
|
|
10
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
11
|
-
|
|
12
|
-
const sesh = new Session()
|
|
13
|
-
await sesh.notifyUpdate()
|
|
14
|
-
const hostname = options.hostname || sesh.hostname()
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
const { url, publicKeyValue } = new ArmorOpen(hostname, options.envFile).run()
|
|
18
|
-
const keyDisplay = armoredKeyDisplay(publicKeyValue)
|
|
19
|
-
|
|
20
|
-
await openUrl(url)
|
|
21
|
-
logger.success(`◌ opened (${keyDisplay})`)
|
|
22
|
-
} catch (error) {
|
|
23
|
-
logger.error(error.message)
|
|
24
|
-
return { exitCode: 1, error }
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
module.exports = open
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const { logger } = require('../../../shared/logger')
|
|
2
|
-
const Session = require('./../../../db/session')
|
|
3
|
-
const ArmorPull = require('./../../../lib/services/armorPull')
|
|
4
|
-
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
5
|
-
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
-
|
|
7
|
-
async function pull () {
|
|
8
|
-
const options = this.opts()
|
|
9
|
-
const spinnerOptions = typeof this.optsWithGlobals === 'function' ? this.optsWithGlobals() : options
|
|
10
|
-
const spinner = await createSpinner({ ...spinnerOptions, ...options, text: 'pulling' })
|
|
11
|
-
|
|
12
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
13
|
-
|
|
14
|
-
const sesh = new Session()
|
|
15
|
-
await sesh.notifyUpdate()
|
|
16
|
-
const hostname = options.hostname || sesh.hostname()
|
|
17
|
-
const token = options.token || sesh.token()
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const devicePublicKey = sesh.devicePublicKey()
|
|
21
|
-
|
|
22
|
-
const { changed, privateKeyName, publicKeyValue } = await new ArmorPull(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
23
|
-
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
24
|
-
|
|
25
|
-
if (spinner) spinner.stop()
|
|
26
|
-
if (changed) {
|
|
27
|
-
logger.success(`◇ pulled ${options.envFile || '.env'} (${keyDisplay}) to .env.keys`)
|
|
28
|
-
} else {
|
|
29
|
-
logger.info(`○ no change to ${options.envFile || '.env'} (${keyDisplay})`)
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
if (spinner) spinner.stop()
|
|
33
|
-
logger.error(error.message)
|
|
34
|
-
return { exitCode: 1, error }
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = pull
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const { logger } = require('../../../shared/logger')
|
|
2
|
-
const Session = require('./../../../db/session')
|
|
3
|
-
const ArmorPush = require('./../../../lib/services/armorPush')
|
|
4
|
-
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
5
|
-
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
-
|
|
7
|
-
async function push () {
|
|
8
|
-
const options = this.opts()
|
|
9
|
-
const spinnerOptions = typeof this.optsWithGlobals === 'function' ? this.optsWithGlobals() : options
|
|
10
|
-
const spinner = await createSpinner({ ...spinnerOptions, ...options, text: 'pushing' })
|
|
11
|
-
|
|
12
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
13
|
-
|
|
14
|
-
const sesh = new Session()
|
|
15
|
-
await sesh.notifyUpdate()
|
|
16
|
-
const hostname = options.hostname || sesh.hostname()
|
|
17
|
-
const token = options.token || sesh.token()
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const devicePublicKey = sesh.devicePublicKey()
|
|
21
|
-
|
|
22
|
-
const { changed, privateKeyName, publicKeyValue } = await new ArmorPush(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
23
|
-
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
24
|
-
|
|
25
|
-
if (spinner) spinner.stop()
|
|
26
|
-
if (changed) {
|
|
27
|
-
logger.success(`⛨ pushed ${options.envFile || '.env'} (${keyDisplay}) to Armor`)
|
|
28
|
-
} else {
|
|
29
|
-
logger.info(`○ no change to ${options.envFile || '.env'} (${keyDisplay})`)
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
if (spinner) spinner.stop()
|
|
33
|
-
logger.error(error.message)
|
|
34
|
-
return { exitCode: 1, error }
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = push
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const { logger } = require('../../../shared/logger')
|
|
2
|
-
const Session = require('./../../../db/session')
|
|
3
|
-
const ArmorUp = require('./../../../lib/services/armorUp')
|
|
4
|
-
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
5
|
-
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
6
|
-
|
|
7
|
-
async function up () {
|
|
8
|
-
const options = this.opts()
|
|
9
|
-
const spinnerOptions = typeof this.optsWithGlobals === 'function' ? this.optsWithGlobals() : options
|
|
10
|
-
const spinner = await createSpinner({ ...spinnerOptions, ...options, text: 'armoring' })
|
|
11
|
-
|
|
12
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
13
|
-
|
|
14
|
-
const sesh = new Session()
|
|
15
|
-
await sesh.notifyUpdate()
|
|
16
|
-
const hostname = options.hostname || sesh.hostname()
|
|
17
|
-
const token = options.token || sesh.token()
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const devicePublicKey = sesh.devicePublicKey()
|
|
21
|
-
|
|
22
|
-
const { changed, privateKeyName, publicKeyValue } = await new ArmorUp(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
23
|
-
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
24
|
-
|
|
25
|
-
if (spinner) spinner.stop()
|
|
26
|
-
if (changed) {
|
|
27
|
-
logger.success(`⛨ armored ${options.envFile || '.env'} (${keyDisplay})`)
|
|
28
|
-
} else {
|
|
29
|
-
logger.info(`○ no change to ${options.envFile || '.env'} (${keyDisplay})`)
|
|
30
|
-
}
|
|
31
|
-
} catch (error) {
|
|
32
|
-
if (spinner) spinner.stop()
|
|
33
|
-
logger.error(error.message)
|
|
34
|
-
return { exitCode: 1, error }
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = up
|
package/src/cli/actions/check.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
const statusReporter = require('../../lib/helpers/statusReporter')
|
|
2
|
-
const { logger } = require('./../../shared/logger')
|
|
3
|
-
const catchAndLog = require('./../../lib/helpers/catchAndLog')
|
|
4
|
-
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
5
|
-
const prepareValidatedEnv = require('../../lib/services/validate')
|
|
6
|
-
const diagnosticLocations = require('../../lib/envfile/validation/diagnosticLocation')
|
|
7
|
-
const normalizeDotenvConfigQuiet = require('../../lib/helpers/normalizeDotenvConfigQuiet')
|
|
8
|
-
const normalizeDotenvConfigConvention = require('../../lib/helpers/normalizeDotenvConfigConvention')
|
|
9
|
-
const normalizeDotenvConfigIgnore = require('../../lib/helpers/normalizeDotenvConfigIgnore')
|
|
10
|
-
const path = require('node:path')
|
|
11
|
-
const previewEnvfile = require('../../lib/envfile/rendering/previewEnvfile')
|
|
12
|
-
|
|
13
|
-
async function check () {
|
|
14
|
-
const options = normalizeDotenvConfigIgnore(normalizeDotenvConfigConvention(normalizeDotenvConfigQuiet(this.opts())))
|
|
15
|
-
const spinnerOptions = typeof this.optsWithGlobals === 'function' ? this.optsWithGlobals() : options
|
|
16
|
-
const spinner = await createSpinner({ ...spinnerOptions, ...options, text: 'checking', ...(process.env.CI ? { spinner: false } : {}) })
|
|
17
|
-
const ignore = options.ignore || []
|
|
18
|
-
const showPreview = !options.quiet && !['error', 'infoerror', 'warn'].includes(logger.level)
|
|
19
|
-
let errorCount = 0
|
|
20
|
-
const checked = []
|
|
21
|
-
const messages = []
|
|
22
|
-
const report = (level, message) => messages.push({ level, message })
|
|
23
|
-
const flush = () => {
|
|
24
|
-
if (spinner) spinner.stop()
|
|
25
|
-
for (const { level, message } of messages.splice(0)) logger[level](message)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const { processedEnvs, readableFilepaths, requiredFilepaths, validationError, schema, checked: checkedValues } = await prepareValidatedEnv({
|
|
30
|
-
envs: this.envs,
|
|
31
|
-
options,
|
|
32
|
-
onStatus: statusReporter(spinner)
|
|
33
|
-
})
|
|
34
|
-
checked.push(...readableFilepaths)
|
|
35
|
-
if (processedEnvs.some(row => row.type === 'env' && Object.keys(row.parsed || {}).length)) checked.push('--env')
|
|
36
|
-
if (checked.length === 0 && Object.keys(schema.keys).some(key => checkedValues[key] !== undefined)) checked.push('shell environment')
|
|
37
|
-
const location = diagnosticLocations(processedEnvs, checked.join(', ') || 'Envfile')
|
|
38
|
-
for (const row of processedEnvs) {
|
|
39
|
-
for (const error of row.errors || []) {
|
|
40
|
-
if (ignore.includes(error.code)) continue
|
|
41
|
-
if (error.code === 'MISSING_ENV_FILE' && !requiredFilepaths.has(path.resolve(row.filepath))) {
|
|
42
|
-
report('infoerror', `○ skipped (${row.filepath})`)
|
|
43
|
-
continue
|
|
44
|
-
}
|
|
45
|
-
errorCount++
|
|
46
|
-
report('error', error.messageWithHelp || error.message)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
if (validationError && !ignore.includes(validationError.code)) {
|
|
50
|
-
errorCount++
|
|
51
|
-
for (const diagnostic of showPreview ? [] : validationError.diagnostics) {
|
|
52
|
-
const message = diagnostic.message.replace(`${diagnostic.key} is `, `${diagnostic.key} `)
|
|
53
|
-
report('error', `${message} (${location(diagnostic.key)})`)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (spinner) spinner.stop()
|
|
58
|
-
if (showPreview) {
|
|
59
|
-
const diagnostics = validationError && !ignore.includes(validationError.code) ? validationError.diagnostics : []
|
|
60
|
-
const preview = previewEnvfile(processedEnvs, schema, checkedValues, diagnostics)
|
|
61
|
-
if (preview) {
|
|
62
|
-
for (const line of preview.split('\n')) logger.info(line)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
flush()
|
|
66
|
-
if (checked.length === 0) {
|
|
67
|
-
logger.error('no environment sources found to check')
|
|
68
|
-
return { exitCode: 1 }
|
|
69
|
-
}
|
|
70
|
-
if (errorCount > 0) return { exitCode: 1 }
|
|
71
|
-
} catch (error) {
|
|
72
|
-
flush()
|
|
73
|
-
catchAndLog(error)
|
|
74
|
-
return { exitCode: 1, error }
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
module.exports = check
|
package/src/cli/actions/curl.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const { logger } = require('../../shared/logger')
|
|
2
|
-
const Session = require('../../db/session')
|
|
3
|
-
const { http } = require('../../lib/helpers/http')
|
|
4
|
-
const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
5
|
-
|
|
6
|
-
function requestUrl (value, hostname) {
|
|
7
|
-
const url = new URL(value)
|
|
8
|
-
const trusted = new URL(hostname)
|
|
9
|
-
|
|
10
|
-
if (url.origin !== trusted.origin) {
|
|
11
|
-
throw new Error(`refusing to send Armor token to [${url.origin}]. expected [${trusted.origin}]`)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (url.username || url.password) {
|
|
15
|
-
throw new Error('refusing URL containing credentials')
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return url.toString()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function requestBody (value) {
|
|
22
|
-
if (value === undefined) return undefined
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
return JSON.stringify(JSON.parse(value))
|
|
26
|
-
} catch {
|
|
27
|
-
throw new Error('invalid JSON passed to [--data]')
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function outputBody (value) {
|
|
32
|
-
try {
|
|
33
|
-
return JSON.stringify(JSON.parse(value), null, 2)
|
|
34
|
-
} catch {
|
|
35
|
-
return value
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function curl () {
|
|
40
|
-
try {
|
|
41
|
-
const options = this.opts()
|
|
42
|
-
const session = new Session()
|
|
43
|
-
const token = options.token || session.token()
|
|
44
|
-
if (!token) throw new Error('missing token. Try [dotenvx login].')
|
|
45
|
-
|
|
46
|
-
const body = requestBody(options.data)
|
|
47
|
-
const method = (options.request || (body === undefined ? 'GET' : 'POST')).toUpperCase()
|
|
48
|
-
const url = requestUrl(this.args[0], session.hostname())
|
|
49
|
-
const headers = {
|
|
50
|
-
Authorization: `Bearer ${token}`,
|
|
51
|
-
Accept: 'application/json',
|
|
52
|
-
'dotenvx-device-public-key': session.devicePublicKey()
|
|
53
|
-
}
|
|
54
|
-
if (body !== undefined) headers['Content-Type'] = 'application/json'
|
|
55
|
-
|
|
56
|
-
logger.debug(`request [${method} ${url}]`)
|
|
57
|
-
const response = await http(url, { method, headers, body })
|
|
58
|
-
const text = await response.body.text()
|
|
59
|
-
console.log(outputBody(text))
|
|
60
|
-
|
|
61
|
-
if (response.statusCode >= 400) return { exitCode: 1 }
|
|
62
|
-
} catch (error) {
|
|
63
|
-
catchAndLog(error)
|
|
64
|
-
return { exitCode: 1, error }
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
module.exports = curl
|
|
69
|
-
module.exports.requestUrl = requestUrl
|
|
70
|
-
module.exports.requestBody = requestBody
|
|
71
|
-
module.exports.outputBody = outputBody
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
const statusReporter = require('../../lib/helpers/statusReporter')
|
|
2
|
-
const { publickeys, injectsummary } = require('@dotenvx/primitives')
|
|
3
|
-
const fsx = require('./../../lib/helpers/fsx')
|
|
4
|
-
const { logger } = require('./../../shared/logger')
|
|
5
|
-
|
|
6
|
-
const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
7
|
-
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
8
|
-
const Session = require('../../db/session')
|
|
9
|
-
|
|
10
|
-
const decryptTransform = require('./../../lib/transforms/decrypt')
|
|
11
|
-
const maskEnvSrc = require('../../lib/helpers/maskEnvSrc')
|
|
12
|
-
|
|
13
|
-
async function decrypt () {
|
|
14
|
-
const options = this.opts()
|
|
15
|
-
const spinnerOptions = typeof this.optsWithGlobals === 'function' ? this.optsWithGlobals() : options
|
|
16
|
-
const spinner = await createSpinner({ ...spinnerOptions, ...options, text: 'decrypting' })
|
|
17
|
-
|
|
18
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
19
|
-
|
|
20
|
-
const envs = this.envs
|
|
21
|
-
const sesh = new Session()
|
|
22
|
-
const noArmor = options.armor === false || (await sesh.noArmor())
|
|
23
|
-
const noNative = options.native === false || options.noNative === true
|
|
24
|
-
|
|
25
|
-
let errorCount = 0
|
|
26
|
-
|
|
27
|
-
// stdout - should not have a try so that exit codes can surface to stdout
|
|
28
|
-
if (options.stdout) {
|
|
29
|
-
const {
|
|
30
|
-
processedEnvs
|
|
31
|
-
} = await decryptTransform({
|
|
32
|
-
envs,
|
|
33
|
-
ik: options.key,
|
|
34
|
-
ek: options.excludeKey,
|
|
35
|
-
fk: options.envKeysFile,
|
|
36
|
-
noArmor,
|
|
37
|
-
noNative,
|
|
38
|
-
onStatus: statusReporter(spinner)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
if (spinner) spinner.stop()
|
|
42
|
-
for (const processedEnv of processedEnvs) {
|
|
43
|
-
if (processedEnv.error) {
|
|
44
|
-
errorCount += 1
|
|
45
|
-
logger.error(processedEnv.error.messageWithHelp || processedEnv.error.message)
|
|
46
|
-
} else {
|
|
47
|
-
let showChar = options.mask
|
|
48
|
-
if (options.mask === true) {
|
|
49
|
-
showChar = 6
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let envSrc = processedEnv.envSrc
|
|
53
|
-
if (options.mask !== undefined) {
|
|
54
|
-
envSrc = maskEnvSrc(processedEnv.envSrc, showChar)
|
|
55
|
-
}
|
|
56
|
-
console.log(envSrc)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
61
|
-
} else {
|
|
62
|
-
try {
|
|
63
|
-
const {
|
|
64
|
-
processedEnvs,
|
|
65
|
-
changedFilepaths,
|
|
66
|
-
unchangedFilepaths
|
|
67
|
-
} = await decryptTransform({
|
|
68
|
-
envs,
|
|
69
|
-
ik: options.key,
|
|
70
|
-
ek: options.excludeKey,
|
|
71
|
-
fk: options.envKeysFile,
|
|
72
|
-
noArmor,
|
|
73
|
-
noNative,
|
|
74
|
-
onStatus: statusReporter(spinner)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
for (const processedEnv of processedEnvs) {
|
|
78
|
-
logger.verbose(`decrypting ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
79
|
-
|
|
80
|
-
if (processedEnv.error) {
|
|
81
|
-
errorCount += 1
|
|
82
|
-
logger.error(processedEnv.error.messageWithHelp || processedEnv.error.message)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (processedEnv.changed) {
|
|
86
|
-
await fsx.writeFileX(processedEnv.filepath, processedEnv.envSrc)
|
|
87
|
-
|
|
88
|
-
logger.verbose(`decrypted ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
89
|
-
} else {
|
|
90
|
-
logger.verbose(`no change ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (spinner) spinner.stop()
|
|
95
|
-
const summaryRows = new Map(processedEnvs.map(row => [row.envFilepath, {
|
|
96
|
-
filepath: row.envFilepath,
|
|
97
|
-
publicKeys: publickeys(row.envSrc || ''),
|
|
98
|
-
keySources: row.keySources
|
|
99
|
-
}]))
|
|
100
|
-
if (changedFilepaths.length > 0) {
|
|
101
|
-
const summary = injectsummary.sources(changedFilepaths.map(filepath => summaryRows.get(filepath) || filepath))
|
|
102
|
-
logger.success(`◇ decrypted ${summary.files.join(',')}${summary.suffix}`)
|
|
103
|
-
} else if (unchangedFilepaths.length > 0) {
|
|
104
|
-
const summary = injectsummary.sources(unchangedFilepaths.map(filepath => summaryRows.get(filepath) || filepath))
|
|
105
|
-
logger.info(`○ no change to ${summary.files.join(',')}${summary.suffix}`)
|
|
106
|
-
} else {
|
|
107
|
-
// do nothing - scenario when no .env files found
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
111
|
-
} catch (error) {
|
|
112
|
-
if (spinner) spinner.stop()
|
|
113
|
-
catchAndLog(error)
|
|
114
|
-
return { exitCode: 1, error }
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
module.exports = require('../../lib/events/cli')('decrypt', decrypt)
|
package/src/cli/actions/del.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
const fsx = require('./../../lib/helpers/fsx')
|
|
2
|
-
const { logger } = require('./../../shared/logger')
|
|
3
|
-
|
|
4
|
-
const delTransform = require('./../../lib/transforms/del')
|
|
5
|
-
|
|
6
|
-
const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
7
|
-
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
8
|
-
|
|
9
|
-
async function del (key) {
|
|
10
|
-
const options = this.opts()
|
|
11
|
-
const spinnerOptions = typeof this.optsWithGlobals === 'function' ? this.optsWithGlobals() : options
|
|
12
|
-
const spinner = await createSpinner({ ...spinnerOptions, ...options, text: 'deleting' })
|
|
13
|
-
|
|
14
|
-
logger.debug(`key: ${key}`)
|
|
15
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
16
|
-
|
|
17
|
-
const envs = this.envs || []
|
|
18
|
-
|
|
19
|
-
let errorCount = 0
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
const { processedEnvs, changedFilepaths, unchangedFilepaths } = await delTransform({ envs, key })
|
|
23
|
-
|
|
24
|
-
if (spinner) spinner.stop()
|
|
25
|
-
for (const processedEnv of processedEnvs) {
|
|
26
|
-
logger.verbose(`deleting for ${processedEnv.envFilepath}`)
|
|
27
|
-
if (processedEnv.error) {
|
|
28
|
-
errorCount += 1
|
|
29
|
-
logger.error(processedEnv.error.messageWithHelp || processedEnv.error.message)
|
|
30
|
-
} else if (processedEnv.changed) {
|
|
31
|
-
await fsx.writeFileX(processedEnv.filepath, processedEnv.envSrc)
|
|
32
|
-
logger.verbose(`${processedEnv.key} deleted (${processedEnv.envFilepath})`)
|
|
33
|
-
} else {
|
|
34
|
-
logger.verbose(`no change ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (changedFilepaths.length > 0) {
|
|
39
|
-
logger.success(`◇ removed ${key} (${changedFilepaths.join(',')})`)
|
|
40
|
-
} else if (unchangedFilepaths.length > 0) {
|
|
41
|
-
logger.info(`○ no change (${unchangedFilepaths})`)
|
|
42
|
-
} else {
|
|
43
|
-
// do nothing - scenario when no .env files found
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
47
|
-
} catch (error) {
|
|
48
|
-
if (spinner) spinner.stop()
|
|
49
|
-
catchAndLog(error)
|
|
50
|
-
return { exitCode: 1, error }
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
module.exports = require('../../lib/events/cli')('del', del)
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const { logger } = require('./../../shared/logger')
|
|
2
|
-
const Doctor = require('./../../lib/services/doctor')
|
|
3
|
-
|
|
4
|
-
function doctor (directory = '.') {
|
|
5
|
-
logger.debug(`directory: ${directory}`)
|
|
6
|
-
|
|
7
|
-
const findings = new Doctor(directory).run()
|
|
8
|
-
logger.debug(`findings: ${JSON.stringify(findings)}`)
|
|
9
|
-
|
|
10
|
-
if (findings.length === 0) {
|
|
11
|
-
logger.info('no dotenv loaders found')
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
logger.warn(`found ${findings.length} possible dotenv loader${findings.length === 1 ? '' : 's'}`)
|
|
16
|
-
|
|
17
|
-
for (const finding of findings) {
|
|
18
|
-
logger.info(`│ ${finding.filepath}:${finding.line}: ${finding.code}`)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = doctor
|