@jsenv/https-local 1.0.5 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/https-local",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A programmatic way to generate locally trusted certificates",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -62,10 +62,10 @@
62
62
  "@jsenv/assert": "2.4.1",
63
63
  "@jsenv/core": "25.3.0",
64
64
  "@jsenv/eslint-config": "16.0.9",
65
- "@jsenv/github-release-package": "1.3.2",
65
+ "@jsenv/github-release-package": "1.3.3",
66
66
  "@jsenv/importmap-eslint-resolver": "5.2.5",
67
67
  "@jsenv/importmap-node-module": "5.1.3",
68
- "@jsenv/package-publish": "1.7.1",
68
+ "@jsenv/package-publish": "1.7.2",
69
69
  "@jsenv/performance-impact": "2.2.4",
70
70
  "eslint": "8.7.0",
71
71
  "eslint-plugin-import": "2.25.4",
@@ -1,7 +1,5 @@
1
- /* eslint-disable import/max-dependencies */
2
-
3
- import { createLogger, createDetailedMessage } from "@jsenv/logger"
4
1
  import { readFile, writeFile, removeFileSystemNode } from "@jsenv/filesystem"
2
+ import { createLogger, createDetailedMessage } from "@jsenv/logger"
5
3
 
6
4
  import { infoSign, okSign } from "./internal/logs.js"
7
5
  import { getAuthorityFileInfos } from "./internal/authority_file_infos.js"
@@ -28,8 +28,8 @@ export const getCertutilBinPath = () => "certutil"
28
28
 
29
29
  export const getNSSDynamicInstallInfo = ({ logger }) => {
30
30
  return {
31
- nssIsInstallable: true,
32
- nssInstall: async () => {
31
+ isInstallable: true,
32
+ install: async () => {
33
33
  const aptInstallCommand = `sudo apt install libnss3-tools`
34
34
  logger.info(
35
35
  `"libnss3-tools" is not installed, trying to install "libnss3-tools"`,
@@ -38,10 +38,10 @@ export const getCertutilBinPath = memoize(async () => {
38
38
 
39
39
  export const getNSSDynamicInstallInfo = () => {
40
40
  return {
41
- nssIsInstallable: commandExists("brew"),
42
- nssNotInstallableReason: `"brew" is not available`,
43
- nssInstallFixSuggestion: `install "brew" on this mac`,
44
- installNss: async ({ logger }) => {
41
+ isInstallable: commandExists("brew"),
42
+ notInstallableReason: `"brew" is not available`,
43
+ suggestion: `install "brew" on this mac`,
44
+ install: async ({ logger }) => {
45
45
  const brewInstallCommand = `brew install nss`
46
46
  logger.info(
47
47
  `"nss" is not installed, trying to install "nss" via Homebrew`,
@@ -64,19 +64,15 @@ export const executeTrustQueryOnBrowserNSSDB = async ({
64
64
  const cannotCheckMessage = `${failureSign} cannot check if certificate is in ${browserName}`
65
65
  if (!nssIsInstalled) {
66
66
  if (verb === VERB_ADD_TRUST) {
67
- const {
68
- nssIsInstallable,
69
- nssNotInstallableReason,
70
- nssInstallFixSuggestion,
71
- nssInstall,
72
- } = await getNSSDynamicInstallInfo({ logger })
73
- if (!nssIsInstallable) {
67
+ const nssDynamicInstallInfo = await getNSSDynamicInstallInfo({ logger })
68
+ if (!nssDynamicInstallInfo.isInstallable) {
74
69
  const reason = `"${nssCommandName}" is not installed and not cannot be installed`
75
70
  logger.warn(
76
71
  createDetailedMessage(cannotCheckMessage, {
77
72
  reason,
78
- "reason it cannot be installed": nssNotInstallableReason,
79
- "suggested solution": nssInstallFixSuggestion,
73
+ "reason it cannot be installed":
74
+ nssDynamicInstallInfo.notInstallableReason,
75
+ "suggested solution": nssDynamicInstallInfo.suggestion,
80
76
  }),
81
77
  )
82
78
  return {
@@ -100,7 +96,7 @@ export const executeTrustQueryOnBrowserNSSDB = async ({
100
96
  }
101
97
 
102
98
  try {
103
- await nssInstall()
99
+ await nssDynamicInstallInfo.install()
104
100
  } catch (e) {
105
101
  logger.error(
106
102
  createDetailedMessage(cannotCheckMessage, {