@knapsack/app 4.80.16 → 4.80.17--canary.6256.dbf69c0.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/CHANGELOG.md +0 -28
- package/dist/cli/commands.d.ts +5 -12
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +111 -48
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/knapsack-cli.js +145 -165
- package/dist/cli/knapsack-cli.js.map +1 -1
- package/dist/cli/log.d.ts.map +1 -1
- package/dist/cli/log.js +15 -0
- package/dist/cli/log.js.map +1 -1
- package/dist/lib/util/cache-dir.d.ts +44 -1
- package/dist/lib/util/cache-dir.d.ts.map +1 -1
- package/dist/lib/util/cache-dir.js +11 -1
- package/dist/lib/util/cache-dir.js.map +1 -1
- package/dist/server/rest-api.d.ts.map +1 -1
- package/dist/server/rest-api.js +17 -1
- package/dist/server/rest-api.js.map +1 -1
- package/dist/server/server.d.ts +1 -5
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +25 -27
- package/dist/server/server.js.map +1 -1
- package/dist/types/knapsack-config.d.ts +1 -9
- package/dist/types/knapsack-config.d.ts.map +1 -1
- package/package.json +20 -19
- package/dist/lib/https-cert/constants.d.ts +0 -13
- package/dist/lib/https-cert/constants.d.ts.map +0 -1
- package/dist/lib/https-cert/constants.js +0 -44
- package/dist/lib/https-cert/constants.js.map +0 -1
- package/dist/lib/https-cert/index.d.ts +0 -9
- package/dist/lib/https-cert/index.d.ts.map +0 -1
- package/dist/lib/https-cert/index.js +0 -12
- package/dist/lib/https-cert/index.js.map +0 -1
- package/dist/lib/https-cert/lib/auto-encrypt-localhost.d.ts +0 -3
- package/dist/lib/https-cert/lib/auto-encrypt-localhost.d.ts.map +0 -1
- package/dist/lib/https-cert/lib/auto-encrypt-localhost.js +0 -87
- package/dist/lib/https-cert/lib/auto-encrypt-localhost.js.map +0 -1
- package/dist/lib/https-cert/lib/get-ssl-cert.d.ts +0 -7
- package/dist/lib/https-cert/lib/get-ssl-cert.d.ts.map +0 -1
- package/dist/lib/https-cert/lib/get-ssl-cert.js +0 -32
- package/dist/lib/https-cert/lib/get-ssl-cert.js.map +0 -1
- package/dist/lib/https-cert/lib/install-cert-util.d.ts +0 -2
- package/dist/lib/https-cert/lib/install-cert-util.d.ts.map +0 -1
- package/dist/lib/https-cert/lib/install-cert-util.js +0 -133
- package/dist/lib/https-cert/lib/install-cert-util.js.map +0 -1
- package/dist/lib/https-cert/lib/pre-install-mkcert.d.ts +0 -2
- package/dist/lib/https-cert/lib/pre-install-mkcert.d.ts.map +0 -1
- package/dist/lib/https-cert/lib/pre-install-mkcert.js +0 -66
- package/dist/lib/https-cert/lib/pre-install-mkcert.js.map +0 -1
- package/dist/lib/https-cert/lib/setup-local-cert-auth.d.ts +0 -6
- package/dist/lib/https-cert/lib/setup-local-cert-auth.d.ts.map +0 -1
- package/dist/lib/https-cert/lib/setup-local-cert-auth.js +0 -35
- package/dist/lib/https-cert/lib/setup-local-cert-auth.js.map +0 -1
- package/dist/lib/https-cert/log.d.ts +0 -2
- package/dist/lib/https-cert/log.d.ts.map +0 -1
- package/dist/lib/https-cert/log.js +0 -6
- package/dist/lib/https-cert/log.js.map +0 -1
- package/dist/lib/https-cert/types.d.ts +0 -5
- package/dist/lib/https-cert/types.d.ts.map +0 -1
- package/dist/lib/https-cert/types.js +0 -3
- package/dist/lib/https-cert/types.js.map +0 -1
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.installCertutil = installCertutil;
|
|
7
|
-
const os_1 = __importDefault(require("os"));
|
|
8
|
-
const child_process_1 = __importDefault(require("child_process"));
|
|
9
|
-
const log_1 = require("../log");
|
|
10
|
-
// Does the passed command exist? Returns: bool.
|
|
11
|
-
function commandExists(command) {
|
|
12
|
-
try {
|
|
13
|
-
child_process_1.default.execFileSync('which', [command], { env: process.env });
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//
|
|
21
|
-
// Private.
|
|
22
|
-
//
|
|
23
|
-
// On Linux, we must install nss for mkcert to work with both Chrome and Firefox.
|
|
24
|
-
// Depending on the platform we try to do so using apt, yum, or pacman. If none of
|
|
25
|
-
// those exist, we fail.
|
|
26
|
-
function installCertutilOnLinux() {
|
|
27
|
-
if (commandExists('certutil')) {
|
|
28
|
-
// Already installed
|
|
29
|
-
log_1.log.verbose('done.\n');
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
log_1.log.info('❨auto-encrypt-localhost❩ Installing certutil dependency (Linux) ');
|
|
33
|
-
const options = { env: process.env };
|
|
34
|
-
try {
|
|
35
|
-
if (commandExists('apt')) {
|
|
36
|
-
log_1.log.verbose('using apt… \n');
|
|
37
|
-
options.env.DEBIAN_FRONTEND = 'noninteractive';
|
|
38
|
-
child_process_1.default.execSync('sudo apt-get install -y -q libnss3-tools', options);
|
|
39
|
-
}
|
|
40
|
-
else if (commandExists('yum')) {
|
|
41
|
-
// Untested: if you test this, please let me know https://github.com/indie-mirror/https-server/issues
|
|
42
|
-
log_1.log.verbose('❨auto-encrypt-localhost❩ Attempting to install required dependency using yum. This is currently untested. If it works (or blows up) for you, I’d appreciate it if you could open an issue at https://github.com/indie-mirror/https-server/issues and let me know. Thanks! – Aral\n');
|
|
43
|
-
child_process_1.default.execSync('sudo yum install nss-tools', options);
|
|
44
|
-
log_1.log.verbose('❨auto-encrypt-localhost❩ Certutil installed using yum.');
|
|
45
|
-
}
|
|
46
|
-
else if (commandExists('pacman')) {
|
|
47
|
-
child_process_1.default.execSync('sudo pacman -S nss', options);
|
|
48
|
-
log_1.log.verbose('❨auto-encrypt-localhost❩ Certutil installed using pacman.');
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
// Neither Homebrew nor MacPorts is installed. Warn the person.
|
|
52
|
-
log_1.log.verbose('❨auto-encrypt-localhost❩ Linux: No supported package manager found for installing certutil on Linux (tried apt, yum, and pacman. Please install certutil manually and run Auto Encrypt Localhost again. For more instructions on installing mkcert dependencies, please see https://github.com/FiloSottile/mkcert/\n');
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
// There was an error and we couldn’t install the dependency. Warn the person.
|
|
57
|
-
log_1.log.verbose('❨auto-encrypt-localhost❩ Linux: Failed to install nss. Please install it manually and run Auto Encrypt Localhost again if you want your certificate to work in Chrome and Firefox', error);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// On macOS, we install nss for mkcert to work with Firefox. To
|
|
61
|
-
// install nss, we can use either Homebrew or Macports.
|
|
62
|
-
// If neither Homebrew or MacPorts is installed, we warn the person that
|
|
63
|
-
// they need to install it manually if they want their certificates to work
|
|
64
|
-
// in Firefox.
|
|
65
|
-
function installCertutilOnDarwin() {
|
|
66
|
-
const options = { env: process.env };
|
|
67
|
-
if (commandExists('brew')) {
|
|
68
|
-
// Check if nss installed using brew (we can’t just check using commandExists as
|
|
69
|
-
// nss is installed as keg-only and not symlinked to /usr/local due to issues
|
|
70
|
-
// with Firefox crashing).
|
|
71
|
-
try {
|
|
72
|
-
// Homebrew can take a long time start, show current status.
|
|
73
|
-
child_process_1.default.execSync('brew list nss >/dev/null 2>&1', options);
|
|
74
|
-
log_1.log.verbose('done.');
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
// NSS is not installed. Install it.
|
|
78
|
-
try {
|
|
79
|
-
log_1.log.info('❨auto-encrypt-localhost❩Installing certutil dependency (Darwin) using Homebrew… ');
|
|
80
|
-
child_process_1.default.execSync('brew install nss >/dev/null 2>&1', options);
|
|
81
|
-
log_1.log.verbose('done.');
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
84
|
-
log_1.log.warn('❨auto-encrypt-localhost❩ macOS: Failed to install nss via Homebrew. Please install it manually and run Auto Encrypt Localhost again if you want your certificate to work in Firefox', err);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
else if (commandExists('port')) {
|
|
89
|
-
// Untested. This is based on the documentation at https://guide.macports.org/#using.port.installed. I don’t have MacPorts installed
|
|
90
|
-
// and it doesn’t play well with Homebrew so I won’t be testing this anytime soon. If you do, please let me know how it works
|
|
91
|
-
// by opening an issue on https://github.com/indie-mirror/https-server/issues
|
|
92
|
-
log_1.log.warn('❨auto-encrypt-localhost❩ Attempting to install required dependency using MacPorts. This is currently untested. If it works (or blows up) for you, I’d appreciate it if you could open an issue at https://github.com/indie-mirror/https-server/issues and let me know. Thanks! – Aral\n');
|
|
93
|
-
try {
|
|
94
|
-
child_process_1.default.execSync('port installed nss', options);
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
// nss is not installed, attempt to install it using MacPorts.
|
|
98
|
-
try {
|
|
99
|
-
child_process_1.default.execSync('sudo port install nss', options);
|
|
100
|
-
}
|
|
101
|
-
catch (err) {
|
|
102
|
-
log_1.log.error('❨auto-encrypt-localhost❩ macOS: Failed to install nss via MacPorts. Please install it manually and run Auto Encrypt Localhost again if you want your certificate to work in Firefox', err);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
// Neither Homebrew nor MacPorts is installed. Warn the person.
|
|
108
|
-
log_1.log.error('macOS: Cannot install certutil (nss) as you don’t have Homebrew or MacPorts installed.\n\n If you want your certificate to work in Firefox, please install one of those package managers and then install nss manually:\n ╰─ * Homebrew (https://brew.sh): brew install nss ╰─ * MacPorts(https://macports.org): sudo port install nss\n');
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// Mozilla’s nss is used on Linux to install the certificate in Chrome and Firefox
|
|
112
|
-
// and on macOS for Firefox. Ensure it exists.
|
|
113
|
-
// Source: https://github.com/FiloSottile/mkcert/blob/master/README.md#installation
|
|
114
|
-
function installCertutil() {
|
|
115
|
-
log_1.log.info(`Installing certutil if necessary… `);
|
|
116
|
-
const platform = os_1.default.platform();
|
|
117
|
-
if (platform === 'linux') {
|
|
118
|
-
installCertutilOnLinux();
|
|
119
|
-
}
|
|
120
|
-
else if (platform === 'darwin') {
|
|
121
|
-
installCertutilOnDarwin();
|
|
122
|
-
}
|
|
123
|
-
else if (platform === 'win32') {
|
|
124
|
-
// Do nothing. According to the mkcert documentation, certutil is not
|
|
125
|
-
// required on Windows.
|
|
126
|
-
log_1.log.verbose('done.');
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
// Unknown platform. This should have been caught earlier. Panic.
|
|
130
|
-
throw new Error(`Panic: Unknown platform detected. ${platform}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=install-cert-util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install-cert-util.js","sourceRoot":"","sources":["../../../../src/lib/https-cert/lib/install-cert-util.ts"],"names":[],"mappings":";;;;;AA8HA,0CAeC;AA7ID,4CAAoB;AACpB,kEAAyC;AACzC,gCAA6B;AAE7B,gDAAgD;AAChD,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,CAAC;QACH,uBAAY,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,EAAE;AACF,WAAW;AACX,EAAE;AAEF,iFAAiF;AACjF,kFAAkF;AAClF,wBAAwB;AACxB,SAAS,sBAAsB;IAC7B,IAAI,aAAa,CAAC,UAAU,CAAC,EAAE,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AC;IACJ,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,8CAA8C;AAC9C,mFAAmF;AACnF,SAAgB,eAAe;IAC7B,SAAG,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,YAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,sBAAsB,EAAE,CAAC;IAC3B,CAAC;SAAM,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,uBAAuB,EAAE,CAAC;IAC5B,CAAC;SAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAChC,qEAAqE;QACrE,uBAAuB;QACvB,SAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,iEAAiE;QACjE,MAAM,IAAI,KAAK,CAAC,qCAAqC,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pre-install-mkcert.d.ts","sourceRoot":"","sources":["../../../../src/lib/https-cert/lib/pre-install-mkcert.ts"],"names":[],"mappings":"AA0CA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CA6BtD"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.preInstallMkCert = preInstallMkCert;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
-
const https_1 = __importDefault(require("https"));
|
|
10
|
-
const log_1 = require("../log");
|
|
11
|
-
const constants_1 = require("../constants");
|
|
12
|
-
async function download(url, filePath) {
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
https_1.default
|
|
15
|
-
.get(url, (response) => {
|
|
16
|
-
const { statusCode } = response;
|
|
17
|
-
const redirectUrl = response.headers.location;
|
|
18
|
-
if (typeof redirectUrl !== 'string') {
|
|
19
|
-
return reject(new Error('redirectUrl is not a string'));
|
|
20
|
-
}
|
|
21
|
-
// Reject if it’s not one of the status codes we're expecting.
|
|
22
|
-
if (statusCode !== 302 && statusCode !== 200) {
|
|
23
|
-
return reject(new Error(`bad https download status code: ${statusCode}`));
|
|
24
|
-
}
|
|
25
|
-
const fileStream = fs_extra_1.default.createWriteStream(filePath);
|
|
26
|
-
https_1.default.get(redirectUrl, (resp2) => {
|
|
27
|
-
resp2.pipe(fileStream);
|
|
28
|
-
fileStream.on('finish', () => {
|
|
29
|
-
fileStream.close();
|
|
30
|
-
return resolve();
|
|
31
|
-
});
|
|
32
|
-
fileStream.on('error', (error) => {
|
|
33
|
-
fs_extra_1.default.unlinkSync(filePath);
|
|
34
|
-
reject(error);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
})
|
|
38
|
-
.on('error', (error) => reject(error));
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async function preInstallMkCert() {
|
|
42
|
-
/**
|
|
43
|
-
* Try to install the mkcert binary...
|
|
44
|
-
*
|
|
45
|
-
* 1. If you're running `knapsack start` (ie. locally)
|
|
46
|
-
* 2. Also, only if the binary doesn't already exist on your filesystem
|
|
47
|
-
*/
|
|
48
|
-
fs_extra_1.default.mkdirpSync(constants_1.settingsPath);
|
|
49
|
-
const mkcertBinaryUrl = `https://github.com/FiloSottile/mkcert/releases/download/v${constants_1.version}/${constants_1.binaryName}`;
|
|
50
|
-
if (!fs_extra_1.default.existsSync(path_1.default.join(constants_1.settingsPath, constants_1.binaryName))) {
|
|
51
|
-
log_1.log.info(`🔒️ Downloading mkcert v${constants_1.version} to automatically set up HTTPS`);
|
|
52
|
-
const dlPath = path_1.default.join(constants_1.settingsPath, constants_1.binaryName);
|
|
53
|
-
await download(mkcertBinaryUrl, dlPath);
|
|
54
|
-
if (fs_extra_1.default.existsSync(dlPath)) {
|
|
55
|
-
fs_extra_1.default.chmodSync(path_1.default.join(constants_1.settingsPath, constants_1.binaryName), 0o755);
|
|
56
|
-
log_1.log.info(`✅ Successfully downloaded the mkcert v${constants_1.version} binary!`);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
throw new Error(`Failed to download mkcert binary to ${dlPath}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
log_1.log.info('✅ mkcert already installed so we can auto-configure local HTTPS!');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=pre-install-mkcert.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pre-install-mkcert.js","sourceRoot":"","sources":["../../../../src/lib/https-cert/lib/pre-install-mkcert.ts"],"names":[],"mappings":";;;;;AA0CA,4CA6BC;AAvED,gDAAwB;AACxB,wDAA0B;AAC1B,kDAA0B;AAC1B,gCAA6B;AAC7B,4CAAiE;AAEjE,KAAK,UAAU,QAAQ,CAAC,GAAW,EAAE,QAAgB;IACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,eAAK;aACF,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE;YACrB,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;YAChC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC;YAC9C,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;gBACpC,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;YAC1D,CAAC;YAED,8DAA8D;YAC9D,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gBAC7C,OAAO,M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,CAAC,CAAC;QACxC,IAAI,kBAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1B,kBAAE,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,wBAAY,EAAE,sBAAU,CAAC,EAAE,KAAK,CAAC,CAAC;YACzD,SAAG,CAAC,IAAI,CAAC,yCAAyC,mBAAO,UAAU,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;SAAM,CAAC;QACN,SAAG,CAAC,IAAI,CACN,kEAAkE,CACnE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup-local-cert-auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/https-cert/lib/setup-local-cert-auth.ts"],"names":[],"mappings":"AAOA,wBAAsB,uBAAuB,CAAC,EAC5C,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BhB"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setupLocalCertAuthority = setupLocalCertAuthority;
|
|
7
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
-
const child_process_1 = __importDefault(require("child_process"));
|
|
9
|
-
const log_1 = require("../log");
|
|
10
|
-
const constants_1 = require("../constants");
|
|
11
|
-
const { exec } = child_process_1.default;
|
|
12
|
-
async function setupLocalCertAuthority({ mkcertBinary, certFilePath, keyFilePath, }) {
|
|
13
|
-
return new Promise((resolve, reject) => {
|
|
14
|
-
// mkcert uses the CAROOT environment variable to know where to create/find the certificate authority.
|
|
15
|
-
// We also pass the rest of the system environment to the spawned processes.
|
|
16
|
-
// Create the local certificate authority.
|
|
17
|
-
log_1.log.info('Creating local certificate authority (local CA) using mkcert…');
|
|
18
|
-
exec(`${mkcertBinary} -install`, constants_1.mkcertProcessOptions, (error) => {
|
|
19
|
-
if (error) {
|
|
20
|
-
const err = new Error(`Failed to create local certificate authority. ${error.message}`, { cause: error });
|
|
21
|
-
// auto-cleanup so re-running knapsack start will try to re-configure
|
|
22
|
-
if (fs_extra_1.default.existsSync(certFilePath)) {
|
|
23
|
-
fs_extra_1.default.removeSync(certFilePath);
|
|
24
|
-
}
|
|
25
|
-
if (fs_extra_1.default.existsSync(keyFilePath)) {
|
|
26
|
-
fs_extra_1.default.removeSync(keyFilePath);
|
|
27
|
-
}
|
|
28
|
-
return reject(err);
|
|
29
|
-
}
|
|
30
|
-
log_1.log.info('❨auto-encrypt-localhost❩ Local certificate authority created.');
|
|
31
|
-
return resolve();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=setup-local-cert-auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup-local-cert-auth.js","sourceRoot":"","sources":["../../../../src/lib/https-cert/lib/setup-local-cert-auth.ts"],"names":[],"mappings":";;;;;AAOA,0DAqCC;AA5CD,wDAA0B;AAC1B,kEAA4C;AAC5C,gCAA6B;AAC7B,4CAAoD;AAEpD,MAAM,EAAE,IAAI,EAAE,GAAG,uBAAe,CAAC;AAE1B,KAAK,UAAU,uBAAuB,CAAC,EAC5C,YAAY,EACZ,YAAY,EACZ,WAAW,GAKZ;IACC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,sGAAsG;QACtG,4EAA4E;QAE5E,0CAA0C;QAC1C,SAAG,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;QAC1E,IAAI,CAAC,GAAG,YAAY,WAAW,EAAE,gCAAoB,EAAE,CAAC,KAAK,EAAE,EAAE;YAC/D,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,GAAG,GAAG,IAAI,KAAK,CACnB,iDAAiD,KAAK,CAAC,OAAO,EAAE,EAChE,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAC;gBAEF,qEAAqE;gBACrE,IAAI,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;oBAChC,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;gBAC9B,CAAC;gBAED,IAAI,kBAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;oBAC/B,kBAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAC7B,CAAC;gBACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;YAED,SAAG,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;YAC1E,OAAO,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../src/lib/https-cert/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.log = void 0;
|
|
4
|
-
var log_1 = require("../../cli/log");
|
|
5
|
-
Object.defineProperty(exports, "log", { enumerable: true, get: function () { return log_1.log; } });
|
|
6
|
-
//# sourceMappingURL=log.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/lib/https-cert/log.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,0FAAA,GAAG,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/https-cert/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/https-cert/types.ts"],"names":[],"mappings":""}
|