@jsenv/https-local 3.1.0 → 3.2.0

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": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "A programmatic way to generate locally trusted certificates",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -46,7 +46,9 @@ export const requestCertificate = ({
46
46
  } = getAuthorityFileInfos();
47
47
  if (!rootCertificateFileInfo.exists) {
48
48
  throw new Error(
49
- `Certificate authority not found, "installCertificateAuthority" must be called before "requestServerCertificate"`,
49
+ `Certificate authority not found, "installCertificateAuthority" must be called before "requestServerCertificate".
50
+ --- Suggested command to run ---
51
+ npx @jsenv/https-local install --trust`,
50
52
  );
51
53
  }
52
54
  if (!rootCertificatePrivateKeyFileInfo.exists) {
@@ -25,6 +25,9 @@ if (values.help || positionals.length === 0) {
25
25
 
26
26
  Usage:
27
27
 
28
+ npx @jsenv/https-local setup
29
+ Install root certificate, try to trust it and ensure localhost is mapped to 127.0.0.1
30
+
28
31
  npx @jsenv/https-local install --trust
29
32
  Install root certificate on the filesystem
30
33
  - trust: Try to add root certificate to os and browser trusted stores.
@@ -43,6 +46,18 @@ https://github.com/jsenv/core/tree/main/packages/independent/https-local
43
46
  }
44
47
 
45
48
  const commandHandlers = {
49
+ setup: async () => {
50
+ await installCertificateAuthority({
51
+ tryToTrust: true,
52
+ NSSDynamicInstall: true,
53
+ });
54
+ await verifyHostsFile({
55
+ ipMappings: {
56
+ "127.0.0.1": ["localhost"],
57
+ },
58
+ tryToUpdatesHostsFile: true,
59
+ });
60
+ },
46
61
  install: async ({ tryToTrust }) => {
47
62
  await installCertificateAuthority({
48
63
  tryToTrust,