Initial commit

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
2020-01-08 22:47:50 +01:00
commit d0f8f945f3
21 changed files with 2146 additions and 0 deletions

14
modules/Fish.ts Normal file
View File

@@ -0,0 +1,14 @@
import SimpleModule from "../SimpleModule";
import { getUserHome } from "../Functions";
import FileInterface from "../FileInterface";
export default class Fish extends SimpleModule {
files: FileInterface[] = [
{
displayName: "Functions",
filename: "functions",
path: `${getUserHome()}/.config/fish/functions`
}
]
moduleName = "Fish"
}

14
modules/HyperJS.ts Normal file
View File

@@ -0,0 +1,14 @@
import SimpleModule from "../SimpleModule";
import { getUserHome } from "../Functions";
import FileInterface from "../FileInterface";
export default class HyperJS extends SimpleModule {
files: FileInterface[] = [
{
displayName: "Config",
filename: "hyper.js.bak",
path: `${getUserHome()}/.hyper.js`
}
]
moduleName = "HyperJS"
}

13
modules/Nano.ts Normal file
View File

@@ -0,0 +1,13 @@
import SimpleModule from "../SimpleModule"
import FileInterface from "../FileInterface"
import { getUserHome } from "../Functions"
export default class Nano extends SimpleModule {
files: FileInterface[] = [
{
filename: "Nanorc",
path: `${getUserHome()}/.nanorc`
}
]
moduleName = "Nano"
}

32
modules/OhMyFish.ts Normal file
View File

@@ -0,0 +1,32 @@
import SimpleModule from "../SimpleModule"
import FileInterface from "../FileInterface"
import Requirements from "../Prerequises"
import { execSync } from "child_process"
export default class OhMyFish extends SimpleModule {
files: FileInterface[] = [
{
filename: "Extensions",
prereqs: Requirements.INSTALLED,
commands: {
save: `${this.findCommand()} "omf list | tr '\\t' '\\n"' | grep '^[a-z-]' > {filepath}`,
load: `${this.findCommand()} "omg install {line}"`
}
}
]
moduleName = "OhMyFish"
private findCommand(): string {
try {
execSync('which fish 2> /dev/null')
execSync('which omf 2> /dev/null')
return 'fish -c'
} catch {
return ""
}
}
async isInstalled(): Promise<boolean> {
return this.findCommand() !== ""
}
}

79
modules/VSCode.ts Normal file
View File

@@ -0,0 +1,79 @@
import SimpleModule from "../SimpleModule";
import fsSync, { promises as fs } from "fs";
import { getUserHome } from "../Functions";
import { execSync } from "child_process";
import FileInterface from "../FileInterface";
import Requirements from "../Prerequises";
import 'colors'
export default class VSCode extends SimpleModule {
files: FileInterface[] = [
{
displayName: "Settings",
filename: "settings.json",
path: `${this.findVSCodeFolder()}/User/settings.json`
},
{
displayName: "Keybindings",
filename: "keybindings.json",
path: `${this.findVSCodeFolder()}/User/keybindings.json`
},
{
displayName: "Snippets",
filename: "snippets",
path: `${this.findVSCodeFolder()}/User/snippets`
},
{
displayName: "Extensions",
filename: "extensions.txt",
prereqs: Requirements.INSTALLED,
commands: {
save: `${this.findCommand()} --list-extensions`,
load: `${this.findCommand()} --install-extension {line}`
}
}
]
public moduleName: string
public constructor() {
super()
const filename = __filename.split("/")
this.moduleName = filename[filename.length - 1].replace(".ts", "")
}
private static commands = ["vscodium", "vscode", "code", "codium"]
private findVSCodeFolder(): string {
const possibilities = [
`${getUserHome()}/.config/Code`,
`${getUserHome()}/.config/VSCodium`,
`${getUserHome()}/.config/Code - OSS`,
]
for (const pos of possibilities) {
try {
fsSync.accessSync(pos)
return pos
} catch {continue}
}
return possibilities[0] // default to VSCode folder
}
private findCommand(): string {
for (const cmd of VSCode.commands) {
try {
execSync(`which ${cmd}`)
return cmd
} catch {
continue
}
}
return ""
}
public async isInstalled(): Promise<boolean> {
return this.findCommand() !== ""
}
}

13
modules/Yarn.ts Normal file
View File

@@ -0,0 +1,13 @@
import SimpleModule from "../SimpleModule";
import { getUserHome } from "../Functions";
import FileInterface from "../FileInterface";
export default class Yarn extends SimpleModule {
files: FileInterface[] = [
{
filename: "yarnrc",
path: `${getUserHome()}/.yarnrc`
}
]
moduleName = "Yarn"
}