From 0d6235e427c0f8241d1068bdd1e34903eb9298f9 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Sun, 12 Jul 2020 09:41:20 -0300 Subject: [PATCH] feat(tauri.js) add microsoft edge version to the info output (#810) --- .changes/tauri-info-windows.md | 5 +++++ cli/tauri.js/src/api/info.ts | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .changes/tauri-info-windows.md diff --git a/.changes/tauri-info-windows.md b/.changes/tauri-info-windows.md new file mode 100644 index 000000000..3d5f7405e --- /dev/null +++ b/.changes/tauri-info-windows.md @@ -0,0 +1,5 @@ +--- +"tauri.js": patch +--- + +Improve the `tauri info` output on Windows, including the Microsoft Edge version. diff --git a/cli/tauri.js/src/api/info.ts b/cli/tauri.js/src/api/info.ts index a76cf7187..9bdb3d023 100644 --- a/cli/tauri.js/src/api/info.ts +++ b/cli/tauri.js/src/api/info.ts @@ -1,10 +1,11 @@ + import toml from '@tauri-apps/toml' import chalk from 'chalk' -import { sync as spawn } from 'cross-spawn' import fs from 'fs' import os from 'os' import path from 'path' import { appDir, tauriDir } from '../helpers/app-paths' +import { sync as spawn } from 'cross-spawn' import { TauriConfig } from './../types/config' import { CargoLock, CargoManifest } from '../types/cargo' import nonWebpackRequire from '../helpers/non-webpack-require' @@ -183,12 +184,22 @@ module.exports = () => { ), section: true }) + if (os.platform() === 'win32') { + const { stdout } = spawn('REG', ['QUERY', 'HKEY_CLASSES_root\\AppX3xxs313wwkfjhythsb8q46xdsq8d2cvv\\Application', '/v', 'ApplicationName']) + const match = /{(\S+)}/g.exec(stdout.toString()) + if (match) { + const edgeString = match[1] + printInfo({ key: 'Microsoft Edge', value: edgeString.split('?')[0].replace('Microsoft.MicrosoftEdge_', '') }) + } + } + printInfo({ key: 'Node.js environment', section: true }) printInfo({ key: ' Node.js', value: chalk.green(process.version.slice(1)) }) printInfo({ key: ' tauri.js', value: chalk.green(version) }) + printInfo({ key: 'Rust environment', section: true }) printInfo({ key: ' rustc', @@ -199,9 +210,11 @@ module.exports = () => { value: getVersion('cargo', [], output => output.split(' ')[1]) }) printInfo({ key: ' tauri-bundler', value: getVersion('cargo', ['tauri-bundler']) }) + printInfo({ key: 'Global packages', section: true }) printInfo({ key: ' NPM', value: getVersion('npm') }) printInfo({ key: ' yarn', value: getVersion('yarn') }) + printInfo({ key: 'App directory structure', section: true }) const tree = dirTree(appDir)