update linux support

This commit is contained in:
Chen Asraf
2022-05-26 14:53:51 +03:00
parent dfee05eb4d
commit 507d67caa2
4 changed files with 41 additions and 11 deletions

View File

@@ -1,5 +1,9 @@
# Change Log
## [0.1.0] - 2022-26-05
## [0.0.2] - 2022-26-05
- Fix Linux support
## [0.0.1] - 2022-26-05
- Initial release

View File

@@ -1,12 +1,13 @@
# GI Gen
# GI Gen - Smart Gitignore Generator
## Features
Create a gitignore file for your project automatically.
Uses [gi_gen](https://github.com/chenasraf/gi_gen) to operate, which can automatically discover your
project type, or you can choose manually. Also allows you to remove unused patterns from the
resulting file.
Can **automatically discover** your project type, or you can choose manually, and allows you to
**remove unused patterns** from the resulting file.
Uses [gi_gen](https://github.com/chenasraf/gi_gen) to operate, which
## Requirements
@@ -14,6 +15,10 @@ No requirements other than git, the binary is downloaded on first run.
## Release Notes
### 0.1.0
### 0.0.2
Initial release
- Fix Linux support
### 0.0.1
- Initial release

View File

@@ -1,11 +1,11 @@
{
"name": "gi-gen",
"displayName": "GI Gen",
"displayName": "GI Gen - Smart Gitignore Generator",
"description": "Generates a .gitignore for your project",
"publisher": "casraf",
"repository": "https://github.com/chenasraf/gi-gen-vscode-extension",
"license": "MIT",
"version": "0.0.1",
"version": "0.0.2",
"engines": {
"vscode": "^1.67.0"
},

View File

@@ -36,7 +36,13 @@ export function downloadFile(source: string, target: string): Promise<string> {
})
}
export type AvailablePlatform = 'macos-arm' | 'macos-intel' | 'windows' | 'linux'
export type AvailablePlatform =
| 'macos-arm'
| 'macos-intel'
| 'windows'
| 'linux-arm'
| 'linux-386'
| 'linux-amd64'
export async function getPlatform(): Promise<AvailablePlatform> {
const { platform } = process
@@ -44,7 +50,7 @@ export async function getPlatform(): Promise<AvailablePlatform> {
case 'darwin':
return `macos-${await getMacArch()}`
case 'linux':
return 'linux'
return `linux-${await getLinuxArch()}`
case 'cygwin':
case 'win32':
return 'windows'
@@ -53,6 +59,21 @@ export async function getPlatform(): Promise<AvailablePlatform> {
}
}
export async function getLinuxArch(): Promise<'arm' | 'amd64' | '386'> {
const res = await shellExec('uname', ['-m'])
switch (res) {
case 'i386':
case 'i686':
return '386'
case 'arm':
return 'arm'
case 'x86_64':
case 'amd64':
default:
return 'amd64'
}
}
export async function getMacArch(): Promise<'arm' | 'intel'> {
try {
await shellExec('sysctl', ['sysctl.proc_translated'])