Closes #162: Add platform and architecture to version string

parent bffa9fad
......@@ -103,7 +103,6 @@ const manifest = {
sourceVersion,
releaseChannel
}
fs.writeFileSync('manifest.json', JSON.stringify(manifest), 'utf-8')
const releaseChannelDirectory = path.join('dist', releaseChannel)
const linuxX64Directory = path.join(releaseChannelDirectory, 'linux', binaryVersion)
......@@ -286,6 +285,12 @@ async function build () {
restoreHugoBinary (platform)
}
function writeManifestForPlatformAndArchitecture (platform, architecture) {
manifest.platform = platform
manifest.architecture = architecture
fs.writeFileSync('manifest.json', JSON.stringify(manifest), 'utf-8')
}
// Unstrip at start in case last build failed.
unstrip()
......@@ -297,6 +302,8 @@ async function build () {
if (buildLinuxX64Version) {
console.log(' • Building Linux version (x64)…')
writeManifestForPlatformAndArchitecture('linux', 'x64')
stripForPlatform('linux-amd64')
await compile({
......@@ -315,6 +322,8 @@ async function build () {
if (buildLinuxArmVersion) {
console.log(' • Building Linux version (ARM)…')
writeManifestForPlatformAndArchitecture('linux', 'arm')
stripForPlatform('linux-arm')
await compile({
......@@ -333,6 +342,8 @@ async function build () {
if (buildMacVersion) {
console.log(' • Building macOS version…')
writeManifestForPlatformAndArchitecture('macOS', 'x64')
stripForPlatform('darwin-amd64')
await compile({
......@@ -351,6 +362,8 @@ async function build () {
if (buildWindowsVersion) {
console.log(' • Building Windows version…')
writeManifestForPlatformAndArchitecture('windows', 'x64')
stripForPlatform('windows-amd64.exe')
await compile({
......
......@@ -80,7 +80,9 @@ class Site {
binaryVersion: '20000101000000',
packageVersion: (require(path.join(__dirname, 'package.json'))).version,
sourceVersion: childProcess.execSync(`pushd ${__dirname} > /dev/null && git log -1 --oneline`,options).toString().match(/^[0-9a-fA-F]{7}/)[0],
hugoVersion: (new Hugo()).version
hugoVersion: (new Hugo()).version,
platform: {linux: 'linux', win32: 'windows', 'darwin': 'macOS'}[os.platform()],
architecture: os.arch()
}
}
}
......@@ -94,9 +96,11 @@ class Site {
static get releaseChannel () { return this.getFromManifest('releaseChannel') }
static get binaryVersion () { return this.getFromManifest('binaryVersion') }
static get packageVersion () { return this.getFromManifest('packageVersion') }
static get packageVersion () { return this.getFromManifest('packageVersion') }
static get sourceVersion () { return this.getFromManifest('sourceVersion') }
static get hugoVersion () { return this.getFromManifest('hugoVersion') }
static get hugoVersion () { return this.getFromManifest('hugoVersion') }
static get platform () { return this.getFromManifest('platform') }
static get architecture () { return this.getFromManifest('architecture') }
static binaryVersionToHumanReadableDateString (binaryVersion) {
// Is this the dummy version that signals a development build?
......@@ -160,10 +164,12 @@ class Site {
let message = [
`\n${prefix1}Site.js ${this.releaseChannelFormattedForConsole}\n\n`,
`${prefix2}Version ${clr(`${this.humanReadableBinaryVersion} (${this.packageVersion}-${this.sourceVersion})`, 'green')}\n`,
`${prefix2}Created ${clr(this.humanReadableBinaryVersion, 'green')}\n`,
'\n',
`${prefix2}Version ${clr(`${this.binaryVersion}-${this.packageVersion}-${this.sourceVersion}-${this.platform}/${this.architecture}`, 'green')}\n`,
`${prefix2}Node.js ${clr(`${process.version.replace('v', '')}`, 'green')}\n`,
`${prefix2}Hugo ${clr(`${this.hugoVersion}`, 'green')}\n`,
'\n',
`${prefix2}Base ${clr(`https://sitejs.org/nexe/${process.platform}-${process.arch}-${process.version.replace('v', '')}`, 'cyan')}\n`,
`${prefix2}Source ${clr(`https://source.small-tech.org/site.js/app/-/tree/${this.sourceVersion}`, 'cyan')}\n\n`,
`${prefix2}╔═══════════════════════════════════════════╗\n`,
......
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