Commit 31614f4c authored by Aral Balkan's avatar Aral Balkan

Update console output format to match Site.js; bump version

parent 8e9526c4
......@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Nothing yet.
## [3.1.5] - 2020-02-09
### Changed
- Updated console output formatting to match what’s used in Site.js.
## [3.1.4] - 2019-11-26
### Fixed
......
......@@ -19,7 +19,7 @@ module.exports = function (_nodecertDir = path.join(homeDir, '.small-tech.org',
// Create certificates.
if (!allOK()) {
console.log('\n 🆕 [Nodecert] Setting up…')
console.log('\n 📜 [Nodecert] Setting up…')
// Ensure the nodecert directory exists.
fs.ensureDirSync(nodecertDir)
......@@ -42,18 +42,18 @@ module.exports = function (_nodecertDir = path.join(homeDir, '.small-tech.org',
try {
// Create the local certificate authority.
console.log(' 🖊 [Nodecert] Creating local certificate authority (local CA) using mkcert…')
console.log(' 📜 [Nodecert] Creating local certificate authority (local CA) using mkcert…')
childProcess.execFileSync(mkcertBinary, ['-install'], options)
console.log(' 🎉 [Nodecert] Local certificate authority created.\n')
console.log(' 📜 [Nodecert] Local certificate authority created.')
// Create the local certificate.
console.log(' 📜 [Nodecert] Creating local TLS certificates using mkcert…')
console.log(' 📜 [Nodecert] Creating local TLS certificates using mkcert…')
const createCertificateArguments = [
`-key-file=${path.join(nodecertDir, 'localhost-key.pem')}`,
`-cert-file=${path.join(nodecertDir, 'localhost.pem')}`,
'localhost', '127.0.0.1', '::1'
]
childProcess.execFileSync(mkcertBinary, createCertificateArguments, options)
console.log(' 🎉 [Nodecert] Local TLS certificates created.')
console.log(' 📜 [Nodecert] Local TLS certificates created.')
} catch (error) {
console.log('\n', error)
}
......@@ -62,7 +62,7 @@ module.exports = function (_nodecertDir = path.join(homeDir, '.small-tech.org',
process.exit(1)
}
} else {
console.log(' 📜 [Nodecert] Local development TLS certificate exists.')
console.log(' 📜 [Nodecert] Local development TLS certificate exists.')
}
addRootStoreToNode()
......@@ -129,7 +129,7 @@ function mkcertBinaryForThisMachine() {
const mkcertBuffer = fs.readFileSync(mkcertBinaryInternalPath, 'binary')
fs.writeFileSync(mkcertBinaryExternalPath, mkcertBuffer, {encoding: 'binary', mode: 0o755})
} catch (error) {
throw new Error(` 🤯 [Nodecert] Panic: Could not copy mkcert to external directory: ${error.message}`)
throw new Error(` 🤯 [Nodecert] Panic: Could not copy mkcert to external directory: ${error.message}`)
}
return mkcertBinaryExternalPath
......@@ -160,7 +160,7 @@ function tryToInstallTheDependency() {
// required on Windows.
} else {
// Unknown platform. This should have been caught earlier. Panic.
throw new Error(' 🤯 [Nodecert] Panic: Unknown platform detected.', _platform)
throw new Error(' 🤯 [Nodecert] Panic: Unknown platform detected.', _platform)
}
}
......@@ -171,7 +171,7 @@ function tryToInstallTheDependency() {
function tryToInstallCertutilOnLinux() {
if (commandExists('certutil')) return // Already installed
print(' 🌠 [Nodecert] Installing certutil dependency (Linux) ')
print(' 📜 [Nodecert] Installing certutil dependency (Linux) ')
let options = {env: process.env}
try {
if (commandExists('apt')) {
......@@ -180,19 +180,19 @@ function tryToInstallCertutilOnLinux() {
childProcess.execSync('sudo apt-get install -y -q libnss3-tools', options)
} else if (commandExists('yum')) {
// Untested: if you test this, please let me know https://github.com/indie-mirror/https-server/issues
console.log('\n 🤪 [Nodecert] 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')
console.log('\n 🤪 [Nodecert] 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')
childProcess.execSync('sudo yum install nss-tools', options)
console.log(' 🎉 [Nodecert] Certutil installed using yum.')
console.log(' 📜 [Nodecert] Certutil installed using yum.')
} else if (commandExists('pacman')) {
childProcess.execSync('sudo pacman -S nss', options)
console.log(' 🎉 [Nodecert] Certutil installed using pacman.')
console.log(' 📜 [Nodecert] Certutil installed using pacman.')
} else {
// Neither Homebrew nor MacPorts is installed. Warn the person.
console.log('\n ⚠️ [Nodecert] Linux: No supported package manager found for installing certutil on Linux (tried apt, yum, and pacman. Please install certutil manually and run nodecert again. For more instructions on installing mkcert dependencies, please see https://github.com/FiloSottile/mkcert/\n')
console.log('\n ⚠️ [Nodecert] Linux: No supported package manager found for installing certutil on Linux (tried apt, yum, and pacman. Please install certutil manually and run nodecert again. For more instructions on installing mkcert dependencies, please see https://github.com/FiloSottile/mkcert/\n')
}
} catch (error) {
// There was an error and we couldn’t install the dependency. Warn the person.
console.log('\n ⚠️ [Nodecert] Linux: Failed to install nss. Please install it manually and run nodecert again if you want your certificate to work in Chrome and Firefox', error)
console.log('\n ⚠️ [Nodecert] Linux: Failed to install nss. Please install it manually and run nodecert again if you want your certificate to work in Chrome and Firefox', error)
}
}
......@@ -211,17 +211,17 @@ function tryToInstallCertutilOnDarwin() {
// with Firefox crashing).
try {
// Homebrew can take a long time start, show current status.
print(' 🔍 [Nodecert] Checking if certutil dependency is installed (Darwin) using Homebrew… ')
print(' 📜 [Nodecert] Checking if certutil dependency is installed (Darwin) using Homebrew… ')
childProcess.execSync('brew list nss >/dev/null 2>&1', options)
console.log(' ok.')
} catch (error) {
// NSS is not installed. Install it.
try {
print('\n 🌠 [Nodecert] Installing certutil dependency (Darwin) using Homebrew… ')
print('\n 📜 [Nodecert] Installing certutil dependency (Darwin) using Homebrew… ')
childProcess.execSync('brew install nss >/dev/null 2>&1', options)
console.log('done.')
} catch (error) {
console.log('\n ⚠️ [Nodecert] macOS: Failed to install nss via Homebrew. Please install it manually and run nodecert again if you want your certificate to work in Firefox', error)
console.log('\n ⚠️ [Nodecert] macOS: Failed to install nss via Homebrew. Please install it manually and run nodecert again if you want your certificate to work in Firefox', error)
return
}
}
......@@ -229,7 +229,7 @@ function tryToInstallCertutilOnDarwin() {
// Untested. This is based on the documentation at https://guide.macports.org/#using.port.installed. I don’t have MacPorts installed
// 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
// by opening an issue on https://github.com/indie-mirror/https-server/issues
console.log('\n 🤪 [Nodecert] 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')
console.log('\n 🤪 [Nodecert] 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')
try {
childProcess.execSync('port installed nss', options)
......@@ -238,13 +238,13 @@ function tryToInstallCertutilOnDarwin() {
try {
childProcess.execSync('sudo port install nss', options)
} catch (error) {
console.log('\n ⚠️ [Nodecert] macOS: Failed to install nss via MacPorts. Please install it manually and run nodecert again if you want your certificate to work in Firefox', error)
console.log('\n ⚠️ [Nodecert] macOS: Failed to install nss via MacPorts. Please install it manually and run nodecert again if you want your certificate to work in Firefox', error)
return
}
}
} else {
// Neither Homebrew nor MacPorts is installed. Warn the person.
console.log('\n ⚠️ [Nodecert] 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\n * Homebrew (https://brew.sh): brew install nss\n * MacPorts(https://macports.org): sudo port install nss\n')
console.log('\n ⚠️ [Nodecert] 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\n * Homebrew (https://brew.sh): brew install nss\n * MacPorts(https://macports.org): sudo port install nss\n')
return
}
}
{
"name": "@ind.ie/nodecert",
"version": "3.1.4",
"version": "3.1.5",
"description": "Automatically provision and use locally-trusted TLS certificates in Node.js using mkcert.",
"main": "index.js",
"bin": "bin/nodecert.js",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment