Commit 8358c102 authored by Aral Balkan's avatar Aral Balkan

Merge branch 'alpha-and-beta-builds'

parents ddc338a2 67e69f42
node_modules
dist
.nyc_output
manifest.json
This diff is collapsed.
This diff is collapsed.
......@@ -207,12 +207,6 @@ function serve (args) {
const server = site.server
// Exit on known errors as we have already logged them to console.
// (Otherwise, the stack trace will be output for debugging purposes.)
server.on(server.SMALL_TECH_ORG_ERROR_HTTP_SERVER, () => {
process.exit(1)
})
// Start sync if requested.
if (syncOptions !== null) {
sync(syncOptions)
......
......@@ -26,31 +26,34 @@ async function update () {
const cpuArchitecture = os.arch()
const isLinux = platform === 'linux'
const releaseChannel = Site.releaseChannel
ensure.root('update')
Site.logAppNameAndVersion(/* compact = */ true)
console.log(' 🧐 Checking for updates…\n')
console.log(` 🧐 Checking for ${releaseChannel} updates…\n`)
let response
try {
response = await secureGet('https://sitejs.org/version')
response = await secureGet(`https://sitejs.org/version/${releaseChannel}`)
} catch (error) {
console.log(' 🤯 Error: Could not check for updates.\n')
console.log(` 🤯 Error: Could not check for ${releaseChannel} updates.\n`)
console.log(error)
exitGracefully(1)
return
}
const latestVersion = response.body
const [latestMajor, latestMinor, latestPatch] = latestVersion.split('.').map(string => parseInt(string))
const currentVersion = Site.binaryVersion
const currentVersion = Site.versionNumber()
const [currentMajor, currentMinor, currentPatch] = currentVersion.split('.').map(string => parseInt(string))
const humanReadableCurrentVersion = Site.humanReadableBinaryVersion
const humanReadableLatestVersion = Site.binaryVersionToHumanReadableDateString(latestVersion)
if (currentVersion !== latestVersion) {
// Are we running a newer (development or beta) version than the latest release version?
if (currentMajor > latestMajor || (currentMajor === latestMajor && currentMinor > latestMinor) || (currentMajor === latestMajor && currentMinor === latestMinor && currentPatch > latestPatch)) {
console.log(` 🤓 You are running a newer version (${currentVersion}) than the latest released version (${latestVersion}).\n`)
// Are we running a newer version than the latest release version?
if (currentVersion > latestVersion) {
console.log(` 🤓 You are running a newer ${releaseChannel} version (released on ${humanReadableCurrentVersion}) than the latest version released on ${humanReadableLatestVersion}.\n`)
exitGracefully()
return
}
......@@ -58,7 +61,7 @@ async function update () {
// The current version is not newer than the latest version and we know
// that it isn’t equal to the release version so it must be older. Let’s
// update!
console.log(` 🎁 There is a new version of Site.js available (v${latestVersion}).\n`)
console.log(` 🎁 There is a new version of Site.js available in the ${releaseChannel} channel: (${latestVersion} released on ${humanReadableLatestVersion}). You currently have version ${currentVersion} released on ${humanReadableCurrentVersion}.\n`)
//
// Compose the right binary URL for the platform and architecture.
......@@ -74,9 +77,9 @@ async function update () {
platformPath = `${platformPath}-arm`
}
let binaryUrl = `https://sitejs.org/releases/${platformPath}/${latestVersion}.tar.gz`
let binaryUrl = `https://sitejs.org/binaries/${releaseChannel}/${platformPath}/${latestVersion}.tar.gz`
console.log(` 📡 Downloading Site.js version ${latestVersion}…`)
console.log(` 📡 Downloading Site.js ${releaseChannel} version ${latestVersion}…`)
let latestReleaseResponse
try {
......@@ -121,7 +124,7 @@ async function update () {
if (ensure.commandExists('systemctl')) {
const { isActive } = status()
if (isActive) {
console.log(` 😈 Daemon is running on old version. Restarting it using Site.js v${latestVersion}…`)
console.log(` 😈 Daemon is running on old version. Restarting it using Site.js ${releaseChannel} version ${latestVersion}…`)
try {
restart()
......
This diff is collapsed.
#!/bin/bash
######################################################################
#
# Site.js installer for Linux (x86 and ARM) and macOS.
#
# Usage:
#
# wget -qO- https://sitejs.org/install | bash
#
# Or:
#
# curl -s https://sitejs.org/install | bash
#
# For alpha, replace bash with bash -s -- alpha
# For beta, replace bash with bash -s -- beta
#
# Copyright (c) 2019-2020 Aral Balkan.
# Released under the AGPL version 3.0 or later license.
# Made with ♥ by Small Technology Foundation (https://small-tech.org)
#
# Like this? Fund us! (https://small-tech.org/fund-us)
#
######################################################################
set -e
function cleanUp {
popd > /dev/null
rm -rf /tmp/sitejs.org
}
releaseChannel=$1
# Release is the default release type (others are alpha and beta).
if [[ "$releaseChannel" == "" ]]; then
releaseChannel='release'
fi
alphaBinaryVersion=00000000000000
alphaPackageVersion=00.00.00
alphaSourceVersion=bedface
betaBinaryVersion=00000000000000
betaPackageVersion=00.00.00
betaSourceVersion=acecafe
releaseBinaryVersion=00000000000000
releasePackageVersion=00.00.00
releaseSourceVersion=decafAF
binaryVersionVariableName="${releaseChannel}BinaryVersion"
packageVersionVariableName="${releaseChannel}PackageVersion"
sourceVersionVariableName="${releaseChannel}SourceVersion"
binaryVersion=${!binaryVersionVariableName}
packageVersion=${!packageVersionVariableName}
sourceVersion=${!sourceVersionVariableName}
if [[ "$binaryVersion" == "00000000000000" ]]; then
echo " ❌ Sorry, no Site.js ${releaseChannel} binaries have been released yet."
cleanUp
exit 1
fi
echo
echo " 📡 Downloading Site.js version ${binaryVersion} (${packageversion}/${sourceVersion})…"
# Mark alpha and beta releases prominently.
if [[ "$releaseChannel" == "alpha" ]]; then
# Writes ALPHA in large red block letters.
echo -e '\033[31m'
echo ' █████  ██  ██████  ██  ██  █████'
echo ' ██   ██ ██  ██   ██ ██  ██ ██   ██ '
echo ' ███████ ██  ██████  ███████ ███████ '
echo ' ██   ██ ██  ██      ██   ██ ██   ██ '
echo ' ██  ██ ███████ ██  ██  ██ ██  ██'
echo -e '\033[0m'
elif [[ "$releaseChannel" == "beta" ]]; then
# Writes BETA in large yellow block letters.
echo -e '\033[33m'
echo ' ██████  ███████ ████████  █████ '
echo ' ██   ██ ██         ██    ██   ██ '
echo ' ██████  █████  ██  ███████ '
echo ' ██   ██ ██     ██  ██   ██ '
echo ' ██████  ███████  ██  ██  ██'
echo -e '\033[0m'
fi
# Setup.
rm -rf /tmp/sitejs.org
mkdir -p /tmp/sitejs.org
pushd /tmp/sitejs.org > /dev/null
# Download the release.
if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux-gnueabihf" ]]; then
cpuArchitecture=`uname -m`
if [[ "$cpuArchitecture" == "x86_64" ]]; then
# Linux on x64.
wget -q "https://sitejs.org/binaries/${releaseChannel}/linux/${binaryVersion}.tar.gz"
elif [[ "$cpuArchitecture" == "armv7l" || "$cpuArchitecture" == "armv6l" ]]; then
# Linux on ARM. Tested on Raspberry Pi Zero W (armv6l), 3B+ and 4B (both reporting armv7l).
wget -q "https://sitejs.org/binaries/${releaseChannel}/linux-arm/${binaryVersion}.tar.gz"
else
# Error: unsupported architecture.
echo
echo " ❌ Error: this architecture is not supported on Linux (only x86_64, armv6l, and armv7l are)."
echo
cleanUp
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
curl -Os "https://sitejs.org/binaries/${releaseChannel}/macos/${binaryVersion}.tar.gz"
else
# Error: Unsupported operating system.
echo
echo " ❌ Error: this operating system is not supported."
echo
cleanUp
exit 1
fi
# Install.
echo " 📦 Installing…"
gzip -d "${binaryVersion}.tar.gz"
tar -xf "${binaryVersion}.tar"
# Ensure /usr/local/bin directory exists (it does not by default on macOS)
sudo mkdir -p /usr/local/bin/
# Install the Site.js binary.
sudo mv site /usr/local/bin/
cleanUp
echo " 🎉 Done!"
echo
################################################################################
##########################################################################################
#
# Site.js v12.11.0 Installer for Windows 10 (PowerShell)
# Site.js 00000000000000 (00.00.00/bedface) Installer for Windows 10 (PowerShell)
#
# To use:
#
# iex(iwr -UseBasicParsing https://sitejs.org/windows).Content
#
# Copyright (c) 2019 Aral Balkan.
# Copyright (c) 2019-2020 Aral Balkan.
# Released under the AGPL version 3.0 or later license.
# Made with <3 by Small Technology Foundation (https://small-tech.org)
# Like this? Fund us! (https://small-tech.org/fund-us)
#
################################################################################
##########################################################################################
# This is where the binary will be installed to.
$installationDirectory = 'C:\Program Files\site.js'
......@@ -23,7 +23,7 @@ $installationScriptUrl = 'https://sitejs.org/install.txt'
$installationScriptFileName = 'install-site.js.ps1'
# The address to download the tar-gzipped archive of the Site.js binary from.
$archiveUrl = 'https://sitejs.org/releases/windows/12.11.0.tar.gz'
$archiveUrl = 'https://sitejs.org/binaries/release/windows/00000000000000.tar.gz'
# Emoji encodings (because Powershell is from the Stone Age and cannot handle
# emoji literals in strings)
......@@ -86,7 +86,7 @@ if (!([Security.Principal.WindowsPrincipal] `
# Installer is running with regular privileges. Start a new PowerShell session with elevated privileges.
#
Write-Output ''
Write-Output " $satelliteEmoji Downloading Site.js v12.11.0$ellipsis"
Write-Output " $satelliteEmoji Downloading Site.js 00000000000000 (00.00.00/bedface)$ellipsis"
# We need to start a new PowerShell session with elevated privileges but if we're running in memory
# only after being downloaded by the installation command, we don't have a copy of ourselves to run.
......@@ -112,16 +112,16 @@ if (!([Security.Principal.WindowsPrincipal] `
Write-Output "`n`n`n`n`n`n"
Write-Output ' Installing Site.js using administrator privileges...'
Write-Output ''
Write-Output ' * Downloading Site.js v12.11.0...'
Write-Output ' * Downloading Site.js 00000000000000 (00.00.00/bedface)...'
# Download the latest Site.js archive.
Invoke-WebRequest -Uri $archiveUrl -OutFile '12.11.0.tar.gz'
Invoke-WebRequest -Uri $archiveUrl -OutFile '00000000000000.tar.gz'
Write-Output ''
Write-Output ' * Extracting binary...'
# Gunzip and untar the binary.
tar -xf 12.11.0.tar.gz
tar -xf 00000000000000.tar.gz
Write-Output ''
Write-Output ' * Installing binary...'
......
This diff is collapsed.
......@@ -16,8 +16,14 @@
"build": "node bin/build.js",
"deploy": "bin/build.js --deploy",
"install-locally": "node bin/build.js --install",
"test": "QUIET=true tape test/*.js | tap-spec",
"coverage": "QUIET=true nyc tape test/*.js | tap-nyc"
"build-alpha": "node bin/build.js --alpha",
"deploy-alpha": "bin/build.js --deploy --alpha",
"install-locally-alpha": "node bin/build.js --install --alpha",
"build-beta": "node bin/build.js --beta",
"deploy-beta": "bin/build.js --deploy --beta",
"install-locally-beta": "node bin/build.js --install --beta",
"test": "tape test/*.js | tap-spec",
"coverage": "nyc tape test/*.js | tap-nyc"
},
"funding": {
"type": "foundation",
......@@ -38,7 +44,7 @@
"@small-tech/express-ws": "^1.0.0",
"@small-tech/https": "^1.2.2",
"@small-tech/instant": "^1.1.0",
"@small-tech/node-hugo": "^1.3.0",
"@small-tech/node-hugo": "^1.4.0",
"@small-tech/web-routes-from-files": "^2.0.0",
"ansi-escape-sequences": "^4.1.0",
"body-parser": "^1.19.0",
......
#!/bin/bash
######################################################################
#
# Site.js v12.11.0 Installer for Linux (x86 and armv7l) and macOS.
#
# To use:
#
# wget -qO- https://sitejs.org/install | bash
#
# Copyright (c) 2019 Aral Balkan.
# Released under the AGPL version 3.0 or later license.
# Made with ♥ by Small Technology Foundation (https://small-tech.org)
# Like this? Fund us! (https://small-tech.org/fund-us)
#
######################################################################
set -e
echo
echo " 📡 Downloading Site.js v12.11.0…"
function cleanUp {
popd > /dev/null
rm -rf /tmp/sitejs.org
}
# Setup
rm -rf /tmp/sitejs.org
mkdir -p /tmp/sitejs.org
pushd /tmp/sitejs.org > /dev/null
if [[ "$OSTYPE" == "linux-gnu" || "$OSTYPE" == "linux-gnueabihf" ]]; then
cpuArchitecture=`uname -m`
if [[ "$cpuArchitecture" == "x86_64" ]]; then
# Linux on x64.
wget -q https://sitejs.org/releases/linux/12.11.0.tar.gz
elif [[ "$cpuArchitecture" == "armv7l" || "$cpuArchitecture" == "armv6l" ]]; then
# Linux on ARM. Tested on Raspberry Pi Zero W (armv6l), 3B+ and 4B (both reporting armv7l).
wget -q https://sitejs.org/releases/linux-arm/12.11.0.tar.gz
else
# Unsupported
echo "\n ❌ Error: this architecture is not supported on Linux (only x86_64, armv6l, and armv7l are).\n"
cleanUp
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
curl -Os https://sitejs.org/releases/macos/12.11.0.tar.gz
else
# Unsupported
echo "\n ❌ Error: this operating system is not supported.\n"
cleanUp
exit 1
fi
echo " 📦 Installing…"
gzip -d 12.11.0.tar.gz
tar -xf 12.11.0.tar
# Ensure that the /usr/local/bin directory exists (it does not by default on macOS)
sudo mkdir -p /usr/local/bin/
# Move the site binary there.
sudo mv site /usr/local/bin/
cleanUp
echo " 🎉 Done!"
echo
......@@ -4,6 +4,8 @@ const cli = require('../bin/lib/cli')
const fs = require('fs')
const path = require('path')
process.env['QUIET'] = true
function loadPath(commandPath) {
fs.readFileSync(path.resolve(`${commandPath.replace('.', './bin')}.js`))
}
......
This diff is collapsed.
......@@ -21,6 +21,8 @@ const queryString = require('querystring')
const WebSocket = require('ws')
process.env['QUIET'] = true
function localhost(path) {
return `https://localhost${path}`
}
......
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